Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ |
| 7 | 7 |
| 8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
| 9 #include "ui/base/layout.h" | 9 #include "ui/base/layout.h" |
| 10 | 10 |
| 11 namespace gfx { | 11 namespace gfx { |
| 12 class Point; | 12 class Point; |
| 13 class Rect; | 13 class Rect; |
| 14 class Size; | 14 class Size; |
| 15 } // namespace gfx | 15 } // namespace gfx |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 class RenderWidgetHostView; | 18 class RenderWidgetHostView; |
| 19 | 19 |
| 20 // Returns scale factor of the display nearest to |view|. | 20 // Returns scale factor of the display nearest to |view|. |
| 21 // Returns ui::SCALE_FACTOR_100P if the platform does not support DIP. | 21 // Returns ui::SCALE_FACTOR_100P if the platform does not support DIP. |
| 22 CONTENT_EXPORT ui::ScaleFactor GetScaleFactorForView( | 22 CONTENT_EXPORT ui::ScaleFactor GetScaleFactorForView( |
| 23 const RenderWidgetHostView* view); | 23 const RenderWidgetHostView* view); |
| 24 | 24 |
| 25 // Utility functions that convert point/size/rect between DIP and pixel | 25 // Utility functions that convert point/size/rect between DIP and pixel |
| 26 // coordinate system. | 26 // coordinate system. |
| 27 CONTENT_EXPORT gfx::Size ConvertSizeToDIP(float scale_factor, | |
| 28 const gfx::Size& size_in_pixel); | |
|
piman
2013/05/24 01:03:41
nit: the style guide eschews overloading...
Maybe
ccameron
2013/05/24 09:45:03
Good idea -- I pruned them down to the functions t
| |
| 27 CONTENT_EXPORT gfx::Point ConvertPointToDIP(const RenderWidgetHostView* view, | 29 CONTENT_EXPORT gfx::Point ConvertPointToDIP(const RenderWidgetHostView* view, |
| 28 const gfx::Point& point_in_pixel); | 30 const gfx::Point& point_in_pixel); |
| 29 CONTENT_EXPORT gfx::Size ConvertSizeToDIP(const RenderWidgetHostView* view, | 31 CONTENT_EXPORT gfx::Size ConvertSizeToDIP(const RenderWidgetHostView* view, |
| 30 const gfx::Size& size_in_pixel); | 32 const gfx::Size& size_in_pixel); |
| 33 CONTENT_EXPORT gfx::Rect ConvertRectToDIP(float scale_factor, | |
| 34 const gfx::Rect& rect_in_pixel); | |
| 31 CONTENT_EXPORT gfx::Rect ConvertRectToDIP(const RenderWidgetHostView* view, | 35 CONTENT_EXPORT gfx::Rect ConvertRectToDIP(const RenderWidgetHostView* view, |
| 32 const gfx::Rect& rect_in_pixel); | 36 const gfx::Rect& rect_in_pixel); |
| 33 CONTENT_EXPORT gfx::Point ConvertPointToPixel(const RenderWidgetHostView* view, | 37 CONTENT_EXPORT gfx::Point ConvertPointToPixel(const RenderWidgetHostView* view, |
| 34 const gfx::Point& point_in_dip); | 38 const gfx::Point& point_in_dip); |
| 35 CONTENT_EXPORT gfx::Size ConvertSizeToPixel(const RenderWidgetHostView* view, | 39 CONTENT_EXPORT gfx::Size ConvertSizeToPixel(const RenderWidgetHostView* view, |
| 36 const gfx::Size& size_in_dip); | 40 const gfx::Size& size_in_dip); |
| 41 CONTENT_EXPORT gfx::Rect ConvertRectToPixel(float scale_factor, | |
| 42 const gfx::Rect& rect_in_dip); | |
| 37 CONTENT_EXPORT gfx::Rect ConvertRectToPixel(const RenderWidgetHostView* view, | 43 CONTENT_EXPORT gfx::Rect ConvertRectToPixel(const RenderWidgetHostView* view, |
| 38 const gfx::Rect& rect_in_dip); | 44 const gfx::Rect& rect_in_dip); |
| 39 } // namespace content | 45 } // namespace content |
| 40 | 46 |
| 41 #endif // CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ | 47 #endif // CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ |
| OLD | NEW |