ES-DE/source/clippathelement.cpp
Leon Styhre 32546b5874 Squashed 'external/lunasvg/' content from commit 7417baa0a
git-subtree-dir: external/lunasvg
git-subtree-split: 7417baa0aff477f361e44e2aa793fdb0c7aae352
2022-10-03 18:25:42 +02:00

38 lines
923 B
C++

#include "clippathelement.h"
#include "parser.h"
#include "layoutcontext.h"
namespace lunasvg {
ClipPathElement::ClipPathElement()
: GraphicsElement(ElementId::ClipPath)
{
}
Units ClipPathElement::clipPathUnits() const
{
auto& value = get(PropertyId::ClipPathUnits);
return Parser::parseUnits(value, Units::UserSpaceOnUse);
}
std::unique_ptr<LayoutClipPath> ClipPathElement::getClipper(LayoutContext* context) const
{
if(context->hasReference(this))
return nullptr;
LayoutBreaker layoutBreaker(context, this);
auto clipper = std::make_unique<LayoutClipPath>();
clipper->units = clipPathUnits();
clipper->transform = transform();
clipper->clipper = context->getClipper(clip_path());
layoutChildren(context, clipper.get());
return clipper;
}
std::unique_ptr<Node> ClipPathElement::clone() const
{
return cloneElement<ClipPathElement>();
}
} // namespace lunasvg