In OpenGl2Renderer, do not issue a draw call per DrawVectorText call.
This significantly improves performance with ANGLE.
This commit is contained in:
parent
727c0a97dc
commit
10251c6484
@ -100,7 +100,6 @@ public:
|
|||||||
|
|
||||||
void DrawLine(const Vector &a, const Vector &b, hStroke hcs) override;
|
void DrawLine(const Vector &a, const Vector &b, hStroke hcs) override;
|
||||||
void DrawEdges(const SEdgeList &el, hStroke hcs) override;
|
void DrawEdges(const SEdgeList &el, hStroke hcs) override;
|
||||||
void DrawEdgesInternal(const SEdgeList &el, hStroke hcs);
|
|
||||||
bool DrawBeziers(const SBezierList &bl, hStroke hcs) override { return false; }
|
bool DrawBeziers(const SBezierList &bl, hStroke hcs) override { return false; }
|
||||||
void DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs mode) override;
|
void DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs mode) override;
|
||||||
void DrawVectorText(const std::string &text, double height,
|
void DrawVectorText(const std::string &text, double height,
|
||||||
@ -436,23 +435,6 @@ void OpenGl2Renderer::DrawEdges(const SEdgeList &el, hStroke hcs) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGl2Renderer::DrawEdgesInternal(const SEdgeList &el, hStroke hcs) {
|
|
||||||
if(el.l.n == 0) return;
|
|
||||||
|
|
||||||
Stroke *stroke = SelectStroke(hcs);
|
|
||||||
if(stroke->stipplePattern == StipplePattern::ZIGZAG ||
|
|
||||||
stroke->stipplePattern == StipplePattern::FREEHAND)
|
|
||||||
{
|
|
||||||
for(const SEdge *e = el.l.First(); e; e = el.l.NextAfter(e)) {
|
|
||||||
DoStippledLine(e->a, e->b, hcs);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
edgeRenderer.SetStroke(*stroke, 1.0 / camera.scale);
|
|
||||||
edgeRenderer.Draw(el);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OpenGl2Renderer::DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs mode) {
|
void OpenGl2Renderer::DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs mode) {
|
||||||
if(ol.l.n == 0) return;
|
if(ol.l.n == 0) return;
|
||||||
|
|
||||||
@ -468,11 +450,16 @@ void OpenGl2Renderer::DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutl
|
|||||||
void OpenGl2Renderer::DrawVectorText(const std::string &text, double height,
|
void OpenGl2Renderer::DrawVectorText(const std::string &text, double height,
|
||||||
const Vector &o, const Vector &u, const Vector &v,
|
const Vector &o, const Vector &u, const Vector &v,
|
||||||
hStroke hcs) {
|
hStroke hcs) {
|
||||||
SEdgeList el = {};
|
SEdgeListItem *eli = lines.FindByIdNoOops(hcs);
|
||||||
auto traceEdge = [&](Vector a, Vector b) { el.AddEdge(a, b); };
|
if(eli == NULL) {
|
||||||
|
SEdgeListItem item = {};
|
||||||
|
item.h = hcs;
|
||||||
|
lines.Add(&item);
|
||||||
|
eli = lines.FindByIdNoOops(hcs);
|
||||||
|
}
|
||||||
|
SEdgeList &lines = eli->lines;
|
||||||
|
auto traceEdge = [&](Vector a, Vector b) { lines.AddEdge(a, b); };
|
||||||
VectorFont::Builtin()->Trace(height, o, u, v, text, traceEdge, camera);
|
VectorFont::Builtin()->Trace(height, o, u, v, text, traceEdge, camera);
|
||||||
DrawEdgesInternal(el, hcs);
|
|
||||||
el.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGl2Renderer::DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d,
|
void OpenGl2Renderer::DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d,
|
||||||
@ -643,7 +630,10 @@ void OpenGl2Renderer::FlushFrame() {
|
|||||||
meshes.Clear();
|
meshes.Clear();
|
||||||
|
|
||||||
for(SEdgeListItem &eli : lines) {
|
for(SEdgeListItem &eli : lines) {
|
||||||
DrawEdgesInternal(eli.lines, eli.h);
|
Stroke *stroke = SelectStroke(eli.h);
|
||||||
|
|
||||||
|
edgeRenderer.SetStroke(*stroke, 1.0 / camera.scale);
|
||||||
|
edgeRenderer.Draw(eli.lines);
|
||||||
eli.lines.Clear();
|
eli.lines.Clear();
|
||||||
}
|
}
|
||||||
lines.Clear();
|
lines.Clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user