r300: move some more function to generic
[mesa.git] / src / mesa / swrast / s_imaging.c
index 43e955c6a727dd8e24b694f3efa7d8b6ce6e1662..591857c3423e4f29d0c26b78dd530c152b27e510 100644 (file)
  * extensions into either swrast or a sister module.  
  */
 
+#include "main/glheader.h"
+#include "main/colortab.h"
+#include "main/convolve.h"
 #include "s_context.h"
 #include "s_span.h"
-#include "colortab.h"
-#include "convolve.h"
 
 
 void
@@ -38,6 +39,7 @@ _swrast_CopyColorTable( GLcontext *ctx,
                        GLenum target, GLenum internalformat,
                        GLint x, GLint y, GLsizei width)
 {
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
    GLchan data[MAX_WIDTH][4];
    struct gl_buffer_object *bufferSave;
 
@@ -49,9 +51,13 @@ _swrast_CopyColorTable( GLcontext *ctx,
    if (width > MAX_WIDTH)
       width = MAX_WIDTH;
 
+   RENDER_START( swrast, ctx );
+
    /* read the data from framebuffer */
    _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer,
-                           width, x, y, data );
+                           width, x, y, CHAN_TYPE, data );
+
+   RENDER_FINISH(swrast,ctx);
 
    /* save PBO binding */
    bufferSave = ctx->Unpack.BufferObj;
@@ -68,6 +74,7 @@ void
 _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start,
                           GLint x, GLint y, GLsizei width)
 {
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
    GLchan data[MAX_WIDTH][4];
    struct gl_buffer_object *bufferSave;
 
@@ -79,9 +86,13 @@ _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start,
    if (width > MAX_WIDTH)
       width = MAX_WIDTH;
 
+   RENDER_START( swrast, ctx );
+
    /* read the data from framebuffer */
    _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer,
-                           width, x, y, data );
+                           width, x, y, CHAN_TYPE, data );
+
+   RENDER_FINISH(swrast,ctx);
 
    /* save PBO binding */
    bufferSave = ctx->Unpack.BufferObj;
@@ -112,7 +123,7 @@ _swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target,
 
    /* read the data from framebuffer */
    _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer,
-                           width, x, y, (GLchan (*)[4]) rgba );
+                           width, x, y, CHAN_TYPE, rgba );
    
    RENDER_FINISH( swrast, ctx );
 
@@ -150,7 +161,7 @@ _swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target,
    /* read pixels from framebuffer */
    for (i = 0; i < height; i++) {
       _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer,
-                              width, x, y + i, (GLchan (*)[4]) rgba[i] );
+                              width, x, y + i, CHAN_TYPE, rgba[i] );
    }
 
    RENDER_FINISH(swrast,ctx);