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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp

Issue 2523943002: Explicitly specify target color space to ImageDecoder at creation (Closed)
Patch Set: Rebase Created 4 years, 1 month 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
Index: third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp
index 7747ae8346406dd1b25f49b5323ef5dfe70e5dff..8e6e19d0163bf49d3634bb637d2d5039c3972b7a 100644
--- a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp
@@ -47,9 +47,13 @@ namespace blink {
PNGImageDecoder::PNGImageDecoder(AlphaOption alphaOption,
ColorSpaceOption colorOptions,
+ sk_sp<SkColorSpace> targetColorSpace,
size_t maxDecodedBytes,
size_t offset)
- : ImageDecoder(alphaOption, colorOptions, maxDecodedBytes),
+ : ImageDecoder(alphaOption,
+ colorOptions,
+ std::move(targetColorSpace),
+ maxDecodedBytes),
m_offset(offset) {}
PNGImageDecoder::~PNGImageDecoder() {}
@@ -152,7 +156,7 @@ void PNGImageDecoder::headerAvailable() {
colorType == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png);
- if ((colorType & PNG_COLOR_MASK_COLOR) && !m_ignoreColorSpace) {
+ if ((colorType & PNG_COLOR_MASK_COLOR) && !ignoresColorSpace()) {
// We only support color profiles for color PALETTE and RGB[A] PNG.
// Supporting color profiles for gray-scale images is slightly tricky, at
// least using the CoreGraphics ICC library, because we expand gray-scale
@@ -178,7 +182,7 @@ void PNGImageDecoder::headerAvailable() {
const double inverseGamma = 0.45455;
const double defaultGamma = 2.2;
double gamma;
- if (!m_ignoreColorSpace && png_get_gAMA(png, info, &gamma)) {
+ if (!ignoresColorSpace() && png_get_gAMA(png, info, &gamma)) {
const double maxGamma = 21474.83;
if ((gamma <= 0.0) || (gamma > maxGamma)) {
gamma = inverseGamma;
@@ -226,7 +230,7 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer,
if (buffer.getStatus() == ImageFrame::FrameEmpty) {
png_structp png = m_reader->pngPtr();
if (!buffer.setSizeAndColorSpace(size().width(), size().height(),
- colorSpace())) {
+ colorSpaceForSkImages())) {
longjmp(JMPBUF(png), 1);
return;
}

Powered by Google App Engine
This is Rietveld 408576698