From 1d8625d40dd3775fb5f25f624719389ae08512cb Mon Sep 17 00:00:00 2001 From: Michal Maciola <71131832+mmaciola@users.noreply.github.com> Date: Tue, 14 Sep 2021 14:27:39 +0200 Subject: [PATCH] wasm: paint opacity in the layers list (#804) --- src/wasm/thorvgwasm.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wasm/thorvgwasm.cpp b/src/wasm/thorvgwasm.cpp index 6e3f71bd..9f554231 100644 --- a/src/wasm/thorvgwasm.cpp +++ b/src/wasm/thorvgwasm.cpp @@ -235,6 +235,7 @@ private: uint32_t depth; uint32_t type; uint32_t composite; + uint32_t opacity; }; void sublayers(Array* layers, const Paint* paint, uint32_t depth) { @@ -246,7 +247,8 @@ private: it->begin(); while (auto child = it->next()) { uint32_t type = child->id(); - layers->push({.paint = reinterpret_cast(child), .depth = depth + 1, .type = type, .composite = static_cast(CompositeMethod::None)}); + uint32_t opacity = child->opacity(); + layers->push({.paint = reinterpret_cast(child), .depth = depth + 1, .type = type, .composite = static_cast(CompositeMethod::None), .opacity = opacity}); sublayers(layers, child, depth + 1); } } @@ -256,7 +258,8 @@ private: CompositeMethod composite = paint->composite(&compositeTarget); if (compositeTarget && composite != CompositeMethod::None) { uint32_t type = compositeTarget->id(); - layers->push({.paint = reinterpret_cast(compositeTarget), .depth = depth, .type = type, .composite = static_cast(composite)}); + uint32_t opacity = compositeTarget->opacity(); + layers->push({.paint = reinterpret_cast(compositeTarget), .depth = depth, .type = type, .composite = static_cast(composite), .opacity = opacity}); sublayers(layers, compositeTarget, depth); } }