bool LOTCompItem::render(const rlottie::Surface &surface)
{
- VBitmap bitmap(reinterpret_cast<uchar *>(surface.buffer()),
+ mSurface.reset(reinterpret_cast<uchar *>(surface.buffer()),
uint(surface.width()), uint(surface.height()), uint(surface.bytesPerLine()),
VBitmap::Format::ARGB32_Premultiplied);
e->preprocess(clip);
}
- VPainter painter(&bitmap);
+ mPainter.begin(&mSurface);
// set sub surface area for drawing.
- painter.setDrawRegion(
+ mPainter.setDrawRegion(
VRect(int(surface.drawRegionPosX()), int(surface.drawRegionPosY()),
int(surface.drawRegionWidth()), int(surface.drawRegionHeight())));
- mRootLayer->render(&painter, {}, {});
-
+ mRootLayer->render(&mPainter, {}, {});
+ mPainter.end();
return true;
}
bool render(const rlottie::Surface &surface);
void setValue(const std::string &keypath, LOTVariant &value);
private:
+ VPainter mPainter;
+ VBitmap mSurface;
VMatrix mScaleMatrix;
VSize mViewSize;
LOTCompositionData *mCompData;