Index: ui/gfx/geometry/point.cc |
diff --git a/ui/gfx/geometry/point.cc b/ui/gfx/geometry/point.cc |
index cf8919e2573332295b35e211f83ea35ad78a6e67..0893550e0690a039dd1fa26ccc1ef28a19221f11 100644 |
--- a/ui/gfx/geometry/point.cc |
+++ b/ui/gfx/geometry/point.cc |
@@ -13,6 +13,7 @@ |
#endif |
#include "base/strings/stringprintf.h" |
+#include "ui/gfx/geometry/point_conversions.h" |
namespace gfx { |
@@ -63,4 +64,40 @@ std::string Point::ToString() const { |
return base::StringPrintf("%d,%d", x(), y()); |
} |
+Point ScaleToCeiledPoint(const Point& point, float x_scale, float y_scale) { |
+ if (x_scale == 1.f && y_scale == 1.f) |
+ return point; |
+ return ToCeiledPoint(ScalePoint(gfx::PointF(point), x_scale, y_scale)); |
+} |
+ |
+Point ScaleToCeiledPoint(const Point& point, float scale) { |
sky
2015/10/21 16:45:00
WDYT of inlining the single float variants? For ex
danakj
2015/10/21 17:55:40
I would but they require the PointF definition the
|
+ if (scale == 1.f) |
+ return point; |
+ return ToCeiledPoint(ScalePoint(gfx::PointF(point), scale, scale)); |
+} |
+ |
+Point ScaleToFlooredPoint(const Point& point, float x_scale, float y_scale) { |
+ if (x_scale == 1.f && y_scale == 1.f) |
+ return point; |
+ return ToFlooredPoint(ScalePoint(gfx::PointF(point), x_scale, y_scale)); |
+} |
+ |
+Point ScaleToFlooredPoint(const Point& point, float scale) { |
+ if (scale == 1.f) |
+ return point; |
+ return ToFlooredPoint(ScalePoint(gfx::PointF(point), scale, scale)); |
+} |
+ |
+Point ScaleToRoundedPoint(const Point& point, float x_scale, float y_scale) { |
+ if (x_scale == 1.f && y_scale == 1.f) |
+ return point; |
+ return ToRoundedPoint(ScalePoint(gfx::PointF(point), x_scale, y_scale)); |
+} |
+ |
+Point ScaleToRoundedPoint(const Point& point, float scale) { |
+ if (scale == 1.f) |
+ return point; |
+ return ToRoundedPoint(ScalePoint(gfx::PointF(point), scale, scale)); |
+} |
+ |
} // namespace gfx |