aboutsummaryrefslogtreecommitdiff
path: root/graphics/managed_surface.h
diff options
context:
space:
mode:
authorDaniel2019-04-26 05:23:19 +0100
committerFilippos Karapetis2019-04-26 13:08:38 +0300
commit903569cab8ae8bc850a989fb57c69e6fd873dd08 (patch)
treec5eed940d0fbbe5617d1f09aa56ddc047bc7214d /graphics/managed_surface.h
parentcf08697e0491779e8d78d12811a9e71bcbac926a (diff)
downloadscummvm-rg350-903569cab8ae8bc850a989fb57c69e6fd873dd08.tar.gz
scummvm-rg350-903569cab8ae8bc850a989fb57c69e6fd873dd08.tar.bz2
scummvm-rg350-903569cab8ae8bc850a989fb57c69e6fd873dd08.zip
GRAPHICS: Fix ManagedSurface dirty rects when drawing lines
Fixes an invalidRect assert when drawing lines which don't go from top-left to bottom-right.
Diffstat (limited to 'graphics/managed_surface.h')
-rw-r--r--graphics/managed_surface.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/graphics/managed_surface.h b/graphics/managed_surface.h
index a7cf70f857..a11d05c557 100644
--- a/graphics/managed_surface.h
+++ b/graphics/managed_surface.h
@@ -317,7 +317,7 @@ public:
*/
void drawLine(int x0, int y0, int x1, int y1, uint32 color) {
_innerSurface.drawLine(x0, y0, x1, y1, color);
- addDirtyRect(Common::Rect(x0, y0, x1, y1));
+ addDirtyRect(Common::Rect(MIN(x0, x1), MIN(y0, y1), MAX(x0, x1), MAX(y0, y1)));
}
/**
@@ -325,7 +325,7 @@ public:
*/
void drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, uint32 color) {
_innerSurface.drawThickLine(x0, y0, x1, y1, penX, penY, color);
- addDirtyRect(Common::Rect(x0, y0, x1 + penX, y1 + penY));
+ addDirtyRect(Common::Rect(MIN(x0, x1 + penX), MIN(y0, y1 + penY), MAX(x0, x1 + penX), MAX(y0, y1 + penY)));
}
/**