From fa2d604a7ded95a3ace905519b476129cd0fffcb Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Tue, 17 Oct 2017 09:11:04 -0400 Subject: Make GPU backend triangulate rects such that they are rendered as tri strips rather than tri fans. Right now when we turn rects into quads we use a vertex order compatible with a tri fan rather than a tri strip. I wanted it to be the case that the same code could be used to generate a non-indexed mesh for a single rect or indexed using the quad index buffer when batching. Triangle fanning is not available in all APIS (e.g. is emulated in ANGLE and not supported in Metal) so it seems better to use a triangle strip over a fan in the single rect case. Change-Id: I31eebd794e7328f4b39e3ec3377bf2ec556360ca Reviewed-on: https://skia-review.googlesource.com/60081 Commit-Queue: Brian Salomon Reviewed-by: Robert Phillips --- gm/beziereffects.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gm/beziereffects.cpp') diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp index 3a5548822e..bf53aa2652 100644 --- a/gm/beziereffects.cpp +++ b/gm/beziereffects.cpp @@ -92,7 +92,7 @@ private: return; } SkRect rect = this->rect(); - pts[0].setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vertexStride); + pts[0].setRectTriStrip(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vertexStride); helper.recordDraw(target, this->gp(), this->makePipeline(target)); } @@ -267,8 +267,8 @@ private: return; } SkRect rect = this->rect(); - verts[0].fPosition.setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, - sizeof(Vertex)); + verts[0].fPosition.setRectTriStrip(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, + sizeof(Vertex)); for (int v = 0; v < 4; ++v) { SkScalar pt3[3] = {verts[v].fPosition.x(), verts[v].fPosition.y(), 1.f}; fKLM.mapHomogeneousPoints(verts[v].fKLM, pt3, 1); @@ -481,8 +481,8 @@ private: return; } SkRect rect = this->rect(); - verts[0].fPosition.setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, - sizeof(Vertex)); + verts[0].fPosition.setRectTriStrip(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, + sizeof(Vertex)); fDevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts); helper.recordDraw(target, this->gp(), this->makePipeline(target)); } -- cgit v1.2.3