From: subhransu mohanty Date: Wed, 12 Dec 2018 06:30:16 +0000 (+0900) Subject: lottie/render: optimize rendering by passing rle clip to painter instead of creating... X-Git-Tag: submit/tizen/20181217.041818~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cbf5a3245eb6e5275da2dd353b5edfd5b2422e8a;p=platform%2Fcore%2Fuifw%2Flottie-player.git lottie/render: optimize rendering by passing rle clip to painter instead of creating a new rle. Rle operations usually generate new rle which means memory allocation. by using drawRle() with clip version we can avoid the intermediate rle generation. Change-Id: I8b3010b1dfc296ee9288631d7b5df1ac4265210b --- diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index 621f64c..0ea95e1 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -278,18 +278,27 @@ void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask, const VRle for (auto &i : mDrawableList) { painter->setBrush(i->mBrush); VRle rle = i->rle(); - if (!mask.empty()) rle = rle & mask; + if (matteRle.empty()) { + if (mask.empty()) { + // no mask no matte + painter->drawRle(VPoint(), rle); + } else { + // only mask + painter->drawRle(rle, mask); + } - if (rle.empty()) continue; + } else { + if (!mask.empty()) rle = rle & mask; - if (!matteRle.empty()) { + if (rle.empty()) continue; if (matteType() == MatteType::AlphaInv) { rle = rle - matteRle; + painter->drawRle(VPoint(), rle); } else { - rle = rle & matteRle; + // render with matteRle as clip. + painter->drawRle(rle, matteRle); } } - painter->drawRle(VPoint(), rle); } }