From: Roland Scheidegger <srol...@vmware.com> In contrast to non-aa, where stippling is based on either dx or dy (depending on if it's a x or y major line), stippling is based on actual distance with smooth lines, so adjust for this.
(It looks like there's some minor artifacts with mesa demos line-sample with wide lines, I think there might be some issues with wide lines and very short line segments (when the original line segment length is below half a pixel) but it may be related to aa lines rather than stippling.) --- src/gallium/auxiliary/draw/draw_pipe_stipple.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/draw/draw_pipe_stipple.c b/src/gallium/auxiliary/draw/draw_pipe_stipple.c index 3a84d6c..8fa8274 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_stipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_stipple.c @@ -50,6 +50,7 @@ struct stipple_stage { float counter; uint pattern; uint factor; + bool smooth; }; @@ -136,9 +137,15 @@ stipple_line(struct draw_stage *stage, struct prim_header *header) float dx = x0 > x1 ? x0 - x1 : x1 - x0; float dy = y0 > y1 ? y0 - y1 : y1 - y0; - float length = MAX2(dx, dy); + float length; int i; + if (stipple->smooth) { + length = sqrtf(dx*dx + dy*dy); + } else { + length = MAX2(dx, dy); + } + if (header->flags & DRAW_PIPE_RESET_STIPPLE) stipple->counter = 0; @@ -205,6 +212,7 @@ stipple_first_line(struct draw_stage *stage, stipple->pattern = draw->rasterizer->line_stipple_pattern; stipple->factor = draw->rasterizer->line_stipple_factor + 1; + stipple->smooth = draw->rasterizer->line_smooth; stage->line = stipple_line; stage->line(stage, header); -- 2.7.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev