OSDN Git Service

mesa/main: Make FEATURE_drawpix follow feature conventions.
authorChia-I Wu <olvaffe@gmail.com>
Tue, 8 Sep 2009 02:15:06 +0000 (10:15 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Sat, 12 Sep 2009 12:55:56 +0000 (20:55 +0800)
As shown in mfeatures.h, this allows users of drawpix.h to work
without knowing if the feature is available.

src/mesa/main/api_exec.c
src/mesa/main/drawpix.c
src/mesa/main/drawpix.h

index 8de0691..5ddbf49 100644 (file)
@@ -57,9 +57,7 @@
 #if FEATURE_dlist
 #include "dlist.h"
 #endif
-#if FEATURE_drawpix
 #include "drawpix.h"
-#endif
 #include "rastpos.h"
 #include "enable.h"
 #if FEATURE_evaluators
@@ -209,11 +207,9 @@ _mesa_init_exec_table(struct _glapi_table *exec)
    SET_DepthFunc(exec, _mesa_DepthFunc);
    SET_DepthMask(exec, _mesa_DepthMask);
    SET_DepthRange(exec, _mesa_DepthRange);
-#if FEATURE_drawpix
-   SET_Bitmap(exec, _mesa_Bitmap);
-   SET_CopyPixels(exec, _mesa_CopyPixels);
-   SET_DrawPixels(exec, _mesa_DrawPixels);
-#endif
+
+   _mesa_init_drawpix_dispatch(exec);
+
 #if FEATURE_feedback
    SET_InitNames(exec, _mesa_InitNames);
    SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer);
index aef6585..f7ce64f 100644 (file)
 #include "image.h"
 #include "readpix.h"
 #include "state.h"
+#include "glapi/dispatch.h"
 
 
+#if FEATURE_drawpix
+
 
 /**
  * If a fragment program is enabled, check that it's valid.
@@ -47,8 +50,6 @@ valid_fragment_program(GLcontext *ctx)
 }
 
 
-#if _HAVE_FULL_GL
-
 /*
  * Execute glDrawPixels
  */
@@ -225,9 +226,6 @@ end:
    _mesa_set_vp_override(ctx, GL_FALSE);
 }
 
-#endif /* _HAVE_FULL_GL */
-
-
 
 void GLAPIENTRY
 _mesa_Bitmap( GLsizei width, GLsizei height,
@@ -309,3 +307,15 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
    ctx->Current.RasterPos[0] += xmove;
    ctx->Current.RasterPos[1] += ymove;
 }
+
+
+void 
+_mesa_init_drawpix_dispatch(struct _glapi_table *disp)
+{
+   SET_Bitmap(disp, _mesa_Bitmap);
+   SET_CopyPixels(disp, _mesa_CopyPixels);
+   SET_DrawPixels(disp, _mesa_DrawPixels);
+}
+
+
+#endif /* FEATURE_drawpix */
index 6177ada..01564b3 100644 (file)
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#ifndef DRAWPIX_H
+#define DRAWPIX_H
 
-#ifndef DRAWPIXELS_H
-#define DRAWPIXELS_H
 
+#include "main/mtypes.h"
 
-#include "main/glheader.h"
 
+#if FEATURE_drawpix
+
+#define _MESA_INIT_DRAWPIX_FUNCTIONS(driver, impl) \
+   do {                                            \
+      (driver)->DrawPixels = impl ## DrawPixels;   \
+      (driver)->CopyPixels = impl ## CopyPixels;   \
+      (driver)->Bitmap     = impl ## Bitmap;       \
+   } while (0)
 
 extern void GLAPIENTRY
 _mesa_DrawPixels( GLsizei width, GLsizei height,
@@ -45,5 +53,19 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
               GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove,
               const GLubyte *bitmap );
 
+extern void 
+_mesa_init_drawpix_dispatch(struct _glapi_table *disp);
+
+#else /* FEATURE_drawpix */
+
+#define _MESA_INIT_DRAWPIX_FUNCTIONS(driver, impl) do { } while (0)
+
+static INLINE void 
+_mesa_init_drawpix_dispatch(struct _glapi_table *disp)
+{
+}
+
+#endif /* FEATURE_drawpix */
+
 
-#endif
+#endif /* DRAWPIX_H */