From 92a32db931c1303388158f8a9e045e922d0b8dfa Mon Sep 17 00:00:00 2001 From: dsinclair Date: Tue, 14 Feb 2017 14:58:49 +0000 Subject: Revert "Convert CFX_FloatPoint to CFX_PointF" This reverts commit 4797c4240cb9e2d8cd36c583d46cd52ff94af95d. Reason for revert: Reverting chain to see if fixes Chrome roll. Original change's description: > Convert CFX_FloatPoint to CFX_PointF > > The two classes store the same information, remove the CFX_FloatPoint variant. > > Change-Id: Ie598c2ba5af04fb2bb3347dd48c30fd5e4845e62 > Reviewed-on: https://pdfium-review.googlesource.com/2612 > Commit-Queue: dsinclair > Reviewed-by: Tom Sepez > TBR=tsepez@chromium.org,dsinclair@chromium.org,pdfium-reviews@googlegroups.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Ia42074e706983c62d2e57497c3079b3c338343a3 Reviewed-on: https://pdfium-review.googlesource.com/2694 Commit-Queue: dsinclair Reviewed-by: dsinclair --- core/fxcrt/fx_basic_coords.cpp | 4 ++++ core/fxcrt/fx_coordinates.h | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'core/fxcrt') diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp index 35364e8030..c5ee4048a2 100644 --- a/core/fxcrt/fx_basic_coords.cpp +++ b/core/fxcrt/fx_basic_coords.cpp @@ -197,6 +197,10 @@ FX_RECT CFX_FloatRect::GetClosestRect() const { return rect; } +bool CFX_FloatRect::Contains(const CFX_FloatPoint& point) const { + return Contains(point.x, point.y); +} + bool CFX_FloatRect::Contains(const CFX_PointF& point) const { return Contains(point.x, point.y); } diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index 3a5b1feabe..172d794e97 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -245,6 +245,21 @@ struct FX_RECT { int32_t bottom; }; +// LBRT rectangles (y-axis runs upwards). +class CFX_FloatPoint { + public: + CFX_FloatPoint() : x(0.0f), y(0.0f) {} + CFX_FloatPoint(FX_FLOAT xx, FX_FLOAT yy) : x(xx), y(yy) {} + + bool operator==(const CFX_FloatPoint& that) const { + return x == that.x && y == that.y; + } + bool operator!=(const CFX_FloatPoint& that) const { return !(*this == that); } + + FX_FLOAT x; + FX_FLOAT y; +}; + // LTWH rectangles (y-axis runs downwards). template class CFX_RTemplate { @@ -480,6 +495,7 @@ class CFX_FloatRect { } bool IsEmpty() const { return left >= right || bottom >= top; } + bool Contains(const CFX_FloatPoint& point) const; bool Contains(const CFX_PointF& point) const; bool Contains(const CFX_FloatRect& other_rect) const; bool Contains(FX_FLOAT x, FX_FLOAT y) const; -- cgit v1.2.3