aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-06-02 14:52:22 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-02 19:17:07 +0000
commit0271c5b7dba460f523611d65c5711a9cf21c7761 (patch)
tree6626099452b1a64738250c739ee090b2632dafa4 /src
parent56f6e8355a37a44f9994df87853c64e4447b7a25 (diff)
simplify verts in certain modes
Bug: skia: Change-Id: I7cc54c940b61332f06b8d21eeba1def8bd9cb3dc Reviewed-on: https://skia-review.googlesource.com/18495 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkDraw_vertices.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/core/SkDraw_vertices.cpp b/src/core/SkDraw_vertices.cpp
index 662a6ff187..d0ef2d7116 100644
--- a/src/core/SkDraw_vertices.cpp
+++ b/src/core/SkDraw_vertices.cpp
@@ -203,6 +203,26 @@ void SkDraw::drawVertices(SkVertices::VertexMode vmode, int count,
textures = nullptr;
}
+ // We can simplify things for certain blendmodes. This is for speed, and SkComposeShader
+ // itself insists we don't pass kSrc or kDst to it.
+ //
+ if (colors && textures) {
+ switch (bmode) {
+ case SkBlendMode::kSrc:
+ colors = nullptr;
+ break;
+ case SkBlendMode::kDst:
+ textures = nullptr;
+ break;
+ default: break;
+ }
+ }
+
+ // we don't use the shader if there are no textures
+ if (!textures) {
+ shader = nullptr;
+ }
+
constexpr size_t defCount = 16;
constexpr size_t outerSize = sizeof(SkTriColorShader) +
sizeof(SkComposeShader) +