Sprite: Fix regression with "mirror" attribute
FloatRect::hFlipped() returns a rectangle with negative width,
which was clobbered by the clamping further down.
Regression introduced in 55cec53911
.
This commit is contained in:
parent
fba20e6294
commit
f172f58c74
|
@ -140,15 +140,12 @@ struct SpritePrivate
|
||||||
if (!nullOrDisposed(bitmap))
|
if (!nullOrDisposed(bitmap))
|
||||||
bmSize = Vec2i(bitmap->width(), bitmap->height());
|
bmSize = Vec2i(bitmap->width(), bitmap->height());
|
||||||
|
|
||||||
if (mirrored)
|
|
||||||
rect = rect.hFlipped();
|
|
||||||
|
|
||||||
/* Clamp the rectangle so it doesn't reach outside
|
/* Clamp the rectangle so it doesn't reach outside
|
||||||
* the bitmap bounds */
|
* the bitmap bounds */
|
||||||
rect.w = clamp<int>(rect.w, 0, bmSize.x-rect.x);
|
rect.w = clamp<int>(rect.w, 0, bmSize.x-rect.x);
|
||||||
rect.h = clamp<int>(rect.h, 0, bmSize.y-rect.y);
|
rect.h = clamp<int>(rect.h, 0, bmSize.y-rect.y);
|
||||||
|
|
||||||
quad.setTexRect(rect);
|
quad.setTexRect(mirrored ? rect.hFlipped() : rect);
|
||||||
|
|
||||||
quad.setPosRect(FloatRect(0, 0, rect.w, rect.h));
|
quad.setPosRect(FloatRect(0, 0, rect.w, rect.h));
|
||||||
recomputeBushDepth();
|
recomputeBushDepth();
|
||||||
|
|
Loading…
Reference in New Issue