summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-07-21 10:06:18 -0600
committerBrian <[email protected]>2007-07-21 10:06:41 -0600
commitaf2aa8e9cf88a9ee3ec338eddc9a47bf2f142cb7 (patch)
tree39abc89e77ed3a102551d1c18bf11a13f2310fa6 /src/mesa/swrast
parent5842bc3bf9e33333b122ce7fd6bf108aab780111 (diff)
Remove ctx->Point._Size and ctx->Line._Width.
The clamping for these values depends on whether we're drawing AA or non-AA points, lines. Defer clamping until drawing time. Drivers could compute and keep clamped AA and clamped non-AA values if desired.
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_aalinetemp.h4
-rw-r--r--src/mesa/swrast/s_lines.c16
-rw-r--r--src/mesa/swrast/s_points.c8
3 files changed, 16 insertions, 12 deletions
diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h
index 69a1f0cd396..e7911fec3b5 100644
--- a/src/mesa/swrast/s_aalinetemp.h
+++ b/src/mesa/swrast/s_aalinetemp.h
@@ -132,7 +132,9 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
line.dx = line.x1 - line.x0;
line.dy = line.y1 - line.y0;
line.len = SQRTF(line.dx * line.dx + line.dy * line.dy);
- line.halfWidth = 0.5F * ctx->Line._Width;
+ line.halfWidth = 0.5F * CLAMP(ctx->Line.Width,
+ ctx->Const.MinLineWidthAA,
+ ctx->Const.MaxLineWidthAA);
if (line.len == 0.0 || IS_INF_OR_NAN(line.len))
return;
diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c
index 781146e67f9..15ef6233eda 100644
--- a/src/mesa/swrast/s_lines.c
+++ b/src/mesa/swrast/s_lines.c
@@ -63,12 +63,13 @@ compute_stipple_mask( GLcontext *ctx, GLuint len, GLubyte mask[] )
static void
draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
{
- GLint width, start;
+ const GLint width = (GLint) CLAMP(ctx->Line.Width,
+ ctx->Const.MinLineWidth,
+ ctx->Const.MaxLineWidth);
+ GLint start;
ASSERT(span->end < MAX_WIDTH);
- width = (GLint) CLAMP( ctx->Line._Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH );
-
if (width & 1)
start = width / 2;
else
@@ -143,7 +144,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
span.arrayMask |= SPAN_MASK; \
compute_stipple_mask(ctx, span.end, span.array->mask); \
} \
- if (ctx->Line._Width > 1.0) { \
+ if (ctx->Line.Width > 1.0) { \
draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \
} \
else { \
@@ -161,7 +162,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
span.arrayMask |= SPAN_MASK; \
compute_stipple_mask(ctx, span.end, span.array->mask); \
} \
- if (ctx->Line._Width > 1.0) { \
+ if (ctx->Line.Width > 1.0) { \
draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \
} \
else { \
@@ -180,7 +181,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
span.arrayMask |= SPAN_MASK; \
compute_stipple_mask(ctx, span.end, span.array->mask); \
} \
- if (ctx->Line._Width > 1.0) { \
+ if (ctx->Line.Width > 1.0) { \
draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \
} \
else { \
@@ -274,7 +275,7 @@ _swrast_choose_line( GLcontext *ctx )
USE(general_line);
}
else if (ctx->Depth.Test
- || ctx->Line._Width != 1.0
+ || ctx->Line.Width != 1.0
|| ctx->Line.StippleFlag) {
/* no texture, but Z, fog, width>1, stipple, etc. */
if (rgbmode)
@@ -284,6 +285,7 @@ _swrast_choose_line( GLcontext *ctx )
}
else {
ASSERT(!ctx->Depth.Test);
+ ASSERT(ctx->Line.Width == 1.0);
/* simple lines */
if (rgbmode)
USE(simple_no_z_rgba_line);
diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c
index 8eba53c8076..4768fbea972 100644
--- a/src/mesa/swrast/s_points.c
+++ b/src/mesa/swrast/s_points.c
@@ -76,7 +76,7 @@ sprite_point(GLcontext *ctx, const SWvertex *vert)
}
else {
/* use constant point size */
- size = ctx->Point._Size; /* already clamped to user range */
+ size = ctx->Point.Size;
}
/* clamp to non-AA implementation limits */
size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
@@ -227,7 +227,7 @@ smooth_point(GLcontext *ctx, const SWvertex *vert)
}
else {
/* use constant point size */
- size = ctx->Point._Size; /* this is already clamped */
+ size = ctx->Point.Size;
}
/* clamp to AA implementation limits */
size = CLAMP(size, ctx->Const.MinPointSizeAA, ctx->Const.MaxPointSizeAA);
@@ -361,7 +361,7 @@ large_point(GLcontext *ctx, const SWvertex *vert)
}
else {
/* use constant point size */
- size = ctx->Point._Size; /* already clamped to user range */
+ size = ctx->Point.Size;
}
/* clamp to non-AA implementation limits */
size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
@@ -550,7 +550,7 @@ _swrast_choose_point(GLcontext *ctx)
else if (ctx->Point.SmoothFlag) {
swrast->Point = smooth_point;
}
- else if (ctx->Point._Size > 1.0 ||
+ else if (ctx->Point.Size > 1.0 ||
ctx->Point._Attenuated ||
ctx->VertexProgram.PointSizeEnabled) {
swrast->Point = large_point;