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

Side by Side Diff: ui/base/clipboard/clipboard_win.cc

Issue 2400873002: keep only one typedef for the native drawing context (Closed)
Patch Set: native_drawing_context.h Created 4 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 unified diff | Download patch
« no previous file with comments | « skia/ext/skia_utils_mac.mm ('k') | ui/gfx/blit.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Many of these functions are based on those found in 5 // Many of these functions are based on those found in
6 // webkit/port/platform/PasteboardWin.cpp 6 // webkit/port/platform/PasteboardWin.cpp
7 7
8 #include "ui/base/clipboard/clipboard_win.h" 8 #include "ui/base/clipboard/clipboard_win.h"
9 9
10 #include <shellapi.h> 10 #include <shellapi.h>
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 } 610 }
611 const void* bitmap_bits = reinterpret_cast<const char*>(bitmap) 611 const void* bitmap_bits = reinterpret_cast<const char*>(bitmap)
612 + bitmap->bmiHeader.biSize + color_table_length * sizeof(RGBQUAD); 612 + bitmap->bmiHeader.biSize + color_table_length * sizeof(RGBQUAD);
613 613
614 gfx::Canvas canvas(gfx::Size(bitmap->bmiHeader.biWidth, 614 gfx::Canvas canvas(gfx::Size(bitmap->bmiHeader.biWidth,
615 bitmap->bmiHeader.biHeight), 615 bitmap->bmiHeader.biHeight),
616 1.0f, 616 1.0f,
617 false); 617 false);
618 { 618 {
619 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); 619 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas());
620 HDC dc = scoped_platform_paint.GetPlatformSurface(); 620 HDC dc = scoped_platform_paint.GetNativeDrawingContext();
621 ::SetDIBitsToDevice(dc, 0, 0, bitmap->bmiHeader.biWidth, 621 ::SetDIBitsToDevice(dc, 0, 0, bitmap->bmiHeader.biWidth,
622 bitmap->bmiHeader.biHeight, 0, 0, 0, 622 bitmap->bmiHeader.biHeight, 0, 0, 0,
623 bitmap->bmiHeader.biHeight, bitmap_bits, bitmap, 623 bitmap->bmiHeader.biHeight, bitmap_bits, bitmap,
624 DIB_RGB_COLORS); 624 DIB_RGB_COLORS);
625 } 625 }
626 // Windows doesn't really handle alpha channels well in many situations. When 626 // Windows doesn't really handle alpha channels well in many situations. When
627 // the source image is < 32 bpp, we force the bitmap to be opaque. When the 627 // the source image is < 32 bpp, we force the bitmap to be opaque. When the
628 // source image is 32 bpp, the alpha channel might still contain garbage data. 628 // source image is 32 bpp, the alpha channel might still contain garbage data.
629 // Since Windows uses premultiplied alpha, we scan for instances where 629 // Since Windows uses premultiplied alpha, we scan for instances where
630 // (R, G, B) > A. If there are any invalid premultiplied colors in the image, 630 // (R, G, B) > A. If there are any invalid premultiplied colors in the image,
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 if (!clipboard_owner_) 882 if (!clipboard_owner_)
883 return NULL; 883 return NULL;
884 884
885 if (clipboard_owner_->hwnd() == NULL) 885 if (clipboard_owner_->hwnd() == NULL)
886 clipboard_owner_->Create(base::Bind(&ClipboardOwnerWndProc)); 886 clipboard_owner_->Create(base::Bind(&ClipboardOwnerWndProc));
887 887
888 return clipboard_owner_->hwnd(); 888 return clipboard_owner_->hwnd();
889 } 889 }
890 890
891 } // namespace ui 891 } // namespace ui
OLDNEW
« no previous file with comments | « skia/ext/skia_utils_mac.mm ('k') | ui/gfx/blit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698