uint32_t ctxFlag = ContextFlag::Invalid;
uint32_t id;
uint8_t opacity = 255;
+ uint8_t refCnt = 0;
~Impl()
{
if (compData) {
- delete(compData->target);
+ if (P(compData->target)->unref() == 0) delete(compData->target);
free(compData);
}
if (smethod) delete(smethod);
if (rTransform) delete(rTransform);
}
+ uint8_t ref()
+ {
+ if (refCnt == 255) TVGERR("RENDERER", "Corrupted reference count!");
+ return (++refCnt);
+ }
+
+ uint8_t unref()
+ {
+ if (refCnt == 0) TVGERR("RENDERER", "Corrupted reference count!");
+ return (--refCnt);
+ }
+
void method(StrategyMethod* method)
{
smethod = method;
if ((!target && method != CompositeMethod::None) || (target && method == CompositeMethod::None)) return false;
if (compData) {
- delete(compData->target);
+ P(compData->target)->unref();
+ if ((compData->target != target) && P(compData->target)->refCnt == 0) {
+ delete(compData->target);
+ }
//Reset scenario
if (!target && method == CompositeMethod::None) {
free(compData);
if (!target && method == CompositeMethod::None) return true;
compData = static_cast<Composite*>(calloc(1, sizeof(Composite)));
}
+ P(target)->ref();
compData->target = target;
compData->source = source;
compData->method = method;
rs.path.cmdCnt = 0;
rs.path.ptsCnt = 0;
- flag = RenderUpdateFlag::Path;
+ flag |= RenderUpdateFlag::Path;
}
void append(const PathCommand* cmds, uint32_t cmdCnt, const Point* pts, uint32_t ptsCnt)