blob: 9c24ca0172464c952023ebf154f8a1fd2be44561 [file] [log] [blame]
#include "rive/drawable.hpp"
#include "rive/artboard.hpp"
#include "rive/shapes/clipping_shape.hpp"
#include "rive/shapes/path_composer.hpp"
#include "rive/shapes/shape.hpp"
using namespace rive;
void Drawable::addClippingShape(ClippingShape* shape) { m_ClippingShapes.push_back(shape); }
bool Drawable::clip(Renderer* renderer) const {
if (m_ClippingShapes.size() == 0) {
return false;
}
renderer->save();
for (auto clippingShape : m_ClippingShapes) {
if (!clippingShape->isVisible()) {
continue;
}
RenderPath* renderPath = clippingShape->renderPath();
// Can intentionally be null if all the clipping shapes are hidden.
if (renderPath != nullptr) {
renderer->clipPath(renderPath);
}
}
return true;
}