OSDN Git Service

swrast: Move the check for fast_copy_pixels() ability to caller.
authorEric Anholt <eric@anholt.net>
Wed, 4 Jan 2012 23:59:39 +0000 (15:59 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 6 Jan 2012 17:48:47 +0000 (09:48 -0800)
I'm going to reuse this function from glBlitFramebuffer() handling,
which wants to do the same thing.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/swrast/s_copypix.c

index 1dc4286..8fae01f 100644 (file)
@@ -438,14 +438,6 @@ fast_copy_pixels(struct gl_context *ctx,
    GLubyte *srcMap, *dstMap;
    GLint srcRowStride, dstRowStride;
 
-   if (SWRAST_CONTEXT(ctx)->_RasterMask != 0x0 ||
-       ctx->Pixel.ZoomX != 1.0F ||
-       ctx->Pixel.ZoomY != 1.0F ||
-       ctx->_ImageTransferState) {
-      /* can't handle these */
-      return GL_FALSE;
-   }
-
    if (type == GL_COLOR) {
       if (dstFb->_NumColorDrawBuffers != 1)
          return GL_FALSE;
@@ -582,7 +574,11 @@ _swrast_CopyPixels( struct gl_context *ctx,
    if (swrast->NewState)
       _swrast_validate_derived( ctx );
 
-   if (fast_copy_pixels(ctx, srcx, srcy, width, height, destx, desty, type)) {
+   if (!(SWRAST_CONTEXT(ctx)->_RasterMask != 0x0 ||
+        ctx->Pixel.ZoomX != 1.0F ||
+        ctx->Pixel.ZoomY != 1.0F ||
+        ctx->_ImageTransferState) &&
+       fast_copy_pixels(ctx, srcx, srcy, width, height, destx, desty, type)) {
       /* all done */
       return;
    }