lottie/render: handle the case when resulting mask is null.

Change-Id: Ie78a1465474ec408bff0deafdff509f3b3a199d8
This commit is contained in:
subhransu mohanty 2018-08-20 16:12:17 +09:00
parent bbdd2e246f
commit 57b58412b6

View File

@ -170,18 +170,25 @@ void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask, LOTLayerIt
} }
mDrawableList.clear(); mDrawableList.clear();
renderList(mDrawableList); renderList(mDrawableList);
VRle mask = inheritMask;
VRle mask;
if (hasMask()) { if (hasMask()) {
if (mask.isEmpty()) mask = maskRle(painter->clipBoundingRect());
mask = maskRle(painter->clipBoundingRect()); if (!inheritMask.isEmpty())
else
mask = mask & inheritMask; mask = mask & inheritMask;
// if resulting mask is empty then return.
if (mask.isEmpty())
return;
} else {
mask = inheritMask;
} }
for (auto &i : mDrawableList) { for (auto &i : mDrawableList) {
painter->setBrush(i->mBrush); painter->setBrush(i->mBrush);
VRle rle = i->rle(); VRle rle = i->rle();
if (!mask.isEmpty()) rle = i->rle() & mask; if (!mask.isEmpty()) rle = rle & mask;
if (rle.isEmpty()) continue;
if (!matteRle.isEmpty()) { if (!matteRle.isEmpty()) {
if (mLayerData->mMatteType == MatteType::AlphaInv) { if (mLayerData->mMatteType == MatteType::AlphaInv) {
@ -348,13 +355,16 @@ void LOTCompLayerItem::render(VPainter *painter, const VRle &inheritMask, LOTLay
} }
} }
VRle mask = inheritMask; VRle mask;
if (hasMask()) { if (hasMask()) {
if (mask.isEmpty()) mask = maskRle(painter->clipBoundingRect());
mask = maskRle(painter->clipBoundingRect()); if (!inheritMask.isEmpty())
else
mask = mask & inheritMask; mask = mask & inheritMask;
// if resulting mask is empty then return.
if (mask.isEmpty())
return;
} else {
mask = inheritMask;
} }
LOTLayerItem *matteLayer = nullptr; LOTLayerItem *matteLayer = nullptr;