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

Unified Diff: chrome/renderer/extensions/extension_process_bindings.cc

Issue 333011: Fix premultiplication mismatch (Closed)
Patch Set: Created 11 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/extension_process_bindings.cc
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc
index 50f596e0c0121d1c87ca6b15c9c2e38321403a58..c8f1764fb7e6e7dc38183cdd6a01b0f7fbf5526e 100644
--- a/chrome/renderer/extensions/extension_process_bindings.cc
+++ b/chrome/renderer/extensions/extension_process_bindings.cc
@@ -434,12 +434,15 @@ class ExtensionImpl : public ExtensionBase {
uint32_t* pixels = bitmap.getAddr32(0, 0);
for (int t = 0; t < width*height; t++) {
- // |data| is RGBA, pixels is ARGB.
- pixels[t] =
- ((data->Get(v8::Integer::New(4*t + 3))->Int32Value() & 0xFF) << 24) |
- ((data->Get(v8::Integer::New(4*t + 0))->Int32Value() & 0xFF) << 16) |
- ((data->Get(v8::Integer::New(4*t + 1))->Int32Value() & 0xFF) << 8) |
- ((data->Get(v8::Integer::New(4*t + 2))->Int32Value() & 0xFF) << 0);
+ // |data| is RGBA not premutiplied, pixels is ARGB premultiplied.
tony 2009/10/23 16:52:17 Drive-by-nit: third_party/skia/include/core/SkColo
+ uint32_t r = data->Get(v8::Integer::New(4*t + 0))->Int32Value();
+ uint32_t g = data->Get(v8::Integer::New(4*t + 1))->Int32Value();
+ uint32_t b = data->Get(v8::Integer::New(4*t + 2))->Int32Value();
+ uint32_t a = data->Get(v8::Integer::New(4*t + 3))->Int32Value();
+ pixels[t] = (a & 0xFF) << 24 |
+ (r * a / 0xFF & 0xFF) << 16 |
+ (g * a / 0xFF & 0xFF) << 8 |
+ (b * a / 0xFF & 0xFF);
}
// Construct the Value object.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698