diff options
author | Brian Osman <brianosman@google.com> | 2016-11-14 15:09:56 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-15 15:27:14 +0000 |
commit | c73a1ecbed64652b3d7aa8dc6face9a2205ce830 (patch) | |
tree | 59e66c879ca0d1ab68720ccae740cecb2d5660ef /src/core/SkBitmapProvider.h | |
parent | fd01ce05ef7902c49b0272b3524a389693c72b35 (diff) |
Support decoding images to multiple formats, depending on usage
Our codec generator will now preserve any asked-for color space, and
convert the encoded data to that representation. Cacherator now
allows decoding an image to both legacy (nullptr color space), and
color-correct formats. In color-correct mode, we choose the best
decoded format, based on the original properties, and our backend's
capabilities. Preference is given to the native format, when it's
already texturable (sRGB 8888 or F16 linear). Otherwise, we prefer
linear F16, and fall back to sRGB when that's not an option.
BUG=skia:5907
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4438
Change-Id: I847c243dcfb72d8c0f1f6fc73c09547adea933f0
Reviewed-on: https://skia-review.googlesource.com/4438
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/core/SkBitmapProvider.h')
-rw-r--r-- | src/core/SkBitmapProvider.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/SkBitmapProvider.h b/src/core/SkBitmapProvider.h index 2e878b18ab..9cbbf0d470 100644 --- a/src/core/SkBitmapProvider.h +++ b/src/core/SkBitmapProvider.h @@ -13,9 +13,14 @@ class SkBitmapProvider { public: - explicit SkBitmapProvider(const SkImage* img) : fImage(img) { SkASSERT(img); } + explicit SkBitmapProvider(const SkImage* img, SkDestinationSurfaceColorMode colorMode) + : fImage(img) + , fColorMode(colorMode) { + SkASSERT(img); + } SkBitmapProvider(const SkBitmapProvider& other) : fImage(other.fImage) + , fColorMode(other.fColorMode) {} int width() const; @@ -40,7 +45,8 @@ private: // SkBitmapProvider is always short-lived/stack allocated, and the source image is guaranteed // to outlive its scope => we can store a raw ptr to avoid ref churn. - const SkImage* fImage; + const SkImage* fImage; + SkDestinationSurfaceColorMode fColorMode; }; #endif |