sw_engine image: fix the clipped image issue.

there was a wrong condition introduced the bug that image was not updated,
because transformation is not re-applied after the first created the internal image data.

@Issues: https://github.com/Samsung/thorvg/issues/751
This commit is contained in:
Hermet Park 2021-09-08 20:43:23 +09:00 committed by Hermet Park
parent 789083527e
commit 1ea9692841
3 changed files with 1 additions and 11 deletions

View file

@ -322,7 +322,6 @@ SwOutline* strokeExportOutline(SwStroke* stroke, SwMpool* mpool, unsigned tid);
void strokeFree(SwStroke* stroke); void strokeFree(SwStroke* stroke);
bool imagePrepare(SwImage* image, const Matrix* transform, const SwBBox& clipRegion, SwBBox& renderRegion, SwMpool* mpool, unsigned tid); bool imagePrepare(SwImage* image, const Matrix* transform, const SwBBox& clipRegion, SwBBox& renderRegion, SwMpool* mpool, unsigned tid);
bool imagePrepared(const SwImage* image);
bool imageGenRle(SwImage* image, TVG_UNUSED const Picture* pdata, const SwBBox& renderRegion, bool antiAlias); bool imageGenRle(SwImage* image, TVG_UNUSED const Picture* pdata, const SwBBox& renderRegion, bool antiAlias);
void imageDelOutline(SwImage* image, SwMpool* mpool, uint32_t tid); void imageDelOutline(SwImage* image, SwMpool* mpool, uint32_t tid);
void imageReset(SwImage* image); void imageReset(SwImage* image);

View file

@ -79,12 +79,6 @@ bool imagePrepare(SwImage* image, const Matrix* transform, const SwBBox& clipReg
} }
bool imagePrepared(const SwImage* image)
{
return image->rle ? true : false;
}
bool imageGenRle(SwImage* image, TVG_UNUSED const Picture* pdata, const SwBBox& renderRegion, bool antiAlias) bool imageGenRle(SwImage* image, TVG_UNUSED const Picture* pdata, const SwBBox& renderRegion, bool antiAlias)
{ {
if ((image->rle = rleRender(image->rle, image->outline, renderRegion, antiAlias))) return true; if ((image->rle = rleRender(image->rle, image->outline, renderRegion, antiAlias))) return true;

View file

@ -178,10 +178,7 @@ struct SwImageTask : SwTask
auto clipRegion = bbox; auto clipRegion = bbox;
//Invisible shape turned to visible by alpha. //Invisible shape turned to visible by alpha.
auto prepareImage = false; if ((flags & (RenderUpdateFlag::Image | RenderUpdateFlag::Transform | RenderUpdateFlag::Color)) && (opacity > 0)) {
if (!imagePrepared(&image) && ((flags & RenderUpdateFlag::Image) || (opacity > 0))) prepareImage = true;
if (prepareImage) {
imageReset(&image); imageReset(&image);
image.data = const_cast<uint32_t*>(pdata->data(&image.w, &image.h)); image.data = const_cast<uint32_t*>(pdata->data(&image.w, &image.h));