mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 19:44:28 +00:00
Revert "svg_loader: clipping composite layer is added independently on the bounds of the shapes"
This reverts commit c38e4e40a7
.
It was pushed by mistake. The same changes are currently under rev in PR #399
This commit is contained in:
parent
c38e4e40a7
commit
f1d5571aad
1 changed files with 15 additions and 8 deletions
|
@ -402,18 +402,25 @@ unique_ptr<Scene> svgSceneBuild(SvgNode* node, float vx, float vy, float vw, flo
|
|||
{
|
||||
if (!node || (node->type != SvgNodeType::Doc)) return nullptr;
|
||||
|
||||
unique_ptr<Scene> root;
|
||||
auto docNode = _sceneBuildHelper(node, vx, vy, vw, vh);
|
||||
float x, y, w, h;
|
||||
|
||||
auto viewBoxClip = Shape::gen();
|
||||
viewBoxClip->appendRect(vx, vy ,vw, vh, 0, 0);
|
||||
viewBoxClip->fill(0, 0, 0, 255);
|
||||
if (docNode->bounds(&x, &y, &w, &h) != Result::Success) return nullptr;
|
||||
|
||||
auto compositeLayer = Scene::gen();
|
||||
compositeLayer->composite(move(viewBoxClip), CompositeMethod::ClipPath);
|
||||
compositeLayer->push(move(docNode));
|
||||
if (x < vx || y < vy || w > vh || h > vh) {
|
||||
auto viewBoxClip = Shape::gen();
|
||||
viewBoxClip->appendRect(vx, vy ,vw, vh, 0, 0);
|
||||
viewBoxClip->fill(0, 0, 0, 255);
|
||||
|
||||
auto root = Scene::gen();
|
||||
root->push(move(compositeLayer));
|
||||
auto compositeLayer = Scene::gen();
|
||||
compositeLayer->composite(move(viewBoxClip), CompositeMethod::ClipPath);
|
||||
compositeLayer->push(move(docNode));
|
||||
|
||||
root = Scene::gen();
|
||||
root->push(move(compositeLayer));
|
||||
} else {
|
||||
root = move(docNode);
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue