blob: 7227b2ebf3020fdd275d7dd0ecaaa5042a9e0321 [file] [log] [blame] [edit]
#include "rive/artboard.hpp"
#include "rive/shapes/points_path.hpp"
#include "rive/shapes/vertex.hpp"
#include "rive/shapes/path_vertex.hpp"
#include "rive/shapes/shape.hpp"
#include "rive/bones/skin.hpp"
#include "rive/span.hpp"
#include "rive/shapes/shape_path_flags.hpp"
using namespace rive;
void PointsPath::buildDependencies()
{
Super::buildDependencies();
if (skin() != nullptr)
{
skin()->addDependent(this);
}
}
const Mat2D& PointsPath::pathTransform() const
{
if (skin() != nullptr)
{
static Mat2D identity;
return identity;
}
return worldTransform();
}
void PointsPath::update(ComponentDirt value)
{
if (hasDirt(value, ComponentDirt::Path) && skin() != nullptr)
{
// Path tracks re-adding ComponentDirt::Path if we deferred due to to
// shape being invisible.
skin()->deform(
Span<Vertex*>((Vertex**)m_Vertices.data(), m_Vertices.size()));
}
Super::update(value);
}
void PointsPath::markPathDirty(bool sendToLayout)
{
if (skin() != nullptr)
{
skin()->addDirt(ComponentDirt::Skin);
}
Super::markPathDirty();
}
void PointsPath::markSkinDirty() { markPathDirty(); }
bool PointsPath::isClockwise() const
{
return (pathFlags() & (int)ShapePathFlags::isCounterClockwise) == 0;
}