Possible fix rendering reference layers in nonreproducible scenario (fix #3460)

This is a patch, but we don't know why this can happen, so it's highly
probable that other kind of crashes might appear in the near
future (or this doesn't fix the original bug).
master
David Capello 2022-08-05 10:30:17 -03:00
parent 1f24e0be9f
commit c62aa571aa
1 changed files with 12 additions and 0 deletions

View File

@ -222,6 +222,18 @@ void composite_image_scale_up(
int px_x, px_y;
int px_w = int(sx);
int px_h = int(sy);
// We've received crash reports about these values being 0 when it's
// called from Render::renderImage() when the projection is scaled
// to the cel bounds (this can happen only when a reference layer is
// scaled, but when a reference layer is visible we shouldn't be
// here, we should be using the composite_image_general(), see the
// "finegrain" var in Render::getImageComposition()).
ASSERT(px_w > 0);
ASSERT(px_h > 0);
if (px_w <= 0 || px_h <= 0)
return;
int first_px_w = px_w - (area.src.x % px_w);
int first_px_h = px_h - (area.src.y % px_h);