Convert RenderPath/CommandPath and RenderPaint to refcounted objects

Diffs=
8666bde87 Convert RenderPath/CommandPath and RenderPaint to refcounted objects (#6395)

Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
diff --git a/.rive_head b/.rive_head
index 60cc578..cdccb94 100644
--- a/.rive_head
+++ b/.rive_head
@@ -1 +1 @@
-9c3da38e31678c3eaccc88857f6b54255e889cee
+8666bde87b8ef973ff99d7a285a4b768bdf76aa9
diff --git a/cg_renderer/include/cg_factory.hpp b/cg_renderer/include/cg_factory.hpp
index ec4c34d..47af775 100644
--- a/cg_renderer/include/cg_factory.hpp
+++ b/cg_renderer/include/cg_factory.hpp
@@ -31,11 +31,11 @@
                                          const float stops[],     // [count]
                                          size_t count) override;
 
-    std::unique_ptr<RenderPath> makeRenderPath(RawPath&, FillRule) override;
+    rcp<RenderPath> makeRenderPath(RawPath&, FillRule) override;
 
-    std::unique_ptr<RenderPath> makeEmptyRenderPath() override;
+    rcp<RenderPath> makeEmptyRenderPath() override;
 
-    std::unique_ptr<RenderPaint> makeRenderPaint() override;
+    rcp<RenderPaint> makeRenderPaint() override;
 
     rcp<RenderImage> decodeImage(Span<const uint8_t>) override;
 };
diff --git a/cg_renderer/src/cg_factory.cpp b/cg_renderer/src/cg_factory.cpp
index 8d4244a..8229db7 100644
--- a/cg_renderer/src/cg_factory.cpp
+++ b/cg_renderer/src/cg_factory.cpp
@@ -506,20 +506,14 @@
         new CGRadialGradientRenderShader(cx, cy, radius, colors, stops, count));
 }
 
-std::unique_ptr<RenderPath> CGFactory::makeRenderPath(RawPath& rawPath, FillRule fillRule)
+rcp<RenderPath> CGFactory::makeRenderPath(RawPath& rawPath, FillRule fillRule)
 {
-    return std::make_unique<CGRenderPath>(rawPath.points(), rawPath.verbs(), fillRule);
+    return make_rcp<CGRenderPath>(rawPath.points(), rawPath.verbs(), fillRule);
 }
 
-std::unique_ptr<RenderPath> CGFactory::makeEmptyRenderPath()
-{
-    return std::make_unique<CGRenderPath>();
-}
+rcp<RenderPath> CGFactory::makeEmptyRenderPath() { return make_rcp<CGRenderPath>(); }
 
