list.clear();
mRoot->processTrimItems(list);
}
+
+ if (list.size() > 1) setComplexShape(true);
+ else setComplexShape(false);
}
void renderer::ShapeLayer::updateContent()
{
- mRoot->update(frameNo(), combinedMatrix(), 1.0f , flag());
+ float alpha = combinedAlpha();
+ if (isComplexShape()) alpha = 1.0f;
+ mRoot->update(frameNo(), combinedMatrix(), alpha , flag());
if (mLayerData->hasPathOperator()) {
mRoot->applyTrim();
if (vCompare(combinedAlpha(), 1.0)) {
Layer::render(painter, inheritMask, matteRle, cache);
} else {
- //do offscreen rendering
- VSize size = painter->clipBoundingRect().size();
- VPainter srcPainter;
- VBitmap srcBitmap = cache.make_surface(size.width(), size.height());
- srcPainter.begin(&srcBitmap);
- Layer::render(&srcPainter, inheritMask, matteRle, cache);
- srcPainter.end();
- painter->drawBitmap(VPoint(), srcBitmap,
- uint8_t(combinedAlpha() * 255.0f));
- cache.release_surface(srcBitmap);
+ if (isComplexShape()) {
+ //do offscreen rendering
+ VSize size = painter->clipBoundingRect().size();
+ VPainter srcPainter;
+ VBitmap srcBitmap = cache.make_surface(size.width(), size.height());
+ srcPainter.begin(&srcBitmap);
+ Layer::render(&srcPainter, inheritMask, matteRle, cache);
+ srcPainter.end();
+ painter->drawBitmap(VPoint(), srcBitmap,
+ uint8_t(combinedAlpha() * 255.0f));
+ cache.release_surface(srcBitmap);
+ }
+ else {
+ Layer::render(painter, inheritMask, matteRle, cache);
+ }
}
}
LOTVariant &value) override;
void render(VPainter *painter, const VRle &mask, const VRle &matteRle,
SurfaceCache &cache) final;
+ void setComplexShape(bool value) { mComplexShpae = value; }
+ bool isComplexShape() { return mComplexShpae; }
protected:
void preprocessStage(const VRect &clip) final;
void updateContent() final;
std::vector<VDrawable *> mDrawableList;
Group * mRoot{nullptr};
+ bool mComplexShpae{false};
};
class NullLayer final : public Layer {