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

Unified Diff: ui/gfx/geometry/size.h

Issue 1357423009: gfx: Make conversions from Size to SizeF be explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sizefconvert-gfx: . Created 5 years, 3 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/gfx/geometry/rect_f.h ('k') | ui/gfx/geometry/size.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/size.h
diff --git a/ui/gfx/geometry/size.h b/ui/gfx/geometry/size.h
index 7c0b8cf8ff8930d2c3e42cc4be5eab9fec3d3b56..754978672e9054cf482f078872f62fd1bf697aae 100644
--- a/ui/gfx/geometry/size.h
+++ b/ui/gfx/geometry/size.h
@@ -9,7 +9,6 @@
#include <string>
#include "base/compiler_specific.h"
-#include "ui/gfx/geometry/size_f.h"
#include "ui/gfx/gfx_export.h"
#if defined(OS_WIN)
@@ -62,10 +61,6 @@ class GFX_EXPORT Size {
bool IsEmpty() const { return !width() || !height(); }
- operator SizeF() const {
- return SizeF(static_cast<float>(width()), static_cast<float>(height()));
- }
-
std::string ToString() const;
private:
@@ -86,6 +81,20 @@ inline bool operator!=(const Size& lhs, const Size& rhs) {
// This should not be used in production code - call ToString() instead.
void PrintTo(const Size& size, ::std::ostream* os);
+// Helper methods to scale a gfx::Size to a new gfx::Size.
+GFX_EXPORT Size ScaleToCeiledSize(const Size& size,
+ float x_scale,
+ float y_scale);
+GFX_EXPORT Size ScaleToCeiledSize(const Size& size, float x_scale);
+GFX_EXPORT Size ScaleToFlooredSize(const Size& size,
+ float x_scale,
+ float y_scale);
+GFX_EXPORT Size ScaleToFlooredSize(const Size& size, float x_scale);
+GFX_EXPORT Size ScaleToRoundedSize(const Size& size,
+ float x_scale,
+ float y_scale);
+GFX_EXPORT Size ScaleToRoundedSize(const Size& size, float x_scale);
+
} // namespace gfx
#endif // UI_GFX_GEOMETRY_SIZE_H_
« no previous file with comments | « ui/gfx/geometry/rect_f.h ('k') | ui/gfx/geometry/size.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698