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

Unified Diff: content/browser/renderer_host/dip_util.cc

Issue 15666007: Use correct device scale factors in Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698