mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 19:44:28 +00:00
gl_engine: Fix repeated clip drawing causes performance degradation
The clips need to be cleared every time when shape update. Otherwise, the increasing number of clips will hurt the performance.
This commit is contained in:
parent
d37ab3b39f
commit
552d4bcee1
1 changed files with 8 additions and 2 deletions
|
@ -1320,7 +1320,10 @@ RenderData GlRenderer::prepare(RenderSurface* image, RenderData data, const Matr
|
|||
|
||||
sdata->geometry->tesselate(image, flags);
|
||||
|
||||
if (!clips.empty()) sdata->clips.push(clips);
|
||||
if (!clips.empty()) {
|
||||
sdata->clips.clear();
|
||||
sdata->clips.push(clips);
|
||||
}
|
||||
|
||||
return sdata;
|
||||
}
|
||||
|
@ -1376,7 +1379,10 @@ RenderData GlRenderer::prepare(const RenderShape& rshape, RenderData data, const
|
|||
if (!sdata->geometry->tesselate(rshape, sdata->updateFlag)) return sdata;
|
||||
}
|
||||
|
||||
if (!clipper && !clips.empty()) sdata->clips.push(clips);
|
||||
if (!clipper && !clips.empty()) {
|
||||
sdata->clips.clear();
|
||||
sdata->clips.push(clips);
|
||||
}
|
||||
|
||||
return sdata;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue