Select zoom layer before doing clipping/offsets in GfxBlitter

pull/642/head
Jonathan G Rennison 4 months ago
parent 7dd820fe22
commit 02e6925c2a

@ -1086,6 +1086,16 @@ static void GfxBlitter(const GfxBlitterCtx &ctx, const Sprite *sprite, int x, in
const DrawPixelInfo *dpi = ctx.dpi;
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) {
/* Scale it */
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);
}
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 */
bp.sprite = sprite->data;
bp.sprite_width = sprite->width;

Loading…
Cancel
Save