[Mesa-dev] [PATCH 1/2] mesa: Add functions _mesa_[un]pack_is_default()
Chad Versace
chad.versace at linux.intel.com
Thu Oct 11 20:16:12 PDT 2012
These functions check if each of the pixel packing and unpacking state,
including the pack and unpack buffers, are the default.
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
src/mesa/main/pack.c | 21 +++++++++++++++++++++
src/mesa/main/pack.h | 6 ++++++
2 files changed, 27 insertions(+)
diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index a23bc99..6131cb0 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -41,6 +41,7 @@
# pragma optimize( "g", off )
#endif
+#include <string.h>
#include "glheader.h"
#include "colormac.h"
@@ -88,7 +89,27 @@ flip_bytes( GLubyte *p, GLuint n )
}
}
+/**
+ * Check that all pixel packing state, including the pixel pack buffer,
+ * is the default.
+ */
+bool
+_mesa_pack_is_default(struct gl_context *ctx)
+{
+ return memcmp(&ctx->Pack, &ctx->DefaultPacking,
+ sizeof(struct gl_pixelstore_attrib)) == 0;
+}
+/**
+ * Check that all pixel unpacking state, including the pixel unpack buffer,
+ * is the default.
+ */
+bool
+_mesa_unpack_is_default(struct gl_context *ctx)
+{
+ return memcmp(&ctx->Unpack, &ctx->DefaultPacking,
+ sizeof(struct gl_pixelstore_attrib)) == 0;
+}
/*
* Unpack a 32x32 pixel polygon stipple from user memory using the
diff --git a/src/mesa/main/pack.h b/src/mesa/main/pack.h
index 2fbdf91..86a5361 100644
--- a/src/mesa/main/pack.h
+++ b/src/mesa/main/pack.h
@@ -26,9 +26,15 @@
#ifndef PACK_H
#define PACK_H
+#include <stdbool.h>
#include "mtypes.h"
+bool
+_mesa_pack_is_default(struct gl_context *ctx);
+
+bool
+_mesa_unpack_is_default(struct gl_context *ctx);
extern void
_mesa_unpack_polygon_stipple(const GLubyte *pattern, GLuint dest[32],
--
1.7.11.7
More information about the mesa-dev
mailing list