submodule: add rive-cpp to rive-tizen as submodule
[platform/core/uifw/rive-tizen.git] / submodule / src / shapes / path_vertex.cpp
1 #include "shapes/path_vertex.hpp"
2 #include "shapes/path.hpp"
3
4 using namespace rive;
5
6 Vec2D PathVertex::renderTranslation()
7 {
8         if (hasWeight())
9         {
10                 return m_Weight->translation();
11         }
12         return Vec2D(x(), y());
13 }
14
15 StatusCode PathVertex::onAddedDirty(CoreContext* context)
16 {
17         StatusCode code = Super::onAddedDirty(context);
18         if (code != StatusCode::Ok)
19         {
20                 return code;
21         }
22         if (!parent()->is<Path>())
23         {
24                 return StatusCode::MissingObject;
25         }
26         parent()->as<Path>()->addVertex(this);
27         return StatusCode::Ok;
28 }
29
30 void PathVertex::markPathDirty()
31 {
32         if (parent() == nullptr)
33         {
34                 // This is an acceptable condition as the parametric paths create points
35                 // that are not part of the core context.
36                 return;
37         }
38         parent()->as<Path>()->markPathDirty();
39 }
40
41 void PathVertex::xChanged() { markPathDirty(); }
42 void PathVertex::yChanged() { markPathDirty(); }
43
44 void PathVertex::deform(Mat2D& worldTransform, float* boneTransforms)
45 {
46         Weight::deform(x(),
47                        y(),
48                        m_Weight->indices(),
49                        m_Weight->values(),
50                        worldTransform,
51                        boneTransforms,
52                        m_Weight->translation());
53 }