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

Side by Side Diff: ui/views/controls/menu/menu_separator_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/BUILD.gn ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_win.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 #include "ui/views/controls/menu/menu_separator.h" 5 #include "ui/views/controls/menu/menu_separator.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <uxtheme.h> 8 #include <uxtheme.h>
9 #include <Vssym32.h> 9 #include <Vssym32.h>
10 10
11 #include "ui/display/win/dpi.h"
11 #include "ui/gfx/canvas.h" 12 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/geometry/rect.h" 13 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/win/dpi.h"
14 #include "ui/native_theme/native_theme.h" 14 #include "ui/native_theme/native_theme.h"
15 #include "ui/native_theme/native_theme_aura.h" 15 #include "ui/native_theme/native_theme_aura.h"
16 #include "ui/views/controls/menu/menu_item_view.h" 16 #include "ui/views/controls/menu/menu_item_view.h"
17 17
18 namespace views { 18 namespace views {
19 19
20 void MenuSeparator::OnPaint(gfx::Canvas* canvas) { 20 void MenuSeparator::OnPaint(gfx::Canvas* canvas) {
21 ui::NativeTheme* native_theme = GetNativeTheme(); 21 ui::NativeTheme* native_theme = GetNativeTheme();
22 if (native_theme == ui::NativeThemeAura::instance()) { 22 if (native_theme == ui::NativeThemeAura::instance()) {
23 OnPaintAura(canvas); 23 OnPaintAura(canvas);
24 return; 24 return;
25 } 25 }
26 26
27 gfx::Rect separator_bounds = GetPaintBounds(); 27 gfx::Rect separator_bounds = GetPaintBounds();
28 28
29 // Hack to get the separator to display correctly on Windows where we may 29 // Hack to get the separator to display correctly on Windows where we may
30 // have fractional scales. We move the separator 1 pixel down to ensure that 30 // have fractional scales. We move the separator 1 pixel down to ensure that
31 // it falls within the clipping rect which is scaled up. 31 // it falls within the clipping rect which is scaled up.
32 float device_scale = gfx::GetDPIScale(); 32 float device_scale = display::win::GetDPIScale();
33 bool is_fractional_scale = 33 bool is_fractional_scale =
34 (device_scale - static_cast<int>(device_scale) != 0); 34 (device_scale - static_cast<int>(device_scale) != 0);
35 if (is_fractional_scale && separator_bounds.y() == 0) 35 if (is_fractional_scale && separator_bounds.y() == 0)
36 separator_bounds.set_y(1); 36 separator_bounds.set_y(1);
37 37
38 ui::NativeTheme::ExtraParams extra; 38 ui::NativeTheme::ExtraParams extra;
39 native_theme->Paint( 39 native_theme->Paint(
40 canvas->sk_canvas(), ui::NativeTheme::kMenuPopupSeparator, 40 canvas->sk_canvas(), ui::NativeTheme::kMenuPopupSeparator,
41 ui::NativeTheme::kNormal, separator_bounds, extra); 41 ui::NativeTheme::kNormal, separator_bounds, extra);
42 } 42 }
43 43
44 } // namespace views 44 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698