OSDN Git Service

egl/android: simplify swrastPutImage
authorChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 22 Mar 2017 17:25:27 +0000 (01:25 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Tue, 11 Apr 2017 02:36:22 +0000 (10:36 +0800)
Just call swrastPutImage2 with stride = 0.

src/egl/drivers/dri2/platform_android.c

index 270bedf..af6aba5 100644 (file)
@@ -1039,6 +1039,8 @@ swrastPutImage2(__DRIdrawable * draw, int op,
    dstStride = BPerPixel * dri2_surf->buffer->stride;
    copyWidth = BPerPixel * w;
    xOffset = BPerPixel * x;
+   if (stride == 0)
+      stride = copyWidth;
 
    /* drivers expect we do these checks (and some rely on it) */
    if (copyWidth > dstStride - xOffset)
@@ -1077,15 +1079,7 @@ swrastPutImage(__DRIdrawable * draw, int op,
               int x, int y, int w, int h,
               char *data, void *loaderPrivate)
 {
-   struct dri2_egl_surface *dri2_surf = loaderPrivate;
-   int stride;
-
-   if (swrastUpdateBuffer(dri2_surf)) {
-      return;
-   }
-
-   stride = get_format_bpp(dri2_surf->buffer->format) * w;
-   swrastPutImage2(draw, op, x, y, w, h, stride, data, loaderPrivate);
+   swrastPutImage2(draw, op, x, y, w, h, 0, data, loaderPrivate);
 }
 
 static void