From f528eee136a602643a7777d87a2cce52cf83f38a Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 14 Feb 2017 11:52:07 -0500 Subject: Reland "Convert CFX_FloatPoint to CFX_PointF" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL updates the CFX_FloatPoint Cl to accommodate for the Origin CL being reverted. Change-Id: I345fe1117938a49ad9ee5f310fe7b5e21d9f1948 Reviewed-on: https://pdfium-review.googlesource.com/2697 Reviewed-by: Nicolás Peña Commit-Queue: dsinclair --- core/fpdfdoc/cpdf_variabletext.cpp | 48 ++++++++++++++++++-------------------- core/fpdfdoc/cpdf_variabletext.h | 18 +++++++------- core/fpdfdoc/cpvt_generateap.cpp | 37 ++++++++++++++--------------- core/fpdfdoc/cpvt_generateap.h | 2 +- core/fpdfdoc/cpvt_line.h | 10 +++++--- core/fpdfdoc/cpvt_lineinfo.h | 23 ++++++++++-------- core/fpdfdoc/cpvt_word.h | 5 ++-- core/fpdfdoc/csection.cpp | 2 +- core/fpdfdoc/csection.h | 5 ++-- core/fpdftext/cpdf_textpage.cpp | 4 ++-- core/fpdftext/cpdf_textpage.h | 2 +- core/fxcrt/fx_basic_coords.cpp | 4 ++++ core/fxcrt/fx_coordinates.h | 17 ++------------ 13 files changed, 86 insertions(+), 91 deletions(-) (limited to 'core') diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp index 546bd9f740..94b3425a09 100644 --- a/core/fpdfdoc/cpdf_variabletext.cpp +++ b/core/fpdfdoc/cpdf_variabletext.cpp @@ -172,8 +172,8 @@ bool CPDF_VariableText::Iterator::GetWord(CPVT_Word& word) const { word.nCharset = pWord->nCharset; word.fWidth = m_pVT->GetWordWidth(*pWord); word.ptWord = m_pVT->InToOut( - CFX_FloatPoint(pWord->fWordX + pSection->m_SecInfo.rcSection.left, - pWord->fWordY + pSection->m_SecInfo.rcSection.top)); + CFX_PointF(pWord->fWordX + pSection->m_SecInfo.rcSection.left, + pWord->fWordY + pSection->m_SecInfo.rcSection.top)); word.fAscent = m_pVT->GetWordAscent(*pWord); word.fDescent = m_pVT->GetWordDescent(*pWord); if (pWord->pWordProps) @@ -205,7 +205,7 @@ bool CPDF_VariableText::Iterator::GetLine(CPVT_Line& line) const { line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1); if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { if (CLine* pLine = pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) { - line.ptLine = m_pVT->InToOut(CFX_FloatPoint( + line.ptLine = m_pVT->InToOut(CFX_PointF( pLine->m_LineInfo.fLineX + pSection->m_SecInfo.rcSection.left, pLine->m_LineInfo.fLineY + pSection->m_SecInfo.rcSection.top)); line.fLineWidth = pLine->m_LineInfo.fLineWidth; @@ -548,8 +548,8 @@ CPVT_WordPlace CPDF_VariableText::GetNextWordPlace( } CPVT_WordPlace CPDF_VariableText::SearchWordPlace( - const CFX_FloatPoint& point) const { - CFX_FloatPoint pt = OutToIn(point); + const CFX_PointF& point) const { + CFX_PointF pt = OutToIn(point); CPVT_WordPlace place = GetBeginWordPlace(); int32_t nLeft = 0; int32_t nRight = m_SectionArray.GetSize() - 1; @@ -574,8 +574,8 @@ CPVT_WordPlace CPDF_VariableText::SearchWordPlace( continue; } else { place = pSection->SearchWordPlace( - CFX_FloatPoint(pt.x - pSection->m_SecInfo.rcSection.left, - pt.y - pSection->m_SecInfo.rcSection.top)); + CFX_PointF(pt.x - pSection->m_SecInfo.rcSection.left, + pt.y - pSection->m_SecInfo.rcSection.top)); place.nSecIndex = nMid; return place; } @@ -592,10 +592,10 @@ CPVT_WordPlace CPDF_VariableText::SearchWordPlace( CPVT_WordPlace CPDF_VariableText::GetUpWordPlace( const CPVT_WordPlace& place, - const CFX_FloatPoint& point) const { + const CFX_PointF& point) const { if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) { CPVT_WordPlace temp = place; - CFX_FloatPoint pt = OutToIn(point); + CFX_PointF pt = OutToIn(point); if (temp.nLineIndex-- > 0) { return pSection->SearchWordPlace( pt.x - pSection->m_SecInfo.rcSection.left, temp); @@ -613,10 +613,10 @@ CPVT_WordPlace CPDF_VariableText::GetUpWordPlace( CPVT_WordPlace CPDF_VariableText::GetDownWordPlace( const CPVT_WordPlace& place, - const CFX_FloatPoint& point) const { + const CFX_PointF& point) const { if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) { CPVT_WordPlace temp = place; - CFX_FloatPoint pt = OutToIn(point); + CFX_PointF pt = OutToIn(point); if (temp.nLineIndex++ < pSection->m_LineArray.GetSize() - 1) { return pSection->SearchWordPlace( pt.x - pSection->m_SecInfo.rcSection.left, temp); @@ -1109,34 +1109,32 @@ CFX_SizeF CPDF_VariableText::GetPlateSize() const { return CFX_SizeF(GetPlateWidth(), GetPlateHeight()); } -CFX_FloatPoint CPDF_VariableText::GetBTPoint() const { - return CFX_FloatPoint(m_rcPlate.left, m_rcPlate.top); +CFX_PointF CPDF_VariableText::GetBTPoint() const { + return CFX_PointF(m_rcPlate.left, m_rcPlate.top); } -CFX_FloatPoint CPDF_VariableText::GetETPoint() const { - return CFX_FloatPoint(m_rcPlate.right, m_rcPlate.bottom); +CFX_PointF CPDF_VariableText::GetETPoint() const { + return CFX_PointF(m_rcPlate.right, m_rcPlate.bottom); } -CFX_FloatPoint CPDF_VariableText::InToOut(const CFX_FloatPoint& point) const { - return CFX_FloatPoint(point.x + GetBTPoint().x, GetBTPoint().y - point.y); +CFX_PointF CPDF_VariableText::InToOut(const CFX_PointF& point) const { + return CFX_PointF(point.x + GetBTPoint().x, GetBTPoint().y - point.y); } -CFX_FloatPoint CPDF_VariableText::OutToIn(const CFX_FloatPoint& point) const { - return CFX_FloatPoint(point.x - GetBTPoint().x, GetBTPoint().y - point.y); +CFX_PointF CPDF_VariableText::OutToIn(const CFX_PointF& point) const { + return CFX_PointF(point.x - GetBTPoint().x, GetBTPoint().y - point.y); } CFX_FloatRect CPDF_VariableText::InToOut(const CPVT_FloatRect& rect) const { - CFX_FloatPoint ptLeftTop = InToOut(CFX_FloatPoint(rect.left, rect.top)); - CFX_FloatPoint ptRightBottom = - InToOut(CFX_FloatPoint(rect.right, rect.bottom)); + CFX_PointF ptLeftTop = InToOut(CFX_PointF(rect.left, rect.top)); + CFX_PointF ptRightBottom = InToOut(CFX_PointF(rect.right, rect.bottom)); return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, ptLeftTop.y); } CPVT_FloatRect CPDF_VariableText::OutToIn(const CFX_FloatRect& rect) const { - CFX_FloatPoint ptLeftTop = OutToIn(CFX_FloatPoint(rect.left, rect.top)); - CFX_FloatPoint ptRightBottom = - OutToIn(CFX_FloatPoint(rect.right, rect.bottom)); + CFX_PointF ptLeftTop = OutToIn(CFX_PointF(rect.left, rect.top)); + CFX_PointF ptRightBottom = OutToIn(CFX_PointF(rect.right, rect.bottom)); return CPVT_FloatRect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, ptRightBottom.y); } diff --git a/core/fpdfdoc/cpdf_variabletext.h b/core/fpdfdoc/cpdf_variabletext.h index 5983a2978b..8e7c0c964a 100644 --- a/core/fpdfdoc/cpdf_variabletext.h +++ b/core/fpdfdoc/cpdf_variabletext.h @@ -20,13 +20,13 @@ #include "core/fxcrt/fx_system.h" #include "core/fxge/fx_font.h" +class CPVT_Word; class CSection; class IPVT_FontMap; - struct CPVT_SecProps; struct CPVT_Section; struct CPVT_SectionInfo; -struct CPVT_Word; + struct CPVT_WordInfo; struct CPVT_WordProps; @@ -132,11 +132,11 @@ class CPDF_VariableText { CPVT_WordPlace GetEndWordPlace() const; CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const; CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const; - CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; + CPVT_WordPlace SearchWordPlace(const CFX_PointF& point) const; CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place, - const CFX_FloatPoint& point) const; + const CFX_PointF& point) const; CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace& place, - const CFX_FloatPoint& point) const; + const CFX_PointF& point) const; CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const; CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const; CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace& place) const; @@ -152,11 +152,11 @@ class CPDF_VariableText { FX_FLOAT GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; } FX_FLOAT GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; } CFX_SizeF GetPlateSize() const; - CFX_FloatPoint GetBTPoint() const; - CFX_FloatPoint GetETPoint() const; + CFX_PointF GetBTPoint() const; + CFX_PointF GetETPoint() const; - CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const; - CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const; + CFX_PointF InToOut(const CFX_PointF& point) const; + CFX_PointF OutToIn(const CFX_PointF& point) const; CFX_FloatRect InToOut(const CPVT_FloatRect& rect) const; CPVT_FloatRect OutToIn(const CFX_FloatRect& rect) const; diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index 4bb244f29e..15515151bc 100644 --- a/core/fpdfdoc/cpvt_generateap.cpp +++ b/core/fpdfdoc/cpvt_generateap.cpp @@ -246,10 +246,10 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, vt.SetText(swValue); vt.RearrangeAll(); CFX_FloatRect rcContent = vt.GetContentRect(); - CFX_FloatPoint ptOffset; + CFX_PointF ptOffset; if (!bMultiLine) { ptOffset = - CFX_FloatPoint(0.0f, (rcContent.Height() - rcBody.Height()) / 2.0f); + CFX_PointF(0.0f, (rcContent.Height() - rcBody.Height()) / 2.0f); } CFX_ByteString sBody = CPVT_GenerateAP::GenerateEditAP( &map, vt.GetIterator(), ptOffset, !bCharArray, subWord); @@ -296,8 +296,8 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, vt.SetText(swValue); vt.RearrangeAll(); CFX_FloatRect rcContent = vt.GetContentRect(); - CFX_FloatPoint ptOffset = - CFX_FloatPoint(0.0f, (rcContent.Height() - rcEdit.Height()) / 2.0f); + CFX_PointF ptOffset = + CFX_PointF(0.0f, (rcContent.Height() - rcEdit.Height()) / 2.0f); CFX_ByteString sEdit = CPVT_GenerateAP::GenerateEditAP( &map, vt.GetIterator(), ptOffset, true, 0); if (sEdit.GetLength() > 0) { @@ -328,9 +328,8 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, if (sButtonBorder.GetLength() > 0) sAppStream << "q\n" << sButtonBorder << "Q\n"; - CFX_FloatPoint ptCenter = - CFX_FloatPoint((rcButton.left + rcButton.right) / 2, - (rcButton.top + rcButton.bottom) / 2); + CFX_PointF ptCenter = CFX_PointF((rcButton.left + rcButton.right) / 2, + (rcButton.top + rcButton.bottom) / 2); if (IsFloatBigger(rcButton.Width(), 6) && IsFloatBigger(rcButton.Height(), 6)) { sAppStream << "q\n" @@ -402,7 +401,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, CPVT_Color(CPVT_Color::kGray, 1), PaintOperation::FILL) << CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(), - CFX_FloatPoint(0.0f, fy), + CFX_PointF(0.0f, fy), true, 0) << "ET\n"; } else { @@ -410,7 +409,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, << CPVT_GenerateAP::GenerateColorAP(crText, PaintOperation::FILL) << CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(), - CFX_FloatPoint(0.0f, fy), + CFX_PointF(0.0f, fy), true, 0) << "ET\n"; } @@ -529,7 +528,7 @@ CFX_ByteString GetPopupContentsString(CPDF_Document* pDoc, vt.Initialize(); vt.SetText(swValue); vt.RearrangeAll(); - CFX_FloatPoint ptOffset(3.0f, -3.0f); + CFX_PointF ptOffset(3.0f, -3.0f); CFX_ByteString sContent = CPVT_GenerateAP::GenerateEditAP( &map, vt.GetIterator(), ptOffset, false, 0); @@ -1102,14 +1101,14 @@ bool CPVT_GenerateAP::GenerateStrikeOutAP(CPDF_Document* pDoc, CFX_ByteString CPVT_GenerateAP::GenerateEditAP( IPVT_FontMap* pFontMap, CPDF_VariableText::Iterator* pIterator, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, bool bContinuous, uint16_t SubWord) { CFX_ByteTextBuf sEditStream; CFX_ByteTextBuf sLineStream; CFX_ByteTextBuf sWords; - CFX_FloatPoint ptOld; - CFX_FloatPoint ptNew; + CFX_PointF ptOld; + CFX_PointF ptNew; int32_t nCurFontIndex = -1; CPVT_WordPlace oldplace; @@ -1126,13 +1125,13 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP( } CPVT_Word word; if (pIterator->GetWord(word)) { - ptNew = CFX_FloatPoint(word.ptWord.x + ptOffset.x, - word.ptWord.y + ptOffset.y); + ptNew = CFX_PointF(word.ptWord.x + ptOffset.x, + word.ptWord.y + ptOffset.y); } else { CPVT_Line line; pIterator->GetLine(line); - ptNew = CFX_FloatPoint(line.ptLine.x + ptOffset.x, - line.ptLine.y + ptOffset.y); + ptNew = CFX_PointF(line.ptLine.x + ptOffset.x, + line.ptLine.y + ptOffset.y); } if (ptNew != ptOld) { sLineStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y @@ -1157,8 +1156,8 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP( } else { CPVT_Word word; if (pIterator->GetWord(word)) { - ptNew = CFX_FloatPoint(word.ptWord.x + ptOffset.x, - word.ptWord.y + ptOffset.y); + ptNew = + CFX_PointF(word.ptWord.x + ptOffset.x, word.ptWord.y + ptOffset.y); if (ptNew != ptOld) { sEditStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y << " Td\n"; diff --git a/core/fpdfdoc/cpvt_generateap.h b/core/fpdfdoc/cpvt_generateap.h index 16c939fe92..62a84531ee 100644 --- a/core/fpdfdoc/cpvt_generateap.h +++ b/core/fpdfdoc/cpvt_generateap.h @@ -48,7 +48,7 @@ class CPVT_GenerateAP { CPDF_Dictionary* pAnnotDict); static CFX_ByteString GenerateEditAP(IPVT_FontMap* pFontMap, CPDF_VariableText::Iterator* pIterator, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, bool bContinuous, uint16_t SubWord); static CFX_ByteString GenerateBorderAP(const CFX_FloatRect& rect, diff --git a/core/fpdfdoc/cpvt_line.h b/core/fpdfdoc/cpvt_line.h index 25ae34af16..47c3e84d6a 100644 --- a/core/fpdfdoc/cpvt_line.h +++ b/core/fpdfdoc/cpvt_line.h @@ -11,15 +11,19 @@ #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" -struct CPVT_Line { - CPVT_Line() : fLineWidth(0.0f), fLineAscent(0.0f), fLineDescent(0.0f) {} +class CPVT_Line { + public: + CPVT_Line(); CPVT_WordPlace lineplace; CPVT_WordPlace lineEnd; - CFX_FloatPoint ptLine; + CFX_PointF ptLine; FX_FLOAT fLineWidth; FX_FLOAT fLineAscent; FX_FLOAT fLineDescent; }; +inline CPVT_Line::CPVT_Line() + : fLineWidth(0.0f), fLineAscent(0.0f), fLineDescent(0.0f) {} + #endif // CORE_FPDFDOC_CPVT_LINE_H_ diff --git a/core/fpdfdoc/cpvt_lineinfo.h b/core/fpdfdoc/cpvt_lineinfo.h index 2ebc51cb8e..8fb10de250 100644 --- a/core/fpdfdoc/cpvt_lineinfo.h +++ b/core/fpdfdoc/cpvt_lineinfo.h @@ -9,16 +9,9 @@ #include "core/fxcrt/fx_system.h" -struct CPVT_LineInfo { - CPVT_LineInfo() - : nTotalWord(0), - nBeginWordIndex(-1), - nEndWordIndex(-1), - fLineX(0.0f), - fLineY(0.0f), - fLineWidth(0.0f), - fLineAscent(0.0f), - fLineDescent(0.0f) {} +class CPVT_LineInfo { + public: + CPVT_LineInfo(); int32_t nTotalWord; int32_t nBeginWordIndex; @@ -30,4 +23,14 @@ struct CPVT_LineInfo { FX_FLOAT fLineDescent; }; +inline CPVT_LineInfo::CPVT_LineInfo() + : nTotalWord(0), + nBeginWordIndex(-1), + nEndWordIndex(-1), + fLineX(0.0f), + fLineY(0.0f), + fLineWidth(0.0f), + fLineAscent(0.0f), + fLineDescent(0.0f) {} + #endif // CORE_FPDFDOC_CPVT_LINEINFO_H_ diff --git a/core/fpdfdoc/cpvt_word.h b/core/fpdfdoc/cpvt_word.h index 92a4ce1e94..540f0416ad 100644 --- a/core/fpdfdoc/cpvt_word.h +++ b/core/fpdfdoc/cpvt_word.h @@ -11,13 +11,14 @@ #include "core/fpdfdoc/cpvt_wordprops.h" #include "core/fxcrt/fx_system.h" -struct CPVT_Word { +class CPVT_Word { + public: CPVT_Word(); uint16_t Word; int32_t nCharset; CPVT_WordPlace WordPlace; - CFX_FloatPoint ptWord; + CFX_PointF ptWord; FX_FLOAT fAscent; FX_FLOAT fDescent; FX_FLOAT fWidth; diff --git a/core/fpdfdoc/csection.cpp b/core/fpdfdoc/csection.cpp index 4964504175..490ef1b230 100644 --- a/core/fpdfdoc/csection.cpp +++ b/core/fpdfdoc/csection.cpp @@ -146,7 +146,7 @@ void CSection::UpdateWordPlace(CPVT_WordPlace& place) const { } } -CPVT_WordPlace CSection::SearchWordPlace(const CFX_FloatPoint& point) const { +CPVT_WordPlace CSection::SearchWordPlace(const CFX_PointF& point) const { ASSERT(m_pVT); CPVT_WordPlace place = GetBeginWordPlace(); bool bUp = true; diff --git a/core/fpdfdoc/csection.h b/core/fpdfdoc/csection.h index 706f5b67bb..a2ac43b102 100644 --- a/core/fpdfdoc/csection.h +++ b/core/fpdfdoc/csection.h @@ -14,8 +14,7 @@ #include "core/fxcrt/fx_system.h" class CPDF_VariableText; - -struct CPVT_LineInfo; +class CPVT_LineInfo; struct CPVT_WordLine; struct CPVT_WordPlace; @@ -40,7 +39,7 @@ class CSection final { CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const; CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const; void UpdateWordPlace(CPVT_WordPlace& place) const; - CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; + CPVT_WordPlace SearchWordPlace(const CFX_PointF& point) const; CPVT_WordPlace SearchWordPlace(FX_FLOAT fx, const CPVT_WordPlace& lineplace) const; CPVT_WordPlace SearchWordPlace(FX_FLOAT fx, diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index 55551dcfa0..d3dc461992 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -284,7 +284,7 @@ std::vector CPDF_TextPage::GetRectArray(int start, return rectArray; } -int CPDF_TextPage::GetIndexAtPos(CFX_FloatPoint point, +int CPDF_TextPage::GetIndexAtPos(const CFX_PointF& point, FX_FLOAT xTolerance, FX_FLOAT yTolerance) const { if (!m_bIsParsed) @@ -366,7 +366,7 @@ int CPDF_TextPage::GetIndexAtPos(FX_FLOAT x, FX_FLOAT y, FX_FLOAT xTolerance, FX_FLOAT yTolerance) const { - CFX_FloatPoint point(x, y); + CFX_PointF point(x, y); return GetIndexAtPos(point, xTolerance, yTolerance); } diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h index 85ee7058b6..dd1493ff1c 100644 --- a/core/fpdftext/cpdf_textpage.h +++ b/core/fpdftext/cpdf_textpage.h @@ -91,7 +91,7 @@ class CPDF_TextPage { int CountChars() const; void GetCharInfo(int index, FPDF_CHAR_INFO* info) const; std::vector GetRectArray(int start, int nCount) const; - int GetIndexAtPos(CFX_FloatPoint point, + int GetIndexAtPos(const CFX_PointF& point, FX_FLOAT xTolerance, FX_FLOAT yTolerance) const; int GetIndexAtPos(FX_FLOAT x, diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp index e8abace53d..0567fa76c5 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_PointF& point) const { + return Contains(point.x, point.y); +} + bool CFX_FloatRect::Contains(const CFX_FloatRect& other_rect) const { CFX_FloatRect n1(*this); CFX_FloatRect n2(other_rect); diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index c9e5433226..12640216ee 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -245,21 +245,6 @@ 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 { @@ -495,6 +480,8 @@ class CFX_FloatRect { } bool IsEmpty() const { return left >= right || bottom >= top; } + + 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