Skip to content

Commit

Permalink
GRAPHICS: Fix potential rounding errors in the h/v thick line drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Aug 25, 2016
1 parent 102fe0b commit 2b3af19
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions graphics/primitives.cpp
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2b3af19

Please sign in to comment.