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

Unified Diff: views/drag_utils_win.cc

Issue 2935010: Revert 52249 - Windows: Fix opacity of drag images.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/drag_utils_win.cc
===================================================================
--- views/drag_utils_win.cc (revision 52299)
+++ views/drag_utils_win.cc (working copy)
@@ -13,7 +13,6 @@
#include "gfx/canvas_skia.h"
#include "gfx/gdi_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
-#include "third_party/skia/include/core/SkUnPreMultiply.h"
namespace drag_utils {
@@ -62,33 +61,9 @@
const gfx::Point& cursor_offset,
OSExchangeData* data_object) {
gfx::CanvasSkia canvas(sk_bitmap.width(), sk_bitmap.height(),
- /*is_opaque=*/true);
- SkBitmap opaque_bitmap;
- if (sk_bitmap.isOpaque()) {
- opaque_bitmap = sk_bitmap;
- } else {
- // InitializeFromBitmap() doesn't expect an alpha channel and is confused
- // by premultiplied colors, so unpremultiply the bitmap.
- SkBitmap tmp_bitmap;
- tmp_bitmap.setConfig(
- sk_bitmap.config(), sk_bitmap.width(), sk_bitmap.height());
- tmp_bitmap.allocPixels();
+ /*is_opaque=*/false);
+ canvas.DrawBitmapInt(sk_bitmap, 0, 0);
- SkAutoLockPixels lock(tmp_bitmap);
- const int kBytesPerPixel = 4;
- for (int y = 0; y < tmp_bitmap.height(); y++) {
- for (int x = 0; x < tmp_bitmap.width(); x++) {
- uint32 src_pixel = *sk_bitmap.getAddr32(x, y);
- uint32* dst_pixel = tmp_bitmap.getAddr32(x, y);
- SkColor unmultiplied = SkUnPreMultiply::PMColorToColor(src_pixel);
- *dst_pixel = unmultiplied;
- }
- }
- tmp_bitmap.setIsOpaque(true);
- opaque_bitmap = tmp_bitmap;
- }
- canvas.DrawBitmapInt(opaque_bitmap, 0, 0);
-
DCHECK(data_object && !size.IsEmpty());
// SetDragImageOnDataObject(HBITMAP) takes ownership of the bitmap.
HBITMAP bitmap = CreateBitmapFromCanvas(canvas, size.width(), size.height());
« 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