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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc

Issue 1889423002: Move Windows DPI Code from ui/gfx to ui/display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a TODO Created 4 years, 8 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 | « ui/views/controls/menu/menu_separator_win.cc ('k') | no next file » | 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 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "third_party/skia/include/core/SkPath.h" 8 #include "third_party/skia/include/core/SkPath.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
11 #include "ui/aura/client/cursor_client.h" 11 #include "ui/aura/client/cursor_client.h"
12 #include "ui/aura/client/focus_client.h" 12 #include "ui/aura/client/focus_client.h"
13 #include "ui/aura/window_event_dispatcher.h" 13 #include "ui/aura/window_event_dispatcher.h"
14 #include "ui/aura/window_property.h" 14 #include "ui/aura/window_property.h"
15 #include "ui/base/cursor/cursor_loader_win.h" 15 #include "ui/base/cursor/cursor_loader_win.h"
16 #include "ui/base/ime/input_method.h" 16 #include "ui/base/ime/input_method.h"
17 #include "ui/base/win/shell.h" 17 #include "ui/base/win/shell.h"
18 #include "ui/compositor/compositor_constants.h" 18 #include "ui/compositor/compositor_constants.h"
19 #include "ui/compositor/paint_context.h" 19 #include "ui/compositor/paint_context.h"
20 #include "ui/display/win/dpi.h"
20 #include "ui/display/win/screen_win.h" 21 #include "ui/display/win/screen_win.h"
21 #include "ui/gfx/geometry/insets.h" 22 #include "ui/gfx/geometry/insets.h"
22 #include "ui/gfx/geometry/vector2d.h" 23 #include "ui/gfx/geometry/vector2d.h"
23 #include "ui/gfx/native_widget_types.h" 24 #include "ui/gfx/native_widget_types.h"
24 #include "ui/gfx/path.h" 25 #include "ui/gfx/path.h"
25 #include "ui/gfx/path_win.h" 26 #include "ui/gfx/path_win.h"
26 #include "ui/gfx/win/dpi.h"
27 #include "ui/native_theme/native_theme_aura.h" 27 #include "ui/native_theme/native_theme_aura.h"
28 #include "ui/native_theme/native_theme_win.h" 28 #include "ui/native_theme/native_theme_win.h"
29 #include "ui/views/corewm/tooltip_win.h" 29 #include "ui/views/corewm/tooltip_win.h"
30 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h" 30 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h"
31 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" 31 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h"
32 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" 32 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h"
33 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 33 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
34 #include "ui/views/widget/root_view.h" 34 #include "ui/views/widget/root_view.h"
35 #include "ui/views/widget/widget_delegate.h" 35 #include "ui/views/widget/widget_delegate.h"
36 #include "ui/views/widget/widget_hwnd_utils.h" 36 #include "ui/views/widget/widget_hwnd_utils.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 gfx::Rect pixel_bounds = gfx::Rect(monitor_info.rcWork); 299 gfx::Rect pixel_bounds = gfx::Rect(monitor_info.rcWork);
300 return display::win::ScreenWin::ScreenToDIPRect(GetHWND(), pixel_bounds); 300 return display::win::ScreenWin::ScreenToDIPRect(GetHWND(), pixel_bounds);
301 } 301 }
302 302
303 void DesktopWindowTreeHostWin::SetShape(SkRegion* native_region) { 303 void DesktopWindowTreeHostWin::SetShape(SkRegion* native_region) {
304 if (native_region) { 304 if (native_region) {
305 // TODO(wez): This would be a lot simpler if we were passed an SkPath. 305 // TODO(wez): This would be a lot simpler if we were passed an SkPath.
306 // See crbug.com/410593. 306 // See crbug.com/410593.
307 SkRegion* shape = native_region; 307 SkRegion* shape = native_region;
308 SkRegion device_region; 308 SkRegion device_region;
309 if (gfx::GetDPIScale() > 1.0) { 309 if (display::win::GetDPIScale() > 1.0) {
310 shape = &device_region; 310 shape = &device_region;
311 const float& scale = gfx::GetDPIScale(); 311 const float& scale = display::win::GetDPIScale();
312 std::vector<SkIRect> rects; 312 std::vector<SkIRect> rects;
313 for (SkRegion::Iterator it(*native_region); !it.done(); it.next()) { 313 for (SkRegion::Iterator it(*native_region); !it.done(); it.next()) {
314 const SkIRect& rect = it.rect(); 314 const SkIRect& rect = it.rect();
315 SkRect scaled_rect = 315 SkRect scaled_rect =
316 SkRect::MakeLTRB(rect.left() * scale, rect.top() * scale, 316 SkRect::MakeLTRB(rect.left() * scale, rect.top() * scale,
317 rect.right() * scale, rect.bottom() * scale); 317 rect.right() * scale, rect.bottom() * scale);
318 SkIRect rounded_scaled_rect; 318 SkIRect rounded_scaled_rect;
319 scaled_rect.roundOut(&rounded_scaled_rect); 319 scaled_rect.roundOut(&rounded_scaled_rect);
320 rects.push_back(rounded_scaled_rect); 320 rects.push_back(rounded_scaled_rect);
321 } 321 }
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 981
982 // static 982 // static
983 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( 983 DesktopWindowTreeHost* DesktopWindowTreeHost::Create(
984 internal::NativeWidgetDelegate* native_widget_delegate, 984 internal::NativeWidgetDelegate* native_widget_delegate,
985 DesktopNativeWidgetAura* desktop_native_widget_aura) { 985 DesktopNativeWidgetAura* desktop_native_widget_aura) {
986 return new DesktopWindowTreeHostWin(native_widget_delegate, 986 return new DesktopWindowTreeHostWin(native_widget_delegate,
987 desktop_native_widget_aura); 987 desktop_native_widget_aura);
988 } 988 }
989 989
990 } // namespace views 990 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_separator_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698