mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +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;
|
if (!node || (node->type != SvgNodeType::Doc)) return nullptr;
|
||||||
|
|
||||||
|
unique_ptr<Scene> root;
|
||||||
auto docNode = _sceneBuildHelper(node, vx, vy, vw, vh);
|
auto docNode = _sceneBuildHelper(node, vx, vy, vw, vh);
|
||||||
|
float x, y, w, h;
|
||||||
|
|
||||||
auto viewBoxClip = Shape::gen();
|
if (docNode->bounds(&x, &y, &w, &h) != Result::Success) return nullptr;
|
||||||
viewBoxClip->appendRect(vx, vy ,vw, vh, 0, 0);
|
|
||||||
viewBoxClip->fill(0, 0, 0, 255);
|
|
||||||
|
|
||||||
auto compositeLayer = Scene::gen();
|
if (x < vx || y < vy || w > vh || h > vh) {
|
||||||
compositeLayer->composite(move(viewBoxClip), CompositeMethod::ClipPath);
|
auto viewBoxClip = Shape::gen();
|
||||||
compositeLayer->push(move(docNode));
|
viewBoxClip->appendRect(vx, vy ,vw, vh, 0, 0);
|
||||||
|
viewBoxClip->fill(0, 0, 0, 255);
|
||||||
|
|
||||||
auto root = Scene::gen();
|
auto compositeLayer = Scene::gen();
|
||||||
root->push(move(compositeLayer));
|
compositeLayer->composite(move(viewBoxClip), CompositeMethod::ClipPath);
|
||||||
|
compositeLayer->push(move(docNode));
|
||||||
|
|
||||||
|
root = Scene::gen();
|
||||||
|
root->push(move(compositeLayer));
|
||||||
|
} else {
|
||||||
|
root = move(docNode);
|
||||||
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue