diff options
author | 2016-09-21 06:45:09 -0700 | |
---|---|---|
committer | 2016-09-21 06:45:09 -0700 | |
commit | 2695eaa41fbd208dcee9e134e180c6609856f0ac (patch) | |
tree | fd7689a3f08108d58a9cd75993e7bd40efdfc852 /src/gpu/SkGr.cpp | |
parent | 4d450d24f5a7e60015fb34de998da2bf46196d46 (diff) |
Fix some GPU image filter code to preserve precision and color space
On the pure-GPU path, we just have an SkSpecialImage (that's definitely
texture backed), and we need a renderable config for the draw context we
make. Added a helper function to pick - this is basically the high
precision analog of what we were doing before (always using 8888).
The assert that I added catches many other problems in image filter code,
but those fixes are coming in subsequent CLs.
12 GMs render correctly (or more correctly) in gpusrgb and gpuf16
configs. In most cases, they were drawing previously nothing.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2359443003
Review-Url: https://codereview.chromium.org/2359443003
Diffstat (limited to 'src/gpu/SkGr.cpp')
-rw-r--r-- | src/gpu/SkGr.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index c8839f3f1a..9ee8722afa 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -508,6 +508,19 @@ bool GrPixelConfigToColorType(GrPixelConfig config, SkColorType* ctOut) { return true; } +GrPixelConfig GrRenderableConfigForColorSpace(SkColorSpace* colorSpace) { + if (!colorSpace) { + return kRGBA_8888_GrPixelConfig; + } else if (colorSpace->gammaIsLinear()) { + return kRGBA_half_GrPixelConfig; + } else if (colorSpace->gammaCloseToSRGB()) { + return kSRGBA_8888_GrPixelConfig; + } else { + SkDEBUGFAIL("No renderable config exists for color space with strange gamma"); + return kUnknown_GrPixelConfig; + } +} + //////////////////////////////////////////////////////////////////////////////////////////////// static inline bool blend_requires_shader(const SkXfermode::Mode mode, bool primitiveIsSrc) { |