blob: e468eb88c0a9d85c5a44cea15a28bfdac6ac35a4 [file] [log] [blame]
#include "rive/shapes/paint/shape_paint.hpp"
#include "rive/shapes/shape_paint_container.hpp"
#include "rive/artboard.hpp"
#include "rive/factory.hpp"
using namespace rive;
StatusCode ShapePaint::onAddedClean(CoreContext* context)
{
auto container = ShapePaintContainer::from(parent());
if (container == nullptr)
{
return StatusCode::MissingObject;
}
// If the paint mutator wasn't compatible with this runtime it's possible we
// get a ShapePaint with no mutator (not children).
if (m_PaintMutator != nullptr)
{
container->addPaint(this);
}
return StatusCode::Ok;
}
RenderPaint* ShapePaint::initRenderPaint(ShapePaintMutator* mutator)
{
assert(m_RenderPaint == nullptr);
m_PaintMutator = mutator;
auto factory = mutator->component()->artboard()->factory();
m_RenderPaint = factory->makeRenderPaint();
return m_RenderPaint.get();
}
void ShapePaint::blendMode(BlendMode value)
{
assert(m_RenderPaint != nullptr);
m_RenderPaint->blendMode(value);
}