Skip to content

Commit b5ff132

Browse files
authored
Merge pull request #2 from sysprog21/improve-raster
Unify rasterization with optimized capsule SDF
2 parents 164c93e + ab35e9e commit b5ff132

File tree

3 files changed

+324
-205
lines changed

3 files changed

+324
-205
lines changed

ports/headless.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ struct iui_port_ctx {
116116
#define get_blue(c) iui_color_blue(c)
117117
#define make_color(r, g, b, a) iui_make_color(r, g, b, a)
118118

119-
/* NOTE: Drawing primitives (fill_rounded_rect, draw_line_impl, fill_circle,
120-
* stroke_circle, draw_arc_impl) have been consolidated into port-sw.h as shared
121-
* inline functions: iui_raster_rounded_rect, iui_raster_line_bresenham,
119+
/* NOTE: Drawing primitives (fill_rounded_rect, draw_line, fill_circle,
120+
* stroke_circle, draw_arc) have been consolidated into port-sw.h as shared
121+
* inline functions: iui_raster_rounded_rect, iui_raster_line,
122122
* iui_raster_circle_fill, iui_raster_circle_stroke, iui_raster_arc
123123
*/
124124

@@ -180,8 +180,7 @@ static void headless_draw_line(float x0,
180180

181181
#if HEADLESS_ENABLE_FRAMEBUFFER
182182
if (ctx->framebuffer)
183-
iui_raster_line_bresenham(&ctx->raster, x0, y0, x1, y1, width,
184-
srgb_color);
183+
iui_raster_line(&ctx->raster, x0, y0, x1, y1, width, srgb_color);
185184
#else
186185
(void) x0;
187186
(void) y0;
@@ -307,11 +306,8 @@ static void headless_path_stroke(float width, uint32_t color, void *user)
307306
return;
308307
}
309308

310-
for (int i = 0; i < ctx->path.count - 1; i++) {
311-
iui_raster_line_bresenham(
312-
&ctx->raster, ctx->path.points_x[i], ctx->path.points_y[i],
313-
ctx->path.points_x[i + 1], ctx->path.points_y[i + 1], width, color);
314-
}
309+
/* Use SDL2-compatible path stroke with round caps and consistent AA */
310+
iui_raster_path_stroke(&ctx->raster, &ctx->path, width, color);
315311
iui_path_reset(&ctx->path);
316312
#else
317313
(void) width;

0 commit comments

Comments
 (0)