aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkCodecImageGenerator.cpp
diff options
context:
space:
mode:
authorGravatar herb <herb@google.com>2016-04-15 12:57:42 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-15 12:57:42 -0700
commit4d1061cff656fa82a5d6595eb903b45b9393b638 (patch)
tree0cfa4769875f267b011ca4882c2a7612910dcc5b /src/codec/SkCodecImageGenerator.cpp
parentf230c6d979d7035cbf6995da8a0161e7802b92b7 (diff)
Add ability to default incoming image data as sRGB by default.
Diffstat (limited to 'src/codec/SkCodecImageGenerator.cpp')
-rw-r--r--src/codec/SkCodecImageGenerator.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/codec/SkCodecImageGenerator.cpp b/src/codec/SkCodecImageGenerator.cpp
index db13aaea29..2548a00629 100644
--- a/src/codec/SkCodecImageGenerator.cpp
+++ b/src/codec/SkCodecImageGenerator.cpp
@@ -6,6 +6,7 @@
*/
#include "SkCodecImageGenerator.h"
+#include "SkPM4fPriv.h"
SkImageGenerator* SkCodecImageGenerator::NewFromEncodedCodec(SkData* data) {
SkCodec* codec = SkCodec::NewFromData(data);
@@ -25,9 +26,12 @@ static SkImageInfo fix_info(const SkCodec& codec) {
SkAlphaType alphaType = (kUnpremul_SkAlphaType == info.alphaType()) ? kPremul_SkAlphaType :
info.alphaType();
- // Crudely guess that the presence of a color space means sRGB.
- SkColorProfileType profileType = (codec.getColorSpace()) ? kSRGB_SkColorProfileType :
- kLinear_SkColorProfileType;
+ SkColorProfileType profileType = kLinear_SkColorProfileType;
+ // Crudely guess that the presence of a color space means sRGB, or obey the global sRGB
+ // selector.
+ if (gTreatSkColorAsSRGB || codec.getColorSpace()) {
+ profileType = kSRGB_SkColorProfileType;
+ }
return SkImageInfo::Make(info.width(), info.height(), info.colorType(), alphaType, profileType);
}