summaryrefslogtreecommitdiffstats
path: root/base/gfx
diff options
context:
space:
mode:
authornsylvain@google.com <nsylvain@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-05 19:19:25 +0000
committernsylvain@google.com <nsylvain@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-05 19:19:25 +0000
commit13f29d976aa29c24a5f912f3d0e2484f397dca42 (patch)
treed078eaaa2ff642f2a029646a12a5127cf6cd9c47 /base/gfx
parentc213ae3cecdb13d713efe1dea8564cd03aec3588 (diff)
downloadchromium_src-13f29d976aa29c24a5f912f3d0e2484f397dca42.zip
chromium_src-13f29d976aa29c24a5f912f3d0e2484f397dca42.tar.gz
chromium_src-13f29d976aa29c24a5f912f3d0e2484f397dca42.tar.bz2
Revert base\gfx changes because it breaks the build
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@386 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/gfx')
-rw-r--r--base/gfx/point.cc14
-rw-r--r--base/gfx/point.h14
-rw-r--r--base/gfx/rect.cc30
-rw-r--r--base/gfx/rect.h15
-rw-r--r--base/gfx/rect_unittest.cc14
-rw-r--r--base/gfx/size.h10
-rw-r--r--base/gfx/size_mac.cc22
7 files changed, 7 insertions, 112 deletions
diff --git a/base/gfx/point.cc b/base/gfx/point.cc
index c8bf413..7c435a0 100644
--- a/base/gfx/point.cc
+++ b/base/gfx/point.cc
@@ -29,9 +29,7 @@
#include "base/gfx/point.h"
-#if defined(OS_WIN)
#include <windows.h>
-#endif
namespace gfx {
@@ -41,7 +39,6 @@ Point::Point() : x_(0), y_(0) {
Point::Point(int x, int y) : x_(x), y_(y) {
}
-#if defined(OS_WIN)
Point::Point(const POINT& point) : x_(point.x), y_(point.y) {
}
@@ -51,16 +48,5 @@ POINT Point::ToPOINT() const {
p.y = y_;
return p;
}
-#elif defined(OS_MACOSX)
-Point::Point(const CGPoint& point) : x_(point.x), y_(point.y) {
-}
-
-CGPoint Point::ToCGPoint() const {
- CGPoint p;
- p.x = x_;
- p.y = y_;
- return p;
-}
-#endif
} // namespace gfx
diff --git a/base/gfx/point.h b/base/gfx/point.h
index e4a5038..3e09a81 100644
--- a/base/gfx/point.h
+++ b/base/gfx/point.h
@@ -30,17 +30,11 @@
#ifndef BASE_GFX_POINT_H__
#define BASE_GFX_POINT_H__
-#include "build/build_config.h"
-
#ifdef UNIT_TEST
#include <iostream>
#endif
-#if defined(OS_WIN)
typedef struct tagPOINT POINT;
-#elif defined(OS_MACOSX)
-#import <ApplicationServices/ApplicationServices.h>
-#endif
namespace gfx {
@@ -51,11 +45,7 @@ class Point {
public:
Point();
Point(int x, int y);
-#if defined(OS_WIN)
explicit Point(const POINT& point);
-#elif defined(OS_MACOSX)
- explicit Point(const CGPoint& point);
-#endif
~Point() {}
@@ -78,11 +68,7 @@ class Point {
return !(*this == rhs);
}
-#if defined(OS_WIN)
POINT ToPOINT() const;
-#elif defined(OS_MACOSX)
- CGPoint ToCGPoint() const;
-#endif
private:
int x_;
diff --git a/base/gfx/rect.cc b/base/gfx/rect.cc
index f9a88d4..dda7e67 100644
--- a/base/gfx/rect.cc
+++ b/base/gfx/rect.cc
@@ -29,11 +29,7 @@
#include "base/gfx/rect.h"
-#if defined(OS_WIN)
#include <windows.h>
-#elif defined(OS_MACOSX)
-#import <CoreGraphics/CGGeometry.h>
-#endif
#include "base/logging.h"
@@ -67,7 +63,6 @@ Rect::Rect(int x, int y, int width, int height)
set_height(height);
}
-#if defined(OS_WIN)
Rect::Rect(const RECT& r)
: origin_(r.left, r.top) {
set_width(r.right - r.left);
@@ -80,20 +75,6 @@ Rect& Rect::operator=(const RECT& r) {
set_height(r.bottom - r.top);
return *this;
}
-#elif defined(OS_MACOSX)
-Rect::Rect(const CGRect& r)
-: origin_(r.origin.x, r.origin.y) {
- set_width(r.size.width);
- set_height(r.size.height);
-}
-
-Rect& Rect::operator=(const CGRect& r) {
- origin_.SetPoint(r.origin.x, r.origin.y);
- set_width(r.size.width);
- set_height(r.size.height);
- return *this;
-}
-#endif
void Rect::set_width(int width) {
if (width < 0) {
@@ -138,7 +119,6 @@ bool Rect::operator==(const Rect& other) const {
return origin_ == other.origin_ && size_ == other.size_;
}
-#if defined(OS_WIN)
RECT Rect::ToRECT() const {
RECT r;
r.left = x();
@@ -147,16 +127,6 @@ RECT Rect::ToRECT() const {
r.bottom = bottom();
return r;
}
-#elif defined(OS_MACOSX)
-CGRect Rect::ToCGRect() const {
- CGRect r;
- r.origin.x = x();
- r.origin.y = y();
- r.size.width = width();
- r.size.height = height();
- return r;
-}
-#endif
bool Rect::Contains(int point_x, int point_y) const {
return (point_x >= x()) && (point_x < right()) &&
diff --git a/base/gfx/rect.h b/base/gfx/rect.h
index d19bf7e..486f799 100644
--- a/base/gfx/rect.h
+++ b/base/gfx/rect.h
@@ -40,9 +40,7 @@
#include "base/gfx/size.h"
#include "base/gfx/point.h"
-#if defined(OS_WIN)
typedef struct tagRECT RECT;
-#endif
namespace gfx {
@@ -51,20 +49,12 @@ class Rect {
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);
-#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);
-#endif
int x() const { return origin_.x(); }
void set_x(int x) { origin_.set_x(x); }
@@ -103,13 +93,8 @@ class Rect {
return !(*this == other);
}
-#if defined(OS_WIN)
// Construct an equivalent Win32 RECT object.
RECT ToRECT() 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
diff --git a/base/gfx/rect_unittest.cc b/base/gfx/rect_unittest.cc
index 2bfcac2..c218cc9 100644
--- a/base/gfx/rect_unittest.cc
+++ b/base/gfx/rect_unittest.cc
@@ -55,7 +55,7 @@ TEST(RectTest, Contains) {
{0, 0, -10, -10, 0, 0, false},
#endif // NDEBUG
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(contains_cases); ++i) {
+ for (int i = 0; i < arraysize(contains_cases); ++i) {
const ContainsCase& value = contains_cases[i];
gfx::Rect rect(value.rect_x, value.rect_y,
value.rect_width, value.rect_height);
@@ -84,7 +84,7 @@ TEST(RectTest, Intersects) {
{ 10, 10, 10, 10, 20, 15, 10, 10, false },
{ 10, 10, 10, 10, 21, 15, 10, 10, false }
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
+ for (size_t i = 0; i < arraysize(tests); ++i) {
gfx::Rect r1(tests[i].x1, tests[i].y1, tests[i].w1, tests[i].h1);
gfx::Rect r2(tests[i].x2, tests[i].y2, tests[i].w2, tests[i].h2);
EXPECT_EQ(tests[i].intersects, r1.Intersects(r2));
@@ -125,7 +125,7 @@ TEST(RectTest, Intersect) {
0, 0, 2, 2,
0, 0, 0, 0 }
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
+ for (size_t i = 0; i < arraysize(tests); ++i) {
gfx::Rect r1(tests[i].x1, tests[i].y1, tests[i].w1, tests[i].h1);
gfx::Rect r2(tests[i].x2, tests[i].y2, tests[i].w2, tests[i].h2);
gfx::Rect r3(tests[i].x3, tests[i].y3, tests[i].w3, tests[i].h3);
@@ -138,7 +138,7 @@ TEST(RectTest, Intersect) {
}
TEST(RectTest, Union) {
- static const struct Test {
+ static const struct {
int x1; // rect 1
int y1;
int w1;
@@ -174,7 +174,7 @@ TEST(RectTest, Union) {
2, 2, 2, 2,
2, 2, 2, 2 }
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
+ for (size_t i = 0; i < arraysize(tests); ++i) {
gfx::Rect r1(tests[i].x1, tests[i].y1, tests[i].w1, tests[i].h1);
gfx::Rect r2(tests[i].x2, tests[i].y2, tests[i].w2, tests[i].h2);
gfx::Rect r3(tests[i].x3, tests[i].y3, tests[i].w3, tests[i].h3);
@@ -196,7 +196,7 @@ TEST(RectTest, Equals) {
}
TEST(RectTest, AdjustToFit) {
- static const struct Test {
+ static const struct {
int x1; // source
int y1;
int w1;
@@ -226,7 +226,7 @@ TEST(RectTest, AdjustToFit) {
0, 0, 3, 3,
2, 2, 1, 1 }
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
+ for (size_t i = 0; i < arraysize(tests); ++i) {
gfx::Rect r1(tests[i].x1, tests[i].y1, tests[i].w1, tests[i].h1);
gfx::Rect r2(tests[i].x2, tests[i].y2, tests[i].w2, tests[i].h2);
gfx::Rect r3(tests[i].x3, tests[i].y3, tests[i].w3, tests[i].h3);
diff --git a/base/gfx/size.h b/base/gfx/size.h
index 4aa612e..cba2e51 100644
--- a/base/gfx/size.h
+++ b/base/gfx/size.h
@@ -30,17 +30,11 @@
#ifndef BASE_GFX_SIZE_H__
#define BASE_GFX_SIZE_H__
-#include "build/build_config.h"
-
#ifdef UNIT_TEST
#include <iostream>
#endif
-#if defined(OS_WIN)
typedef struct tagSIZE SIZE;
-#elif defined(OS_MACOSX)
-#import <ApplicationServices/ApplicationServices.h>
-#endif
namespace gfx {
@@ -77,11 +71,7 @@ class Size {
return !width_ && !height_;
}
-#if defined(OS_WIN)
SIZE ToSIZE() const;
-#elif defined(OS_MACOSX)
- CGSize ToCGSize() const;
-#endif
private:
int width_;
diff --git a/base/gfx/size_mac.cc b/base/gfx/size_mac.cc
deleted file mode 100644
index 1b0abb5..0000000
--- a/base/gfx/size_mac.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2008 Google Inc. All Rights Reserved.
-
-#include "base/gfx/size.h"
-
-#import <CoreGraphics/CoreGraphics.h>
-
-#include <ostream>
-
-namespace gfx {
-
-CGSize Size::ToCGSize() const {
- CGSize s;
- s.width = width_;
- s.height = height_;
- return s;
-}
-
-std::ostream& operator<<(std::ostream& out, const gfx::Size& s) {
- return out << s.width() << "x" << s.height();
-}
-
-} // namespace gfx