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

Unified Diff: base/gfx/png_encoder.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 | « base/gfx/png_decoder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/gfx/png_encoder.cc
===================================================================
--- base/gfx/png_encoder.cc (revision 20166)
+++ base/gfx/png_encoder.cc (working copy)
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "base/scoped_ptr.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "third_party/skia/include/core/SkUnPreMultiply.h"
extern "C" {
#include "third_party/libpng/png.h"
@@ -214,9 +215,10 @@
int alpha = SkColorGetA(pixel);
if (alpha != 0 && alpha != 255) {
- divided[i + 0] = (SkColorGetR(pixel) << 8) / alpha;
- divided[i + 1] = (SkColorGetG(pixel) << 8) / alpha;
- divided[i + 2] = (SkColorGetB(pixel) << 8) / alpha;
+ SkColor unmultiplied = SkUnPreMultiply::PMColorToColor(pixel);
+ divided[i + 0] = SkColorGetR(unmultiplied);
+ divided[i + 1] = SkColorGetG(unmultiplied);
+ divided[i + 2] = SkColorGetB(unmultiplied);
divided[i + 3] = alpha;
} else {
divided[i + 0] = SkColorGetR(pixel);
Property changes on: base\gfx\png_encoder.cc
___________________________________________________________________
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/base/gfx/png_encoder.cc:r69-2775
Merged /trunk/src/base/gfx/png_encoder.cc:r20040
« no previous file with comments | « base/gfx/png_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698