> - temp = malloc(width * MAX_PIXEL_BYTES); > - if (!temp) { > - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels"); > - return GL_FALSE; > + /* different src/dst buffers */ > + ctx->Driver.MapRenderbuffer(ctx, srcRb, srcX, srcY, > + width, height, > + GL_MAP_READ_BIT, &srcMap, &srcRowStride); > + if (!srcMap) { > + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels"); > + return GL_TRUE; /* don't retry with slow path */ > + } > + ctx->Driver.MapRenderbuffer(ctx, dstRb, dstX, dstY, > + width, height, > + GL_MAP_WRITE_BIT, &dstMap, &dstRowStride); > + if (!dstMap) { > + ctx->Driver.UnmapRenderbuffer(ctx, srcRb); > + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels"); > + return GL_TRUE; /* don't retry with slow path */ > + } > } > > for (row = 0; row < height; row++) { > - srcRb->GetRow(ctx, srcRb, width, srcX, srcY, temp); > - dstRb->PutRow(ctx, dstRb, width, dstX, dstY, temp, NULL); > - srcY += yStep; > - dstY += yStep; > + memcpy(dstMap, srcMap, widthInBytes); > + dstMap += dstRowStride; > + srcMap += srcRowStride; > }
So, previously we didn't have to worry about X direction for overlap because we used a temp between the Get and Put. Now, I think you need to use memmove instead of memcpy. Patch 1, and 3-7 are: Reviewed-by: Eric Anholt <e...@anholt.net> this one is too if memmove is the solution.
pgpdl5xmy3Rp2.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev