aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_blend.c8
-rw-r--r--src/mesa/swrast/s_clear.c10
2 files changed, 4 insertions, 14 deletions
diff --git a/src/mesa/swrast/s_blend.c b/src/mesa/swrast/s_blend.c
index 793921250ad..3760f91d64b 100644
--- a/src/mesa/swrast/s_blend.c
+++ b/src/mesa/swrast/s_blend.c
@@ -851,12 +851,8 @@ blend_general(struct gl_context *ctx, GLuint n, const GLubyte mask[],
blend_general_float(ctx, n, mask, rgbaF, destF, chanType);
/* convert back to ubytes */
for (i = 0; i < n; i++) {
- if (mask[i]) {
- UNCLAMPED_FLOAT_TO_UBYTE(rgba[i][RCOMP], rgbaF[i][RCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(rgba[i][GCOMP], rgbaF[i][GCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(rgba[i][BCOMP], rgbaF[i][BCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(rgba[i][ACOMP], rgbaF[i][ACOMP]);
- }
+ if (mask[i])
+ _mesa_unclamped_float_rgba_to_ubyte(rgba[i], rgbaF[i]);
}
}
else if (chanType == GL_UNSIGNED_SHORT) {
diff --git a/src/mesa/swrast/s_clear.c b/src/mesa/swrast/s_clear.c
index 16d1cdbfcc8..980d29bbade 100644
--- a/src/mesa/swrast/s_clear.c
+++ b/src/mesa/swrast/s_clear.c
@@ -60,10 +60,7 @@ clear_rgba_buffer_with_masking(struct gl_context *ctx, struct gl_renderbuffer *r
span.array->ChanType = rb->DataType;
if (span.array->ChanType == GL_UNSIGNED_BYTE) {
GLubyte clearColor[4];
- UNCLAMPED_FLOAT_TO_UBYTE(clearColor[RCOMP], ctx->Color.ClearColor.f[0]);
- UNCLAMPED_FLOAT_TO_UBYTE(clearColor[GCOMP], ctx->Color.ClearColor.f[1]);
- UNCLAMPED_FLOAT_TO_UBYTE(clearColor[BCOMP], ctx->Color.ClearColor.f[2]);
- UNCLAMPED_FLOAT_TO_UBYTE(clearColor[ACOMP], ctx->Color.ClearColor.f[3]);
+ _mesa_unclamped_float_rgba_to_ubyte(clearColor, ctx->Color.ClearColor.f);
for (i = 0; i < width; i++) {
COPY_4UBV(span.array->rgba[i], clearColor);
}
@@ -127,10 +124,7 @@ clear_rgba_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint buf
switch (rb->DataType) {
case GL_UNSIGNED_BYTE:
- UNCLAMPED_FLOAT_TO_UBYTE(clear8[0], ctx->Color.ClearColor.f[0]);
- UNCLAMPED_FLOAT_TO_UBYTE(clear8[1], ctx->Color.ClearColor.f[1]);
- UNCLAMPED_FLOAT_TO_UBYTE(clear8[2], ctx->Color.ClearColor.f[2]);
- UNCLAMPED_FLOAT_TO_UBYTE(clear8[3], ctx->Color.ClearColor.f[3]);
+ _mesa_unclamped_float_rgba_to_ubyte(clear8, ctx->Color.ClearColor.f);
clearVal = clear8;
break;
case GL_UNSIGNED_SHORT: