aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/android/SkBitmapRegionCodec.cpp
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2016-12-12 16:30:13 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-12 22:19:05 +0000
commit966bb348a5bdeec44252ede4cb73ba907af2d92b (patch)
tree42f15254a018158a6a05d36c049d8160c48c1118 /src/android/SkBitmapRegionCodec.cpp
parent131c1fb96328ee00cb18f629eddfb665b36e9463 (diff)
Decode to sRGB on Android
I want to land this so we can start testing color space aware decoding on Android. In particular, it will be interesting to see how linear premultiplication will affect existing content. This will only modify BitmapRegionDecoder behavior. I'll follow up with a similar change to BitmapFactory.cpp in Android. This will cause image diffs on Gold. BUG=skia: Change-Id: Iffda5f035447f2608ce26945570b503f8971b735 Reviewed-on: https://skia-review.googlesource.com/5698 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/android/SkBitmapRegionCodec.cpp')
-rw-r--r--src/android/SkBitmapRegionCodec.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/android/SkBitmapRegionCodec.cpp b/src/android/SkBitmapRegionCodec.cpp
index 973e3c9470..ffe7ea81f8 100644
--- a/src/android/SkBitmapRegionCodec.cpp
+++ b/src/android/SkBitmapRegionCodec.cpp
@@ -52,12 +52,9 @@ bool SkBitmapRegionCodec::decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocat
// Create the image info for the decode
SkColorType dstColorType = fCodec->computeOutputColorType(prefColorType);
SkAlphaType dstAlphaType = fCodec->computeOutputAlphaType(requireUnpremul);
-
- // Enable legacy behavior to avoid any gamma correction. Android's assets are
- // adjusted to expect a non-gamma correct premultiply.
- sk_sp<SkColorSpace> colorSpace = nullptr;
+ sk_sp<SkColorSpace> dstColorSpace = fCodec->computeOutputColorSpace(dstColorType);
SkImageInfo decodeInfo = SkImageInfo::Make(scaledSize.width(), scaledSize.height(),
- dstColorType, dstAlphaType, colorSpace);
+ dstColorType, dstAlphaType, dstColorSpace);
// Construct a color table for the decode if necessary
sk_sp<SkColorTable> colorTable(nullptr);
@@ -135,8 +132,6 @@ bool SkBitmapRegionCodec::decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocat
}
bool SkBitmapRegionCodec::conversionSupported(SkColorType colorType) {
- // Enable legacy behavior.
- sk_sp<SkColorSpace> colorSpace = nullptr;
- SkImageInfo dstInfo = fCodec->getInfo().makeColorType(colorType).makeColorSpace(colorSpace);
+ SkImageInfo dstInfo = fCodec->getInfo().makeColorType(colorType);
return conversion_possible(dstInfo, fCodec->getInfo());
}