summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-08-15 10:49:24 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-15 10:49:24 -0700
commit1679d3ae2e0e64c7aba811476341a153dcef8b04 (patch)
tree4cac3f15e03e8fb923d0ccdcbeaff2c176f3cff3 /core/fxcrt
parent93ee11937bc2351882648f6aa1127883adbf0268 (diff)
downloadpdfium-1679d3ae2e0e64c7aba811476341a153dcef8b04.tar.xz
Get rid of FX_SMALL_RECT.
Review-Url: https://codereview.chromium.org/2248463002
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/include/fx_coordinates.h33
1 files changed, 5 insertions, 28 deletions
diff --git a/core/fxcrt/include/fx_coordinates.h b/core/fxcrt/include/fx_coordinates.h
index e9c05ec644..49f6a19859 100644
--- a/core/fxcrt/include/fx_coordinates.h
+++ b/core/fxcrt/include/fx_coordinates.h
@@ -124,28 +124,11 @@ typedef CFX_VTemplate<FX_FLOAT> CFX_VectorF;
// TODO(tsepez): Consolidate all these different rectangle classes.
// LTRB rectangles (y-axis runs downwards).
-struct FX_SMALL_RECT {
- FX_SMALL_RECT() : FX_SMALL_RECT(kInvalid, kInvalid, kInvalid, kInvalid) {}
-
- FX_SMALL_RECT(int16_t l, int16_t t, int16_t r, int16_t b)
- : left(l), top(t), right(r), bottom(b) {}
-
- static const int16_t kInvalid = -1;
-
- int16_t left;
- int16_t top;
- int16_t right;
- int16_t bottom;
-};
-
struct FX_RECT {
FX_RECT() : left(0), top(0), right(0), bottom(0) {}
FX_RECT(int l, int t, int r, int b) : left(l), top(t), right(r), bottom(b) {}
- explicit FX_RECT(const FX_SMALL_RECT& other)
- : FX_RECT(other.left, other.top, other.right, other.bottom) {}
-
int Width() const { return right - left; }
int Height() const { return bottom - top; }
bool IsEmpty() const { return right <= left || bottom <= top; }
@@ -178,21 +161,15 @@ struct FX_RECT {
bottom == src.bottom;
}
- FX_BOOL Contains(const FX_RECT& other_rect) const {
+ bool Contains(const FX_RECT& other_rect) const {
return other_rect.left >= left && other_rect.right <= right &&
other_rect.top >= top && other_rect.bottom <= bottom;
}
- FX_BOOL Contains(int x, int y) const {
+ bool Contains(int x, int y) const {
return x >= left && x < right && y >= top && y < bottom;
}
- FX_SMALL_RECT ToSmallRect() const {
- return FX_SMALL_RECT(
- static_cast<uint16_t>(left), static_cast<uint16_t>(top),
- static_cast<uint16_t>(right), static_cast<uint16_t>(bottom));
- }
-
int32_t left;
int32_t top;
int32_t right;
@@ -433,11 +410,11 @@ class CFX_RTemplate {
return width <= fEpsilon || height <= fEpsilon;
}
void Empty() { width = height = 0; }
- FX_BOOL Contains(baseType x, baseType y) const {
+ bool Contains(baseType x, baseType y) const {
return x >= left && x < left + width && y >= top && y < top + height;
}
- FX_BOOL Contains(const FXT_POINT& p) const { return Contains(p.x, p.y); }
- FX_BOOL Contains(const FXT_RECT& rt) const {
+ bool Contains(const FXT_POINT& p) const { return Contains(p.x, p.y); }
+ bool Contains(const FXT_RECT& rt) const {
return rt.left >= left && rt.right() <= right() && rt.top >= top &&
rt.bottom() <= bottom();
}