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:
RuiwenTang 2024-11-11 11:40:46 +08:00 committed by Hermet Park
parent 6b2f18ffa2
commit b9cbd74fc6

View file

@ -1207,7 +1207,10 @@ RenderData GlRenderer::prepare(RenderSurface* image, RenderData data, const Matr
sdata->geometry->tesselate(image, flags); sdata->geometry->tesselate(image, flags);
if (!clips.empty()) sdata->clips.push(clips); if (!clips.empty()) {
sdata->clips.clear();
sdata->clips.push(clips);
}
return sdata; 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 (!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; return sdata;
} }