mesa: refactor: new _mesa_init_pixelstore() function
authorBrian Paul <brian.paul@tungstengraphics.com>
Mon, 9 Jun 2008 20:25:23 +0000 (14:25 -0600)
committerKeith Whitwell <keith@tungstengraphics.com>
Mon, 22 Sep 2008 05:13:51 +0000 (22:13 -0700)
(cherry picked from commit 5f91007f996d0b7e3233f221a6b0056203e356d2)

src/mesa/main/context.c
src/mesa/main/pixel.c
src/mesa/main/pixelstore.c
src/mesa/main/pixelstore.h

index 9748fa0434b08f640fcb95858ff44657f2da7dfe..ef1c417903c07dcfe7c13f634a9f771c81df82f9 100644 (file)
 #include "macros.h"
 #include "matrix.h"
 #include "pixel.h"
+#include "pixelstore.h"
 #include "points.h"
 #include "polygon.h"
 #include "queryobj.h"
@@ -995,6 +996,7 @@ init_attrib_groups(GLcontext *ctx)
    _mesa_init_matrix( ctx );
    _mesa_init_multisample( ctx );
    _mesa_init_pixel( ctx );
+   _mesa_init_pixelstore( ctx );
    _mesa_init_point( ctx );
    _mesa_init_polygon( ctx );
    _mesa_init_program( ctx );
index ee9bdabf53b96d6d6cfee372d11b2d870985428f..19b4525cb614923083527d4a6dc66f42098a9805 100644 (file)
@@ -1306,34 +1306,6 @@ _mesa_init_pixel( GLcontext *ctx )
    ASSIGN_4V(ctx->Pixel.TextureColorTableScale, 1.0, 1.0, 1.0, 1.0);
    ASSIGN_4V(ctx->Pixel.TextureColorTableBias, 0.0, 0.0, 0.0, 0.0);
 
-   /* Pixel transfer */
-   ctx->Pack.Alignment = 4;
-   ctx->Pack.RowLength = 0;
-   ctx->Pack.ImageHeight = 0;
-   ctx->Pack.SkipPixels = 0;
-   ctx->Pack.SkipRows = 0;
-   ctx->Pack.SkipImages = 0;
-   ctx->Pack.SwapBytes = GL_FALSE;
-   ctx->Pack.LsbFirst = GL_FALSE;
-   ctx->Pack.ClientStorage = GL_FALSE;
-   ctx->Pack.Invert = GL_FALSE;
-#if FEATURE_EXT_pixel_buffer_object
-   ctx->Pack.BufferObj = ctx->Array.NullBufferObj;
-#endif
-   ctx->Unpack.Alignment = 4;
-   ctx->Unpack.RowLength = 0;
-   ctx->Unpack.ImageHeight = 0;
-   ctx->Unpack.SkipPixels = 0;
-   ctx->Unpack.SkipRows = 0;
-   ctx->Unpack.SkipImages = 0;
-   ctx->Unpack.SwapBytes = GL_FALSE;
-   ctx->Unpack.LsbFirst = GL_FALSE;
-   ctx->Unpack.ClientStorage = GL_FALSE;
-   ctx->Unpack.Invert = GL_FALSE;
-#if FEATURE_EXT_pixel_buffer_object
-   ctx->Unpack.BufferObj = ctx->Array.NullBufferObj;
-#endif
-
    /*
     * _mesa_unpack_image() returns image data in this format.  When we
     * execute image commands (glDrawPixels(), glTexImage(), etc) from
index f5f054f938e6c4035c43428c96541b32b2b2477b..3bf89bd3e18efd139eb5ba0751d252bb8ac8fb3a 100644 (file)
@@ -224,3 +224,40 @@ _mesa_PixelStoref( GLenum pname, GLfloat param )
 {
    _mesa_PixelStorei( pname, (GLint) param );
 }
+
+
+
+/**
+ * Initialize the context's pixel store state.
+ */
+void
+_mesa_init_pixelstore( GLcontext *ctx )
+{
+   /* Pixel transfer */
+   ctx->Pack.Alignment = 4;
+   ctx->Pack.RowLength = 0;
+   ctx->Pack.ImageHeight = 0;
+   ctx->Pack.SkipPixels = 0;
+   ctx->Pack.SkipRows = 0;
+   ctx->Pack.SkipImages = 0;
+   ctx->Pack.SwapBytes = GL_FALSE;
+   ctx->Pack.LsbFirst = GL_FALSE;
+   ctx->Pack.ClientStorage = GL_FALSE;
+   ctx->Pack.Invert = GL_FALSE;
+#if FEATURE_EXT_pixel_buffer_object
+   ctx->Pack.BufferObj = ctx->Array.NullBufferObj;
+#endif
+   ctx->Unpack.Alignment = 4;
+   ctx->Unpack.RowLength = 0;
+   ctx->Unpack.ImageHeight = 0;
+   ctx->Unpack.SkipPixels = 0;
+   ctx->Unpack.SkipRows = 0;
+   ctx->Unpack.SkipImages = 0;
+   ctx->Unpack.SwapBytes = GL_FALSE;
+   ctx->Unpack.LsbFirst = GL_FALSE;
+   ctx->Unpack.ClientStorage = GL_FALSE;
+   ctx->Unpack.Invert = GL_FALSE;
+#if FEATURE_EXT_pixel_buffer_object
+   ctx->Unpack.BufferObj = ctx->Array.NullBufferObj;
+#endif
+}
index c42f3040306b6c2abba5526902e77e8be85c0203..ee963f9ba3c113cd2c8a2890b4b974b375408b6d 100644 (file)
@@ -43,4 +43,8 @@ extern void GLAPIENTRY
 _mesa_PixelStoref( GLenum pname, GLfloat param );
 
 
+extern void
+_mesa_init_pixelstore( GLcontext *ctx );
+
+
 #endif