-std::unique_ptr<RenderPaint> CGFactory::makeRenderPaint()
-{
-    return std::make_unique<CGRenderPaint>();
-}
+rcp<RenderPaint> CGFactory::makeRenderPaint() { return make_rcp<CGRenderPaint>(); }
 
 rcp<RenderImage> CGFactory::decodeImage(Span<const uint8_t> encoded)
 {
diff --git a/include/rive/artboard.hpp b/include/rive/artboard.hpp
index d284253..2b1d1bc 100644
--- a/include/rive/artboard.hpp
+++ b/include/rive/artboard.hpp
@@ -52,8 +52,8 @@
     bool m_JoysticksApplyBeforeUpdate = true;
 
     unsigned int m_DirtDepth = 0;
-    std::unique_ptr<RenderPath> m_BackgroundPath;
-    std::unique_ptr<RenderPath> m_ClipPath;
+    rcp<RenderPath> m_BackgroundPath;
+    rcp<RenderPath> m_ClipPath;
     Factory* m_Factory = nullptr;
     Drawable* m_FirstDrawable = nullptr;
     bool m_IsInstance = false;
diff --git a/include/rive/command_path.hpp b/include/rive/command_path.hpp
index 324946e..c0ae7b6 100644
--- a/include/rive/command_path.hpp
+++ b/include/rive/command_path.hpp
@@ -3,13 +3,14 @@
 
 #include "rive/math/mat2d.hpp"
 #include "rive/math/path_types.hpp"
+#include "rive/refcnt.hpp"
 
 namespace rive
 {
 class RenderPath;
 
 /// Abstract path used to build up commands used for rendering.
-class CommandPath
+class CommandPath : public RefCnt<CommandPath>
 {
 public:
     virtual ~CommandPath() {}
diff --git a/include/rive/factory.hpp b/include/rive/factory.hpp
index 7cf4649..1484c0f 100644
--- a/include/rive/factory.hpp
+++ b/include/rive/factory.hpp
@@ -10,9 +10,7 @@
 #include "rive/refcnt.hpp"
 #include "rive/span.hpp"
 #include "rive/math/aabb.hpp"
-#include "rive/math/mat2d.hpp"
 
-#include <cmath>
 #include <stdio.h>
 #include <cstdint>
 
@@ -49,12 +47,12 @@
     // Returns a full-formed RenderPath -- can be treated as immutable
     // This call might swap out the arrays backing the points and verbs in the given RawPath, so the
     // caller can expect it to be in an undefined state upon return.
-    virtual std::unique_ptr<RenderPath> makeRenderPath(RawPath&, FillRule) = 0;
+    virtual rcp<RenderPath> makeRenderPath(RawPath&, FillRule) = 0;
 
     // Deprecated -- working to make RenderPath's immutable
-    virtual std::unique_ptr<RenderPath> makeEmptyRenderPath() = 0;
+    virtual rcp<RenderPath> makeEmptyRenderPath() = 0;
 
-    virtual std::unique_ptr<RenderPaint> makeRenderPaint() = 0;
+    virtual rcp<RenderPaint> makeRenderPaint() = 0;
 
     virtual rcp<RenderImage> decodeImage(Span<const uint8_t>) = 0;
 
@@ -62,7 +60,7 @@
 
     // Non-virtual helpers
 
-    std::unique_ptr<RenderPath> makeRenderPath(const AABB&);
+    rcp<RenderPath> makeRenderPath(const AABB&);
 };
 
 } // namespace rive
diff --git a/include/rive/renderer.hpp b/include/rive/renderer.hpp
index 4b31825..6e08ec9 100644
--- a/include/rive/renderer.hpp
+++ b/include/rive/renderer.hpp
@@ -10,7 +10,6 @@
 #include "rive/command_path.hpp"
 #include "rive/layout.hpp"
 #include "rive/refcnt.hpp"
-#include "rive/span.hpp"
 #include "rive/math/aabb.hpp"
 #include "rive/math/mat2d.hpp"
 #include "rive/shapes/paint/blend_mode.hpp"
@@ -18,7 +17,6 @@
 #include "rive/shapes/paint/stroke_join.hpp"
 #include "utils/lite_rtti.hpp"
 
-#include <cmath>
 #include <stdio.h>
 #include <cstdint>
 
@@ -89,7 +87,7 @@
     virtual ~RenderShader();
 };
 
-class RenderPaint : public enable_lite_rtti<RenderPaint>
+class RenderPaint : public RefCnt<RenderPaint>, public enable_lite_rtti<RenderPaint>
 {
 public:
     RenderPaint();
diff --git a/include/rive/shapes/clipping_shape.hpp b/include/rive/shapes/clipping_shape.hpp
index 3657013..dd020d6 100644
--- a/include/rive/shapes/clipping_shape.hpp
+++ b/include/rive/shapes/clipping_shape.hpp
@@ -2,7 +2,6 @@
 #define _RIVE_CLIPPING_SHAPE_HPP_
 #include "rive/renderer.hpp"
 #include "rive/generated/shapes/clipping_shape_base.hpp"
-#include <stdio.h>
 #include <vector>
 
 namespace rive
@@ -15,7 +14,7 @@
 private:
     std::vector<Shape*> m_Shapes;
     Node* m_Source = nullptr;
-    std::unique_ptr<RenderPath> m_RenderPath;
+    rcp<RenderPath> m_RenderPath;
 
     // The actual render path used for clipping, which may be different from
     // the stored render path. For example if there's only one clipping
@@ -34,4 +33,4 @@
 };
 } // namespace rive
 
