Replies: 1 comment
-
@dtromb Hello, I just noticed this answer is missing. You have 2 options:
Sorry for late. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I don't think I'm quite understanding the memory management model in thorvg.
In other vector libraries I've used, the move, draw, curve, etc. primitives just function as commands, changing the state of a buffer or setting primitives to be used for a single frame / iteration of a draw operation.
Here however, they are shape objects which have a lifecycle. That's OK, but...
Suppose I have one canvas, with some shape objects that I want to be longer-lived (for example, I loaded an svg into a Picture, which is expensive, and I want to retain that object for reuse), as well as some objects that do not need to be long-lived (for example, some lines drawn on top of the svg.)
Now, when I want to clear the canvas, it seems my only choices are to completely destroy all of the shape objects (Canvas::clear with free=true), or leave them in the canvas (Canvas::clear with free=false).
What I would like to do is /remove all of the shapes from the canvas, but keep the objects alive/ so that I can dispose the ones I don't need, and keep the ones I do to reuse in the next draw.
When I call Canvas::clear with free=false and re-add the shapes, the very next draw fails with "INSUFFICIENT CONDITION" error (and no more information that =/) and the documentation is very unclear in general about how lifecycle of Shape objects is supposed to work....
When I call Canvas::clear with free=true and destroy the objects, I get double-free stack corruption.
How can I clear the canvas without destroying objects?
Beta Was this translation helpful? Give feedback.
All reactions