mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +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
6b2f18ffa2
commit
b9cbd74fc6
1 changed files with 8 additions and 2 deletions
|
@ -1207,7 +1207,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;
|
||||
}
|
||||
|
@ -1263,7 +1266,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