| 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" | |
| 10 | 9 |
| 11 namespace gfx { | 10 namespace gfx { |
| 12 class Point; | 11 class Point; |
| 13 class Rect; | 12 class Rect; |
| 14 class Size; | 13 class Size; |
| 15 } // namespace gfx | 14 } // namespace gfx |
| 16 | 15 |
| 17 namespace content { | 16 namespace content { |
| 18 class RenderWidgetHostView; | 17 class RenderWidgetHostView; |
| 19 | 18 |
| 20 // Returns scale factor of the display nearest to |view|. | 19 // Returns scale factor of the display nearest to |view|. |
| 21 // Returns ui::SCALE_FACTOR_100P if the platform does not support DIP. | 20 // Returns 1.0f if the platform does not support DIP. |
| 22 CONTENT_EXPORT ui::ScaleFactor GetScaleFactorForView( | 21 CONTENT_EXPORT float GetScaleFactorForView(const RenderWidgetHostView* view); |
| 23 const RenderWidgetHostView* view); | |
| 24 | 22 |
| 25 // Utility functions that convert point/size/rect between DIP and pixel | 23 // Utility functions that convert point/size/rect between DIP and pixel |
| 26 // coordinate system. | 24 // coordinate system. |
| 27 CONTENT_EXPORT gfx::Point ConvertViewPointToDIP( | 25 CONTENT_EXPORT gfx::Point ConvertViewPointToDIP( |
| 28 const RenderWidgetHostView* view, const gfx::Point& point_in_pixel); | 26 const RenderWidgetHostView* view, const gfx::Point& point_in_pixel); |
| 29 CONTENT_EXPORT gfx::Size ConvertViewSizeToPixel( | 27 CONTENT_EXPORT gfx::Size ConvertViewSizeToPixel( |
| 30 const RenderWidgetHostView* view, const gfx::Size& size_in_dip); | 28 const RenderWidgetHostView* view, const gfx::Size& size_in_dip); |
| 31 CONTENT_EXPORT gfx::Rect ConvertViewRectToPixel( | 29 CONTENT_EXPORT gfx::Rect ConvertViewRectToPixel( |
| 32 const RenderWidgetHostView* view, const gfx::Rect& rect_in_dip); | 30 const RenderWidgetHostView* view, const gfx::Rect& rect_in_dip); |
| 33 | 31 |
| 34 CONTENT_EXPORT gfx::Size ConvertSizeToDIP( | 32 CONTENT_EXPORT gfx::Size ConvertSizeToDIP( |
| 35 float scale_factor, const gfx::Size& size_in_pixel); | 33 float scale_factor, const gfx::Size& size_in_pixel); |
| 36 CONTENT_EXPORT gfx::Rect ConvertRectToDIP( | 34 CONTENT_EXPORT gfx::Rect ConvertRectToDIP( |
| 37 float scale_factor, const gfx::Rect& rect_in_pixel); | 35 float scale_factor, const gfx::Rect& rect_in_pixel); |
| 38 CONTENT_EXPORT gfx::Size ConvertSizeToPixel( | 36 CONTENT_EXPORT gfx::Size ConvertSizeToPixel( |
| 39 float scale_factor, const gfx::Size& size_in_pixel); | 37 float scale_factor, const gfx::Size& size_in_pixel); |
| 40 CONTENT_EXPORT gfx::Rect ConvertRectToPixel( | 38 CONTENT_EXPORT gfx::Rect ConvertRectToPixel( |
| 41 float scale_factor, const gfx::Rect& rect_in_dip); | 39 float scale_factor, const gfx::Rect& rect_in_dip); |
| 42 | 40 |
| 43 } // namespace content | 41 } // namespace content |
| 44 | 42 |
| 45 #endif // CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ | 43 #endif // CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ |
| OLD | NEW |