diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2008-02-29 11:37:12 -0700 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2008-02-29 11:37:12 -0700 |
commit | 2a121e8e2289d2ca136f511c5a6ef049f9c99ec4 (patch) | |
tree | 8fd77e4b02c95222bb1a034ddbaf03c73a863303 /src/gallium/auxiliary/draw/draw_wide_line.c | |
parent | 0b47eb4808aa47e2ab276ab60493e28774cef21a (diff) |
gallium: tweak coords for wide lines
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_wide_line.c')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_wide_line.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/draw/draw_wide_line.c b/src/gallium/auxiliary/draw/draw_wide_line.c index 946a983f00..9a168ce8bd 100644 --- a/src/gallium/auxiliary/draw/draw_wide_line.c +++ b/src/gallium/auxiliary/draw/draw_wide_line.c @@ -86,7 +86,10 @@ static void wideline_line( struct draw_stage *stage, const float dx = FABSF(pos0[0] - pos2[0]); const float dy = FABSF(pos0[1] - pos2[1]); - + + /* small tweak to meet GL specification */ + const float bias = 0.125f; + /* * Draw wide line as a quad (two tris) by "stretching" the line along * X or Y. @@ -95,10 +98,10 @@ static void wideline_line( struct draw_stage *stage, if (dx > dy) { /* x-major line */ - pos0[1] = pos0[1] - half_width - 0.25f; - pos1[1] = pos1[1] + half_width - 0.25f; - pos2[1] = pos2[1] - half_width - 0.25f; - pos3[1] = pos3[1] + half_width - 0.25f; + pos0[1] = pos0[1] - half_width - bias; + pos1[1] = pos1[1] + half_width - bias; + pos2[1] = pos2[1] - half_width - bias; + pos3[1] = pos3[1] + half_width - bias; if (pos0[0] < pos2[0]) { /* left to right line */ pos0[0] -= 0.5f; @@ -116,10 +119,10 @@ static void wideline_line( struct draw_stage *stage, } else { /* y-major line */ - pos0[0] = pos0[0] - half_width + 0.25f; - pos1[0] = pos1[0] + half_width + 0.25f; - pos2[0] = pos2[0] - half_width + 0.25f; - pos3[0] = pos3[0] + half_width + 0.25f; + pos0[0] = pos0[0] - half_width + bias; + pos1[0] = pos1[0] + half_width + bias; + pos2[0] = pos2[0] - half_width + bias; + pos3[0] = pos3[0] + half_width + bias; if (pos0[1] < pos2[1]) { /* top to bottom line */ pos0[1] -= 0.5f; |