aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-05-25 09:27:18 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-26 21:00:34 +0000
commit5addedd59dc171592f3200ff0a5244dc056aed9b (patch)
treee5563cd1471a56cd3652e3777897d221920a7906 /src
parentd1f08302aa3630f4482f560837f70454a415c56c (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkBlitter_Sprite.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/SkBlitter_Sprite.cpp b/src/core/SkBlitter_Sprite.cpp
index 4c184bdb33..8cf283f2fa 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 @@ private:
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 @@ SkBlitter* SkBlitter::ChooseSprite(const SkPixmap& dst, const SkPaint& paint,
*/
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) {