aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-04-21 08:48:18 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-21 08:48:18 -0700
commit0370712fd50d7187277cfe42d8564aa1f6cfedca (patch)
tree31c96f44b601442ac771c3d32691258a551861f1
parentb5d7468e5559c78a7c3fe2c0b97ea262fbac550c (diff)
Remove obsolete image codec colorspace hacks.
With Herb's latest change, the codecs themselves are emitting images tagged based on the new (separate) global flag. All of the changes we had here to fixup color profile type are no longer needed (and just create more confusion). This change effectively reverts the file to where it was two commits ago. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1904943003 Review URL: https://codereview.chromium.org/1904943003
-rw-r--r--src/codec/SkCodecImageGenerator.cpp22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/codec/SkCodecImageGenerator.cpp b/src/codec/SkCodecImageGenerator.cpp
index 2548a00629..e579da92f6 100644
--- a/src/codec/SkCodecImageGenerator.cpp
+++ b/src/codec/SkCodecImageGenerator.cpp
@@ -6,7 +6,6 @@
*/
#include "SkCodecImageGenerator.h"
-#include "SkPM4fPriv.h"
SkImageGenerator* SkCodecImageGenerator::NewFromEncodedCodec(SkData* data) {
SkCodec* codec = SkCodec::NewFromData(data);
@@ -17,27 +16,16 @@ SkImageGenerator* SkCodecImageGenerator::NewFromEncodedCodec(SkData* data) {
return new SkCodecImageGenerator(codec, data);
}
-// FIXME: We should expose information about the encoded format on the
-// SkImageGenerator, so the client can interpret the encoded
-// format and request an output format. For now, as a workaround,
-// we guess what output format the client wants.
-static SkImageInfo fix_info(const SkCodec& codec) {
- const SkImageInfo& info = codec.getInfo();
- SkAlphaType alphaType = (kUnpremul_SkAlphaType == info.alphaType()) ? kPremul_SkAlphaType :
- info.alphaType();
-
- 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;
+static SkImageInfo make_premul(const SkImageInfo& info) {
+ if (kUnpremul_SkAlphaType == info.alphaType()) {
+ return info.makeAlphaType(kPremul_SkAlphaType);
}
- return SkImageInfo::Make(info.width(), info.height(), info.colorType(), alphaType, profileType);
+ return info;
}
SkCodecImageGenerator::SkCodecImageGenerator(SkCodec* codec, SkData* data)
- : INHERITED(fix_info(*codec))
+ : INHERITED(make_premul(codec->getInfo()))
, fCodec(codec)
, fData(SkRef(data))
{}