sw_engine: fixing the composition for canvas width != canvas stride
authorMira Grudzinska <m.grudzinska@samsung.com>
Mon, 7 Jun 2021 13:48:52 +0000 (15:48 +0200)
committerHermet Park <chuneon.park@samsung.com>
Fri, 11 Jun 2021 03:40:07 +0000 (12:40 +0900)
When canvas width was smaller than its stride and a composition is used,
the plots were drawn incorrectly. This is fixed by setting the image width
(image from a compositor) to be equal to the surface stride, instead of its width.
The image data are now allocated accordingly the fixed image width.

Change-Id: I9faa3374bf8efb85d7f6c429c41e5fd182982ed9

src/lib/sw_engine/tvgSwRenderer.cpp

index 2886f3bdd81d0ceca7749fb2e0f1326fbb7ea5ce..146426984390ca34c494ffa890621b5a5e5d110b 100644 (file)
@@ -455,7 +455,7 @@ Compositor* SwRenderer::target(const RenderRegion& region)
         if (!cmp->compositor) goto err;
 
         //SwImage, Optimize Me: Surface size from MainSurface(WxH) to Parameter W x H
-        cmp->compositor->image.data = (uint32_t*) malloc(sizeof(uint32_t) * surface->w * surface->h);
+        cmp->compositor->image.data = (uint32_t*) malloc(sizeof(uint32_t) * surface->stride * surface->h);
         if (!cmp->compositor->image.data) goto err;
         compositors.push(cmp);
     }
@@ -475,7 +475,7 @@ Compositor* SwRenderer::target(const RenderRegion& region)
     cmp->compositor->bbox.min.y = y;
     cmp->compositor->bbox.max.x = x + w;
     cmp->compositor->bbox.max.y = y + h;
-    cmp->compositor->image.w = surface->w;
+    cmp->compositor->image.w = surface->stride;
     cmp->compositor->image.h = surface->h;
 
     //We know partial clear region
@@ -648,4 +648,4 @@ SwRenderer* SwRenderer::gen()
 {
     ++rendererCnt;
     return new SwRenderer();
-}
\ No newline at end of file
+}