-#endif
\ No newline at end of file
+#endif
diff --git a/include/rive/shapes/metrics_path.hpp b/include/rive/shapes/metrics_path.hpp
index 6f104e4..29a7c98 100644
--- a/include/rive/shapes/metrics_path.hpp
+++ b/include/rive/shapes/metrics_path.hpp
@@ -60,10 +60,10 @@
 class RenderMetricsPath : public MetricsPath
 {
 private:
-    std::unique_ptr<RenderPath> m_RenderPath;
+    rcp<RenderPath> m_RenderPath;
 
 public:
-    RenderMetricsPath(std::unique_ptr<RenderPath>);
+    RenderMetricsPath(rcp<RenderPath>);
     RenderPath* renderPath() override { return m_RenderPath.get(); }
     void addPath(CommandPath* path, const Mat2D& transform) override;
 
@@ -75,4 +75,4 @@
     void close() override;
 };
 } // namespace rive
-#endif
\ No newline at end of file
+#endif
diff --git a/include/rive/shapes/paint/shape_paint.hpp b/include/rive/shapes/paint/shape_paint.hpp
index 391f486..3673580 100644
--- a/include/rive/shapes/paint/shape_paint.hpp
+++ b/include/rive/shapes/paint/shape_paint.hpp
@@ -12,7 +12,7 @@
 class ShapePaint : public ShapePaintBase
 {
 protected:
-    std::unique_ptr<RenderPaint> m_RenderPaint;
+    rcp<RenderPaint> m_RenderPaint;
     ShapePaintMutator* m_PaintMutator = nullptr;
 
 public:
diff --git a/include/rive/shapes/paint/trim_path.hpp b/include/rive/shapes/paint/trim_path.hpp
index 99ed5bb..3c55ffb 100644
--- a/include/rive/shapes/paint/trim_path.hpp
+++ b/include/rive/shapes/paint/trim_path.hpp
@@ -3,14 +3,13 @@
 #include "rive/generated/shapes/paint/trim_path_base.hpp"
 #include "rive/shapes/paint/stroke_effect.hpp"
 #include "rive/renderer.hpp"
-#include <stdio.h>
 
 namespace rive
 {
 class TrimPath : public TrimPathBase, public StrokeEffect
 {
 private:
-    std::unique_ptr<RenderPath> m_TrimmedPath;
+    rcp<RenderPath> m_TrimmedPath;
     RenderPath* m_RenderPath = nullptr;
 
 public:
@@ -25,4 +24,4 @@
 };
 } // namespace rive
 
-#endif
\ No newline at end of file
+#endif
diff --git a/include/rive/shapes/path.hpp b/include/rive/shapes/path.hpp
index 49e01dc..b92428a 100644
--- a/include/rive/shapes/path.hpp
+++ b/include/rive/shapes/path.hpp
@@ -37,7 +37,7 @@
 {
 protected:
     Shape* m_Shape = nullptr;
-    std::unique_ptr<CommandPath> m_CommandPath;
+    rcp<CommandPath> m_CommandPath;
     std::vector<PathVertex*> m_Vertices;
     bool m_deferredPathDirt = false;
     PathSpace m_DefaultPathSpace = PathSpace::Neither;
diff --git a/include/rive/shapes/path_composer.hpp b/include/rive/shapes/path_composer.hpp
index 6880ce0..aa6ccbc 100644
--- a/include/rive/shapes/path_composer.hpp
+++ b/include/rive/shapes/path_composer.hpp
@@ -1,6 +1,7 @@
 #ifndef _RIVE_PATH_COMPOSER_HPP_
 #define _RIVE_PATH_COMPOSER_HPP_
 #include "rive/component.hpp"
+#include "rive/refcnt.hpp"
 namespace rive
 {
 class Shape;
@@ -10,8 +11,8 @@
 {
 private:
     Shape* m_Shape;
-    std::unique_ptr<CommandPath> m_LocalPath;
-    std::unique_ptr<CommandPath> m_WorldPath;
+    rcp<CommandPath> m_LocalPath;
+    rcp<CommandPath> m_WorldPath;
     bool m_deferredPathDirt;
 
 public:
diff --git a/include/rive/shapes/shape_paint_container.hpp b/include/rive/shapes/shape_paint_container.hpp
index 1ef63b8..690ccca 100644
--- a/include/rive/shapes/shape_paint_container.hpp
+++ b/include/rive/shapes/shape_paint_container.hpp
@@ -1,6 +1,6 @@
 #ifndef _RIVE_SHAPE_PAINT_CONTAINER_HPP_
 #define _RIVE_SHAPE_PAINT_CONTAINER_HPP_
-#include "rive/shapes/paint/blend_mode.hpp"
+#include "rive/refcnt.hpp"
 #include "rive/shapes/path_space.hpp"
 #include <vector>
 
@@ -35,7 +35,7 @@
 
     void invalidateStrokeEffects();
 
-    std::unique_ptr<CommandPath> makeCommandPath(PathSpace space);
+    rcp<CommandPath> makeCommandPath(PathSpace space);
 
     void propagateOpacity(float opacity);
 
diff --git a/include/rive/text/text.hpp b/include/rive/text/text.hpp
index 91c6419..bed19f2 100644
--- a/include/rive/text/text.hpp
+++ b/include/rive/text/text.hpp
@@ -226,7 +226,7 @@
     // Runs ordered by paragraph line.
     std::vector<OrderedLine> m_orderedLines;
     GlyphRun m_ellipsisRun;
-    std::unique_ptr<RenderPath> m_clipRenderPath;
+    rcp<RenderPath> m_clipRenderPath;
     AABB m_bounds;
     std::vector<TextModifierGroup*> m_modifierGroups;
 
@@ -238,4 +238,4 @@
 };
 } // namespace rive
 
-#endif
\ No newline at end of file
+#endif
diff --git a/include/rive/text/text_style.hpp b/include/rive/text/text_style.hpp
index fd82c31..49efcea 100644
--- a/include/rive/text/text_style.hpp
+++ b/include/rive/text/text_style.hpp
@@ -49,14 +49,14 @@
 
 private:
     std::unique_ptr<TextVariationHelper> m_variationHelper;
-    std::unordered_map<float, std::unique_ptr<RenderPath>> m_opacityPaths;
+    std::unordered_map<float, rcp<RenderPath>> m_opacityPaths;
     rcp<Font> m_variableFont;
-    std::unique_ptr<RenderPath> m_path;
+    rcp<RenderPath> m_path;
     bool m_hasContents = false;
     std::vector<Font::Coord> m_coords;
     std::vector<TextStyleAxis*> m_variations;
-    std::vector<std::unique_ptr<RenderPaint>> m_paintPool;
+    std::vector<rcp<RenderPaint>> m_paintPool;
 };
 } // namespace rive
 
-#endif
\ No newline at end of file
+#endif
diff --git a/include/utils/no_op_factory.hpp b/include/utils/no_op_factory.hpp
index cb5f220..59186e5 100644
--- a/include/utils/no_op_factory.hpp
+++ b/include/utils/no_op_factory.hpp
@@ -29,11 +29,11 @@
                                          const float stops[],     // [count]
                                          size_t count) override;
 
-    std::unique_ptr<RenderPath> makeRenderPath(RawPath&, FillRule) override;
+    rcp<RenderPath> makeRenderPath(RawPath&, FillRule) override;
 
-    std::unique_ptr<RenderPath> makeEmptyRenderPath() override;
+    rcp<RenderPath> makeEmptyRenderPath() override;
 
-    std::unique_ptr<RenderPaint> makeRenderPaint() override;
+    rcp<RenderPaint> makeRenderPaint() override;
 
     rcp<RenderImage> decodeImage(Span<const uint8_t>) override;
 };
diff --git a/skia/renderer/include/skia_factory.hpp b/skia/renderer/include/skia_factory.hpp
index f8c9537..27b5a3d 100644
--- a/skia/renderer/include/skia_factory.hpp
+++ b/skia/renderer/include/skia_factory.hpp
@@ -31,11 +31,11 @@
                                          const float stops[],     // [count]
                                          size_t count) override;
 
-    std::unique_ptr<RenderPath> makeRenderPath(RawPath&, FillRule) override;
+    rcp<RenderPath> makeRenderPath(RawPath&, FillRule) override;
 
-    std::unique_ptr<RenderPath> makeEmptyRenderPath() override;
+    rcp<RenderPath> makeEmptyRenderPath() override;
 
-    std::unique_ptr<RenderPaint> makeRenderPaint() override;
+    rcp<RenderPaint> makeRenderPaint() override;
 
     rcp<RenderImage> decodeImage(Span<const uint8_t>) override;
 
diff --git a/skia/renderer/src/skia_factory.cpp b/skia/renderer/src/skia_factory.cpp
index f0bc87d..4b8ce82 100644
--- a/skia/renderer/src/skia_factory.cpp
+++ b/skia/renderer/src/skia_factory.cpp
@@ -264,12 +264,12 @@
     return rcp<RenderShader>(new SkiaRenderShader(std::move(sh)));
 }
 
-std::unique_ptr<RenderPath> SkiaFactory::makeRenderPath(RawPath& rawPath, FillRule fillRule)
+rcp<RenderPath> SkiaFactory::makeRenderPath(RawPath& rawPath, FillRule fillRule)
 {
     const bool isVolatile = false; // ???
     const SkScalar* conicWeights = nullptr;
     const int conicWeightCount = 0;
-    return std::make_unique<SkiaRenderPath>(
+    return make_rcp<SkiaRenderPath>(
         SkPath::Make(reinterpret_cast<const SkPoint*>(rawPath.points().data()),
                      rawPath.points().size(),
                      (uint8_t*)rawPath.verbs().data(),
@@ -280,15 +280,9 @@
                      isVolatile));
 }
 
-std::unique_ptr<RenderPath> SkiaFactory::makeEmptyRenderPath()
-{
-    return std::make_unique<SkiaRenderPath>();
-}
+rcp<RenderPath> SkiaFactory::makeEmptyRenderPath() { return make_rcp<SkiaRenderPath>(); }
 
-std::unique_ptr<RenderPaint> SkiaFactory::makeRenderPaint()
-{
-    return std::make_unique<SkiaRenderPaint>();
-}
+rcp<RenderPaint> SkiaFactory::makeRenderPaint() { return make_rcp<SkiaRenderPaint>(); }
 
 rcp<RenderImage> SkiaFactory::decodeImage(Span<const uint8_t> encoded)
 {
diff --git a/src/artboard.cpp b/src/artboard.cpp
index 68f8641..2b2ea3e 100644
--- a/src/artboard.cpp
+++ b/src/artboard.cpp
@@ -1,6 +1,5 @@
 #include "rive/artboard.hpp"
 #include "rive/backboard.hpp"
-#include "rive/animation/animation.hpp"
 #include "rive/animation/linear_animation_instance.hpp"
 #include "rive/dependency_sorter.hpp"
 #include "rive/draw_rules.hpp"
@@ -9,7 +8,6 @@
 #include "rive/drawable.hpp"
 #include "rive/animation/keyed_object.hpp"
 #include "rive/factory.hpp"
-#include "rive/node.hpp"
 #include "rive/renderer.hpp"
 #include "rive/shapes/paint/shape_paint.hpp"
 #include "rive/importers/import_stack.hpp"
@@ -21,7 +19,6 @@
 #include "rive/text/text_value_run.hpp"
 #include "rive/event.hpp"
 
-#include <stack>
 #include <unordered_map>
 
 using namespace rive;
diff --git a/src/factory.cpp b/src/factory.cpp
index 7b4aad8..00b89c1 100644
--- a/src/factory.cpp
+++ b/src/factory.cpp
@@ -11,7 +11,7 @@
 
 using namespace rive;
 
-std::unique_ptr<RenderPath> Factory::makeRenderPath(const AABB& r)
+rcp<RenderPath> Factory::makeRenderPath(const AABB& r)
 {
     RawPath rawPath;
     rawPath.addRect(r);
@@ -25,4 +25,4 @@
 #else
     return nullptr;
 #endif
-}
\ No newline at end of file
+}
diff --git a/src/shapes/metrics_path.cpp b/src/shapes/metrics_path.cpp
index be8ce44..3a0dbf5 100644
--- a/src/shapes/metrics_path.cpp
+++ b/src/shapes/metrics_path.cpp
@@ -1,7 +1,5 @@
-#include "rive/core/type_conversions.hpp"
 #include "rive/shapes/metrics_path.hpp"
 #include "rive/renderer.hpp"
-#include "rive/math/cubic_utilities.hpp"
 #include "rive/math/raw_path.hpp"
 #include "rive/math/contour_measure.hpp"
 
@@ -79,9 +77,7 @@
     tmp.addTo(result);
 }
 
-RenderMetricsPath::RenderMetricsPath(std::unique_ptr<RenderPath> path) :
-    m_RenderPath(std::move(path))
-{}
+RenderMetricsPath::RenderMetricsPath(rcp<RenderPath> path) : m_RenderPath(std::move(path)) {}
 
 void RenderMetricsPath::addPath(CommandPath* path, const Mat2D& transform)
 {
diff --git a/src/shapes/shape_paint_container.cpp b/src/shapes/shape_paint_container.cpp
index 1848125..a0232db 100644
--- a/src/shapes/shape_paint_container.cpp
+++ b/src/shapes/shape_paint_container.cpp
@@ -2,9 +2,7 @@
 #include "rive/artboard.hpp"
 #include "rive/factory.hpp"
 #include "rive/component.hpp"
-#include "rive/renderer.hpp"
 #include "rive/shapes/metrics_path.hpp"
-#include "rive/shapes/paint/fill.hpp"
 #include "rive/shapes/paint/stroke.hpp"
 #include "rive/shapes/shape.hpp"
 #include "rive/text/text_style.hpp"
@@ -48,7 +46,7 @@
     }
 }
 
-std::unique_ptr<CommandPath> ShapePaintContainer::makeCommandPath(PathSpace space)
+rcp<CommandPath> ShapePaintContainer::makeCommandPath(PathSpace space)
 {
     // Force a render path if we specifically request to use it for clipping or
     // this shape is used for clipping.
@@ -79,19 +77,19 @@
     auto factory = getArtboard()->factory();
     if (needForEffects && needForRender)
     {
-        return std::unique_ptr<CommandPath>(new RenderMetricsPath(factory->makeEmptyRenderPath()));
+        return make_rcp<RenderMetricsPath>(factory->makeEmptyRenderPath());
     }
     else if (needForConstraint)
     {
-        return std::unique_ptr<CommandPath>(new RenderMetricsPath(factory->makeEmptyRenderPath()));
+        return make_rcp<RenderMetricsPath>(factory->makeEmptyRenderPath());
     }
     else if (needForEffects)
     {
-        return std::unique_ptr<CommandPath>(new OnlyMetricsPath());
+        return make_rcp<OnlyMetricsPath>();
     }
     else
     {
-        return std::unique_ptr<CommandPath>(factory->makeEmptyRenderPath());
+        return factory->makeEmptyRenderPath();
     }
 }
 
@@ -101,4 +99,4 @@
     {
         shapePaint->renderOpacity(opacity);
     }
-}
\ No newline at end of file
+}
diff --git a/tess/include/rive/tess/sokol/sokol_factory.hpp b/tess/include/rive/tess/sokol/sokol_factory.hpp
index 598f1f0..6d66d4d 100644
--- a/tess/include/rive/tess/sokol/sokol_factory.hpp
+++ b/tess/include/rive/tess/sokol/sokol_factory.hpp
@@ -34,11 +34,11 @@
                                          size_t count) override;
 
     // Returns a full-formed RenderPath -- can be treated as immutable
-    std::unique_ptr<RenderPath> makeRenderPath(RawPath&, FillRule) override;
+    rcp<RenderPath> makeRenderPath(RawPath&, FillRule) override;
 
-    std::unique_ptr<RenderPath> makeEmptyRenderPath() override;
+    rcp<RenderPath> makeEmptyRenderPath() override;
 
-    std::unique_ptr<RenderPaint> makeRenderPaint() override;
+    rcp<RenderPaint> makeRenderPaint() override;
 };
 } // namespace rive
 #endif
diff --git a/tess/src/sokol/sokol_tess_renderer.cpp b/tess/src/sokol/sokol_tess_renderer.cpp
index 6dc792e..346a8c1 100644
--- a/tess/src/sokol/sokol_tess_renderer.cpp
+++ b/tess/src/sokol/sokol_tess_renderer.cpp
@@ -140,15 +140,12 @@
 };
 
 // Returns a full-formed RenderPath -- can be treated as immutable
-std::unique_ptr<RenderPath> SokolFactory::makeRenderPath(RawPath& rawPath, FillRule rule)
+rcp<RenderPath> SokolFactory::makeRenderPath(RawPath& rawPath, FillRule rule)
 {
-    return rivestd::make_unique<SokolRenderPath>(rawPath, rule);
+    return make_rcp<SokolRenderPath>(rawPath, rule);
 }
 
-std::unique_ptr<RenderPath> SokolFactory::makeEmptyRenderPath()
-{
-    return rivestd::make_unique<SokolRenderPath>();
-}
+rcp<RenderPath> SokolFactory::makeEmptyRenderPath() { return make_rcp<SokolRenderPath>(); }
 
 class SokolBuffer : public lite_rtti_override<RenderBuffer, SokolBuffer>
 {
@@ -930,10 +927,7 @@
     }
 };
 
-std::unique_ptr<RenderPaint> SokolFactory::makeRenderPaint()
-{
-    return rivestd::make_unique<SokolRenderPaint>();
-}
+rcp<RenderPaint> SokolFactory::makeRenderPaint() { return make_rcp<SokolRenderPaint>(); }
 
 void SokolTessRenderer::restore()
 {
diff --git a/test/clip_test.cpp b/test/clip_test.cpp
index 1a3cb99..d31a3dd 100644
--- a/test/clip_test.cpp
+++ b/test/clip_test.cpp
@@ -7,7 +7,6 @@
 #include <utils/no_op_renderer.hpp>
 #include "rive_file_reader.hpp"
 #include <catch.hpp>
-#include <cstdio>
 
 TEST_CASE("clipping loads correctly", "[clipping]")
 {
@@ -48,10 +47,9 @@
 
 class ClippingFactory : public rive::NoOpFactory
 {
-    std::unique_ptr<rive::RenderPath> makeRenderPath(rive::RawPath& rawPath,
-                                                     rive::FillRule) override
+    rive::rcp<rive::RenderPath> makeRenderPath(rive::RawPath& rawPath, rive::FillRule) override
     {
-        return rivestd::make_unique<ClipTestRenderPath>(rawPath);
+        return rive::make_rcp<ClipTestRenderPath>(rawPath);
     }
 };
 
@@ -150,4 +148,4 @@
     rive::NoOpRenderer renderer;
     auto clipResult = shape->clip(&renderer);
     REQUIRE(clipResult == rive::ClipResult::emptyClip);
-}
\ No newline at end of file
+}
diff --git a/test/path_test.cpp b/test/path_test.cpp
index 55afb19..bd58078 100644
--- a/test/path_test.cpp
+++ b/test/path_test.cpp
@@ -82,9 +82,9 @@
 class TestNoOpFactory : public rive::NoOpFactory
 {
 public:
-    std::unique_ptr<rive::RenderPath> makeEmptyRenderPath() override
+    rive::rcp<rive::RenderPath> makeEmptyRenderPath() override
     {
-        return rivestd::make_unique<TestRenderPath>();
+        return rive::make_rcp<TestRenderPath>();
     }
 };
 } // namespace
diff --git a/utils/no_op_factory.cpp b/utils/no_op_factory.cpp
index 16d20c5..0656882 100644
--- a/utils/no_op_factory.cpp
+++ b/utils/no_op_factory.cpp
@@ -1,5 +1,4 @@
 #include "utils/no_op_factory.hpp"
-#include "utils/no_op_renderer.hpp"
 
 using namespace rive;
 
@@ -65,19 +64,13 @@
     return nullptr;
 }
 
-std::unique_ptr<RenderPath> NoOpFactory::makeRenderPath(RawPath&, FillRule)
+rcp<RenderPath> NoOpFactory::makeRenderPath(RawPath&, FillRule)
 {
-    return rivestd::make_unique<NoOpRenderPath>();
+    return make_rcp<NoOpRenderPath>();
 }
 
-std::unique_ptr<RenderPath> NoOpFactory::makeEmptyRenderPath()
-{
-    return rivestd::make_unique<NoOpRenderPath>();
-}
+rcp<RenderPath> NoOpFactory::makeEmptyRenderPath() { return make_rcp<NoOpRenderPath>(); }
 
-std::unique_ptr<RenderPaint> NoOpFactory::makeRenderPaint()
-{
-    return rivestd::make_unique<NoOpRenderPaint>();
-}
+rcp<RenderPaint> NoOpFactory::makeRenderPaint() { return make_rcp<NoOpRenderPaint>(); }
 
 rcp<RenderImage> NoOpFactory::decodeImage(Span<const uint8_t>) { return nullptr; }
diff --git a/viewer/src/viewer_content/text_content.cpp b/viewer/src/viewer_content/text_content.cpp
index d455b78..3892d46 100644
--- a/viewer/src/viewer_content/text_content.cpp
+++ b/viewer/src/viewer_content/text_content.cpp
@@ -114,9 +114,7 @@
     return nullptr;
 }
 
-static std::unique_ptr<rive::RenderPath> make_line(rive::Factory* factory,
-                                                   rive::Vec2D a,
-                                                   rive::Vec2D b)
+static rive::rcp<rive::RenderPath> make_line(rive::Factory* factory, rive::Vec2D a, rive::Vec2D b)
 {
     rive::RawPath rawPath;
     rawPath.move(a);
diff --git a/viewer/src/viewer_content/textpath_content.cpp b/viewer/src/viewer_content/textpath_content.cpp
index 351da53..69fe3fd 100644
--- a/viewer/src/viewer_content/textpath_content.cpp
+++ b/viewer/src/viewer_content/textpath_content.cpp
@@ -72,7 +72,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////////
 
-static std::unique_ptr<RenderPath> make_rpath(RawPath& path)
+static rcp<RenderPath> make_rpath(RawPath& path)
 {
     return ViewerContent::RiveFactory()->makeRenderPath(path, FillRule::nonZero);
 }
@@ -114,7 +114,7 @@
 {
     std::vector<Unichar> m_unichars;
     FontGlyphRuns m_gruns;
-    std::unique_ptr<RenderPaint> m_paint;
+    rcp<RenderPaint> m_paint;
     AABB m_gbounds;
 
     std::vector<Vec2D> m_pathpts;
diff --git a/viewer/src/viewer_content/trimpath_content.cpp b/viewer/src/viewer_content/trimpath_content.cpp
index d63a00b..af28c42 100644
--- a/viewer/src/viewer_content/trimpath_content.cpp
+++ b/viewer/src/viewer_content/trimpath_content.cpp
@@ -40,7 +40,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////////
 
-static std::unique_ptr<RenderPath> make_rpath(RawPath& path)
+static rcp<RenderPath> make_rpath(RawPath& path)
 {
     return ViewerContent::RiveFactory()->makeRenderPath(path, FillRule::nonZero);
 }