aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-05-26 09:52:05 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-26 18:29:47 +0000
commite28bbcf0f61c91c1a3be7b2cb10f66fe5d3c3627 (patch)
tree560b341f7b5b770731dfbad776b823b5a34886bc
parent10240e385f541f9a6dea30469bda84c92799fbd9 (diff)
avoid rebuilding pipeline w/ only tricolors
patch_primitive: 2.0 --> 1.4 Bug: skia: Change-Id: Ia43c31873b9438332c94958232f6367240ba9a62 Reviewed-on: https://skia-review.googlesource.com/18030 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
-rw-r--r--src/core/SkDraw_vertices.cpp59
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.