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

Unified Diff: src/codec/SkJpegCodec.cpp

Issue 2184543003: Perform color correction on png decodes (Closed) Base URL: https://skia.googlesource.com/skia.git@colorjpegs
Patch Set: Fixes Created 4 years, 4 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 | « src/codec/SkCodecPriv.h ('k') | src/codec/SkPngCodec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkJpegCodec.cpp
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index 8096a29f49866ebd21a0bc1234ea8e0215b68d19..eb5f6b03873b004c9999d2a47fa591d83848af94 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -478,12 +478,6 @@ bool SkJpegCodec::onDimensionsSupported(const SkISize& size) {
return true;
}
-static bool needs_color_xform(const SkImageInfo& dstInfo, const SkImageInfo& srcInfo) {
- return (kRGBA_F16_SkColorType == dstInfo.colorType()) ||
- (dstInfo.colorSpace() && !SkColorSpace::Equals(srcInfo.colorSpace(),
- dstInfo.colorSpace()));
-}
-
int SkJpegCodec::readRows(const SkImageInfo& dstInfo, void* dst, size_t rowBytes, int count) {
// Set the jump location for libjpeg-turbo errors
if (setjmp(fDecoderMgr->getJmpBuf())) {
@@ -529,22 +523,8 @@ int SkJpegCodec::readRows(const SkImageInfo& dstInfo, void* dst, size_t rowBytes
}
if (fColorXform) {
- int width = dstInfo.width();
- switch (dstInfo.colorType()) {
- case kRGBA_8888_SkColorType:
- fColorXform->applyToRGBA((uint32_t*) dst, swizzleDst, width);
- break;
- case kBGRA_8888_SkColorType:
- fColorXform->applyToBGRA((uint32_t*) dst, swizzleDst, width);
- break;
- case kRGBA_F16_SkColorType:
- fColorXform->applyToF16((uint64_t*) dst, swizzleDst, width);
- break;
- default:
- SkASSERT(false);
- break;
- }
-
+ fColorXform->apply(dst, swizzleDst, dstInfo.width(), dstInfo.colorType(),
+ kOpaque_SkAlphaType);
dst = SkTAddOffset<void>(dst, rowBytes);
}
@@ -619,7 +599,7 @@ void SkJpegCodec::allocateStorage(const SkImageInfo& dstInfo) {
size_t xformBytes = 0;
if (kRGBA_F16_SkColorType == dstInfo.colorType()) {
SkASSERT(fColorXform);
- xformBytes = dstInfo.width() * sizeof(SkColorSpaceXform::RGBA32);
+ xformBytes = dstInfo.width() * sizeof(uint32_t);
}
size_t totalBytes = swizzleBytes + xformBytes;
« no previous file with comments | « src/codec/SkCodecPriv.h ('k') | src/codec/SkPngCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698