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

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

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename methods and vars to make image_scale more clear Created 7 years, 3 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 | Annotate | Revision Log
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.h" 8 #include "ui/base/clipboard/clipboard.h"
9 9
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 10 matching lines...) Expand all
21 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
22 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
23 #include "base/strings/utf_offset_string_conversions.h" 23 #include "base/strings/utf_offset_string_conversions.h"
24 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
25 #include "base/win/message_window.h" 25 #include "base/win/message_window.h"
26 #include "base/win/scoped_gdi_object.h" 26 #include "base/win/scoped_gdi_object.h"
27 #include "base/win/scoped_hdc.h" 27 #include "base/win/scoped_hdc.h"
28 #include "third_party/skia/include/core/SkBitmap.h" 28 #include "third_party/skia/include/core/SkBitmap.h"
29 #include "ui/base/clipboard/clipboard_util_win.h" 29 #include "ui/base/clipboard/clipboard_util_win.h"
30 #include "ui/base/clipboard/custom_data_helper.h" 30 #include "ui/base/clipboard/custom_data_helper.h"
31 #include "ui/base/layout.h"
31 #include "ui/gfx/canvas.h" 32 #include "ui/gfx/canvas.h"
32 #include "ui/gfx/size.h" 33 #include "ui/gfx/size.h"
33 34
34 namespace ui { 35 namespace ui {
35 36
36 namespace { 37 namespace {
37 38
38 // A scoper to manage acquiring and automatically releasing the clipboard. 39 // A scoper to manage acquiring and automatically releasing the clipboard.
39 class ScopedClipboard { 40 class ScopedClipboard {
40 public: 41 public:
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 case 24: 556 case 24:
556 break; 557 break;
557 default: 558 default:
558 NOTREACHED(); 559 NOTREACHED();
559 } 560 }
560 const void* bitmap_bits = reinterpret_cast<const char*>(bitmap) 561 const void* bitmap_bits = reinterpret_cast<const char*>(bitmap)
561 + bitmap->bmiHeader.biSize + color_table_length * sizeof(RGBQUAD); 562 + bitmap->bmiHeader.biSize + color_table_length * sizeof(RGBQUAD);
562 563
563 gfx::Canvas canvas(gfx::Size(bitmap->bmiHeader.biWidth, 564 gfx::Canvas canvas(gfx::Size(bitmap->bmiHeader.biWidth,
564 bitmap->bmiHeader.biHeight), 565 bitmap->bmiHeader.biHeight),
565 ui::SCALE_FACTOR_100P, 566 1.0f,
566 false); 567 false);
567 { 568 {
568 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); 569 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas());
569 HDC dc = scoped_platform_paint.GetPlatformSurface(); 570 HDC dc = scoped_platform_paint.GetPlatformSurface();
570 ::SetDIBitsToDevice(dc, 0, 0, bitmap->bmiHeader.biWidth, 571 ::SetDIBitsToDevice(dc, 0, 0, bitmap->bmiHeader.biWidth,
571 bitmap->bmiHeader.biHeight, 0, 0, 0, 572 bitmap->bmiHeader.biHeight, 0, 0, 0,
572 bitmap->bmiHeader.biHeight, bitmap_bits, bitmap, 573 bitmap->bmiHeader.biHeight, bitmap_bits, bitmap,
573 DIB_RGB_COLORS); 574 DIB_RGB_COLORS);
574 } 575 }
575 // Windows doesn't really handle alpha channels well in many situations. When 576 // Windows doesn't really handle alpha channels well in many situations. When
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 if (!clipboard_owner_) 822 if (!clipboard_owner_)
822 return NULL; 823 return NULL;
823 824
824 if (clipboard_owner_->hwnd() == NULL) 825 if (clipboard_owner_->hwnd() == NULL)
825 clipboard_owner_->Create(base::Bind(&ClipboardOwnerWndProc)); 826 clipboard_owner_->Create(base::Bind(&ClipboardOwnerWndProc));
826 827
827 return clipboard_owner_->hwnd(); 828 return clipboard_owner_->hwnd();
828 } 829 }
829 830
830 } // namespace ui 831 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698