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>
diff --git a/src/core/SkDraw_vertices.cpp b/src/core/SkDraw_vertices.cpp
index 662a6ff..d0ef2d7 100644
--- a/src/core/SkDraw_vertices.cpp
+++ b/src/core/SkDraw_vertices.cpp
@@ -203,6 +203,26 @@
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) +