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

Unified Diff: ui/gfx/geometry/size_f.cc

Issue 662273002: gfx:: De-templatize Size and SizeF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: inlines-size: . Created 6 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/gfx/geometry/size_f.h ('k') | ui/gfx/geometry/size_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/size_f.cc
diff --git a/ui/gfx/geometry/size_f.cc b/ui/gfx/geometry/size_f.cc
index 10c144575e7677cd242776b08bd4589071c9d01c..6d08e18c62ea5b1ad33dee9cecf26e0ff347e47a 100644
--- a/ui/gfx/geometry/size_f.cc
+++ b/ui/gfx/geometry/size_f.cc
@@ -8,7 +8,23 @@
namespace gfx {
-template class SizeBase<SizeF, float>;
+float SizeF::GetArea() const {
+ return width() * height();
+}
+
+void SizeF::Enlarge(float grow_width, float grow_height) {
+ SetSize(width() + grow_width, height() + grow_height);
+}
+
+void SizeF::SetToMin(const SizeF& other) {
+ width_ = width() <= other.width() ? width() : other.width();
+ height_ = height() <= other.height() ? height() : other.height();
+}
+
+void SizeF::SetToMax(const SizeF& other) {
+ width_ = width() >= other.width() ? width() : other.width();
+ height_ = height() >= other.height() ? height() : other.height();
+}
std::string SizeF::ToString() const {
return base::StringPrintf("%fx%f", width(), height());
« no previous file with comments | « ui/gfx/geometry/size_f.h ('k') | ui/gfx/geometry/size_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698