summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2026-03-29 09:59:21 +0300
committerSyndamia <kamen@syndamia.com>2026-03-29 09:59:21 +0300
commit2f49c471e32bcf3d942b3396eb954a8dac0db4c7 (patch)
tree105145a83be15f1adb4ba3336febfe89a625ea2e
parentddd9c909a68ab0b28fa6707a9c4d6f92c78f22f9 (diff)
downloadppm_graphics-2f49c471e32bcf3d942b3396eb954a8dac0db4c7.tar
ppm_graphics-2f49c471e32bcf3d942b3396eb954a8dac0db4c7.tar.gz
ppm_graphics-2f49c471e32bcf3d942b3396eb954a8dac0db4c7.zip
fix(P_LineSegment): Proplery center line segment
-rw-r--r--FrameRender/P_LineSegment.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/FrameRender/P_LineSegment.c b/FrameRender/P_LineSegment.c
index f2236ff..02f7049 100644
--- a/FrameRender/P_LineSegment.c
+++ b/FrameRender/P_LineSegment.c
@@ -26,8 +26,8 @@ void LineSegment_callback(LineSegment* self, struct PixelContext* fc) {
rotatePoint(&y, &x, -phi);
rotatePoint(&bY, &bX, -phi);
- if (0 <= x && x <= bX &&
- -(i32)self->width / 2 <= y && y <= self->width / 2)
+ i32 halfWidth = self->width / 2;
+ if (0 <= x && x <= bX && -halfWidth <= y && y <= halfWidth)
{
ARGB_merge(&fc->pixel, self->color);
}