buffer.bytesPerLine, VBitmap::Format::ARGB32_Premultiplied, nullptr, nullptr);
VPainter painter(&bitmap);
+ VRle mask;
for (auto i = mLayers.rbegin(); i != mLayers.rend(); ++i) {
LOTLayerItem *layer = *i;
- layer->render(&painter);
+ layer->render(&painter, mask);
}
// for(auto i : mRenderList) {
}
}
-void LOTLayerItem::render(VPainter *painter)
+void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask)
{
std::vector<VDrawable *> list;
renderList(list);
- VRle mask = maskRle();
+ VRle mask = inheritMask;
+ if (hasMask()) {
+ if (mask.isEmpty())
+ mask = maskRle();
+ else
+ mask = mask & inheritMask;
+ }
for(auto i : list) {
i->preprocess();
painter->setBrush(i->mBrush);
if (!mask.isEmpty()) {
- VRle rle = i->mRle + mask;
+ VRle rle = i->mRle & mask;
painter->drawRle(VPoint(), rle);
} else {
painter->drawRle(VPoint(), i->mRle);
break;
}
case LOTMaskData::Mode::Substarct: {
+ if (rle.isEmpty() && !mBoundingRect.isEmpty())
+ rle = VRle::toRle(mBoundingRect);
rle = rle - i->mRle;
break;
}
}
}
+void LOTCompLayerItem::render(VPainter *painter, const VRle &inheritMask)
+{
+ VRle mask = inheritMask;
+
+ if (hasMask()) {
+ if (mask.isEmpty())
+ mask = maskRle();
+ else
+ mask = mask & inheritMask;
+ }
+
+ for(auto i : mLayers) {
+ i->render(painter, mask);
+ }
+}
+
LOTCompLayerItem::~LOTCompLayerItem()
{
for(auto i : mLayers) {
VMatrix matrix(int frameNo) const;
virtual void renderList(std::vector<VDrawable *> &list){}
virtual void updateStaticProperty();
- void render(VPainter *painter);
+ virtual void render(VPainter *painter, const VRle &mask);
protected:
virtual void updateContent() = 0;
inline VMatrix combinedMatrix() const {return mCombinedMatrix;}
float mCombinedAlpha;
int mFrameNo;
DirtyFlag mDirtyFlag;
+ VRectF mBoundingRect;
bool mVisible;
bool mStatic;
};
LOTCompLayerItem(LOTLayerData *layerData);
void renderList(std::vector<VDrawable *> &list)final;
void updateStaticProperty() final;
+ void render(VPainter *painter, const VRle &mask) final;
protected:
void updateContent() final;
private: