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

Unified Diff: base/gfx/png_decoder.cc

Issue 155227: Merge 20040 - Fix retarded bitmath. << 8 != * 255... (Closed) Base URL: svn://chrome-svn/chrome/branches/191/src/
Patch Set: Created 11 years, 5 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 | base/gfx/png_encoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/gfx/png_decoder.cc
===================================================================
--- base/gfx/png_decoder.cc (revision 20166)
+++ base/gfx/png_decoder.cc (working copy)
@@ -329,10 +329,12 @@
for (int i = width * height * 4 - 4; i >= 0; i -= 4) {
unsigned char alpha = decoded_data[i + 3];
if (alpha != 0 && alpha != 255) {
+ SkColor premultiplied = SkPreMultiplyARGB(alpha,
+ decoded_data[i], decoded_data[i + 1], decoded_data[i + 2]);
bitmap_data[i + 3] = alpha;
- bitmap_data[i] = (decoded_data[i] * alpha) >> 8;
- bitmap_data[i + 1] = (decoded_data[i + 1] * alpha) >> 8;
- bitmap_data[i + 2] = (decoded_data[i + 2] * alpha) >> 8;
+ bitmap_data[i] = SkColorGetR(premultiplied);
+ bitmap_data[i + 1] = SkColorGetG(premultiplied);
+ bitmap_data[i + 2] = SkColorGetB(premultiplied);
} else {
bitmap_data[i + 3] = alpha;
bitmap_data[i] = decoded_data[i];
Property changes on: base\gfx\png_decoder.cc
___________________________________________________________________
Modified: svn:mergeinfo
Merged /trunk/src/base/gfx/png_decoder.cc:r20040
« no previous file with comments | « no previous file | base/gfx/png_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698