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

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

Issue 750173002: Move dip utils to gfx/geometry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missed android change Created 6 years, 1 month 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 30490158a3ce0e0ccad4c99515bb6ebb0059b2f9..6952dd920af96309219389f79c6f49a797e9ac9c 100644
--- a/content/browser/renderer_host/dip_util.cc
+++ b/content/browser/renderer_host/dip_util.cc
@@ -7,6 +7,7 @@
#include "content/public/browser/render_widget_host_view.h"
#include "ui/base/layout.h"
#include "ui/gfx/display.h"
+#include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/point.h"
#include "ui/gfx/point_conversions.h"
#include "ui/gfx/rect.h"
@@ -23,41 +24,17 @@ float GetScaleFactorForView(const RenderWidgetHostView* view) {
gfx::Point ConvertViewPointToDIP(const RenderWidgetHostView* view,
const gfx::Point& point_in_pixel) {
- return gfx::ToFlooredPoint(
- gfx::ScalePoint(point_in_pixel, 1.0f / GetScaleFactorForView(view)));
+ return gfx::ConvertPointToDIP(GetScaleFactorForView(view), point_in_pixel);
}
gfx::Size ConvertViewSizeToPixel(const RenderWidgetHostView* view,
const gfx::Size& size_in_dip) {
- return ConvertSizeToPixel(GetScaleFactorForView(view), size_in_dip);
+ return gfx::ConvertSizeToPixel(GetScaleFactorForView(view), size_in_dip);
}
gfx::Rect ConvertViewRectToPixel(const RenderWidgetHostView* view,
const gfx::Rect& rect_in_dip) {
- return ConvertRectToPixel(GetScaleFactorForView(view), rect_in_dip);
-}
-
-gfx::Size ConvertSizeToDIP(float scale_factor,
- const gfx::Size& size_in_pixel) {
- return gfx::ToFlooredSize(
- gfx::ScaleSize(size_in_pixel, 1.0f / scale_factor));
-}
-
-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::Size ConvertSizeToPixel(float scale_factor,
- const gfx::Size& size_in_dip) {
- return gfx::ToFlooredSize(gfx::ScaleSize(size_in_dip, scale_factor));
-}
-
-gfx::Rect ConvertRectToPixel(float scale_factor,
- const gfx::Rect& rect_in_dip) {
- return gfx::ToFlooredRectDeprecated(
- gfx::ScaleRect(rect_in_dip, scale_factor));
+ return gfx::ConvertRectToPixel(GetScaleFactorForView(view), rect_in_dip);
}
} // namespace content
« no previous file with comments | « content/browser/renderer_host/dip_util.h ('k') | content/browser/renderer_host/render_widget_host_view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698