summaryrefslogtreecommitdiff
path: root/Libraries/LibGfx/Painter.cpp
diff options
context:
space:
mode:
authorStephan Unverwerth <s.unverwerth@gmx.de>2020-04-18 13:21:32 +0200
committerAndreas Kling <kling@serenityos.org>2020-04-18 13:24:34 +0200
commitcbcf317e760c3370d10cfc525f0f528abd44e820 (patch)
tree635cad6242672544f783847774508d0de6495b96 /Libraries/LibGfx/Painter.cpp
parente2f0e36bdb7b1847c42f01bb651ca80138ab6e69 (diff)
downloadserenity-cbcf317e760c3370d10cfc525f0f528abd44e820.zip
LibGfx: Fix draw_triangle() clipping calculations
Diffstat (limited to 'Libraries/LibGfx/Painter.cpp')
-rw-r--r--Libraries/LibGfx/Painter.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Libraries/LibGfx/Painter.cpp b/Libraries/LibGfx/Painter.cpp
index 140d3fce23..b1d80ea7db 100644
--- a/Libraries/LibGfx/Painter.cpp
+++ b/Libraries/LibGfx/Painter.cpp
@@ -360,8 +360,8 @@ void Painter::draw_triangle(const Point& a, const Point& b, const Point& c, Colo
int top = p0.y();
if (top < clip.top()) {
- x01 += dx01 * clip.top() - top;
- x02 += dx02 * clip.top() - top;
+ x01 += dx01 * (clip.top() - top);
+ x02 += dx02 * (clip.top() - top);
top = clip.top();
}
@@ -381,8 +381,8 @@ void Painter::draw_triangle(const Point& a, const Point& b, const Point& c, Colo
top = p1.y();
if (top < clip.top()) {
- x02 += dx02 * clip.top() - top;
- x12 += dx12 * clip.top() - top;
+ x02 += dx02 * (clip.top() - top);
+ x12 += dx12 * (clip.top() - top);
top = clip.top();
}