summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/gfx/point.h80
-rw-r--r--base/gfx/rect.h165
-rw-r--r--base/gfx/size.h83
-rw-r--r--chrome/browser/gtk/tab_contents_drag_source.h2
-rw-r--r--chrome/browser/notifications/notification_test_util.h2
-rw-r--r--gfx/point.h10
-rw-r--r--gfx/rect.h10
-rw-r--r--gfx/size.h10
8 files changed, 15 insertions, 347 deletions
diff --git a/base/gfx/point.h b/base/gfx/point.h
deleted file mode 100644
index 513d555..0000000
--- a/base/gfx/point.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_GFX_POINT_H__
-#define BASE_GFX_POINT_H__
-
-#include "build/build_config.h"
-
-#include <iosfwd>
-
-#if defined(OS_WIN)
-typedef unsigned long DWORD;
-typedef struct tagPOINT POINT;
-#elif defined(OS_MACOSX)
-#include <ApplicationServices/ApplicationServices.h>
-#endif
-
-namespace gfx {
-
-//
-// A point has an x and y coordinate.
-//
-class Point {
- public:
- Point();
- Point(int x, int y);
-#if defined(OS_WIN)
- // |point| is a DWORD value that contains a coordinate. The x-coordinate is
- // the low-order short and the y-coordinate is the high-order short. This
- // value is commonly acquired from GetMessagePos/GetCursorPos.
- explicit Point(DWORD point);
- explicit Point(const POINT& point);
- Point& operator=(const POINT& point);
-#elif defined(OS_MACOSX)
- explicit Point(const CGPoint& point);
-#endif
-
- ~Point() {}
-
- int x() const { return x_; }
- int y() const { return y_; }
-
- void SetPoint(int x, int y) {
- x_ = x;
- y_ = y;
- }
-
- void set_x(int x) { x_ = x; }
- void set_y(int y) { y_ = y; }
-
- void Offset(int delta_x, int delta_y) {
- x_ += delta_x;
- y_ += delta_y;
- }
-
- bool operator==(const Point& rhs) const {
- return x_ == rhs.x_ && y_ == rhs.y_;
- }
-
- bool operator!=(const Point& rhs) const {
- return !(*this == rhs);
- }
-
-#if defined(OS_WIN)
- POINT ToPOINT() const;
-#elif defined(OS_MACOSX)
- CGPoint ToCGPoint() const;
-#endif
-
- private:
- int x_;
- int y_;
-};
-
-} // namespace gfx
-
-std::ostream& operator<<(std::ostream& out, const gfx::Point& p);
-
-#endif // BASE_GFX_POINT_H__
diff --git a/base/gfx/rect.h b/base/gfx/rect.h
deleted file mode 100644
index c3c01ad..0000000
--- a/base/gfx/rect.h
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Defines a simple integer rectangle class. The containment semantics
-// are array-like; that is, the coordinate (x, y) is considered to be
-// contained by the rectangle, but the coordinate (x + width, y) is not.
-// The class will happily let you create malformed rectangles (that is,
-// rectangles with negative width and/or height), but there will be assertions
-// in the operations (such as contain()) to complain in this case.
-
-#ifndef BASE_GFX_RECT_H__
-#define BASE_GFX_RECT_H__
-
-#include <iosfwd>
-
-#include "base/gfx/point.h"
-#include "base/gfx/size.h"
-
-#if defined(OS_WIN)
-typedef struct tagRECT RECT;
-#elif defined(USE_X11)
-typedef struct _GdkRectangle GdkRectangle;
-#endif
-
-namespace gfx {
-
-class Rect {
- public:
- Rect();
- Rect(int width, int height);
- Rect(int x, int y, int width, int height);
-#if defined(OS_WIN)
- explicit Rect(const RECT& r);
-#elif defined(OS_MACOSX)
- explicit Rect(const CGRect& r);
-#elif defined(USE_X11)
- explicit Rect(const GdkRectangle& r);
-#endif
- Rect(const gfx::Point& origin, const gfx::Size& size);
-
- ~Rect() {}
-
-#if defined(OS_WIN)
- Rect& operator=(const RECT& r);
-#elif defined(OS_MACOSX)
- Rect& operator=(const CGRect& r);
-#elif defined(USE_X11)
- Rect& operator=(const GdkRectangle& r);
-#endif
-
- int x() const { return origin_.x(); }
- void set_x(int x) { origin_.set_x(x); }
-
- int y() const { return origin_.y(); }
- void set_y(int y) { origin_.set_y(y); }
-
- int width() const { return size_.width(); }
- void set_width(int width);
-
- int height() const { return size_.height(); }
- void set_height(int height);
-
- const gfx::Point& origin() const { return origin_; }
- void set_origin(const gfx::Point& origin) { origin_ = origin; }
-
- const gfx::Size& size() const { return size_; }
- void set_size(const gfx::Size& size) { size_ = size; }
-
- int right() const { return x() + width(); }
- int bottom() const { return y() + height(); }
-
- void SetRect(int x, int y, int width, int height);
-
- // Shrink the rectangle by a horizontal and vertical distance on all sides.
- void Inset(int horizontal, int vertical) {
- Inset(horizontal, vertical, horizontal, vertical);
- }
-
- // Shrink the rectangle by the specified amount on each side.
- void Inset(int left, int top, int right, int bottom);
-
- // Move the rectangle by a horizontal and vertical distance.
- void Offset(int horizontal, int vertical);
- void Offset(const gfx::Point& point) {
- Offset(point.x(), point.y());
- }
-
- // Returns true if the area of the rectangle is zero.
- bool IsEmpty() const { return size_.IsEmpty(); }
-
- bool operator==(const Rect& other) const;
-
- bool operator!=(const Rect& other) const {
- return !(*this == other);
- }
-
-#if defined(OS_WIN)
- // Construct an equivalent Win32 RECT object.
- RECT ToRECT() const;
-#elif defined(USE_X11)
- GdkRectangle ToGdkRectangle() const;
-#elif defined(OS_MACOSX)
- // Construct an equivalent CoreGraphics object.
- CGRect ToCGRect() const;
-#endif
-
- // Returns true if the point identified by point_x and point_y falls inside
- // this rectangle. The point (x, y) is inside the rectangle, but the
- // point (x + width, y + height) is not.
- bool Contains(int point_x, int point_y) const;
-
- // Returns true if the specified point is contained by this rectangle.
- bool Contains(const gfx::Point& point) const {
- return Contains(point.x(), point.y());
- }
-
- // Returns true if this rectangle contains the specified rectangle.
- bool Contains(const Rect& rect) const;
-
- // Returns true if this rectangle intersects the specified rectangle.
- bool Intersects(const Rect& rect) const;
-
- // Computes the intersection of this rectangle with the given rectangle.
- Rect Intersect(const Rect& rect) const;
-
- // Computes the union of this rectangle with the given rectangle. The union
- // is the smallest rectangle containing both rectangles.
- Rect Union(const Rect& rect) const;
-
- // Computes the rectangle resulting from subtracting |rect| from |this|. If
- // |rect| does not intersect completely in either the x- or y-direction, then
- // |*this| is returned. If |rect| contains |this|, then an empty Rect is
- // returned.
- Rect Subtract(const Rect& rect) const;
-
- // Returns true if this rectangle equals that of the supplied rectangle.
- bool Equals(const Rect& rect) const {
- return *this == rect;
- }
-
- // Fits as much of the receiving rectangle into the supplied rectangle as
- // possible, returning the result. For example, if the receiver had
- // a x-location of 2 and a width of 4, and the supplied rectangle had
- // an x-location of 0 with a width of 5, the returned rectangle would have
- // an x-location of 1 with a width of 4.
- Rect AdjustToFit(const Rect& rect) const;
-
- // Returns the center of this rectangle.
- Point CenterPoint() const;
-
- // Returns true if this rectangle shares an entire edge (i.e., same width or
- // same height) with the given rectangle, and the rectangles do not overlap.
- bool SharesEdgeWith(const gfx::Rect& rect) const;
-
- private:
- gfx::Point origin_;
- gfx::Size size_;
-};
-
-} // namespace gfx
-
-std::ostream& operator<<(std::ostream& out, const gfx::Rect& r);
-
-#endif // BASE_GFX_RECT_H__
diff --git a/base/gfx/size.h b/base/gfx/size.h
deleted file mode 100644
index 896908e8..0000000
--- a/base/gfx/size.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_GFX_SIZE_H_
-#define BASE_GFX_SIZE_H_
-
-#include "build/build_config.h"
-
-#include <iosfwd>
-
-#if defined(OS_WIN)
-typedef struct tagSIZE SIZE;
-#elif defined(OS_MACOSX)
-#include <ApplicationServices/ApplicationServices.h>
-#endif
-
-namespace gfx {
-
-//
-// A size has width and height values.
-//
-class Size {
- public:
- Size() : width_(0), height_(0) {}
- Size(int width, int height);
-#if defined(OS_MACOSX)
- explicit Size(const CGSize& s);
-#endif
-
- ~Size() {}
-
-#if defined(OS_MACOSX)
- Size& operator=(const CGSize& s);
-#endif
-
- int width() const { return width_; }
- int height() const { return height_; }
-
- int GetArea() const { return width_ * height_; }
-
- void SetSize(int width, int height) {
- set_width(width);
- set_height(height);
- }
-
- void Enlarge(int width, int height) {
- set_width(width_ + width);
- set_height(height_ + height);
- }
-
- void set_width(int width);
- void set_height(int height);
-
- bool operator==(const Size& s) const {
- return width_ == s.width_ && height_ == s.height_;
- }
-
- bool operator!=(const Size& s) const {
- return !(*this == s);
- }
-
- bool IsEmpty() const {
- // Size doesn't allow negative dimensions, so testing for 0 is enough.
- return (width_ == 0) || (height_ == 0);
- }
-
-#if defined(OS_WIN)
- SIZE ToSIZE() const;
-#elif defined(OS_MACOSX)
- CGSize ToCGSize() const;
-#endif
-
- private:
- int width_;
- int height_;
-};
-
-} // namespace gfx
-
-std::ostream& operator<<(std::ostream& out, const gfx::Size& s);
-
-#endif // BASE_GFX_SIZE_H_
diff --git a/chrome/browser/gtk/tab_contents_drag_source.h b/chrome/browser/gtk/tab_contents_drag_source.h
index b7407f3..65f0ba1 100644
--- a/chrome/browser/gtk/tab_contents_drag_source.h
+++ b/chrome/browser/gtk/tab_contents_drag_source.h
@@ -9,9 +9,9 @@
#include "base/basictypes.h"
#include "base/file_path.h"
-#include "base/gfx/point.h"
#include "base/message_loop.h"
#include "base/string16.h"
+#include "gfx/point.h"
#include "gfx/native_widget_types.h"
#include "googleurl/src/gurl.h"
#include "third_party/skia/include/core/SkBitmap.h"
diff --git a/chrome/browser/notifications/notification_test_util.h b/chrome/browser/notifications/notification_test_util.h
index 95e8fd1..15849c4 100644
--- a/chrome/browser/notifications/notification_test_util.h
+++ b/chrome/browser/notifications/notification_test_util.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_
#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_
-#include "base/gfx/size.h"
#include "chrome/browser/notifications/notification_object_proxy.h"
#include "chrome/browser/notifications/balloon.h"
+#include "gfx/size.h"
// Mock implementation of Javascript object proxy which logs events that
// would have been fired on it. |Logger| class must static "log()" method.
diff --git a/gfx/point.h b/gfx/point.h
index 513d555..6e2cfe7 100644
--- a/gfx/point.h
+++ b/gfx/point.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_GFX_POINT_H__
-#define BASE_GFX_POINT_H__
+#ifndef GFX_POINT_H_
+#define GFX_POINT_H_
#include "build/build_config.h"
@@ -18,9 +18,7 @@ typedef struct tagPOINT POINT;
namespace gfx {
-//
// A point has an x and y coordinate.
-//
class Point {
public:
Point();
@@ -77,4 +75,4 @@ class Point {
std::ostream& operator<<(std::ostream& out, const gfx::Point& p);
-#endif // BASE_GFX_POINT_H__
+#endif // GFX_POINT_H_
diff --git a/gfx/rect.h b/gfx/rect.h
index 315f99c..4a217c2 100644
--- a/gfx/rect.h
+++ b/gfx/rect.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,10 +7,10 @@
// contained by the rectangle, but the coordinate (x + width, y) is not.
// The class will happily let you create malformed rectangles (that is,
// rectangles with negative width and/or height), but there will be assertions
-// in the operations (such as contain()) to complain in this case.
+// in the operations (such as Contains()) to complain in this case.
-#ifndef BASE_GFX_RECT_H__
-#define BASE_GFX_RECT_H__
+#ifndef GFX_RECT_H_
+#define GFX_RECT_H_
#include <iosfwd>
@@ -162,4 +162,4 @@ class Rect {
std::ostream& operator<<(std::ostream& out, const gfx::Rect& r);
-#endif // BASE_GFX_RECT_H__
+#endif // GFX_RECT_H_
diff --git a/gfx/size.h b/gfx/size.h
index 896908e8..e438336 100644
--- a/gfx/size.h
+++ b/gfx/size.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_GFX_SIZE_H_
-#define BASE_GFX_SIZE_H_
+#ifndef GFX_SIZE_H_
+#define GFX_SIZE_H_
#include "build/build_config.h"
@@ -17,9 +17,7 @@ typedef struct tagSIZE SIZE;
namespace gfx {
-//
// A size has width and height values.
-//
class Size {
public:
Size() : width_(0), height_(0) {}
@@ -80,4 +78,4 @@ class Size {
std::ostream& operator<<(std::ostream& out, const gfx::Size& s);
-#endif // BASE_GFX_SIZE_H_
+#endif // GFX_SIZE_H_