summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/egl/drivers/dri2/platform_android.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 3c14086..d248ed2 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -882,10 +882,14 @@ swrastPutImage2(__DRIdrawable * draw, int op,
dstPtr += y * dstStride + xOffset;
srcPtr = data;
- for (; h>0; h--) {
- memcpy(dstPtr, srcPtr, copyWidth);
- srcPtr += stride;
- dstPtr += dstStride;
+ if (xOffset == 0 && copyWidth == stride && copyWidth == dstStride) {
+ memcpy(dstPtr, srcPtr, copyWidth * h);
+ } else {
+ for (; h>0; h--) {
+ memcpy(dstPtr, srcPtr, copyWidth);
+ srcPtr += stride;
+ dstPtr += dstStride;
+ }
}
if (gr_module->unlock(gr_module, dri2_surf->buffer->handle)) {
@@ -942,10 +946,14 @@ swrastGetImage(__DRIdrawable * read,
srcPtr += y * srcStride + xOffset;
dstPtr = data;
- for (; h>0; h--) {
- memcpy(dstPtr, srcPtr, copyWidth);
- srcPtr += srcStride;
- dstPtr += copyWidth;
+ if (xOffset == 0 && copyWidth == srcStride) {
+ memcpy(dstPtr, srcPtr, copyWidth * h);
+ } else {
+ for (; h>0; h--) {
+ memcpy(dstPtr, srcPtr, copyWidth);
+ srcPtr += srcStride;
+ dstPtr += copyWidth;
+ }
}
if (gr_module->unlock(gr_module, dri2_surf->buffer->handle)) {