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

Unified Diff: ui/compositor/dip_util.cc

Issue 11081007: Remove implicit flooring Scale() method from Point and Size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
« no previous file with comments | « ui/base/x/x11_util.cc ('k') | ui/compositor/layer.cc » ('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 eff86e2b836c37a1a733f7341f3371b13108210f..b7731d48c572e9fc8d961924383b5bd71dec980d 100644
--- a/ui/compositor/dip_util.cc
+++ b/ui/compositor/dip_util.cc
@@ -11,8 +11,10 @@
#include "ui/compositor/layer.h"
#include "ui/gfx/display.h"
#include "ui/gfx/point.h"
+#include "ui/gfx/point_conversions.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
+#include "ui/gfx/size_conversions.h"
namespace ui {
@@ -22,35 +24,38 @@ float GetDeviceScaleFactor(const Layer* layer) {
gfx::Point ConvertPointToDIP(const Layer* layer,
const gfx::Point& point_in_pixel) {
- return point_in_pixel.Scale(1.0f / GetDeviceScaleFactor(layer));
+ return gfx::ToFlooredPoint(
+ point_in_pixel.Scale(1.0f / GetDeviceScaleFactor(layer)));
}
gfx::Size ConvertSizeToDIP(const Layer* layer,
const gfx::Size& size_in_pixel) {
- return size_in_pixel.Scale(1.0f / GetDeviceScaleFactor(layer));
+ return gfx::ToFlooredSize(
+ size_in_pixel.Scale(1.0f / GetDeviceScaleFactor(layer)));
}
gfx::Rect ConvertRectToDIP(const Layer* layer,
const gfx::Rect& rect_in_pixel) {
float scale = 1.0f / GetDeviceScaleFactor(layer);
- return gfx::Rect(rect_in_pixel.origin().Scale(scale),
- rect_in_pixel.size().Scale(scale));
+ return gfx::Rect(gfx::ToFlooredPoint(rect_in_pixel.origin().Scale(scale)),
+ gfx::ToFlooredSize(rect_in_pixel.size().Scale(scale)));
}
gfx::Point ConvertPointToPixel(const Layer* layer,
const gfx::Point& point_in_dip) {
- return point_in_dip.Scale(GetDeviceScaleFactor(layer));
+ return gfx::ToFlooredPoint(
+ point_in_dip.Scale(GetDeviceScaleFactor(layer)));
}
gfx::Size ConvertSizeToPixel(const Layer* layer,
const gfx::Size& size_in_dip) {
- return size_in_dip.Scale(GetDeviceScaleFactor(layer));
+ return gfx::ToFlooredSize(size_in_dip.Scale(GetDeviceScaleFactor(layer)));
}
gfx::Rect ConvertRectToPixel(const Layer* layer,
const gfx::Rect& rect_in_dip) {
float scale = GetDeviceScaleFactor(layer);
- return gfx::Rect(rect_in_dip.origin().Scale(scale),
- rect_in_dip.size().Scale(scale));
+ return gfx::Rect(gfx::ToFlooredPoint(rect_in_dip.origin().Scale(scale)),
+ gfx::ToFlooredSize(rect_in_dip.size().Scale(scale)));
}
} // namespace ui
« no previous file with comments | « ui/base/x/x11_util.cc ('k') | ui/compositor/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698