ecere/gui/Picture: Fixed variable mix up in render method
authorJerome St-Louis <jerome@ecere.com>
Thu, 17 Apr 2014 04:16:10 +0000 (00:16 -0400)
committerJerome St-Louis <jerome@ecere.com>
Thu, 17 Apr 2014 04:18:26 +0000 (00:18 -0400)
ecere/src/gui/controls/Picture.ec

index d5440df..9eb7226 100644 (file)
@@ -256,22 +256,23 @@ private:
          {
             int w = bitmap.width;
             int h = bitmap.height;
-            if(clientSize.w == bitmap.width && clientSize.h == bitmap.height)
+            int cw = clientSize.w, ch = clientSize.h;
+            if(cw == bitmap.width && ch == bitmap.height)
                surface.Blit(bitmap,
-                  Max(0, (clientSize.w - w) / 2), Max(0, (clientSize.h - h) / 2),
+                  Max(0, (cw - w) / 2), Max(0, (ch - h) / 2),
                   scroll.x,scroll.y,
-                  hasHorzScroll ? clientSize.w : bitmap.width, hasVertScroll ? clientSize.h : bitmap.height);
+                  hasHorzScroll ? cw : w, hasVertScroll ? ch : h);
             else
             {
-               int x = hasHorzScroll ? Max(0, (clientSize.w - w) / 2) : 0;
-               int y = hasVertScroll ? Max(0, (clientSize.h - h) / 2) : 0;
+               int x = hasHorzScroll ? Max(0, (cw - w) / 2) : 0;
+               int y = hasVertScroll ? Max(0, (ch - h) / 2) : 0;
                int sx = scroll.x, sy = scroll.y;
-               int w = clientSize.w, h = clientSize.h;
-               int sw = hasHorzScroll ? clientSize.w : bitmap.width, sh = hasVertScroll ? clientSize.h : bitmap.height;
+               int dw = cw, dh = ch;
+               int sw = hasHorzScroll ? cw : w, sh = hasVertScroll ? ch : h;
                if(filter)
-                  surface.Filter(bitmap, x, y, sx, sy, w, h, sw, sh);
+                  surface.Filter(bitmap, x, y, sx, sy, dw, dh, sw, sh);
                else
-                  surface.Stretch(bitmap, x, y, sx, sy, w, h, sw, sh);
+                  surface.Stretch(bitmap, x, y, sx, sy, dw, dh, sw, sh);
             }
          }
       }