submodule: add rive-cpp to rive-tizen as submodule
[platform/core/uifw/rive-tizen.git] / submodule / src / drawable.cpp
1 #include "drawable.hpp"
2 #include "artboard.hpp"
3 #include "shapes/clipping_shape.hpp"
4 #include "shapes/path_composer.hpp"
5 #include "shapes/shape.hpp"
6
7 using namespace rive;
8
9 void Drawable::addClippingShape(ClippingShape* shape)
10 {
11         m_ClippingShapes.push_back(shape);
12 }
13
14 bool Drawable::clip(Renderer* renderer) const
15 {
16         if (m_ClippingShapes.size() == 0)
17         {
18                 return false;
19         }
20
21         renderer->save();
22
23         for (auto clippingShape : m_ClippingShapes)
24         {
25                 if (!clippingShape->isVisible())
26                 {
27                         continue;
28                 }
29
30                 RenderPath* renderPath = clippingShape->renderPath();
31
32                 assert(renderPath != nullptr);
33                 renderer->clipPath(renderPath);
34         }
35         return true;
36 }