Index: content/browser/renderer_host/dip_util.cc |
diff --git a/content/browser/renderer_host/dip_util.cc b/content/browser/renderer_host/dip_util.cc |
index 575232c659b985d2fd9947f0f7fc66be7f8295f1..e1308807ff857f9cc6b30c46c5ff85318bed1c5c 100644 |
--- a/content/browser/renderer_host/dip_util.cc |
+++ b/content/browser/renderer_host/dip_util.cc |
@@ -33,16 +33,26 @@ gfx::Point ConvertPointToDIP(const RenderWidgetHostView* view, |
gfx::ScalePoint(point_in_pixel, 1.0f / GetScaleForView(view))); |
} |
-gfx::Size ConvertSizeToDIP(const RenderWidgetHostView* view, |
+gfx::Size ConvertSizeToDIP(float scale_factor, |
const gfx::Size& size_in_pixel) { |
return gfx::ToFlooredSize( |
- gfx::ScaleSize(size_in_pixel, 1.0f / GetScaleForView(view))); |
+ gfx::ScaleSize(size_in_pixel, 1.0f / scale_factor)); |
+} |
+ |
+gfx::Size ConvertSizeToDIP(const RenderWidgetHostView* view, |
+ const gfx::Size& size_in_pixel) { |
+ return ConvertSizeToDIP(GetScaleForView(view), size_in_pixel); |
+} |
+ |
+gfx::Rect ConvertRectToDIP(float scale_factor, |
+ const gfx::Rect& rect_in_pixel) { |
+ return gfx::ToFlooredRectDeprecated( |
+ gfx::ScaleRect(rect_in_pixel, 1.0f / scale_factor)); |
} |
gfx::Rect ConvertRectToDIP(const RenderWidgetHostView* view, |
const gfx::Rect& rect_in_pixel) { |
- float scale = 1.0f / GetScaleForView(view); |
- return gfx::ToFlooredRectDeprecated(gfx::ScaleRect(rect_in_pixel, scale)); |
+ return ConvertRectToDIP(GetScaleForView(view), rect_in_pixel); |
} |
gfx::Point ConvertPointToPixel(const RenderWidgetHostView* view, |
@@ -57,10 +67,15 @@ gfx::Size ConvertSizeToPixel(const RenderWidgetHostView* view, |
gfx::ScaleSize(size_in_dip, GetScaleForView(view))); |
} |
+gfx::Rect ConvertRectToPixel(float scale_factor, |
+ const gfx::Rect& rect_in_dip) { |
+ return gfx::ToFlooredRectDeprecated( |
+ gfx::ScaleRect(rect_in_dip, scale_factor)); |
+} |
+ |
gfx::Rect ConvertRectToPixel(const RenderWidgetHostView* view, |
const gfx::Rect& rect_in_dip) { |
- float scale = GetScaleForView(view); |
- return gfx::ToFlooredRectDeprecated(gfx::ScaleRect(rect_in_dip, scale)); |
+ return ConvertRectToPixel(GetScaleForView(view), rect_in_dip); |
} |
} // namespace content |