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

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

Issue 2756463003: Remove opaque alpha channel special case (Closed)
Patch Set: Checking if JPEGImageDecoder::OutputScanlines()'s SetHasAlpha(true) is under test Created 3 years, 7 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
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 0e12da8491b7094abc87fe1dd4647a97b07fd634..c2387ea4acfa1a61dec5f3d1d3db88a815bc2d3c 100644
--- a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp
@@ -51,8 +51,7 @@ PNGImageDecoder::PNGImageDecoder(AlphaOption alpha_option,
// that as a signal to never check again, meaning the actual count will
// never be respected.
repetition_count_(kAnimationLoopOnce),
- has_alpha_channel_(false),
- current_buffer_saw_alpha_(false) {}
+ has_alpha_channel_(false) {}
PNGImageDecoder::~PNGImageDecoder() {}
@@ -298,8 +297,6 @@ void PNGImageDecoder::RowAvailable(unsigned char* row_buffer,
return;
}
}
-
- current_buffer_saw_alpha_ = false;
}
const IntRect& frame_rect = buffer.OriginalFrameRect();
@@ -387,7 +384,6 @@ void PNGImageDecoder::RowAvailable(unsigned char* row_buffer,
src_ptr = png_bytep(dst_row);
}
- unsigned alpha_mask = 255;
if (frame_buffer_cache_[current_frame_].GetAlphaBlendSource() ==
ImageFrame::kBlendAtopBgcolor) {
if (buffer.PremultiplyAlpha()) {
@@ -395,14 +391,12 @@ void PNGImageDecoder::RowAvailable(unsigned char* row_buffer,
dst_pixel++, src_ptr += 4) {
ImageFrame::SetRGBAPremultiply(dst_pixel, src_ptr[0], src_ptr[1],
src_ptr[2], src_ptr[3]);
- alpha_mask &= src_ptr[3];
}
} else {
for (auto *dst_pixel = dst_row; dst_pixel < dst_row + width;
dst_pixel++, src_ptr += 4) {
ImageFrame::SetRGBARaw(dst_pixel, src_ptr[0], src_ptr[1], src_ptr[2],
src_ptr[3]);
- alpha_mask &= src_ptr[3];
}
}
} else {
@@ -415,21 +409,15 @@ void PNGImageDecoder::RowAvailable(unsigned char* row_buffer,
dst_pixel++, src_ptr += 4) {
ImageFrame::BlendRGBAPremultiplied(dst_pixel, src_ptr[0], src_ptr[1],
src_ptr[2], src_ptr[3]);
- alpha_mask &= src_ptr[3];
}
} else {
for (auto *dst_pixel = dst_row; dst_pixel < dst_row + width;
dst_pixel++, src_ptr += 4) {
ImageFrame::BlendRGBARaw(dst_pixel, src_ptr[0], src_ptr[1],
src_ptr[2], src_ptr[3]);
- alpha_mask &= src_ptr[3];
}
}
}
-
- if (alpha_mask != 255)
- current_buffer_saw_alpha_ = true;
-
} else {
for (auto *dst_pixel = dst_row; dst_pixel < dst_row + width;
src_ptr += 3, ++dst_pixel) {
@@ -462,9 +450,6 @@ void PNGImageDecoder::FrameComplete() {
return;
}
- if (!current_buffer_saw_alpha_)
- CorrectAlphaWhenFrameBufferSawNoAlpha(current_frame_);
-
buffer.SetStatus(ImageFrame::kFrameComplete);
}

Powered by Google App Engine
This is Rietveld 408576698