no sprite blitters support gamut conversion

This fixes the None/Low bitmap filtering in gamut GM.

BUG=skia:6679

Change-Id: Ic6e0efa6a23b537aea69b4beb24f3c8b8c6ca347
Reviewed-on: https://skia-review.googlesource.com/17923
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/core/SkBlitter_Sprite.cpp b/src/core/SkBlitter_Sprite.cpp
index 4c184bd..8cf283f 100644
--- a/src/core/SkBlitter_Sprite.cpp
+++ b/src/core/SkBlitter_Sprite.cpp
@@ -6,6 +6,7 @@
  */
 
 #include "SkArenaAlloc.h"
+#include "SkColorSpace_Base.h"
 #include "SkOpts.h"
 #include "SkSpriteBlitter.h"
 
@@ -137,6 +138,15 @@
     bool fUseMemcpy {true};
 };
 
+// Returns the hash of the color space gamut if we can, or sRGB's gamut hash if we can't.
+static uint32_t safe_gamut_hash(SkColorSpace* cs) {
+    if (!cs) {
+        static const uint32_t srgb_hash = as_CSB(SkColorSpace::MakeSRGB())->toXYZD50Hash();
+        return srgb_hash;
+    }
+    return as_CSB(cs)->toXYZD50Hash();
+}
+
 // returning null means the caller will call SkBlitter::Choose() and
 // have wrapped the source bitmap inside a shader
 SkBlitter* SkBlitter::ChooseSprite(const SkPixmap& dst, const SkPaint& paint,
@@ -152,6 +162,11 @@
     */
     SkASSERT(allocator != nullptr);
 
+    // No sprite blitters support gamut conversion.
+    if (safe_gamut_hash(source.colorSpace()) != safe_gamut_hash(dst.colorSpace())) {
+        return nullptr;
+    }
+
     // Defer to the general code if the pixels are unpremultipled. This case is not common,
     // and this simplifies the code.
     if (source.alphaType() == kUnpremul_SkAlphaType) {