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:
Jonas Kulla 2017-08-10 21:39:17 +02:00
parent fba20e6294
commit f172f58c74
1 changed files with 1 additions and 4 deletions

View File

@ -140,15 +140,12 @@ struct SpritePrivate
if (!nullOrDisposed(bitmap))
bmSize = Vec2i(bitmap->width(), bitmap->height());
if (mirrored)
rect = rect.hFlipped();
/* Clamp the rectangle so it doesn't reach outside
* the bitmap bounds */
rect.w = clamp<int>(rect.w, 0, bmSize.x-rect.x);
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));
recomputeBushDepth();