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

Side by Side Diff: ui/views/controls/menu/menu_separator_win.cc

Issue 674763002: remove ui::gfx::GetDeviceScaleFactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dpi-cleanup-3
Patch Set: rebase-4 Created 6 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 | « ui/gfx/win/dpi.cc ('k') | ui/views/win/hwnd_message_handler.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
(...skipping 28 matching lines...) Expand all
39 ui::NativeTheme::kNormal, gutter_bounds, extra); 39 ui::NativeTheme::kNormal, gutter_bounds, extra);
40 separator_bounds.set_x(gutter_bounds.x() + config.gutter_width); 40 separator_bounds.set_x(gutter_bounds.x() + config.gutter_width);
41 } 41 }
42 42
43 ui::NativeTheme::ExtraParams extra; 43 ui::NativeTheme::ExtraParams extra;
44 extra.menu_separator.has_gutter = config.render_gutter; 44 extra.menu_separator.has_gutter = config.render_gutter;
45 45
46 // Hack to get the separator to display correctly on Windows where we may 46 // Hack to get the separator to display correctly on Windows where we may
47 // have fractional scales. We move the separator 1 pixel down to ensure that 47 // have fractional scales. We move the separator 1 pixel down to ensure that
48 // it falls within the clipping rect which is scaled up. 48 // it falls within the clipping rect which is scaled up.
49 float device_scale = gfx::win::GetDeviceScaleFactor(); 49 float device_scale = gfx::GetDPIScale();
50 bool is_fractional_scale = 50 bool is_fractional_scale =
51 (device_scale - static_cast<int>(device_scale) != 0); 51 (device_scale - static_cast<int>(device_scale) != 0);
52 if (is_fractional_scale && separator_bounds.y() == 0) 52 if (is_fractional_scale && separator_bounds.y() == 0)
53 separator_bounds.set_y(1); 53 separator_bounds.set_y(1);
54 54
55 config.native_theme->Paint( 55 config.native_theme->Paint(
56 canvas->sk_canvas(), ui::NativeTheme::kMenuPopupSeparator, 56 canvas->sk_canvas(), ui::NativeTheme::kMenuPopupSeparator,
57 ui::NativeTheme::kNormal, separator_bounds, extra); 57 ui::NativeTheme::kNormal, separator_bounds, extra);
58 } 58 }
59 59
60 } // namespace views 60 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/win/dpi.cc ('k') | ui/views/win/hwnd_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698