mesa: Use SATURATE
[mesa.git] / src / mesa / main / pixelstore.c
index 4738f96213515e226df748ef4251a5aa583a9af3..f190c0b2bc1eaf44e95d6fd91215a49b8ebe44ba 100644 (file)
@@ -33,6 +33,7 @@
 #include "context.h"
 #include "pixelstore.h"
 #include "mtypes.h"
+#include "util/rounding.h"
 
 
 static ALWAYS_INLINE void
@@ -215,26 +216,26 @@ pixel_storei(GLenum pname, GLint param, bool no_error)
    return;
 
 invalid_enum_error:
-   _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
+   _mesa_error(ctx, GL_INVALID_ENUM, "glPixelStore");
    return;
 
 invalid_value_error:
-   _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+   _mesa_error(ctx, GL_INVALID_VALUE, "glPixelStore(param)");
    return;
 }
 
 
 void GLAPIENTRY
-_mesa_PixelStorei( GLenum pname, GLint param )
+_mesa_PixelStorei(GLenum pname, GLint param)
 {
    pixel_storei(pname, param, false);
 }
 
 
 void GLAPIENTRY
-_mesa_PixelStoref( GLenum pname, GLfloat param )
+_mesa_PixelStoref(GLenum pname, GLfloat param)
 {
-   _mesa_PixelStorei( pname, IROUND(param) );
+   _mesa_PixelStorei(pname, lroundf(param));
 }
 
 
@@ -248,7 +249,7 @@ _mesa_PixelStorei_no_error(GLenum pname, GLint param)
 void GLAPIENTRY
 _mesa_PixelStoref_no_error(GLenum pname, GLfloat param)
 {
-   _mesa_PixelStorei_no_error(pname, IROUND(param));
+   _mesa_PixelStorei_no_error(pname, lroundf(param));
 }
 
 
@@ -256,7 +257,7 @@ _mesa_PixelStoref_no_error(GLenum pname, GLfloat param)
  * Initialize the context's pixel store state.
  */
 void
-_mesa_init_pixelstore( struct gl_context *ctx )
+_mesa_init_pixelstore(struct gl_context *ctx)
 {
    /* Pixel transfer */
    ctx->Pack.Alignment = 4;
@@ -272,8 +273,7 @@ _mesa_init_pixelstore( struct gl_context *ctx )
    ctx->Pack.CompressedBlockHeight = 0;
    ctx->Pack.CompressedBlockDepth = 0;
    ctx->Pack.CompressedBlockSize = 0;
-   _mesa_reference_buffer_object(ctx, &ctx->Pack.BufferObj,
-                                 ctx->Shared->NullBufferObj);
+   _mesa_reference_buffer_object(ctx, &ctx->Pack.BufferObj, NULL);
    ctx->Unpack.Alignment = 4;
    ctx->Unpack.RowLength = 0;
    ctx->Unpack.ImageHeight = 0;
@@ -287,8 +287,7 @@ _mesa_init_pixelstore( struct gl_context *ctx )
    ctx->Unpack.CompressedBlockHeight = 0;
    ctx->Unpack.CompressedBlockDepth = 0;
    ctx->Unpack.CompressedBlockSize = 0;
-   _mesa_reference_buffer_object(ctx, &ctx->Unpack.BufferObj,
-                                 ctx->Shared->NullBufferObj);
+   _mesa_reference_buffer_object(ctx, &ctx->Unpack.BufferObj, NULL);
 
    /*
     * _mesa_unpack_image() returns image data in this format.  When we
@@ -305,8 +304,7 @@ _mesa_init_pixelstore( struct gl_context *ctx )
    ctx->DefaultPacking.SwapBytes = GL_FALSE;
    ctx->DefaultPacking.LsbFirst = GL_FALSE;
    ctx->DefaultPacking.Invert = GL_FALSE;
-   _mesa_reference_buffer_object(ctx, &ctx->DefaultPacking.BufferObj,
-                                 ctx->Shared->NullBufferObj);
+   _mesa_reference_buffer_object(ctx, &ctx->DefaultPacking.BufferObj, NULL);
 }