mesa: refactor: move glPixelStore function into new pixelstore.c file
authorBrian Paul <brian.paul@tungstengraphics.com>
Mon, 9 Jun 2008 20:14:34 +0000 (14:14 -0600)
committerKeith Whitwell <keith@tungstengraphics.com>
Mon, 22 Sep 2008 05:13:51 +0000 (22:13 -0700)
src/mesa/main/pixel.c
src/mesa/main/pixel.h
src/mesa/main/pixelstore.c [new file with mode: 0644]
src/mesa/main/pixelstore.h [new file with mode: 0644]
src/mesa/main/state.c
src/mesa/sources

index eb4fd6e7c9430db857fefb9c225afa3ac0701931..ee9bdabf53b96d6d6cfee372d11b2d870985428f 100644 (file)
@@ -36,8 +36,6 @@
 /*****                    glPixelZoom                             *****/
 /**********************************************************************/
 
-
-
 void GLAPIENTRY
 _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor )
 {
@@ -54,200 +52,6 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor )
 
 
 
-/**********************************************************************/
-/*****                    glPixelStore                            *****/
-/**********************************************************************/
-
-
-void GLAPIENTRY
-_mesa_PixelStorei( GLenum pname, GLint param )
-{
-   /* NOTE: this call can't be compiled into the display list */
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END(ctx);
-
-   switch (pname) {
-      case GL_PACK_SWAP_BYTES:
-        if (param == (GLint)ctx->Pack.SwapBytes)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-         ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE;
-        break;
-      case GL_PACK_LSB_FIRST:
-        if (param == (GLint)ctx->Pack.LsbFirst)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-         ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE;
-        break;
-      case GL_PACK_ROW_LENGTH:
-        if (param<0) {
-           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
-           return;
-        }
-        if (ctx->Pack.RowLength == param)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-        ctx->Pack.RowLength = param;
-        break;
-      case GL_PACK_IMAGE_HEIGHT:
-         if (param<0) {
-            _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
-           return;
-        }
-        if (ctx->Pack.ImageHeight == param)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-        ctx->Pack.ImageHeight = param;
-         break;
-      case GL_PACK_SKIP_PIXELS:
-        if (param<0) {
-           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
-           return;
-        }
-        if (ctx->Pack.SkipPixels == param)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-        ctx->Pack.SkipPixels = param;
-        break;
-      case GL_PACK_SKIP_ROWS:
-        if (param<0) {
-           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
-           return;
-        }
-        if (ctx->Pack.SkipRows == param)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-        ctx->Pack.SkipRows = param;
-        break;
-      case GL_PACK_SKIP_IMAGES:
-        if (param<0) {
-           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
-           return;
-        }
-        if (ctx->Pack.SkipImages == param)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-        ctx->Pack.SkipImages = param;
-        break;
-      case GL_PACK_ALIGNMENT:
-         if (param!=1 && param!=2 && param!=4 && param!=8) {
-           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
-           return;
-        }
-        if (ctx->Pack.Alignment == param)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-        ctx->Pack.Alignment = param;
-        break;
-      case GL_PACK_INVERT_MESA:
-         if (!ctx->Extensions.MESA_pack_invert) {
-            _mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" );
-            return;
-         }
-         if (ctx->Pack.Invert == param)
-            return;
-         FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-         ctx->Pack.Invert = param;
-         break;
-
-      case GL_UNPACK_SWAP_BYTES:
-        if (param == (GLint)ctx->Unpack.SwapBytes)
-           return;
-        if ((GLint)ctx->Unpack.SwapBytes == param)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-        ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE;
-         break;
-      case GL_UNPACK_LSB_FIRST:
-        if (param == (GLint)ctx->Unpack.LsbFirst)
-           return;
-        if ((GLint)ctx->Unpack.LsbFirst == param)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-        ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE;
-        break;
-      case GL_UNPACK_ROW_LENGTH:
-        if (param<0) {
-           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
-           return;
-        }
-        if (ctx->Unpack.RowLength == param)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-        ctx->Unpack.RowLength = param;
-        break;
-      case GL_UNPACK_IMAGE_HEIGHT:
-         if (param<0) {
-            _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
-           return;
-        }
-        if (ctx->Unpack.ImageHeight == param)
-           return;
-
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-        ctx->Unpack.ImageHeight = param;
-         break;
-      case GL_UNPACK_SKIP_PIXELS:
-        if (param<0) {
-           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
-           return;
-        }
-        if (ctx->Unpack.SkipPixels == param)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-        ctx->Unpack.SkipPixels = param;
-        break;
-      case GL_UNPACK_SKIP_ROWS:
-        if (param<0) {
-           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
-           return;
-        }
-        if (ctx->Unpack.SkipRows == param)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-        ctx->Unpack.SkipRows = param;
-        break;
-      case GL_UNPACK_SKIP_IMAGES:
-        if (param < 0) {
-           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
-           return;
-        }
-        if (ctx->Unpack.SkipImages == param)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-        ctx->Unpack.SkipImages = param;
-        break;
-      case GL_UNPACK_ALIGNMENT:
-         if (param!=1 && param!=2 && param!=4 && param!=8) {
-           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore" );
-           return;
-        }
-        if (ctx->Unpack.Alignment == param)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-        ctx->Unpack.Alignment = param;
-        break;
-      case GL_UNPACK_CLIENT_STORAGE_APPLE:
-         if (param == (GLint)ctx->Unpack.ClientStorage)
-            return;
-         FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-         ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE;
-         break;
-      default:
-        _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
-        return;
-   }
-}
-
-
-void GLAPIENTRY
-_mesa_PixelStoref( GLenum pname, GLfloat param )
-{
-   _mesa_PixelStorei( pname, (GLint) param );
-}
-
-
-
 /**********************************************************************/
 /*****                         glPixelMap                         *****/
 /**********************************************************************/
