aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2016-12-14 10:23:41 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-14 15:59:15 +0000
commit8dcc84f7dc8523dd90501a4feb1f632808337c34 (patch)
tree3923f83afa4c29f3c7817ff33735bb90da3a8d79 /src/codec
parent60c05f98aa22d89e4ef25acb4799936f5df3cff2 (diff)
Prefer F16 in SkAndroidCodec for high precision images
Adapted from: https://googleplex-android-review.git.corp.google.com/#/c/1707531/ TBR=djsollen@google.com BUG=skia: Change-Id: I21b99e8452e728aed70e8913677c253c1ae9f751 Reviewed-on: https://skia-review.googlesource.com/6023 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/codec')
-rw-r--r--src/codec/SkAndroidCodec.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/codec/SkAndroidCodec.cpp b/src/codec/SkAndroidCodec.cpp
index 5dddfe355e..a3daeae72b 100644
--- a/src/codec/SkAndroidCodec.cpp
+++ b/src/codec/SkAndroidCodec.cpp
@@ -70,10 +70,13 @@ SkColorType SkAndroidCodec::computeOutputColorType(SkColorType requestedColorTyp
}
SkColorType suggestedColorType = this->getInfo().colorType();
+ bool highPrecision = fCodec->getEncodedInfo().bitsPerComponent() > 8;
switch (requestedColorType) {
case kARGB_4444_SkColorType:
- case kN32_SkColorType:
return kN32_SkColorType;
+ case kN32_SkColorType:
+ // F16 is the Android default for high precision images.
+ return highPrecision ? kRGBA_F16_SkColorType : kN32_SkColorType;
case kIndex_8_SkColorType:
if (kIndex_8_SkColorType == suggestedColorType) {
return kIndex_8_SkColorType;
@@ -93,6 +96,8 @@ SkColorType SkAndroidCodec::computeOutputColorType(SkColorType requestedColorTyp
return kRGB_565_SkColorType;
}
break;
+ case kRGBA_F16_SkColorType:
+ return kRGBA_F16_SkColorType;
default:
break;
}
@@ -103,8 +108,8 @@ SkColorType SkAndroidCodec::computeOutputColorType(SkColorType requestedColorTyp
return kN32_SkColorType;
}
- // This may be kN32_SkColorType or kIndex_8_SkColorType.
- return suggestedColorType;
+ // |suggestedColorType| may be kN32_SkColorType or kIndex_8_SkColorType.
+ return highPrecision ? kRGBA_F16_SkColorType : suggestedColorType;
}
SkAlphaType SkAndroidCodec::computeOutputAlphaType(bool requestedUnpremul) {