mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
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:
parent
f0598a7481
commit
419751c736
1 changed files with 3 additions and 3 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue