Added destructors for render path and render paint

This commit is contained in:
Matt Sullivan
2020-09-29 14:03:46 -07:00
parent 4d72bf6e5d
commit 8149f9d8e6
3 changed files with 15 additions and 2 deletions

View File

@@ -17,7 +17,7 @@ struct ContentView: View {
struct MyRive: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> RiveViewController {
return RiveViewController(resource: "bird", withExtension: "riv")
return RiveViewController(resource: "truck", withExtension: "riv")
}
func updateUIViewController(_ uiViewController: RiveViewController, context: Context) {}

View File

@@ -88,8 +88,8 @@ namespace rive
std::vector<CGFloat> colorStops;
std::vector<CGFloat> stops;
RiveRenderPaint();
~RiveRenderPaint();
void color(unsigned int value) override;
void style(RenderPaintStyle value) override;
@@ -131,6 +131,8 @@ namespace rive
public:
RiveRenderPath();
~RiveRenderPath();
CGMutablePathRef getPath() { return path; }
FillRule getFillRule() { return m_FillRule; }

View File

@@ -32,6 +32,12 @@ RiveRenderPaint::RiveRenderPaint() {
// NSLog(@"INITIALIZING A NEW RENDER PAINT");
}
RiveRenderPaint::~RiveRenderPaint() {
NSLog(@"Releasing paint resources");
CGColorRelease(cgColor);
CGGradientRelease(gradient);
}
void RiveRenderPaint::style(RenderPaintStyle value) {
// NSLog(@" --- RenderPaint::style");
switch(value) {
@@ -195,6 +201,11 @@ RiveRenderPath::RiveRenderPath() {
path = CGPathCreateMutable();
}
RiveRenderPath::~RiveRenderPath() {
NSLog(@"Releasing path resources");
CGPathRelease(path);
}
void RiveRenderPath::close() {
// NSLog(@" --- RenderPath::close");
CGPathCloseSubpath(path);