Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: src/codec/SkCodecImageGenerator.cpp

Issue 1904943003: Remove obsolete image codec colorspace hacks. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkCodecImageGenerator.cpp
diff --git a/src/codec/SkCodecImageGenerator.cpp b/src/codec/SkCodecImageGenerator.cpp
index 2548a006299f71efb612fbb78b8d2583ec89bffa..e579da92f6f435c8a34ba21aae5fdfb02f2cbe23 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))
{}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698