From f172f58c747240599e212f2ede57f37bd393a170 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Thu, 10 Aug 2017 21:39:17 +0200 Subject: [PATCH] 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 55cec53911f6706f6ad7ae58095644235e2259ba. --- src/sprite.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/sprite.cpp b/src/sprite.cpp index 2cfe13a..26eb297 100644 --- a/src/sprite.cpp +++ b/src/sprite.cpp @@ -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(rect.w, 0, bmSize.x-rect.x); rect.h = clamp(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();