sw_engine: fixing the composition for canvas width != canvas stride

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.
This commit is contained in:
Mira Grudzinska 2021-06-07 15:48:52 +02:00 committed by Hermet Park
parent f0598a7481
commit 419751c736

View 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();
}
}