intel: check for single memcpy() in memcpy_get_tex_image()
authorBrian Paul <brianp@vmware.com>
Thu, 29 Oct 2009 17:04:11 +0000 (11:04 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 29 Oct 2009 17:04:24 +0000 (11:04 -0600)
src/mesa/drivers/dri/intel/intel_tex_image.c

index c861fc552f29017ebde3bfc0bc7cd90f2aa64985..6301444c34081f30511dc8dcfe9bc248cecdd67f 100644 (file)
@@ -696,11 +696,16 @@ memcpy_get_tex_image(GLcontext *ctx, GLenum target, GLint level,
          const GLint srcRowStride = texImage->RowStride * bpp;
          GLuint row;
 
-         for (row = 0; row < texImage->Height; row++) {
-            memcpy(dst, src, bytesPerRow);
-            dst += dstRowStride;
-            src += srcRowStride;
-         }         
+         if (bytesPerRow == dstRowStride && bytesPerRow == dstRowStride) {
+            memcpy(dst, src, bytesPerRow * texImage->Height);
+         }
+         else {
+            for (row = 0; row < texImage->Height; row++) {
+               memcpy(dst, src, bytesPerRow);
+               dst += dstRowStride;
+               src += srcRowStride;
+            }
+         }
       }
 
       if (_mesa_is_bufferobj(pack->BufferObj)) {