diff options
-rw-r--r-- | src/core/SkDraw_vertices.cpp | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/src/core/SkDraw_vertices.cpp b/src/core/SkDraw_vertices.cpp index 7720acc088..6b6ba9c555 100644 --- a/src/core/SkDraw_vertices.cpp +++ b/src/core/SkDraw_vertices.cpp @@ -235,29 +235,46 @@ void SkDraw::drawVertices(SkVertices::VertexMode vmode, int count, SkPaint p(paint); p.setShader(sk_ref_sp(shader)); - while (vertProc(&state)) { - SkSTArenaAlloc<2048> innerAlloc; - - const SkMatrix* ctm = fMatrix; - SkMatrix tmpCtm; - if (textures) { - SkMatrix localM; - texture_to_matrix(state, vertices, textures, &localM); - tmpCtm = SkMatrix::Concat(*fMatrix, localM); - ctm = &tmpCtm; + if (!textures) { // only tricolor shader + SkASSERT(matrix43); + auto blitter = SkCreateRasterPipelineBlitter(fDst, p, *fMatrix, &outerAlloc); + while (vertProc(&state)) { + if (!update_tricolor_matrix(ctmInv, vertices, dstColors, + state.f0, state.f1, state.f2, + matrix43)) { + continue; + } + + SkPoint tmp[] = { + devVerts[state.f0], devVerts[state.f1], devVerts[state.f2] + }; + SkScan::FillTriangle(tmp, *fRC, blitter); } - - if (matrix43 && !update_tricolor_matrix(ctmInv, vertices, dstColors, - state.f0, state.f1, state.f2, - matrix43)) { - continue; + } else { + while (vertProc(&state)) { + SkSTArenaAlloc<2048> innerAlloc; + + const SkMatrix* ctm = fMatrix; + SkMatrix tmpCtm; + if (textures) { + SkMatrix localM; + texture_to_matrix(state, vertices, textures, &localM); + tmpCtm = SkMatrix::Concat(*fMatrix, localM); + ctm = &tmpCtm; + } + + if (matrix43 && !update_tricolor_matrix(ctmInv, vertices, dstColors, + state.f0, state.f1, state.f2, + matrix43)) { + continue; + } + + SkPoint tmp[] = { + devVerts[state.f0], devVerts[state.f1], devVerts[state.f2] + }; + auto blitter = SkCreateRasterPipelineBlitter(fDst, p, *ctm, &innerAlloc); + SkScan::FillTriangle(tmp, *fRC, blitter); } - - SkPoint tmp[] = { - devVerts[state.f0], devVerts[state.f1], devVerts[state.f2] - }; - auto blitter = SkCreateRasterPipelineBlitter(fDst, p, *ctm, &innerAlloc); - SkScan::FillTriangle(tmp, *fRC, blitter); } } else { // no colors[] and no texture, stroke hairlines with paint's color. |