Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(730)

Unified Diff: core/fxcrt/include/fx_coordinates.h

Issue 2248463002: Get rid of FX_SMALL_RECT. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@fontclean
Patch Set: nits Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/fpdf_font/fpdf_font.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/include/fx_coordinates.h
diff --git a/core/fxcrt/include/fx_coordinates.h b/core/fxcrt/include/fx_coordinates.h
index e9c05ec644d38147cf5dbbb8e507e827eaf37d11..49f6a19859d717e29f80f1a471581c8fda558846 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();
}
« no previous file with comments | « core/fpdfapi/fpdf_font/fpdf_font.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698