Support decoding images to multiple formats, depending on usage
authorBrian Osman <brianosman@google.com>
Fri, 18 Nov 2016 16:28:24 +0000 (11:28 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Mon, 21 Nov 2016 14:58:32 +0000 (14:58 +0000)
commit7992da32f02f90e0ac9ab6914eb31676b502eb71
treeeb993b2a03662c692d79013088ba18ebcd793ef3
parentdc940a63c4a2b5bfc8765fcdbeb097ac35e7bbe9
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.

Re-land (and fix) of:
https://skia-review.googlesource.com/c/4438/
https://skia-review.googlesource.com/c/4796/

BUG=skia:5907

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4838

Change-Id: I20ff972ffe1c7e6535ddc501e2a8ab8c246e4061
Reviewed-on: https://skia-review.googlesource.com/4838
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
33 files changed:
bench/SkBlend_optsBench.cpp
gm/image_pict.cpp
src/codec/SkCodecImageGenerator.cpp
src/core/SkBitmapDevice.cpp
src/core/SkBitmapProvider.cpp
src/core/SkBitmapProvider.h
src/core/SkDevice.cpp
src/core/SkImageCacherator.cpp
src/core/SkImageCacherator.h
src/core/SkShadowShader.cpp
src/core/SkSpecialImage.cpp
src/core/SkSpecialImage.h
src/effects/SkImageSource.cpp
src/gpu/GrImageIDTextureAdjuster.cpp
src/gpu/GrImageIDTextureAdjuster.h
src/gpu/GrTextureParamsAdjuster.cpp
src/gpu/GrTextureParamsAdjuster.h
src/gpu/SkGpuDevice.cpp
src/gpu/SkGr.cpp
src/image/SkImage.cpp
src/image/SkImageShader.cpp
src/image/SkImage_Base.h
src/image/SkImage_Generator.cpp
src/image/SkImage_Gpu.cpp
src/image/SkImage_Gpu.h
src/image/SkImage_Raster.cpp
src/pdf/SkPDFBitmap.cpp
src/pdf/SkPDFDevice.cpp
tests/ImageFilterCacheTest.cpp
tests/ImageTest.cpp
tests/SkBlend_optsTest.cpp
tests/SpecialImageTest.cpp
tools/Resources.cpp