diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-01 18:18:03 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-01 18:18:03 +0000 |
commit | c665eb327f8f3486c454a95782ffdad4e79fde2c (patch) | |
tree | 01d2156127a92605a95e7d63e63f718979aa0151 /base | |
parent | 938e1f9ec9e6e1d267dbff0c9bb50d5952937bc7 (diff) | |
download | chromium_src-c665eb327f8f3486c454a95782ffdad4e79fde2c.zip chromium_src-c665eb327f8f3486c454a95782ffdad4e79fde2c.tar.gz chromium_src-c665eb327f8f3486c454a95782ffdad4e79fde2c.tar.bz2 |
Remove base/gfx/.
BUG=none
TEST=trybots
Review URL: http://codereview.chromium.org/1570005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43362 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/gfx/point.h | 80 | ||||
-rw-r--r-- | base/gfx/rect.h | 165 | ||||
-rw-r--r-- | base/gfx/size.h | 83 |
3 files changed, 0 insertions, 328 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_ |