/* External Class Implementation */
/************************************************************************/
-Scene::Scene() : pImpl(new Impl())
+Scene::Scene() : pImpl(new Impl(this))
{
Paint::pImpl->id = TVG_CLASS_ID_SCENE;
Paint::pImpl->method(new PaintMethod<Scene::Impl>(pImpl));
uint8_t opacity; //for composition
RenderMethod* renderer = nullptr; //keep it for explicit clear
+ Scene* scene = nullptr;
+
+ Impl(Scene* s) : scene(s)
+ {
+ }
+
~Impl()
{
for (auto paint = paints.data; paint < (paints.data + paints.count); ++paint) {
bool needComposition(uint32_t opacity)
{
//Half translucent requires intermediate composition.
- if (opacity == 255 || opacity == 0) return false;
+ if (opacity == 0 || paints.count == 0) return false;
+
+ //Masking may require composition (even if opacity == 255)
+ auto compMethod = scene->composite(nullptr);
+ if (compMethod != CompositeMethod::None && compMethod != CompositeMethod::ClipPath) return true;
+
+ //Half translucent requires intermediate composition.
+ if (opacity == 255) return false;
//If scene has several children or only scene, it may require composition.
if (paints.count > 1) return true;