Select zoom layer before doing clipping/offsets in GfxBlitter
This commit is contained in:
18
src/gfx.cpp
18
src/gfx.cpp
@@ -1086,6 +1086,16 @@ static void GfxBlitter(const GfxBlitterCtx &ctx, const Sprite *sprite, int x, in
|
|||||||
const DrawPixelInfo *dpi = ctx.dpi;
|
const DrawPixelInfo *dpi = ctx.dpi;
|
||||||
Blitter::BlitterParams bp;
|
Blitter::BlitterParams bp;
|
||||||
|
|
||||||
|
if (sprite->width <= 0 || sprite->height <= 0) return;
|
||||||
|
|
||||||
|
while (HasBit(sprite->missing_zoom_levels, zoom)) {
|
||||||
|
sprite = sprite->next;
|
||||||
|
if (sprite == nullptr) {
|
||||||
|
DEBUG(sprite, 0, "Failed to draw sprite %u at zoom level %u as required zoom level is missing", sprite_id, zoom);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (SCALED_XY) {
|
if (SCALED_XY) {
|
||||||
/* Scale it */
|
/* Scale it */
|
||||||
x = ScaleByZoom(x, zoom);
|
x = ScaleByZoom(x, zoom);
|
||||||
@@ -1122,14 +1132,6 @@ static void GfxBlitter(const GfxBlitterCtx &ctx, const Sprite *sprite, int x, in
|
|||||||
y += ScaleByZoom(bp.skip_top, zoom);
|
y += ScaleByZoom(bp.skip_top, zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (sprite != nullptr && HasBit(sprite->missing_zoom_levels, zoom)) {
|
|
||||||
sprite = sprite->next;
|
|
||||||
}
|
|
||||||
if (sprite == nullptr) {
|
|
||||||
DEBUG(sprite, 0, "Failed to draw sprite %u at zoom level %u as required zoom level is missing", sprite_id, zoom);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Copy the main data directly from the sprite */
|
/* Copy the main data directly from the sprite */
|
||||||
bp.sprite = sprite->data;
|
bp.sprite = sprite->data;
|
||||||
bp.sprite_width = sprite->width;
|
bp.sprite_width = sprite->width;
|
||||||
|
Reference in New Issue
Block a user