diff options
author | Eric Anholt <eric@anholt.net> | 2009-12-22 11:04:32 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-12-22 14:20:26 -0800 |
commit | d203dbc73d3b036937e0404b580fb04d23e10652 (patch) | |
tree | c1a7011254d39dddead9f31d83779f9c40c073d1 /src/mesa | |
parent | 5727147f894137f194d8efc7adb81b80a9b5acd7 (diff) |
mesa: Replace CLAMP_SELF() macro with more obvious CLAMP() usage.
The same code is generated, and readers and static analyzers are
happier.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i915/i830_state.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_state.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxddtex.c | 5 | ||||
-rw-r--r-- | src/mesa/main/macros.h | 6 |
4 files changed, 7 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c index 645ebe3057..acda7e70de 100644 --- a/src/mesa/drivers/dri/i915/i830_state.c +++ b/src/mesa/drivers/dri/i915/i830_state.c @@ -620,7 +620,7 @@ i830LineWidth(GLcontext * ctx, GLfloat widthf) DBG("%s\n", __FUNCTION__); width = (int) (widthf * 2); - CLAMP_SELF(width, 1, 15); + width = CLAMP(width, 1, 15); state5 = i830->state.Ctx[I830_CTXREG_STATE5] & ~FIXED_LINE_WIDTH_MASK; state5 |= (ENABLE_FIXED_LINE_WIDTH | FIXED_LINE_WIDTH(width)); @@ -639,7 +639,7 @@ i830PointSize(GLcontext * ctx, GLfloat size) DBG("%s\n", __FUNCTION__); - CLAMP_SELF(point_size, 1, 256); + point_size = CLAMP(point_size, 1, 256); I830_STATECHANGE(i830, I830_UPLOAD_CTX); i830->state.Ctx[I830_CTXREG_STATE5] &= ~FIXED_POINT_WIDTH_MASK; i830->state.Ctx[I830_CTXREG_STATE5] |= (ENABLE_FIXED_POINT_WIDTH | diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index cc98d125db..9d7a9e1dfe 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -571,7 +571,7 @@ i915LineWidth(GLcontext * ctx, GLfloat widthf) DBG("%s\n", __FUNCTION__); width = (int) (widthf * 2); - CLAMP_SELF(width, 1, 0xf); + width = CLAMP(width, 1, 0xf); lis4 |= width << S4_LINE_WIDTH_SHIFT; if (lis4 != i915->state.Ctx[I915_CTXREG_LIS4]) { @@ -589,7 +589,7 @@ i915PointSize(GLcontext * ctx, GLfloat size) DBG("%s\n", __FUNCTION__); - CLAMP_SELF(point_size, 1, 255); + point_size = CLAMP(point_size, 1, 255); lis4 |= point_size << S4_POINT_WIDTH_SHIFT; if (lis4 != i915->state.Ctx[I915_CTXREG_LIS4]) { diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index a863b028ad..9dd4f1e9c3 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -275,8 +275,9 @@ fxDDTexEnv(GLcontext * ctx, GLenum target, GLenum pname, /* apply any lod biasing right now */ if (pname == GL_TEXTURE_LOD_BIAS_EXT) { GLfloat bias = *param; - CLAMP_SELF(bias, -ctx->Const.MaxTextureLodBias, - ctx->Const.MaxTextureLodBias - 0.25); + bias = CLAMP(bias, + -ctx->Const.MaxTextureLodBias, + ctx->Const.MaxTextureLodBias - 0.25); grTexLodBiasValue(GR_TMU0, bias); diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index f0ea463fb9..55578adf83 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -626,12 +626,6 @@ do { \ /** Clamp X to [MIN,MAX] */ #define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) ) -/** Assign X to CLAMP(X, MIN, MAX) */ -#define CLAMP_SELF(x, mn, mx) \ - ( (x)<(mn) ? ((x) = (mn)) : ((x)>(mx) ? ((x)=(mx)) : (x)) ) - - - /** Minimum of two values: */ #define MIN2( A, B ) ( (A)<(B) ? (A) : (B) ) |