summaryrefslogtreecommitdiffstats
path: root/base/gfx/size.cc
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-26 22:10:13 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-26 22:10:13 +0000
commitbe36adf48521bae3965b79a852501c696413f133 (patch)
tree0458f2785af75473570b2604431e3f77b7cd9d88 /base/gfx/size.cc
parentb50ed4828c28ac9b4baad3801a1f9938e913d289 (diff)
downloadchromium_src-be36adf48521bae3965b79a852501c696413f133.zip
chromium_src-be36adf48521bae3965b79a852501c696413f133.tar.gz
chromium_src-be36adf48521bae3965b79a852501c696413f133.tar.bz2
Change Size::IsEmpty() to be consistent with Rect::IsEmpty()
Change Size to not accept negative dimensions to be consistent with Rect. BUG=10992 TEST=base_unittests.exe --gtest_filter=RectTest.IsEmpty Review URL: http://codereview.chromium.org/93131 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14567 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/gfx/size.cc')
-rw-r--r--base/gfx/size.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/base/gfx/size.cc b/base/gfx/size.cc
index 0264481..018a42c 100644
--- a/base/gfx/size.cc
+++ b/base/gfx/size.cc
@@ -10,8 +10,16 @@
#include <CoreGraphics/CGGeometry.h>
#endif
+#include "base/logging.h"
+
+
namespace gfx {
+Size::Size(int width, int height) {
+ set_width(width);
+ set_height(height);
+}
+
#if defined(OS_WIN)
SIZE Size::ToSIZE() const {
SIZE s;
@@ -25,4 +33,21 @@ CGSize Size::ToCGSize() const {
}
#endif
+void Size::set_width(int width) {
+ if (width < 0) {
+ NOTREACHED();
+ width = 0;
+ }
+ width_ = width;
+}
+
+void Size::set_height(int height) {
+ if (height < 0) {
+ NOTREACHED();
+ height = 0;
+ }
+ height_ = height;
+}
+
+
} // namespace gfx