1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
9 #include "build/build_config.h"
14 typedef struct tagSIZE SIZE
;
15 #elif defined(OS_MACOSX)
16 #include <ApplicationServices/ApplicationServices.h>
21 // A size has width and height values.
24 Size() : width_(0), height_(0) {}
25 Size(int width
, int height
);
26 #if defined(OS_MACOSX)
27 explicit Size(const CGSize
& s
);
32 #if defined(OS_MACOSX)
33 Size
& operator=(const CGSize
& s
);
36 int width() const { return width_
; }
37 int height() const { return height_
; }
39 int GetArea() const { return width_
* height_
; }
41 void SetSize(int width
, int height
) {
46 void Enlarge(int width
, int height
) {
47 set_width(width_
+ width
);
48 set_height(height_
+ height
);
51 void set_width(int width
);
52 void set_height(int height
);
54 bool operator==(const Size
& s
) const {
55 return width_
== s
.width_
&& height_
== s
.height_
;
58 bool operator!=(const Size
& s
) const {
62 bool IsEmpty() const {
63 // Size doesn't allow negative dimensions, so testing for 0 is enough.
64 return (width_
== 0) || (height_
== 0);
69 #elif defined(OS_MACOSX)
70 CGSize
ToCGSize() const;
78 std::ostream
& operator<<(std::ostream
& out
, const gfx::Size
& s
);