mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-04 21:41:45 +00:00
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
This commit is contained in:
parent
fb6bf7bef9
commit
cbf5a3245e
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user