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

Side by Side Diff: content/browser/renderer_host/dip_util.cc

Issue 2688413007: Add display::GetDisplayNearestView (Closed)
Patch Set: add missing files Created 3 years, 10 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
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 "content/browser/renderer_host/dip_util.h" 5 #include "content/browser/renderer_host/dip_util.h"
6 6
7 #include "content/public/browser/render_widget_host_view.h" 7 #include "content/public/browser/render_widget_host_view.h"
8 #include "ui/base/layout.h" 8 #include "ui/base/layout.h"
9 #include "ui/gfx/geometry/dip_util.h" 9 #include "ui/gfx/geometry/dip_util.h"
10 #include "ui/gfx/geometry/point.h" 10 #include "ui/gfx/geometry/point.h"
11 #include "ui/gfx/geometry/point_conversions.h" 11 #include "ui/gfx/geometry/point_conversions.h"
12 #include "ui/gfx/geometry/rect.h" 12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/geometry/rect_conversions.h" 13 #include "ui/gfx/geometry/rect_conversions.h"
14 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
15 #include "ui/gfx/geometry/size_conversions.h" 15 #include "ui/gfx/geometry/size_conversions.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 float GetScaleFactorForView(const RenderWidgetHostView* view) { 19 float GetScaleFactorForView(const RenderWidgetHostView* view) {
20 return ui::GetScaleFactorForNativeView(view ? view->GetNativeView() : NULL); 20 return view ? view->GetScaleFactorForNativeView() : 1.f;
21 } 21 }
22 22
23 gfx::Point ConvertViewPointToDIP(const RenderWidgetHostView* view, 23 gfx::Point ConvertViewPointToDIP(const RenderWidgetHostView* view,
24 const gfx::Point& point_in_pixel) { 24 const gfx::Point& point_in_pixel) {
25 return gfx::ConvertPointToDIP(GetScaleFactorForView(view), point_in_pixel); 25 return gfx::ConvertPointToDIP(GetScaleFactorForView(view), point_in_pixel);
26 } 26 }
27 27
28 gfx::Size ConvertViewSizeToPixel(const RenderWidgetHostView* view, 28 gfx::Size ConvertViewSizeToPixel(const RenderWidgetHostView* view,
29 const gfx::Size& size_in_dip) { 29 const gfx::Size& size_in_dip) {
30 return gfx::ConvertSizeToPixel(GetScaleFactorForView(view), size_in_dip); 30 return gfx::ConvertSizeToPixel(GetScaleFactorForView(view), size_in_dip);
31 } 31 }
32 32
33 gfx::Rect ConvertViewRectToPixel(const RenderWidgetHostView* view, 33 gfx::Rect ConvertViewRectToPixel(const RenderWidgetHostView* view,
34 const gfx::Rect& rect_in_dip) { 34 const gfx::Rect& rect_in_dip) {
35 return gfx::ConvertRectToPixel(GetScaleFactorForView(view), rect_in_dip); 35 return gfx::ConvertRectToPixel(GetScaleFactorForView(view), rect_in_dip);
36 } 36 }
37 37
38 } // namespace content 38 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698