aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorEugene Sandulenko2016-08-25 12:18:11 +0200
committerEugene Sandulenko2016-08-25 12:18:11 +0200
commit2b3af190db0076576c310b96cf52d7952034aca3 (patch)
treea8da6a6d11631895ae5fac80f49c58d7e201fee4 /graphics
parent102fe0be9faa60e59d3703d53fd10db990fb8896 (diff)
downloadscummvm-rg350-2b3af190db0076576c310b96cf52d7952034aca3.tar.gz
scummvm-rg350-2b3af190db0076576c310b96cf52d7952034aca3.tar.bz2
scummvm-rg350-2b3af190db0076576c310b96cf52d7952034aca3.zip
GRAPHICS: Fix potential rounding errors in the h/v thick line drawing
Diffstat (limited to 'graphics')
-rw-r--r--graphics/primitives.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/graphics/primitives.cpp b/graphics/primitives.cpp
index a879fc9e45..ee240208ac 100644
--- a/graphics/primitives.cpp
+++ b/graphics/primitives.cpp
@@ -108,11 +108,13 @@ void drawThickLine2(int x1, int y1, int x2, int y2, int thick, int color, void (
int dy = abs(y2 - y1);
if (dx == 0) {
- Common::Rect r(x1 - thick / 2, MIN(y1, y2), x1 + thick / 2, MAX(y1, y2));
+ int xn = x1 - thick / 2;
+ Common::Rect r(xn, MIN(y1, y2), xn + thick, MAX(y1, y2));
drawFilledRect(r, color, plotProc, data);
return;
} else if (dy == 0) {
- Common::Rect r(MIN(x1, x2), y1 - thick / 2, MAX(x1, x2), y1 + thick / 2);
+ int yn = y1 - thick / 2;
+ Common::Rect r(MIN(x1, x2), yn, MAX(x1, x2), yn + thick);
drawFilledRect(r, color, plotProc, data);
return;
}