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>
This commit is contained in:
parent
d1f08302aa
commit
5addedd59d
@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SkArenaAlloc.h"
|
#include "SkArenaAlloc.h"
|
||||||
|
#include "SkColorSpace_Base.h"
|
||||||
#include "SkOpts.h"
|
#include "SkOpts.h"
|
||||||
#include "SkSpriteBlitter.h"
|
#include "SkSpriteBlitter.h"
|
||||||
|
|
||||||
@ -137,6 +138,15 @@ private:
|
|||||||
bool fUseMemcpy {true};
|
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
|
// returning null means the caller will call SkBlitter::Choose() and
|
||||||
// have wrapped the source bitmap inside a shader
|
// have wrapped the source bitmap inside a shader
|
||||||
SkBlitter* SkBlitter::ChooseSprite(const SkPixmap& dst, const SkPaint& paint,
|
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);
|
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,
|
// Defer to the general code if the pixels are unpremultipled. This case is not common,
|
||||||
// and this simplifies the code.
|
// and this simplifies the code.
|
||||||
if (source.alphaType() == kUnpremul_SkAlphaType) {
|
if (source.alphaType() == kUnpremul_SkAlphaType) {
|
||||||
|
Loading…
Reference in New Issue
Block a user