index 09155cfd70dc9bcc735a87f137a4c3ed5a586036..ad874e9f0f9adf1f66b85b8c962db45da9a301dd 100644 (file)
@@ -56,13 +56,6 @@ _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values );
 extern void GLAPIENTRY
 _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values );
 
-extern void GLAPIENTRY
-_mesa_PixelStoref( GLenum pname, GLfloat param );
-
-
-extern void GLAPIENTRY
-_mesa_PixelStorei( GLenum pname, GLint param );
-
 extern void GLAPIENTRY
 _mesa_PixelTransferf( GLenum pname, GLfloat param );
 
diff --git a/src/mesa/main/pixelstore.c b/src/mesa/main/pixelstore.c
new file mode 100644 (file)
index 0000000..f5f054f
--- /dev/null
@@ -0,0 +1,226 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.1
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file pixelstore.c
+ * glPixelStore functions.
+ */
+
+
+#include "glheader.h"
+#include "bufferobj.h"
+#include "colormac.h"
+#include "context.h"
+#include "image.h"
+#include "macros.h"
+#include "pixelstore.h"
+#include "mtypes.h"
+
+
+void GLAPIENTRY
+_mesa_PixelStorei( GLenum pname, GLint param )
+{
+   /* NOTE: this call can't be compiled into the display list */
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   switch (pname) {
+      case GL_PACK_SWAP_BYTES:
+        if (param == (GLint)ctx->Pack.SwapBytes)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+         ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE;
+        break;
+      case GL_PACK_LSB_FIRST:
+        if (param == (GLint)ctx->Pack.LsbFirst)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+         ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE;
+        break;
+      case GL_PACK_ROW_LENGTH:
+        if (param<0) {
+           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+           return;
+        }
+        if (ctx->Pack.RowLength == param)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+        ctx->Pack.RowLength = param;
+        break;
+      case GL_PACK_IMAGE_HEIGHT:
+         if (param<0) {
+            _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+           return;
+        }
+        if (ctx->Pack.ImageHeight == param)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+        ctx->Pack.ImageHeight = param;
+         break;
+      case GL_PACK_SKIP_PIXELS:
+        if (param<0) {
+           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+           return;
+        }
+        if (ctx->Pack.SkipPixels == param)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+        ctx->Pack.SkipPixels = param;
+        break;
+      case GL_PACK_SKIP_ROWS:
+        if (param<0) {
+           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+           return;
+        }
+        if (ctx->Pack.SkipRows == param)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+        ctx->Pack.SkipRows = param;
+        break;
+      case GL_PACK_SKIP_IMAGES:
+        if (param<0) {
+           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+           return;
+        }
+        if (ctx->Pack.SkipImages == param)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+        ctx->Pack.SkipImages = param;
+        break;
+      case GL_PACK_ALIGNMENT:
+         if (param!=1 && param!=2 && param!=4 && param!=8) {
+           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+           return;
+        }
+        if (ctx->Pack.Alignment == param)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+        ctx->Pack.Alignment = param;
+        break;
+      case GL_PACK_INVERT_MESA:
+         if (!ctx->Extensions.MESA_pack_invert) {
+            _mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" );
+            return;
+         }
+         if (ctx->Pack.Invert == param)
+            return;
+         FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+         ctx->Pack.Invert = param;
+         break;
+
+      case GL_UNPACK_SWAP_BYTES:
+        if (param == (GLint)ctx->Unpack.SwapBytes)
+           return;
+        if ((GLint)ctx->Unpack.SwapBytes == param)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+        ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE;
+         break;
+      case GL_UNPACK_LSB_FIRST:
+        if (param == (GLint)ctx->Unpack.LsbFirst)
+           return;
+        if ((GLint)ctx->Unpack.LsbFirst == param)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+        ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE;
+        break;
+      case GL_UNPACK_ROW_LENGTH:
+        if (param<0) {
+           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+           return;
+        }
+        if (ctx->Unpack.RowLength == param)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+        ctx->Unpack.RowLength = param;
+        break;
+      case GL_UNPACK_IMAGE_HEIGHT:
+         if (param<0) {
+            _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+           return;
+        }
+        if (ctx->Unpack.ImageHeight == param)
+           return;
+
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+        ctx->Unpack.ImageHeight = param;
+         break;
+      case GL_UNPACK_SKIP_PIXELS:
+        if (param<0) {
+           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+           return;
+        }
+        if (ctx->Unpack.SkipPixels == param)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+        ctx->Unpack.SkipPixels = param;
+        break;
+      case GL_UNPACK_SKIP_ROWS:
+        if (param<0) {
+           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+           return;
+        }
+        if (ctx->Unpack.SkipRows == param)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+        ctx->Unpack.SkipRows = param;
+        break;
+      case GL_UNPACK_SKIP_IMAGES:
+        if (param < 0) {
+           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+           return;
+        }
+        if (ctx->Unpack.SkipImages == param)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+        ctx->Unpack.SkipImages = param;
+        break;
+      case GL_UNPACK_ALIGNMENT:
+         if (param!=1 && param!=2 && param!=4 && param!=8) {
+           _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore" );
+           return;
+        }
+        if (ctx->Unpack.Alignment == param)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+        ctx->Unpack.Alignment = param;
+        break;
+      case GL_UNPACK_CLIENT_STORAGE_APPLE:
+         if (param == (GLint)ctx->Unpack.ClientStorage)
+            return;
+         FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+         ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE;
+         break;
+      default:
+        _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
+        return;
+   }
+}
+
+
+void GLAPIENTRY
+_mesa_PixelStoref( GLenum pname, GLfloat param )
+{
+   _mesa_PixelStorei( pname, (GLint) param );
+}
diff --git a/src/mesa/main/pixelstore.h b/src/mesa/main/pixelstore.h
new file mode 100644 (file)
index 0000000..c42f304
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.1
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file pixelstore.h
+ * glPixelStore functions.
+ */
+
+
+#ifndef PIXELSTORE_H
+#define PIXELSTORE_H
+
+
+#include "glheader.h"
+
+
+extern void GLAPIENTRY
+_mesa_PixelStorei( GLenum pname, GLint param );
+
+
+extern void GLAPIENTRY
+_mesa_PixelStoref( GLenum pname, GLfloat param );
+
+
+#endif
index ece1364d755a1c9b57582e19faacf34c6cbed3ff..e285a9e0957548358a1f657edbfe6a9764f9d7a8 100644 (file)
@@ -72,6 +72,7 @@
 #include "macros.h"
 #include "matrix.h"
 #include "pixel.h"
+#include "pixelstore.h"
 #include "points.h"
 #include "polygon.h"
 #if FEATURE_ARB_occlusion_query || FEATURE_EXT_timer_query
index 7a3b9fb2bcbf403adc3a744990549c47c393a340..cec1862474c35e94306157abe3228e58b1be42b0 100644 (file)
@@ -43,6 +43,7 @@ MAIN_SOURCES = \
        main/mipmap.c \
        main/mm.c \
        main/pixel.c \
+       main/pixelstore.c \
        main/points.c \
        main/polygon.c \
        main/queryobj.c \