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

Unified Diff: ui/compositor/dip_util.cc

Issue 11369144: ui: Make gfx::Point::Scale() mutate the class, similar to gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes for aura Created 8 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
« cc/layer_impl.cc ('K') | « ui/base/x/x11_util.cc ('k') | ui/gfx/point.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/dip_util.cc
diff --git a/ui/compositor/dip_util.cc b/ui/compositor/dip_util.cc
index b7731d48c572e9fc8d961924383b5bd71dec980d..5adf7c4c35acc4c33273d68fc3020451739ae789 100644
--- a/ui/compositor/dip_util.cc
+++ b/ui/compositor/dip_util.cc
@@ -13,6 +13,7 @@
#include "ui/gfx/point.h"
#include "ui/gfx/point_conversions.h"
#include "ui/gfx/rect.h"
+#include "ui/gfx/rect_conversions.h"
#include "ui/gfx/size.h"
#include "ui/gfx/size_conversions.h"
@@ -25,7 +26,7 @@ float GetDeviceScaleFactor(const Layer* layer) {
gfx::Point ConvertPointToDIP(const Layer* layer,
const gfx::Point& point_in_pixel) {
return gfx::ToFlooredPoint(
- point_in_pixel.Scale(1.0f / GetDeviceScaleFactor(layer)));
+ gfx::ScalePoint(point_in_pixel, 1.0f / GetDeviceScaleFactor(layer)));
}
gfx::Size ConvertSizeToDIP(const Layer* layer,
@@ -37,14 +38,13 @@ gfx::Size ConvertSizeToDIP(const Layer* layer,
gfx::Rect ConvertRectToDIP(const Layer* layer,
const gfx::Rect& rect_in_pixel) {
float scale = 1.0f / GetDeviceScaleFactor(layer);
- return gfx::Rect(gfx::ToFlooredPoint(rect_in_pixel.origin().Scale(scale)),
- gfx::ToFlooredSize(rect_in_pixel.size().Scale(scale)));
+ return gfx::ToFlooredRectDeprecated(gfx::ScaleRect(rect_in_pixel, scale));
}
gfx::Point ConvertPointToPixel(const Layer* layer,
const gfx::Point& point_in_dip) {
return gfx::ToFlooredPoint(
- point_in_dip.Scale(GetDeviceScaleFactor(layer)));
+ gfx::ScalePoint(point_in_dip, GetDeviceScaleFactor(layer)));
}
gfx::Size ConvertSizeToPixel(const Layer* layer,
@@ -55,7 +55,6 @@ gfx::Size ConvertSizeToPixel(const Layer* layer,
gfx::Rect ConvertRectToPixel(const Layer* layer,
const gfx::Rect& rect_in_dip) {
float scale = GetDeviceScaleFactor(layer);
- return gfx::Rect(gfx::ToFlooredPoint(rect_in_dip.origin().Scale(scale)),
- gfx::ToFlooredSize(rect_in_dip.size().Scale(scale)));
+ return gfx::ToFlooredRectDeprecated(gfx::ScaleRect(rect_in_dip, scale));
}
} // namespace ui
« cc/layer_impl.cc ('K') | « ui/base/x/x11_util.cc ('k') | ui/gfx/point.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698