blob: 81d9a863f245dd4d7a2e9b137b321a1d0cf0a8f9 [file] [log] [blame] [edit]
#include "rive/shapes/paint/fill.hpp"
#include "rive/shapes/shape_paint_container.hpp"
using namespace rive;
PathFlags Fill::pathFlags() const
{
return (FillRule)fillRule() == FillRule::clockwise
? PathFlags::localClockwise
: PathFlags::local;
}
RenderPaint* Fill::initRenderPaint(ShapePaintMutator* mutator)
{
auto renderPaint = Super::initRenderPaint(mutator);
renderPaint->style(RenderPaintStyle::fill);
return renderPaint;
}
void Fill::applyTo(RenderPaint* renderPaint, float opacityModifier)
{
renderPaint->style(RenderPaintStyle::fill);
renderPaint->shader(nullptr);
m_PaintMutator->applyTo(renderPaint, opacityModifier);
}
ShapePaintPath* Fill::pickPath(ShapePaintContainer* shape) const
{
if ((FillRule)fillRule() == FillRule::clockwise)
{
return shape->localClockwisePath();
}
return shape->localPath();
}
void Fill::buildDependencies()
{
if (effects()->size() > 0)
{
auto container = ShapePaintContainer::from(parent());
if (container != nullptr)
{
container->pathBuilder()->addDependent(this);
}
}
}