From 4797c4240cb9e2d8cd36c583d46cd52ff94af95d Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 13 Feb 2017 15:44:23 -0500 Subject: 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 --- 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 | 16 -- fpdfsdk/cfx_systemhandler.cpp | 6 +- fpdfsdk/cpdfsdk_annothandlermgr.cpp | 16 +- fpdfsdk/cpdfsdk_annothandlermgr.h | 16 +- fpdfsdk/cpdfsdk_baannothandler.cpp | 18 +-- fpdfsdk/cpdfsdk_baannothandler.h | 18 +-- fpdfsdk/cpdfsdk_pageview.cpp | 20 +-- fpdfsdk/cpdfsdk_pageview.h | 12 +- fpdfsdk/cpdfsdk_widget.cpp | 10 +- fpdfsdk/cpdfsdk_widgethandler.cpp | 18 +-- fpdfsdk/cpdfsdk_widgethandler.h | 18 +-- fpdfsdk/cpdfsdk_xfawidgethandler.cpp | 18 +-- fpdfsdk/cpdfsdk_xfawidgethandler.h | 18 +-- fpdfsdk/formfiller/cffl_checkbox.cpp | 2 +- fpdfsdk/formfiller/cffl_checkbox.h | 2 +- fpdfsdk/formfiller/cffl_formfiller.cpp | 39 +++-- fpdfsdk/formfiller/cffl_formfiller.h | 30 ++-- fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 16 +- fpdfsdk/formfiller/cffl_interactiveformfiller.h | 16 +- fpdfsdk/formfiller/cffl_radiobutton.cpp | 2 +- fpdfsdk/formfiller/cffl_radiobutton.h | 2 +- fpdfsdk/fpdfformfill.cpp | 16 +- fpdfsdk/fxedit/fxet_edit.cpp | 104 ++++++------- fpdfsdk/fxedit/fxet_edit.h | 35 ++--- fpdfsdk/fxedit/fxet_list.cpp | 36 ++--- fpdfsdk/fxedit/fxet_list.h | 56 ++++--- fpdfsdk/ipdfsdk_annothandler.h | 18 +-- fpdfsdk/pdfwindow/PWL_Button.cpp | 4 +- fpdfsdk/pdfwindow/PWL_Button.h | 4 +- fpdfsdk/pdfwindow/PWL_Caret.cpp | 16 +- fpdfsdk/pdfwindow/PWL_Caret.h | 18 +-- fpdfsdk/pdfwindow/PWL_ComboBox.cpp | 34 ++--- fpdfsdk/pdfwindow/PWL_ComboBox.h | 6 +- fpdfsdk/pdfwindow/PWL_Edit.cpp | 37 +++-- fpdfsdk/pdfwindow/PWL_Edit.h | 23 ++- fpdfsdk/pdfwindow/PWL_EditCtrl.cpp | 40 +++-- fpdfsdk/pdfwindow/PWL_EditCtrl.h | 20 +-- fpdfsdk/pdfwindow/PWL_ListBox.cpp | 14 +- fpdfsdk/pdfwindow/PWL_ListBox.h | 12 +- fpdfsdk/pdfwindow/PWL_ScrollBar.cpp | 172 +++++++++++----------- fpdfsdk/pdfwindow/PWL_ScrollBar.h | 28 ++-- fpdfsdk/pdfwindow/PWL_SpecialButton.cpp | 5 +- fpdfsdk/pdfwindow/PWL_SpecialButton.h | 4 +- fpdfsdk/pdfwindow/PWL_Utils.cpp | 68 ++++----- fpdfsdk/pdfwindow/PWL_Utils.h | 22 +-- fpdfsdk/pdfwindow/PWL_Wnd.cpp | 29 ++-- fpdfsdk/pdfwindow/PWL_Wnd.h | 32 ++-- 59 files changed, 631 insertions(+), 695 deletions(-) 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 bd068a596b..17bab02a7c 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -300,7 +300,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) @@ -382,7 +382,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 d22cba3e40..946a2d658d 100644 --- a/core/fpdftext/cpdf_textpage.h +++ b/core/fpdftext/cpdf_textpage.h @@ -98,7 +98,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 c5ee4048a2..35364e8030 100644 --- a/core/fxcrt/fx_basic_coords.cpp +++ b/core/fxcrt/fx_basic_coords.cpp @@ -197,10 +197,6 @@ 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 172d794e97..3a5b1feabe 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,7 +480,6 @@ 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; diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp index b897a3e0bb..966dd63d4c 100644 --- a/fpdfsdk/cfx_systemhandler.cpp +++ b/fpdfsdk/cfx_systemhandler.cpp @@ -65,10 +65,8 @@ void CFX_SystemHandler::OutputSelectedRect(CFFL_FormFiller* pFormFiller, if (!pFormFiller) return; - CFX_FloatPoint leftbottom = CFX_FloatPoint(rect.left, rect.bottom); - CFX_FloatPoint righttop = CFX_FloatPoint(rect.right, rect.top); - CFX_FloatPoint ptA = pFormFiller->PWLtoFFL(leftbottom); - CFX_FloatPoint ptB = pFormFiller->PWLtoFFL(righttop); + CFX_PointF ptA = pFormFiller->PWLtoFFL(CFX_PointF(rect.left, rect.bottom)); + CFX_PointF ptB = pFormFiller->PWLtoFFL(CFX_PointF(rect.right, rect.top)); CPDFSDK_Annot* pAnnot = pFormFiller->GetSDKAnnot(); UnderlyingPageType* pPage = pAnnot->GetUnderlyingPage(); diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp index 898b9ccc0f..c4990674de 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp +++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp @@ -106,7 +106,7 @@ bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT(*pAnnot); return GetAnnotHandler(pAnnot->Get()) ->OnLButtonDown(pPageView, pAnnot, nFlags, point); @@ -116,7 +116,7 @@ bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT(*pAnnot); return GetAnnotHandler(pAnnot->Get()) ->OnLButtonUp(pPageView, pAnnot, nFlags, point); @@ -126,7 +126,7 @@ bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT(*pAnnot); return GetAnnotHandler(pAnnot->Get()) ->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); @@ -136,7 +136,7 @@ bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT(*pAnnot); return GetAnnotHandler(pAnnot->Get()) ->OnMouseMove(pPageView, pAnnot, nFlags, point); @@ -147,7 +147,7 @@ bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel( CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT(*pAnnot); return GetAnnotHandler(pAnnot->Get()) ->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); @@ -157,7 +157,7 @@ bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT(*pAnnot); return GetAnnotHandler(pAnnot->Get()) ->OnRButtonDown(pPageView, pAnnot, nFlags, point); @@ -167,7 +167,7 @@ bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT(*pAnnot); return GetAnnotHandler(pAnnot->Get()) ->OnRButtonUp(pPageView, pAnnot, nFlags, point); @@ -263,7 +263,7 @@ CFX_FloatRect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox( bool CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT(pAnnot); IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot); if (pAnnotHandler->CanAnswer(pAnnot)) diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.h b/fpdfsdk/cpdfsdk_annothandlermgr.h index 7742fd6ed3..cbda02cbed 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.h +++ b/fpdfsdk/cpdfsdk_annothandlermgr.h @@ -58,32 +58,32 @@ class CPDFSDK_AnnotHandlerMgr { bool Annot_OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); bool Annot_OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); bool Annot_OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); bool Annot_OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); bool Annot_OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_FloatPoint& point); + const CFX_PointF& point); bool Annot_OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); bool Annot_OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); bool Annot_OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags); bool Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); bool Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); @@ -100,7 +100,7 @@ class CPDFSDK_AnnotHandlerMgr { CPDFSDK_Annot* pAnnot); bool Annot_OnHitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point); + const CFX_PointF& point); private: IPDFSDK_AnnotHandler* GetAnnotHandler(CPDF_Annot::Subtype nSubtype) const; diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp index 617d88fd41..475ee4bf0e 100644 --- a/fpdfsdk/cpdfsdk_baannothandler.cpp +++ b/fpdfsdk/cpdfsdk_baannothandler.cpp @@ -96,28 +96,28 @@ void CPDFSDK_BAAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView, bool CPDFSDK_BAAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { return false; } bool CPDFSDK_BAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { return false; } bool CPDFSDK_BAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { return false; } bool CPDFSDK_BAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { return false; } @@ -125,28 +125,28 @@ bool CPDFSDK_BAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { return false; } bool CPDFSDK_BAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { return false; } bool CPDFSDK_BAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { return false; } bool CPDFSDK_BAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { return false; } @@ -195,7 +195,7 @@ CFX_FloatRect CPDFSDK_BAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, bool CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT(pPageView); ASSERT(pAnnot); diff --git a/fpdfsdk/cpdfsdk_baannothandler.h b/fpdfsdk/cpdfsdk_baannothandler.h index 2efed0e269..d5f170f452 100644 --- a/fpdfsdk/cpdfsdk_baannothandler.h +++ b/fpdfsdk/cpdfsdk_baannothandler.h @@ -39,7 +39,7 @@ class CPDFSDK_BAAnnotHandler : public IPDFSDK_AnnotHandler { CPDFSDK_Annot* pAnnot) override; bool HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, @@ -56,36 +56,36 @@ class CPDFSDK_BAAnnotHandler : public IPDFSDK_AnnotHandler { bool OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index aae903eeb1..0136077df5 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -156,8 +156,8 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, #endif // PDF_ENABLE_XFA if (bHitTest) { pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot.Get()); - CFX_FloatPoint point(pageX, pageY); - if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot.Get(), point)) + if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot.Get(), + CFX_PointF(pageX, pageY))) return pSDKAnnot.Get(); } } @@ -246,8 +246,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByXFAWidget(CXFA_FFWidget* hWidget) { } #endif // PDF_ENABLE_XFA -bool CPDFSDK_PageView::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPDFSDK_PageView::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point.x, point.y)); if (!pAnnot) { m_pFormFillEnv->KillFocusAnnot(nFlag); @@ -267,8 +266,7 @@ bool CPDFSDK_PageView::OnLButtonDown(const CFX_FloatPoint& point, } #ifdef PDF_ENABLE_XFA -bool CPDFSDK_PageView::OnRButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPDFSDK_PageView::OnRButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point.x, point.y)); if (!pAnnot) return false; @@ -285,8 +283,7 @@ bool CPDFSDK_PageView::OnRButtonDown(const CFX_FloatPoint& point, return true; } -bool CPDFSDK_PageView::OnRButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPDFSDK_PageView::OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point.x, point.y)); @@ -300,8 +297,7 @@ bool CPDFSDK_PageView::OnRButtonUp(const CFX_FloatPoint& point, } #endif // PDF_ENABLE_XFA -bool CPDFSDK_PageView::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPDFSDK_PageView::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point.x, point.y)); @@ -315,7 +311,7 @@ bool CPDFSDK_PageView::OnLButtonUp(const CFX_FloatPoint& point, pAnnotHandlerMgr->Annot_OnLButtonUp(this, &pFXAnnot, nFlag, point); } -bool CPDFSDK_PageView::OnMouseMove(const CFX_FloatPoint& point, int nFlag) { +bool CPDFSDK_PageView::OnMouseMove(const CFX_PointF& point, int nFlag) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXAnnotAtPoint(point.x, point.y)); @@ -349,7 +345,7 @@ bool CPDFSDK_PageView::OnMouseMove(const CFX_FloatPoint& point, int nFlag) { bool CPDFSDK_PageView::OnMouseWheel(double deltaX, double deltaY, - const CFX_FloatPoint& point, + const CFX_PointF& point, int nFlag) { CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point.x, point.y)); if (!pAnnot) diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h index 9a3443b4b0..495f1685d6 100644 --- a/fpdfsdk/cpdfsdk_pageview.h +++ b/fpdfsdk/cpdfsdk_pageview.h @@ -59,20 +59,20 @@ class CPDFSDK_PageView final : public CPDF_Page::View { CPDF_Page* GetPDFPage() const; CPDF_Document* GetPDFDocument(); CPDFSDK_FormFillEnvironment* GetFormFillEnv() const { return m_pFormFillEnv; } - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag); + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag); #ifdef PDF_ENABLE_XFA - bool OnRButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - bool OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); + bool OnRButtonDown(const CFX_PointF& point, uint32_t nFlag); + bool OnRButtonUp(const CFX_PointF& point, uint32_t nFlag); #endif // PDF_ENABLE_XFA bool OnChar(int nChar, uint32_t nFlag); bool OnKeyDown(int nKeyCode, int nFlag); bool OnKeyUp(int nKeyCode, int nFlag); - bool OnMouseMove(const CFX_FloatPoint& point, int nFlag); + bool OnMouseMove(const CFX_PointF& point, int nFlag); bool OnMouseWheel(double deltaX, double deltaY, - const CFX_FloatPoint& point, + const CFX_PointF& point, int nFlag); void GetCurrentMatrix(CFX_Matrix& matrix) { matrix = m_curMatrix; } diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index 1af4703da0..7821e1f528 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -1389,7 +1389,7 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const CFX_WideString* sValue) { CFX_FloatRect rcContent = pEdit->GetContentRect(); CFX_ByteString sEdit = - CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint()); + CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_PointF()); if (sEdit.GetLength() > 0) { sBody << "/Tx BMC\n" << "q\n"; @@ -1469,15 +1469,13 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() { sList << "BT\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY, 1), true) - << CPWL_Utils::GetEditAppStream(pEdit.get(), - CFX_FloatPoint(0.0f, fy)) + << CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, fy)) << "ET\n"; } else { CPWL_Color crText = GetTextPWLColor(); sList << "BT\n" << CPWL_Utils::GetColorAppStream(crText, true) - << CPWL_Utils::GetEditAppStream(pEdit.get(), - CFX_FloatPoint(0.0f, fy)) + << CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, fy)) << "ET\n"; } @@ -1566,7 +1564,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) { CFX_FloatRect rcContent = pEdit->GetContentRect(); CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream( - pEdit.get(), CFX_FloatPoint(), nullptr, !bCharArray, subWord); + pEdit.get(), CFX_PointF(), nullptr, !bCharArray, subWord); if (sEdit.GetLength() > 0) { sBody << "/Tx BMC\n" diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp index 4105ae4f3c..bc085464ca 100644 --- a/fpdfsdk/cpdfsdk_widgethandler.cpp +++ b/fpdfsdk/cpdfsdk_widgethandler.cpp @@ -119,7 +119,7 @@ void CPDFSDK_WidgetHandler::OnMouseExit(CPDFSDK_PageView* pPageView, bool CPDFSDK_WidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); @@ -129,7 +129,7 @@ bool CPDFSDK_WidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, bool CPDFSDK_WidgetHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); @@ -139,7 +139,7 @@ bool CPDFSDK_WidgetHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, bool CPDFSDK_WidgetHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); @@ -149,7 +149,7 @@ bool CPDFSDK_WidgetHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, bool CPDFSDK_WidgetHandler::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); @@ -160,7 +160,7 @@ bool CPDFSDK_WidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); @@ -171,7 +171,7 @@ bool CPDFSDK_WidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, bool CPDFSDK_WidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); @@ -181,7 +181,7 @@ bool CPDFSDK_WidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, bool CPDFSDK_WidgetHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); @@ -191,7 +191,7 @@ bool CPDFSDK_WidgetHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, bool CPDFSDK_WidgetHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { return false; } @@ -279,7 +279,7 @@ CFX_FloatRect CPDFSDK_WidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView, bool CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT(pPageView); ASSERT(pAnnot); diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h index 7154bda6fd..6e4d50b272 100644 --- a/fpdfsdk/cpdfsdk_widgethandler.h +++ b/fpdfsdk/cpdfsdk_widgethandler.h @@ -39,7 +39,7 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler { CPDFSDK_Annot* pAnnot) override; bool HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, @@ -56,36 +56,36 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler { bool OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp index 0259be3995..d7bef32acd 100644 --- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp +++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp @@ -100,7 +100,7 @@ CFX_FloatRect CPDFSDK_XFAWidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView, bool CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!pPageView || !pAnnot) return false; @@ -147,7 +147,7 @@ void CPDFSDK_XFAWidgetHandler::OnMouseExit(CPDFSDK_PageView* pPageView, bool CPDFSDK_XFAWidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!pPageView || !(*pAnnot)) return false; @@ -159,7 +159,7 @@ bool CPDFSDK_XFAWidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, bool CPDFSDK_XFAWidgetHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!pPageView || !(*pAnnot)) return false; @@ -172,7 +172,7 @@ bool CPDFSDK_XFAWidgetHandler::OnLButtonDblClk( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!pPageView || !(*pAnnot)) return false; @@ -184,7 +184,7 @@ bool CPDFSDK_XFAWidgetHandler::OnLButtonDblClk( bool CPDFSDK_XFAWidgetHandler::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!pPageView || !(*pAnnot)) return false; @@ -197,7 +197,7 @@ bool CPDFSDK_XFAWidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!pPageView || !(*pAnnot)) return false; @@ -209,7 +209,7 @@ bool CPDFSDK_XFAWidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, bool CPDFSDK_XFAWidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!pPageView || !(*pAnnot)) return false; @@ -221,7 +221,7 @@ bool CPDFSDK_XFAWidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, bool CPDFSDK_XFAWidgetHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!pPageView || !(*pAnnot)) return false; @@ -234,7 +234,7 @@ bool CPDFSDK_XFAWidgetHandler::OnRButtonDblClk( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!pPageView || !(*pAnnot)) return false; diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.h b/fpdfsdk/cpdfsdk_xfawidgethandler.h index 1a1a48081d..3903103eeb 100644 --- a/fpdfsdk/cpdfsdk_xfawidgethandler.h +++ b/fpdfsdk/cpdfsdk_xfawidgethandler.h @@ -34,7 +34,7 @@ class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler { CPDFSDK_Annot* pAnnot) override; bool HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, @@ -50,36 +50,36 @@ class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler { bool OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp index ffa3a032cf..c233c136c1 100644 --- a/fpdfsdk/formfiller/cffl_checkbox.cpp +++ b/fpdfsdk/formfiller/cffl_checkbox.cpp @@ -73,7 +73,7 @@ bool CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot, bool CFFL_CheckBox::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point); if (IsValid()) { diff --git a/fpdfsdk/formfiller/cffl_checkbox.h b/fpdfsdk/formfiller/cffl_checkbox.h index 65dba29f2e..79ddc847cc 100644 --- a/fpdfsdk/formfiller/cffl_checkbox.h +++ b/fpdfsdk/formfiller/cffl_checkbox.h @@ -24,7 +24,7 @@ class CFFL_CheckBox : public CFFL_Button { bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool IsDataChanged(CPDFSDK_PageView* pPageView) override; void SaveData(CPDFSDK_PageView* pPageView) override; }; diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 9ccca2b04a..cad8dafdbc 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -119,7 +119,7 @@ void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, bool CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, true)) { m_bValid = true; FX_RECT rect = GetViewBBox(pPageView, pAnnot); @@ -137,7 +137,7 @@ bool CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, bool CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false); if (!pWnd) return false; @@ -151,7 +151,7 @@ bool CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, bool CFFL_FormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false); if (!pWnd) return false; @@ -163,7 +163,7 @@ bool CFFL_FormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, bool CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (m_ptOldPos != point) m_ptOldPos = point; @@ -179,7 +179,7 @@ bool CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, short zDelta, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { if (!IsValid()) return false; @@ -190,7 +190,7 @@ bool CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, bool CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { CPWL_Wnd* pWnd = GetPDFWindow(pPageView, true); if (!pWnd) return false; @@ -202,7 +202,7 @@ bool CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, bool CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false); if (!pWnd) return false; @@ -483,25 +483,25 @@ CFX_FloatRect CFFL_FormFiller::PWLtoFFL(const CFX_FloatRect& rect) { return temp; } -CFX_FloatPoint CFFL_FormFiller::FFLtoPWL(const CFX_FloatPoint& point) { +CFX_PointF CFFL_FormFiller::FFLtoPWL(const CFX_PointF& point) { CFX_Matrix mt; mt.SetReverse(GetCurMatrix()); - CFX_FloatPoint pt = point; - mt.TransformPoint(pt.x, pt.y); + CFX_PointF pt = point; + mt.Transform(pt); return pt; } -CFX_FloatPoint CFFL_FormFiller::PWLtoFFL(const CFX_FloatPoint& point) { +CFX_PointF CFFL_FormFiller::PWLtoFFL(const CFX_PointF& point) { CFX_Matrix mt = GetCurMatrix(); - CFX_FloatPoint pt = point; - mt.TransformPoint(pt.x, pt.y); + CFX_PointF pt = point; + mt.Transform(pt); return pt; } -CFX_FloatPoint CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, - const CFX_FloatPoint& pt) { +CFX_PointF CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, + const CFX_PointF& pt) { return FFLtoPWL(pt); } @@ -633,9 +633,9 @@ void CFFL_Button::OnMouseExit(CPDFSDK_PageView* pPageView, bool CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { CFX_FloatRect rcAnnot = pAnnot->GetRect(); - if (!rcAnnot.Contains(point.x, point.y)) + if (!rcAnnot.Contains(point)) return false; m_bMouseDown = true; @@ -648,7 +648,7 @@ bool CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView, bool CFFL_Button::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { CFX_FloatRect rcAnnot = pAnnot->GetRect(); if (!rcAnnot.Contains(point.x, point.y)) return false; @@ -664,9 +664,8 @@ bool CFFL_Button::OnLButtonUp(CPDFSDK_PageView* pPageView, bool CFFL_Button::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT(m_pFormFillEnv); - return true; } diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h index cf1aaf7205..7462b40e97 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.h +++ b/fpdfsdk/formfiller/cffl_formfiller.h @@ -41,32 +41,32 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { virtual bool OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); virtual bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); virtual bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); virtual bool OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); virtual bool OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, short zDelta, - const CFX_FloatPoint& point); + const CFX_PointF& point); virtual bool OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); virtual bool OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); virtual bool OnKeyDown(CPDFSDK_Annot* pAnnot, uint32_t nKeyCode, @@ -104,11 +104,10 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { CFX_FloatRect FFLtoPWL(const CFX_FloatRect& rect); CFX_FloatRect PWLtoFFL(const CFX_FloatRect& rect); - CFX_FloatPoint FFLtoPWL(const CFX_FloatPoint& point); - CFX_FloatPoint PWLtoFFL(const CFX_FloatPoint& point); + CFX_PointF FFLtoPWL(const CFX_PointF& point); + CFX_PointF PWLtoFFL(const CFX_PointF& point); - CFX_FloatPoint WndtoPWL(CPDFSDK_PageView* pPageView, - const CFX_FloatPoint& pt); + CFX_PointF WndtoPWL(CPDFSDK_PageView* pPageView, const CFX_PointF& pt); CFX_FloatRect FFLtoWnd(CPDFSDK_PageView* pPageView, const CFX_FloatRect& rect); @@ -159,10 +158,9 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { CPDFSDK_FormFillEnvironment* m_pFormFillEnv; CPDFSDK_Widget* m_pWidget; CPDFSDK_Annot* m_pAnnot; - bool m_bValid; CFFL_PageView2PDFWindow m_Maps; - CFX_FloatPoint m_ptOldPos; + CFX_PointF m_ptOldPos; }; class CFFL_Button : public CFFL_FormFiller { @@ -178,15 +176,15 @@ class CFFL_Button : public CFFL_FormFiller { bool OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index 82b9549a1c..a8368f4352 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -34,7 +34,7 @@ CFFL_InteractiveFormFiller::~CFFL_InteractiveFormFiller() {} bool CFFL_InteractiveFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, - CFX_FloatPoint point) { + const CFX_PointF& point) { CFX_FloatRect rc = pAnnot->GetRect(); return rc.Contains(point.x, point.y); } @@ -179,7 +179,7 @@ bool CFFL_InteractiveFormFiller::OnLButtonDown( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); if (!m_bNotifying) { CPDFSDK_Widget* pWidget = static_cast(pAnnot->Get()); @@ -220,7 +220,7 @@ bool CFFL_InteractiveFormFiller::OnLButtonDown( bool CFFL_InteractiveFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); CPDFSDK_Widget* pWidget = static_cast(pAnnot->Get()); @@ -294,7 +294,7 @@ bool CFFL_InteractiveFormFiller::OnLButtonDblClk( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), false); return pFormFiller && @@ -304,7 +304,7 @@ bool CFFL_InteractiveFormFiller::OnLButtonDblClk( bool CFFL_InteractiveFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), true); return pFormFiller && @@ -316,7 +316,7 @@ bool CFFL_InteractiveFormFiller::OnMouseWheel( CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), false); return pFormFiller && @@ -328,7 +328,7 @@ bool CFFL_InteractiveFormFiller::OnRButtonDown( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), false); return pFormFiller && @@ -338,7 +338,7 @@ bool CFFL_InteractiveFormFiller::OnRButtonDown( bool CFFL_InteractiveFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), false); return pFormFiller && diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index e81d3c88d0..90fd98c0e8 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h @@ -27,7 +27,7 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { bool Annot_HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, - CFX_FloatPoint point); + const CFX_PointF& point); FX_RECT GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot); void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, @@ -45,32 +45,32 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { bool OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); bool OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); bool OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_FloatPoint& point); + const CFX_PointF& point); bool OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); bool OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point); + const CFX_PointF& point); bool OnKeyDown(CPDFSDK_Annot* pAnnot, uint32_t nKeyCode, uint32_t nFlags); bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags); diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp index 70d4c0dee6..e78160e5dc 100644 --- a/fpdfsdk/formfiller/cffl_radiobutton.cpp +++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp @@ -72,7 +72,7 @@ bool CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, bool CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) { + const CFX_PointF& point) { CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point); if (IsValid()) { diff --git a/fpdfsdk/formfiller/cffl_radiobutton.h b/fpdfsdk/formfiller/cffl_radiobutton.h index 49a658f84e..10ac37dcb8 100644 --- a/fpdfsdk/formfiller/cffl_radiobutton.h +++ b/fpdfsdk/formfiller/cffl_radiobutton.h @@ -24,7 +24,7 @@ class CFFL_RadioButton : public CFFL_Button { bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) override; + const CFX_PointF& point) override; bool IsDataChanged(CPDFSDK_PageView* pPageView) override; void SaveData(CPDFSDK_PageView* pPageView) override; }; diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp index 37ecce509d..a891db9019 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -292,9 +292,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView) return false; - - CFX_FloatPoint pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); - return pPageView->OnMouseMove(pt, modifier); + return pPageView->OnMouseMove(CFX_PointF(page_x, page_y), modifier); } DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle, @@ -305,9 +303,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle, CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView) return false; - - CFX_FloatPoint pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); - return pPageView->OnLButtonDown(pt, modifier); + return pPageView->OnLButtonDown(CFX_PointF(page_x, page_y), modifier); } DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle, @@ -319,7 +315,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle, if (!pPageView) return false; - CFX_FloatPoint pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); + CFX_PointF pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); return pPageView->OnLButtonUp(pt, modifier); } @@ -332,9 +328,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle, CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView) return false; - - CFX_FloatPoint pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); - return pPageView->OnRButtonDown(pt, modifier); + return pPageView->OnRButtonDown(CFX_PointF(page_x, page_y), modifier); } DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, @@ -346,7 +340,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, if (!pPageView) return false; - CFX_FloatPoint pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); + CFX_PointF pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); return pPageView->OnRButtonUp(pt, modifier); } #endif // PDF_ENABLE_XFA diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index 1942232553..1d2269c0a0 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -57,7 +57,7 @@ CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap, } void DrawTextString(CFX_RenderDevice* pDevice, - const CFX_FloatPoint& pt, + const CFX_PointF& pt, CPDF_Font* pFont, FX_FLOAT fFontSize, CFX_Matrix* pUser2Device, @@ -78,8 +78,8 @@ void DrawTextString(CFX_RenderDevice* pDevice, ro.m_ColorMode = RENDER_COLOR_NORMAL; if (crTextStroke != 0) { - CFX_FloatPoint pt1; - CFX_FloatPoint pt2; + CFX_PointF pt1; + CFX_PointF pt2; pUser2Device->TransformPoint(pt1.x, pt1.y); pUser2Device->TransformPoint(pt2.x, pt2.y); CFX_GraphStateData gsd; @@ -99,8 +99,8 @@ void DrawTextString(CFX_RenderDevice* pDevice, ro.m_ColorMode = RENDER_COLOR_NORMAL; if (crTextStroke != 0) { - CFX_FloatPoint pt1; - CFX_FloatPoint pt2; + CFX_PointF pt1; + CFX_PointF pt2; pUser2Device->TransformPoint(pt1.x, pt1.y); pUser2Device->TransformPoint(pt2.x, pt2.y); CFX_GraphStateData gsd; @@ -125,7 +125,7 @@ CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjectHolder* pObjectHolder, FX_FLOAT fFontSize, FX_FLOAT fCharSpace, int32_t nHorzScale, - const CFX_FloatPoint& point, + const CFX_PointF& point, const CFX_ByteString& text) { std::unique_ptr pTxtObj(new CPDF_TextObject); pTxtObj->m_TextState.SetFont(pFont); @@ -640,7 +640,7 @@ void CFXEU_InsertText::Undo() { // static CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, bool bContinuous, uint16_t SubWord) { @@ -653,8 +653,8 @@ CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, CFX_ByteTextBuf sEditStream; CFX_ByteTextBuf sWords; int32_t nCurFontIndex = -1; - CFX_FloatPoint ptOld; - CFX_FloatPoint ptNew; + CFX_PointF ptOld; + CFX_PointF ptNew; CPVT_WordPlace oldplace; while (pIterator->NextWord()) { @@ -671,13 +671,13 @@ CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, 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.x != ptOld.x || ptNew.y != ptOld.y) { @@ -708,8 +708,8 @@ CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, } 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.x != ptOld.x || ptNew.y != ptOld.y) { sEditStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y @@ -755,7 +755,7 @@ CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, // static CFX_ByteString CFX_Edit::GetSelectAppearanceStream( CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange) { if (!pRange || !pRange->IsExist()) return CFX_ByteString(); @@ -788,7 +788,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, FX_COLORREF crTextFill, FX_COLORREF crTextStroke, const CFX_FloatRect& rcClip, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, CFX_SystemHandler* pSystemHandler, CFFL_FormFiller* pFFLData) { @@ -808,7 +808,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CFX_ByteTextBuf sTextBuf; int32_t nFontIndex = -1; - CFX_FloatPoint ptBT; + CFX_PointF ptBT; pDevice->SaveState(); if (!rcClip.IsEmpty()) { CFX_FloatRect rcTemp = rcClip; @@ -866,8 +866,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, crOldFill != crCurFill) { if (sTextBuf.GetLength() > 0) { DrawTextString( - pDevice, - CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, sTextBuf.MakeString(), crOldFill, crTextStroke, nHorzScale); @@ -883,8 +882,8 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, .AsStringC(); } else { DrawTextString( - pDevice, CFX_FloatPoint(word.ptWord.x + ptOffset.x, - word.ptWord.y + ptOffset.y), + pDevice, CFX_PointF(word.ptWord.x + ptOffset.x, + word.ptWord.y + ptOffset.y), pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device, GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord), crCurFill, crTextStroke, nHorzScale); @@ -895,7 +894,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, if (sTextBuf.GetLength() > 0) { DrawTextString( - pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, sTextBuf.MakeString(), crOldFill, crTextStroke, nHorzScale); } @@ -907,7 +906,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, // static void CFX_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF crText, std::vector* ObjArray) { @@ -921,7 +920,7 @@ void CFX_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, int32_t nOldFontIndex = -1; CFX_ByteTextBuf sTextBuf; CPVT_WordPlace oldplace; - CFX_FloatPoint ptBT(0.0f, 0.0f); + CFX_PointF ptBT(0.0f, 0.0f); CFX_Edit_Iterator* pIterator = pEdit->GetIterator(); if (pRange) pIterator->SetAt(pRange->BeginPos); @@ -942,7 +941,7 @@ void CFX_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, ObjArray->push_back(AddTextObjToPageObjects( pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), fFontSize, 0.0f, 100, - CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), sTextBuf.MakeString())); sTextBuf.Clear(); @@ -957,7 +956,7 @@ void CFX_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, if (sTextBuf.GetLength() > 0) { ObjArray->push_back(AddTextObjToPageObjects( pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), fFontSize, - 0.0f, 100, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + 0.0f, 100, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), sTextBuf.MakeString())); } } @@ -1017,7 +1016,7 @@ IPVT_FontMap* CFX_Edit::GetFontMap() { void CFX_Edit::SetPlateRect(const CFX_FloatRect& rect) { m_pVT->SetPlateRect(rect); - m_ptScrollPos = CFX_FloatPoint(rect.left, rect.top); + m_ptScrollPos = CFX_PointF(rect.left, rect.top); Paint(); } @@ -1305,10 +1304,10 @@ CPVT_WordRange CFX_Edit::GetVisibleWordRange() const { if (m_pVT->IsValid()) { CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); - CPVT_WordPlace place1 = m_pVT->SearchWordPlace( - EditToVT(CFX_FloatPoint(rcPlate.left, rcPlate.top))); + CPVT_WordPlace place1 = + m_pVT->SearchWordPlace(EditToVT(CFX_PointF(rcPlate.left, rcPlate.top))); CPVT_WordPlace place2 = m_pVT->SearchWordPlace( - EditToVT(CFX_FloatPoint(rcPlate.right, rcPlate.bottom))); + EditToVT(CFX_PointF(rcPlate.right, rcPlate.bottom))); return CPVT_WordRange(place1, place2); } @@ -1316,7 +1315,7 @@ CPVT_WordRange CFX_Edit::GetVisibleWordRange() const { return CPVT_WordRange(); } -CPVT_WordPlace CFX_Edit::SearchWordPlace(const CFX_FloatPoint& point) const { +CPVT_WordPlace CFX_Edit::SearchWordPlace(const CFX_PointF& point) const { if (m_pVT->IsValid()) { return m_pVT->SearchWordPlace(EditToVT(point)); } @@ -1393,7 +1392,7 @@ bool CFX_Edit::IsSelected() const { return m_SelState.IsExist(); } -CFX_FloatPoint CFX_Edit::VTToEdit(const CFX_FloatPoint& point) const { +CFX_PointF CFX_Edit::VTToEdit(const CFX_PointF& point) const { CFX_FloatRect rcContent = m_pVT->GetContentRect(); CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); @@ -1411,11 +1410,11 @@ CFX_FloatPoint CFX_Edit::VTToEdit(const CFX_FloatPoint& point) const { break; } - return CFX_FloatPoint(point.x - (m_ptScrollPos.x - rcPlate.left), - point.y - (m_ptScrollPos.y + fPadding - rcPlate.top)); + return CFX_PointF(point.x - (m_ptScrollPos.x - rcPlate.left), + point.y - (m_ptScrollPos.y + fPadding - rcPlate.top)); } -CFX_FloatPoint CFX_Edit::EditToVT(const CFX_FloatPoint& point) const { +CFX_PointF CFX_Edit::EditToVT(const CFX_PointF& point) const { CFX_FloatRect rcContent = m_pVT->GetContentRect(); CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); @@ -1433,14 +1432,13 @@ CFX_FloatPoint CFX_Edit::EditToVT(const CFX_FloatPoint& point) const { break; } - return CFX_FloatPoint(point.x + (m_ptScrollPos.x - rcPlate.left), - point.y + (m_ptScrollPos.y + fPadding - rcPlate.top)); + return CFX_PointF(point.x + (m_ptScrollPos.x - rcPlate.left), + point.y + (m_ptScrollPos.y + fPadding - rcPlate.top)); } CFX_FloatRect CFX_Edit::VTToEdit(const CFX_FloatRect& rect) const { - CFX_FloatPoint ptLeftBottom = - VTToEdit(CFX_FloatPoint(rect.left, rect.bottom)); - CFX_FloatPoint ptRightTop = VTToEdit(CFX_FloatPoint(rect.right, rect.top)); + CFX_PointF ptLeftBottom = VTToEdit(CFX_PointF(rect.left, rect.bottom)); + CFX_PointF ptRightTop = VTToEdit(CFX_PointF(rect.right, rect.top)); return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y); @@ -1493,14 +1491,14 @@ void CFX_Edit::SetScrollPosY(FX_FLOAT fy) { } } -void CFX_Edit::SetScrollPos(const CFX_FloatPoint& point) { +void CFX_Edit::SetScrollPos(const CFX_PointF& point) { SetScrollPosX(point.x); SetScrollPosY(point.y); SetScrollLimit(); SetCaretInfo(); } -CFX_FloatPoint CFX_Edit::GetScrollPos() const { +CFX_PointF CFX_Edit::GetScrollPos() const { return m_ptScrollPos; } @@ -1542,8 +1540,8 @@ void CFX_Edit::ScrollToCaret() { CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); pIterator->SetAt(m_wpCaret); - CFX_FloatPoint ptHead; - CFX_FloatPoint ptFoot; + CFX_PointF ptHead; + CFX_PointF ptFoot; CPVT_Word word; CPVT_Line line; if (pIterator->GetWord(word)) { @@ -1558,8 +1556,8 @@ void CFX_Edit::ScrollToCaret() { ptFoot.y = line.ptLine.y + line.fLineDescent; } - CFX_FloatPoint ptHeadEdit = VTToEdit(ptHead); - CFX_FloatPoint ptFootEdit = VTToEdit(ptFoot); + CFX_PointF ptHeadEdit = VTToEdit(ptHead); + CFX_PointF ptFootEdit = VTToEdit(ptFoot); CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); if (!IsFloatEqual(rcPlate.left, rcPlate.right)) { if (IsFloatSmaller(ptHeadEdit.x, rcPlate.left) || @@ -1701,8 +1699,8 @@ void CFX_Edit::SetCaretInfo() { CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); pIterator->SetAt(m_wpCaret); - CFX_FloatPoint ptHead; - CFX_FloatPoint ptFoot; + CFX_PointF ptHead; + CFX_PointF ptFoot; CPVT_Word word; CPVT_Line line; if (pIterator->GetWord(word)) { @@ -1737,9 +1735,7 @@ void CFX_Edit::SetCaret(int32_t nPos) { } } -void CFX_Edit::OnMouseDown(const CFX_FloatPoint& point, - bool bShift, - bool bCtrl) { +void CFX_Edit::OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { SelectNone(); SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); @@ -1751,9 +1747,7 @@ void CFX_Edit::OnMouseDown(const CFX_FloatPoint& point, } } -void CFX_Edit::OnMouseMove(const CFX_FloatPoint& point, - bool bShift, - bool bCtrl) { +void CFX_Edit::OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); diff --git a/fpdfsdk/fxedit/fxet_edit.h b/fpdfsdk/fxedit/fxet_edit.h index 555c58b0a3..448207894b 100644 --- a/fpdfsdk/fxedit/fxet_edit.h +++ b/fpdfsdk/fxedit/fxet_edit.h @@ -313,27 +313,26 @@ class CFXEU_InsertText : public CFX_Edit_UndoItem { class CFX_Edit { public: static CFX_ByteString GetEditAppearanceStream(CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, bool bContinuous, uint16_t SubWord); - static CFX_ByteString GetSelectAppearanceStream( - CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, - const CPVT_WordRange* pRange); + static CFX_ByteString GetSelectAppearanceStream(CFX_Edit* pEdit, + const CFX_PointF& ptOffset, + const CPVT_WordRange* pRange); static void DrawEdit(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, CFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke, const CFX_FloatRect& rcClip, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, CFX_SystemHandler* pSystemHandler, CFFL_FormFiller* pFFLData); static void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF crText, std::vector* ObjArray); @@ -352,7 +351,7 @@ class CFX_Edit { // Set the bounding box of the text area. void SetPlateRect(const CFX_FloatRect& rect); - void SetScrollPos(const CFX_FloatPoint& point); + void SetScrollPos(const CFX_PointF& point); // Set the horizontal text alignment. (nFormat [0:left, 1:middle, 2:right]) void SetAlignmentH(int32_t nFormat, bool bPaint); @@ -372,8 +371,8 @@ class CFX_Edit { void SetAutoScroll(bool bAuto, bool bPaint); void SetFontSize(FX_FLOAT fFontSize); void SetTextOverflow(bool bAllowed, bool bPaint); - void OnMouseDown(const CFX_FloatPoint& point, bool bShift, bool bCtrl); - void OnMouseMove(const CFX_FloatPoint& point, bool bShift, bool bCtrl); + void OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl); + void OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl); void OnVK_UP(bool bShift, bool bCtrl); void OnVK_DOWN(bool bShift, bool bCtrl); void OnVK_LEFT(bool bShift, bool bCtrl); @@ -391,14 +390,14 @@ class CFX_Edit { bool Undo(); int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; - CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; + CPVT_WordPlace SearchWordPlace(const CFX_PointF& point) const; int32_t GetCaret() const; CPVT_WordPlace GetCaretWordPlace() const; CFX_WideString GetSelText() const; CFX_WideString GetText() const; FX_FLOAT GetFontSize() const; uint16_t GetPasswordChar() const; - CFX_FloatPoint GetScrollPos() const; + CFX_PointF GetScrollPos() const; int32_t GetCharArray() const; CFX_FloatRect GetContentRect() const; CFX_WideString GetRangeText(const CPVT_WordRange& range) const; @@ -472,8 +471,8 @@ class CFX_Edit { void PaintInsertText(const CPVT_WordPlace& wpOld, const CPVT_WordPlace& wpNew); - inline CFX_FloatPoint VTToEdit(const CFX_FloatPoint& point) const; - inline CFX_FloatPoint EditToVT(const CFX_FloatPoint& point) const; + inline CFX_PointF VTToEdit(const CFX_PointF& point) const; + inline CFX_PointF EditToVT(const CFX_PointF& point) const; inline CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const; void Refresh(); @@ -490,17 +489,15 @@ class CFX_Edit { CPWL_EditCtrl* m_pNotify; CPWL_Edit* m_pOprNotify; std::unique_ptr m_pVTProvider; - CPVT_WordPlace m_wpCaret; CPVT_WordPlace m_wpOldCaret; CFX_Edit_Select m_SelState; - - CFX_FloatPoint m_ptScrollPos; - CFX_FloatPoint m_ptRefreshScrollPos; + CFX_PointF m_ptScrollPos; + CFX_PointF m_ptRefreshScrollPos; bool m_bEnableScroll; std::unique_ptr m_pIterator; CFX_Edit_Refresh m_Refresh; - CFX_FloatPoint m_ptCaret; + CFX_PointF m_ptCaret; CFX_Edit_Undo m_Undo; int32_t m_nAlignment; bool m_bNotifyFlag; diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp index cf718b9acb..39877c955f 100644 --- a/fpdfsdk/fxedit/fxet_list.cpp +++ b/fpdfsdk/fxedit/fxet_list.cpp @@ -207,37 +207,33 @@ void CFX_ListCtrl::SetNotify(CPWL_List_Notify* pNotify) { m_pNotify = pNotify; } -CFX_FloatPoint CFX_ListCtrl::InToOut(const CFX_FloatPoint& point) const { +CFX_PointF CFX_ListCtrl::InToOut(const CFX_PointF& point) const { CFX_FloatRect rcPlate = GetPlateRect(); - - return CFX_FloatPoint(point.x - (m_ptScrollPos.x - rcPlate.left), - point.y - (m_ptScrollPos.y - rcPlate.top)); + return CFX_PointF(point.x - (m_ptScrollPos.x - rcPlate.left), + point.y - (m_ptScrollPos.y - rcPlate.top)); } -CFX_FloatPoint CFX_ListCtrl::OutToIn(const CFX_FloatPoint& point) const { +CFX_PointF CFX_ListCtrl::OutToIn(const CFX_PointF& point) const { CFX_FloatRect rcPlate = GetPlateRect(); - - return CFX_FloatPoint(point.x + (m_ptScrollPos.x - rcPlate.left), - point.y + (m_ptScrollPos.y - rcPlate.top)); + return CFX_PointF(point.x + (m_ptScrollPos.x - rcPlate.left), + point.y + (m_ptScrollPos.y - rcPlate.top)); } CFX_FloatRect CFX_ListCtrl::InToOut(const CFX_FloatRect& rect) const { - CFX_FloatPoint ptLeftBottom = InToOut(CFX_FloatPoint(rect.left, rect.bottom)); - CFX_FloatPoint ptRightTop = InToOut(CFX_FloatPoint(rect.right, rect.top)); - + CFX_PointF ptLeftBottom = InToOut(CFX_PointF(rect.left, rect.bottom)); + CFX_PointF ptRightTop = InToOut(CFX_PointF(rect.right, rect.top)); return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y); } CFX_FloatRect CFX_ListCtrl::OutToIn(const CFX_FloatRect& rect) const { - CFX_FloatPoint ptLeftBottom = OutToIn(CFX_FloatPoint(rect.left, rect.bottom)); - CFX_FloatPoint ptRightTop = OutToIn(CFX_FloatPoint(rect.right, rect.top)); - + CFX_PointF ptLeftBottom = OutToIn(CFX_PointF(rect.left, rect.bottom)); + CFX_PointF ptRightTop = OutToIn(CFX_PointF(rect.right, rect.top)); return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y); } -void CFX_ListCtrl::OnMouseDown(const CFX_FloatPoint& point, +void CFX_ListCtrl::OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl) { int32_t nHitIndex = GetItemIndex(point); @@ -276,7 +272,7 @@ void CFX_ListCtrl::OnMouseDown(const CFX_FloatPoint& point, ScrollToListItem(nHitIndex); } -void CFX_ListCtrl::OnMouseMove(const CFX_FloatPoint& point, +void CFX_ListCtrl::OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl) { int32_t nHitIndex = GetItemIndex(point); @@ -367,7 +363,7 @@ bool CFX_ListCtrl::OnChar(uint16_t nChar, bool bShift, bool bCtrl) { void CFX_ListCtrl::SetPlateRect(const CFX_FloatRect& rect) { CFX_ListContainer::SetPlateRect(rect); m_ptScrollPos.x = rect.left; - SetScrollPos(CFX_FloatPoint(rect.left, rect.top)); + SetScrollPos(CFX_PointF(rect.left, rect.top)); ReArrange(0); InvalidateItem(-1); } @@ -542,7 +538,7 @@ void CFX_ListCtrl::SetScrollInfo() { } } -void CFX_ListCtrl::SetScrollPos(const CFX_FloatPoint& point) { +void CFX_ListCtrl::SetScrollPos(const CFX_PointF& point) { SetScrollPosY(point.y); } @@ -630,8 +626,8 @@ void CFX_ListCtrl::Cancel() { m_aSelItems.DeselectAll(); } -int32_t CFX_ListCtrl::GetItemIndex(const CFX_FloatPoint& point) const { - CFX_FloatPoint pt = OuterToInner(OutToIn(point)); +int32_t CFX_ListCtrl::GetItemIndex(const CFX_PointF& point) const { + CFX_PointF pt = OuterToInner(OutToIn(point)); bool bFirst = true; bool bLast = true; diff --git a/fpdfsdk/fxedit/fxet_list.h b/fpdfsdk/fxedit/fxet_list.h index 38d1957e00..01e18bc000 100644 --- a/fpdfsdk/fxedit/fxet_list.h +++ b/fpdfsdk/fxedit/fxet_list.h @@ -64,11 +64,11 @@ class CLST_Rect : public CFX_FloatRect { return bottom - top; } - CFX_FloatPoint LeftTop() const { return CFX_FloatPoint(left, top); } + CFX_PointF LeftTop() const { return CFX_PointF(left, top); } - CFX_FloatPoint RightBottom() const { return CFX_FloatPoint(right, bottom); } + CFX_PointF RightBottom() const { return CFX_PointF(right, bottom); } - const CLST_Rect operator+=(const CFX_FloatPoint& point) { + const CLST_Rect operator+=(const CFX_PointF& point) { left += point.x; right += point.x; top += point.y; @@ -77,7 +77,7 @@ class CLST_Rect : public CFX_FloatRect { return *this; } - const CLST_Rect operator-=(const CFX_FloatPoint& point) { + const CLST_Rect operator-=(const CFX_PointF& point) { left -= point.x; right -= point.x; top -= point.y; @@ -86,12 +86,12 @@ class CLST_Rect : public CFX_FloatRect { return *this; } - CLST_Rect operator+(const CFX_FloatPoint& point) const { + CLST_Rect operator+(const CFX_PointF& point) const { return CLST_Rect(left + point.x, top + point.y, right + point.x, bottom + point.y); } - CLST_Rect operator-(const CFX_FloatPoint& point) const { + CLST_Rect operator-(const CFX_PointF& point) const { return CLST_Rect(left - point.x, top - point.y, right - point.x, bottom - point.y); } @@ -134,33 +134,31 @@ class CFX_ListContainer { CFX_FloatRect GetPlateRect() const { return m_rcPlate; } void SetContentRect(const CLST_Rect& rect) { m_rcContent = rect; } CLST_Rect GetContentRect() const { return m_rcContent; } - CFX_FloatPoint GetBTPoint() const { - return CFX_FloatPoint(m_rcPlate.left, m_rcPlate.top); + CFX_PointF GetBTPoint() const { + return CFX_PointF(m_rcPlate.left, m_rcPlate.top); } - CFX_FloatPoint GetETPoint() const { - return CFX_FloatPoint(m_rcPlate.right, m_rcPlate.bottom); + CFX_PointF GetETPoint() const { + return CFX_PointF(m_rcPlate.right, m_rcPlate.bottom); } public: - CFX_FloatPoint InnerToOuter(const CFX_FloatPoint& point) const { - return CFX_FloatPoint(point.x + GetBTPoint().x, GetBTPoint().y - point.y); + CFX_PointF InnerToOuter(const CFX_PointF& point) const { + return CFX_PointF(point.x + GetBTPoint().x, GetBTPoint().y - point.y); } - CFX_FloatPoint OuterToInner(const CFX_FloatPoint& point) const { - return CFX_FloatPoint(point.x - GetBTPoint().x, GetBTPoint().y - point.y); + CFX_PointF OuterToInner(const CFX_PointF& point) const { + return CFX_PointF(point.x - GetBTPoint().x, GetBTPoint().y - point.y); } CFX_FloatRect InnerToOuter(const CLST_Rect& rect) const { - CFX_FloatPoint ptLeftTop = - InnerToOuter(CFX_FloatPoint(rect.left, rect.top)); - CFX_FloatPoint ptRightBottom = - InnerToOuter(CFX_FloatPoint(rect.right, rect.bottom)); + CFX_PointF ptLeftTop = InnerToOuter(CFX_PointF(rect.left, rect.top)); + CFX_PointF ptRightBottom = + InnerToOuter(CFX_PointF(rect.right, rect.bottom)); return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, ptLeftTop.y); } CLST_Rect OuterToInner(const CFX_FloatRect& rect) const { - CFX_FloatPoint ptLeftTop = - OuterToInner(CFX_FloatPoint(rect.left, rect.top)); - CFX_FloatPoint ptRightBottom = - OuterToInner(CFX_FloatPoint(rect.right, rect.bottom)); + CFX_PointF ptLeftTop = OuterToInner(CFX_PointF(rect.left, rect.top)); + CFX_PointF ptRightBottom = + OuterToInner(CFX_PointF(rect.right, rect.bottom)); return CLST_Rect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, ptRightBottom.y); } @@ -226,8 +224,8 @@ class CFX_ListCtrl : protected CFX_ListContainer { void SetPlateRect(const CFX_FloatRect& rect) override; void SetNotify(CPWL_List_Notify* pNotify); - void OnMouseDown(const CFX_FloatPoint& point, bool bShift, bool bCtrl); - void OnMouseMove(const CFX_FloatPoint& point, bool bShift, bool bCtrl); + void OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl); + void OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl); void OnVK_UP(bool bShift, bool bCtrl); void OnVK_DOWN(bool bShift, bool bCtrl); void OnVK_LEFT(bool bShift, bool bCtrl); @@ -237,14 +235,14 @@ class CFX_ListCtrl : protected CFX_ListContainer { void OnVK(int32_t nItemIndex, bool bShift, bool bCtrl); bool OnChar(uint16_t nChar, bool bShift, bool bCtrl); - void SetScrollPos(const CFX_FloatPoint& point); + void SetScrollPos(const CFX_PointF& point); void ScrollToListItem(int32_t nItemIndex); CFX_FloatRect GetItemRect(int32_t nIndex) const; int32_t GetCaret() const; int32_t GetSelect() const; int32_t GetTopItem() const; CFX_FloatRect GetContentRect() const; - int32_t GetItemIndex(const CFX_FloatPoint& point) const; + int32_t GetItemIndex(const CFX_PointF& point) const; void AddString(const CFX_WideString& str); void SetTopItem(int32_t nIndex); void Select(int32_t nItemIndex); @@ -267,8 +265,8 @@ class CFX_ListCtrl : protected CFX_ListContainer { int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; int32_t GetFirstSelected() 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 CFX_FloatRect& rect) const; CFX_FloatRect OutToIn(const CFX_FloatRect& rect) const; @@ -291,7 +289,7 @@ class CFX_ListCtrl : protected CFX_ListContainer { CPWL_List_Notify* m_pNotify; bool m_bNotifyFlag; - CFX_FloatPoint m_ptScrollPos; + CFX_PointF m_ptScrollPos; CPLST_Select m_aSelItems; // for multiple int32_t m_nSelItem; // for single int32_t m_nFootIndex; // for multiple diff --git a/fpdfsdk/ipdfsdk_annothandler.h b/fpdfsdk/ipdfsdk_annothandler.h index 408dcceae2..636d161fea 100644 --- a/fpdfsdk/ipdfsdk_annothandler.h +++ b/fpdfsdk/ipdfsdk_annothandler.h @@ -38,7 +38,7 @@ class IPDFSDK_AnnotHandler { CPDFSDK_Annot* pAnnot) = 0; virtual bool HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) = 0; + const CFX_PointF& point) = 0; virtual void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, @@ -55,36 +55,36 @@ class IPDFSDK_AnnotHandler { virtual bool OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) = 0; + const CFX_PointF& point) = 0; virtual bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) = 0; + const CFX_PointF& point) = 0; virtual bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) = 0; + const CFX_PointF& point) = 0; virtual bool OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) = 0; + const CFX_PointF& point) = 0; virtual bool OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_FloatPoint& point) = 0; + const CFX_PointF& point) = 0; virtual bool OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) = 0; + const CFX_PointF& point) = 0; virtual bool OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) = 0; + const CFX_PointF& point) = 0; virtual bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_FloatPoint& point) = 0; + const CFX_PointF& point) = 0; virtual bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) = 0; diff --git a/fpdfsdk/pdfwindow/PWL_Button.cpp b/fpdfsdk/pdfwindow/PWL_Button.cpp index 972e55edad..96be469454 100644 --- a/fpdfsdk/pdfwindow/PWL_Button.cpp +++ b/fpdfsdk/pdfwindow/PWL_Button.cpp @@ -20,7 +20,7 @@ void CPWL_Button::OnCreate(PWL_CREATEPARAM& cp) { cp.eCursorType = FXCT_HAND; } -bool CPWL_Button::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Button::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); m_bMouseDown = true; @@ -29,7 +29,7 @@ bool CPWL_Button::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_Button::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Button::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); ReleaseCapture(); diff --git a/fpdfsdk/pdfwindow/PWL_Button.h b/fpdfsdk/pdfwindow/PWL_Button.h index f35e9adf36..2d1193f89d 100644 --- a/fpdfsdk/pdfwindow/PWL_Button.h +++ b/fpdfsdk/pdfwindow/PWL_Button.h @@ -17,8 +17,8 @@ class CPWL_Button : public CPWL_Wnd { // CPWL_Wnd CFX_ByteString GetClassName() const override; void OnCreate(PWL_CREATEPARAM& cp) override; - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; protected: bool m_bMouseDown; diff --git a/fpdfsdk/pdfwindow/PWL_Caret.cpp b/fpdfsdk/pdfwindow/PWL_Caret.cpp index 6636170e81..06c8e31ce7 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.cpp +++ b/fpdfsdk/pdfwindow/PWL_Caret.cpp @@ -14,6 +14,8 @@ #define PWL_CARET_FLASHINTERVAL 500 +PWL_CARET_INFO::PWL_CARET_INFO() : bVisible(false) {} + CPWL_Caret::CPWL_Caret() : m_bFlash(false), m_fWidth(0.4f), m_nDelay(0) {} CPWL_Caret::~CPWL_Caret() {} @@ -23,7 +25,7 @@ CFX_ByteString CPWL_Caret::GetClassName() const { } void CPWL_Caret::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { - GetCaretApp(sAppStream, CFX_FloatPoint(0.0f, 0.0f)); + GetCaretApp(sAppStream, CFX_PointF()); } void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, @@ -60,7 +62,7 @@ void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, } void CPWL_Caret::GetCaretApp(CFX_ByteTextBuf& sAppStream, - const CFX_FloatPoint& ptOffset) { + const CFX_PointF& ptOffset) { if (IsVisible() && m_bFlash) { CFX_ByteTextBuf sCaret; @@ -85,7 +87,7 @@ void CPWL_Caret::GetCaretApp(CFX_ByteTextBuf& sAppStream, } CFX_ByteString CPWL_Caret::GetCaretAppearanceStream( - const CFX_FloatPoint& ptOffset) { + const CFX_PointF& ptOffset) { CFX_ByteTextBuf sCaret; GetCaretApp(sCaret, ptOffset); return sCaret.MakeString(); @@ -106,8 +108,8 @@ CFX_FloatRect CPWL_Caret::GetCaretRect() const { } void CPWL_Caret::SetCaret(bool bVisible, - const CFX_FloatPoint& ptHead, - const CFX_FloatPoint& ptFoot) { + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot) { if (bVisible) { if (IsVisible()) { if (m_ptHead != ptHead || m_ptFoot != ptFoot) { @@ -126,8 +128,8 @@ void CPWL_Caret::SetCaret(bool bVisible, Move(m_rcInvalid, false, true); } } else { - m_ptHead = CFX_FloatPoint(); - m_ptFoot = CFX_FloatPoint(); + m_ptHead = CFX_PointF(); + m_ptFoot = CFX_PointF(); m_bFlash = false; if (IsVisible()) { EndTimer(); diff --git a/fpdfsdk/pdfwindow/PWL_Caret.h b/fpdfsdk/pdfwindow/PWL_Caret.h index ccee96109e..60ebbdc8e1 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.h +++ b/fpdfsdk/pdfwindow/PWL_Caret.h @@ -11,11 +11,11 @@ struct PWL_CARET_INFO { public: - PWL_CARET_INFO() : bVisible(false) {} + PWL_CARET_INFO(); bool bVisible; - CFX_FloatPoint ptHead; - CFX_FloatPoint ptFoot; + CFX_PointF ptHead; + CFX_PointF ptFoot; }; class CPWL_Caret : public CPWL_Wnd { @@ -33,18 +33,18 @@ class CPWL_Caret : public CPWL_Wnd { void TimerProc() override; void SetCaret(bool bVisible, - const CFX_FloatPoint& ptHead, - const CFX_FloatPoint& ptFoot); - CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset); + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot); + CFX_ByteString GetCaretAppearanceStream(const CFX_PointF& ptOffset); void SetInvalidRect(CFX_FloatRect rc) { m_rcInvalid = rc; } private: - void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CFX_FloatPoint& ptOffset); + void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CFX_PointF& ptOffset); CFX_FloatRect GetCaretRect() const; bool m_bFlash; - CFX_FloatPoint m_ptHead; - CFX_FloatPoint m_ptFoot; + CFX_PointF m_ptHead; + CFX_PointF m_ptFoot; FX_FLOAT m_fWidth; int32_t m_nDelay; CFX_FloatRect m_rcInvalid; diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp index acee850024..1bf1adfbcf 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp @@ -18,7 +18,7 @@ #define PWLCB_DEFAULTFONTSIZE 12.0f -bool CPWL_CBListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_CBListBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (!m_bMouseDown) @@ -102,14 +102,14 @@ void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (IsVisible() && !rectWnd.IsEmpty()) { CFX_ByteTextBuf sButton; - CFX_FloatPoint ptCenter = GetCenterPoint(); + CFX_PointF ptCenter = GetCenterPoint(); - CFX_FloatPoint pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, - ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, - ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt3(ptCenter.x, - ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, + ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, + ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt3(ptCenter.x, + ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); if (IsFloatBigger(rectWnd.right - rectWnd.left, PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) && @@ -133,14 +133,14 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_FloatRect rectWnd = CPWL_Wnd::GetWindowRect(); if (IsVisible() && !rectWnd.IsEmpty()) { - CFX_FloatPoint ptCenter = GetCenterPoint(); + CFX_PointF ptCenter = GetCenterPoint(); - CFX_FloatPoint pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, - ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, - ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt3(ptCenter.x, - ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, + ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, + ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt3(ptCenter.x, + ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); if (IsFloatBigger(rectWnd.right - rectWnd.left, PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) && @@ -162,7 +162,7 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -bool CPWL_CBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_CBButton::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); SetCapture(); @@ -175,7 +175,7 @@ bool CPWL_CBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_CBButton::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_CBButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); ReleaseCapture(); diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.h b/fpdfsdk/pdfwindow/PWL_ComboBox.h index 84261199e9..e1a8df7561 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.h +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.h @@ -23,7 +23,7 @@ class CPWL_CBListBox : public CPWL_ListBox { ~CPWL_CBListBox() override {} // CPWL_ListBox - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; bool OnKeyDownWithExit(uint16_t nChar, bool& bExit, uint32_t nFlag); bool OnCharWithExit(uint16_t nChar, bool& bExit, uint32_t nFlag); @@ -40,8 +40,8 @@ class CPWL_CBButton : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; }; class CPWL_ComboBox : public CPWL_Wnd { diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index b9958a3128..8b46d22f13 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -243,7 +243,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { sAppStream << sLine; CFX_ByteTextBuf sText; - CFX_FloatPoint ptOffset = CFX_FloatPoint(); + CFX_PointF ptOffset; CPVT_WordRange wrWhole = m_pEdit->GetWholeWordRange(); CPVT_WordRange wrSelect = GetSelectWordRange(); CPVT_WordRange wrVisible = @@ -395,10 +395,10 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, pDevice, pUser2Device, m_pEdit.get(), CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), - rcClip, CFX_FloatPoint(), pRange, pSysHandler, m_pFormFiller); + rcClip, CFX_PointF(), pRange, pSysHandler, m_pFormFiller); } -bool CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Edit::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { @@ -414,7 +414,7 @@ bool CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Edit::OnLButtonDblClk(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDblClk(point, nFlag); if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { @@ -424,7 +424,7 @@ bool CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Edit::OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) { if (m_bMouseDown) return false; @@ -454,7 +454,7 @@ void CPWL_Edit::OnSetFocus() { void CPWL_Edit::OnKillFocus() { ShowVScrollBar(false); m_pEdit->SelectNone(); - SetCaret(false, CFX_FloatPoint(), CFX_FloatPoint()); + SetCaret(false, CFX_PointF(), CFX_PointF()); SetCharSet(FXFONT_ANSI_CHARSET); m_bFocus = false; } @@ -464,7 +464,7 @@ void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace) { } CFX_ByteString CPWL_Edit::GetSelectAppearanceStream( - const CFX_FloatPoint& ptOffset) const { + const CFX_PointF& ptOffset) const { CPVT_WordRange wr = GetSelectWordRange(); return CPWL_Utils::GetEditSelAppStream(m_pEdit.get(), ptOffset, &wr); } @@ -486,7 +486,7 @@ CPVT_WordRange CPWL_Edit::GetSelectWordRange() const { } CFX_ByteString CPWL_Edit::GetTextAppearanceStream( - const CFX_FloatPoint& ptOffset) const { + const CFX_PointF& ptOffset) const { CFX_ByteTextBuf sRet; CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit.get(), ptOffset); if (sEdit.GetLength() > 0) { @@ -497,24 +497,22 @@ CFX_ByteString CPWL_Edit::GetTextAppearanceStream( } CFX_ByteString CPWL_Edit::GetCaretAppearanceStream( - const CFX_FloatPoint& ptOffset) const { + const CFX_PointF& ptOffset) const { if (m_pEditCaret) return m_pEditCaret->GetCaretAppearanceStream(ptOffset); return CFX_ByteString(); } -CFX_FloatPoint CPWL_Edit::GetWordRightBottomPoint( - const CPVT_WordPlace& wpWord) { +CFX_PointF CPWL_Edit::GetWordRightBottomPoint(const CPVT_WordPlace& wpWord) { CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); CPVT_WordPlace wpOld = pIterator->GetAt(); pIterator->SetAt(wpWord); - CFX_FloatPoint pt; + CFX_PointF pt; CPVT_Word word; if (pIterator->GetWord(word)) { - pt = CFX_FloatPoint(word.ptWord.x + word.fWidth, - word.ptWord.y + word.fDescent); + pt = CFX_PointF(word.ptWord.x + word.fWidth, word.ptWord.y + word.fDescent); } pIterator->SetAt(wpOld); return pt; @@ -720,10 +718,10 @@ bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { } bool CPWL_Edit::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, + const CFX_PointF& point, uint32_t nFlag) { if (HasFlag(PES_MULTILINE)) { - CFX_FloatPoint ptScroll = GetScrollPos(); + CFX_PointF ptScroll = GetScrollPos(); if (zDelta > 0) { ptScroll.y += GetFontSize(); @@ -805,8 +803,7 @@ CPVT_WordRange CPWL_Edit::CombineWordRange(const CPVT_WordRange& wr1, return wrRet; } -CPVT_WordRange CPWL_Edit::GetLatinWordsRange( - const CFX_FloatPoint& point) const { +CPVT_WordRange CPWL_Edit::GetLatinWordsRange(const CFX_PointF& point) const { return GetSameWordsRange(m_pEdit->SearchWordPlace(point), true, false); } @@ -876,7 +873,7 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place, } void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, std::vector* ObjArray) { CFX_Edit::GeneratePageObjects( pObjectHolder, m_pEdit.get(), ptOffset, nullptr, @@ -885,7 +882,7 @@ void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, } void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_FloatPoint& ptOffset) { + const CFX_PointF& ptOffset) { std::vector ObjArray; CFX_Edit::GeneratePageObjects( pObjectHolder, m_pEdit.get(), ptOffset, nullptr, diff --git a/fpdfsdk/pdfwindow/PWL_Edit.h b/fpdfsdk/pdfwindow/PWL_Edit.h index 801dedd0ac..5143c97424 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.h +++ b/fpdfsdk/pdfwindow/PWL_Edit.h @@ -60,11 +60,11 @@ class CPWL_Edit : public CPWL_EditCtrl { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonDblClk(const CFX_PointF& point, uint32_t nFlag) override; + bool OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) override; bool OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, + const CFX_PointF& point, uint32_t nFlag) override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; @@ -90,10 +90,9 @@ class CPWL_Edit : public CPWL_EditCtrl { void SetText(const CFX_WideString& csText); void ReplaceSel(const CFX_WideString& csText); - CFX_ByteString GetTextAppearanceStream(const CFX_FloatPoint& ptOffset) const; - CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset) const; - CFX_ByteString GetSelectAppearanceStream( - const CFX_FloatPoint& ptOffset) const; + CFX_ByteString GetTextAppearanceStream(const CFX_PointF& ptOffset) const; + CFX_ByteString GetCaretAppearanceStream(const CFX_PointF& ptOffset) const; + CFX_ByteString GetSelectAppearanceStream(const CFX_PointF& ptOffset) const; bool IsTextFull() const; @@ -106,10 +105,10 @@ class CPWL_Edit : public CPWL_EditCtrl { } void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, std::vector* ObjArray); void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_FloatPoint& ptOffset); + const CFX_PointF& ptOffset); bool IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag); void AttachFFLData(CFFL_FormFiller* pData) { m_pFormFiller = pData; } @@ -131,11 +130,11 @@ class CPWL_Edit : public CPWL_EditCtrl { void SetParamByFlag(); FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray); - CFX_FloatPoint GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); + CFX_PointF GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2); - CPVT_WordRange GetLatinWordsRange(const CFX_FloatPoint& point) const; + CPVT_WordRange GetLatinWordsRange(const CFX_PointF& point) const; CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const; CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace& place) const; CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place, diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp index 90b7a3c7c0..64272e34c5 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp @@ -40,8 +40,8 @@ void CPWL_EditCtrl::OnCreated() { bool CPWL_EditCtrl::IsWndHorV() { CFX_Matrix mt = GetWindowMatrix(); - CFX_FloatPoint point1(0, 1); - CFX_FloatPoint point2(1, 1); + CFX_PointF point1(0, 1); + CFX_PointF point2(1, 1); mt.TransformPoint(point1.x, point1.y); mt.TransformPoint(point2.x, point2.y); @@ -93,8 +93,7 @@ void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd, FX_FLOAT fPos = *(FX_FLOAT*)lParam; switch (wParam) { case SBT_VSCROLL: - m_pEdit->SetScrollPos( - CFX_FloatPoint(m_pEdit->GetScrollPos().x, fPos)); + m_pEdit->SetScrollPos(CFX_PointF(m_pEdit->GetScrollPos().x, fPos)); break; } } break; @@ -281,7 +280,7 @@ bool CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { return true; } -bool CPWL_EditCtrl::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_EditCtrl::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (ClientHitTest(point)) { @@ -297,7 +296,7 @@ bool CPWL_EditCtrl::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_EditCtrl::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_EditCtrl::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (m_bMouseDown) { @@ -312,7 +311,7 @@ bool CPWL_EditCtrl::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_EditCtrl::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_EditCtrl::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (m_bMouseDown) @@ -326,8 +325,8 @@ CFX_FloatRect CPWL_EditCtrl::GetContentRect() const { } void CPWL_EditCtrl::SetEditCaret(bool bVisible) { - CFX_FloatPoint ptHead; - CFX_FloatPoint ptFoot; + CFX_PointF ptHead; + CFX_PointF ptFoot; if (bVisible) GetCaretInfo(ptHead, ptFoot); @@ -335,8 +334,7 @@ void CPWL_EditCtrl::SetEditCaret(bool bVisible) { IOnSetCaret(bVisible, ptHead, ptFoot, wpTemp); } -void CPWL_EditCtrl::GetCaretInfo(CFX_FloatPoint& ptHead, - CFX_FloatPoint& ptFoot) const { +void CPWL_EditCtrl::GetCaretInfo(CFX_PointF& ptHead, CFX_PointF& ptFoot) const { CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); pIterator->SetAt(m_pEdit->GetCaret()); CPVT_Word word; @@ -355,15 +353,15 @@ void CPWL_EditCtrl::GetCaretInfo(CFX_FloatPoint& ptHead, } void CPWL_EditCtrl::GetCaretPos(int32_t& x, int32_t& y) const { - CFX_FloatPoint ptHead; - CFX_FloatPoint ptFoot; + CFX_PointF ptHead; + CFX_PointF ptFoot; GetCaretInfo(ptHead, ptFoot); PWLtoWnd(ptHead, x, y); } void CPWL_EditCtrl::SetCaret(bool bVisible, - const CFX_FloatPoint& ptHead, - const CFX_FloatPoint& ptFoot) { + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot) { if (m_pEditCaret) { if (!IsFocused() || m_pEdit->IsSelected()) bVisible = false; @@ -413,11 +411,11 @@ int32_t CPWL_EditCtrl::GetTotalWords() const { return m_pEdit->GetTotalWords(); } -void CPWL_EditCtrl::SetScrollPos(const CFX_FloatPoint& point) { +void CPWL_EditCtrl::SetScrollPos(const CFX_PointF& point) { m_pEdit->SetScrollPos(point); } -CFX_FloatPoint CPWL_EditCtrl::GetScrollPos() const { +CFX_PointF CPWL_EditCtrl::GetScrollPos() const { return m_pEdit->GetScrollPos(); } @@ -544,8 +542,8 @@ void CPWL_EditCtrl::IOnSetScrollPosY(FX_FLOAT fy) { } void CPWL_EditCtrl::IOnSetCaret(bool bVisible, - const CFX_FloatPoint& ptHead, - const CFX_FloatPoint& ptFoot, + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot, const CPVT_WordPlace& place) { PWL_CARET_INFO cInfo; cInfo.bVisible = bVisible; @@ -572,9 +570,9 @@ void CPWL_EditCtrl::GetTextRange(const CFX_FloatRect& rect, int32_t& nStartChar, int32_t& nEndChar) const { nStartChar = m_pEdit->WordPlaceToWordIndex( - m_pEdit->SearchWordPlace(CFX_FloatPoint(rect.left, rect.top))); + m_pEdit->SearchWordPlace(CFX_PointF(rect.left, rect.top))); nEndChar = m_pEdit->WordPlaceToWordIndex( - m_pEdit->SearchWordPlace(CFX_FloatPoint(rect.right, rect.bottom))); + m_pEdit->SearchWordPlace(CFX_PointF(rect.right, rect.bottom))); } CFX_WideString CPWL_EditCtrl::GetText(int32_t& nStartChar, diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/pdfwindow/PWL_EditCtrl.h index 3ff5cc66c9..8b65d4a7b5 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.h +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.h @@ -53,8 +53,8 @@ class CPWL_EditCtrl : public CPWL_Wnd { void Paint(); void EnableRefresh(bool bRefresh); - CFX_FloatPoint GetScrollPos() const; - void SetScrollPos(const CFX_FloatPoint& point); + CFX_PointF GetScrollPos() const; + void SetScrollPos(const CFX_PointF& point); void SetCharSet(uint8_t nCharSet) { m_nCharSet = nCharSet; } int32_t GetCharSet() const; @@ -77,9 +77,9 @@ class CPWL_EditCtrl : public CPWL_Wnd { void OnCreated() override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag) override; void OnNotify(CPWL_Wnd* pWnd, uint32_t msg, intptr_t wParam = 0, @@ -98,8 +98,8 @@ class CPWL_EditCtrl : public CPWL_Wnd { FX_FLOAT fBigStep); void IOnSetScrollPosY(FX_FLOAT fy); void IOnSetCaret(bool bVisible, - const CFX_FloatPoint& ptHead, - const CFX_FloatPoint& ptFoot, + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot, const CPVT_WordPlace& place); void IOnCaretChange(const CPVT_SecProps& secProps, const CPVT_WordProps& wordProps); @@ -121,10 +121,10 @@ class CPWL_EditCtrl : public CPWL_Wnd { void Delete(); void Backspace(); - void GetCaretInfo(CFX_FloatPoint& ptHead, CFX_FloatPoint& ptFoot) const; + void GetCaretInfo(CFX_PointF& ptHead, CFX_PointF& ptFoot) const; void SetCaret(bool bVisible, - const CFX_FloatPoint& ptHead, - const CFX_FloatPoint& ptFoot); + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot); void SetEditCaret(bool bVisible); diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp index 12cad7b9da..3f5dfef142 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp @@ -106,7 +106,7 @@ void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom) continue; - CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); + CFX_PointF ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); if (m_pList->IsItemSelected(i)) { sListItems << CPWL_Utils::GetRectFillAppStream(rcItem, PWL_DEFAULT_SELBACKCOLOR) @@ -158,7 +158,7 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom) continue; - CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); + CFX_PointF ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); if (CFX_Edit* pEdit = m_pList->GetItemEdit(i)) { CFX_FloatRect rcContent = pEdit->GetContentRect(); if (rcContent.Width() > rcClient.Width()) @@ -249,7 +249,7 @@ bool CPWL_ListBox::OnChar(uint16_t nChar, uint32_t nFlag) { return true; } -bool CPWL_ListBox::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_ListBox::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (ClientHitTest(point)) { @@ -263,7 +263,7 @@ bool CPWL_ListBox::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_ListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_ListBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (m_bMouseDown) { @@ -281,7 +281,7 @@ void CPWL_ListBox::SetHoverSel(bool bHoverSel) { m_bHoverSel = bHoverSel; } -bool CPWL_ListBox::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_ListBox::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (m_bHoverSel && !IsCaptureMouse() && ClientHitTest(point)) @@ -323,7 +323,7 @@ void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, fPos = *(FX_FLOAT*)lParam; switch (wParam) { case SBT_VSCROLL: - m_pList->SetScrollPos(CFX_FloatPoint(0, fPos)); + m_pList->SetScrollPos(CFX_PointF(0, fPos)); break; } break; @@ -449,7 +449,7 @@ CFX_FloatRect CPWL_ListBox::GetListRect() const { } bool CPWL_ListBox::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, + const CFX_PointF& point, uint32_t nFlag) { if (zDelta < 0) m_pList->OnVK_DOWN(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.h b/fpdfsdk/pdfwindow/PWL_ListBox.h index 6db4ecb381..f9108a17de 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.h +++ b/fpdfsdk/pdfwindow/PWL_ListBox.h @@ -35,8 +35,8 @@ class CPWL_List_Notify { void IOnInvalidateRect(CFX_FloatRect* pRect); void IOnSetCaret(bool bVisible, - const CFX_FloatPoint& ptHead, - const CFX_FloatPoint& ptFoot, + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot, const CPVT_WordPlace& place); private: @@ -57,11 +57,11 @@ class CPWL_ListBox : public CPWL_Wnd { CFX_Matrix* pUser2Device) override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag) override; bool OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, + const CFX_PointF& point, uint32_t nFlag) override; void KillFocus() override; void OnNotify(CPWL_Wnd* pWnd, diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp index c7e6bbfa99..2aa2c7e35f 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp @@ -137,18 +137,17 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { sAppStream << "q\n"; - CFX_FloatPoint ptCenter = GetCenterPoint(); + CFX_PointF ptCenter = GetCenterPoint(); switch (m_eScrollBarType) { case SBT_HSCROLL: switch (m_eSBButtonType) { case PSBT_MIN: { - CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y); - CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y + PWL_TRIANGLE_HALFLEN); - CFX_FloatPoint pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y - PWL_TRIANGLE_HALFLEN); + CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); + CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y + PWL_TRIANGLE_HALFLEN); + CFX_PointF pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y - PWL_TRIANGLE_HALFLEN); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -162,12 +161,11 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { } } break; case PSBT_MAX: { - CFX_FloatPoint pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y); - CFX_FloatPoint pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y + PWL_TRIANGLE_HALFLEN); - CFX_FloatPoint pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y - PWL_TRIANGLE_HALFLEN); + CFX_PointF pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); + CFX_PointF pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y + PWL_TRIANGLE_HALFLEN); + CFX_PointF pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y - PWL_TRIANGLE_HALFLEN); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -187,12 +185,11 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { case SBT_VSCROLL: switch (m_eSBButtonType) { case PSBT_MIN: { - CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN, - ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN, - ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt3(ptCenter.x, - ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN, + ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN, + ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt3(ptCenter.x, ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -206,12 +203,11 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { } } break; case PSBT_MAX: { - CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN, - ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN, - ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt3(ptCenter.x, - ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN, + ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN, + ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt3(ptCenter.x, ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -244,7 +240,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, if (rectWnd.IsEmpty()) return; - CFX_FloatPoint ptCenter = GetCenterPoint(); + CFX_PointF ptCenter = GetCenterPoint(); int32_t nTransparancy = GetTransparency(); switch (m_eScrollBarType) { @@ -252,12 +248,11 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); switch (m_eSBButtonType) { case PSBT_MIN: { - CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y); - CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y + PWL_TRIANGLE_HALFLEN); - CFX_FloatPoint pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y - PWL_TRIANGLE_HALFLEN); + CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); + CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y + PWL_TRIANGLE_HALFLEN); + CFX_PointF pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y - PWL_TRIANGLE_HALFLEN); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -276,12 +271,11 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } break; case PSBT_MAX: { - CFX_FloatPoint pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y); - CFX_FloatPoint pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y + PWL_TRIANGLE_HALFLEN); - CFX_FloatPoint pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y - PWL_TRIANGLE_HALFLEN); + CFX_PointF pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); + CFX_PointF pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y + PWL_TRIANGLE_HALFLEN); + CFX_PointF pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y - PWL_TRIANGLE_HALFLEN); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -334,13 +328,13 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, if (rectWnd.top - rectWnd.bottom > 6.0f) { FX_FLOAT fX = rectWnd.left + 1.5f; FX_FLOAT fY = rectWnd.bottom; - CFX_FloatPoint pts[7] = {CFX_FloatPoint(fX + 2.5f, fY + 4.0f), - CFX_FloatPoint(fX + 2.5f, fY + 3.0f), - CFX_FloatPoint(fX + 4.5f, fY + 5.0f), - CFX_FloatPoint(fX + 6.5f, fY + 3.0f), - CFX_FloatPoint(fX + 6.5f, fY + 4.0f), - CFX_FloatPoint(fX + 4.5f, fY + 6.0f), - CFX_FloatPoint(fX + 2.5f, fY + 4.0f)}; + CFX_PointF pts[7] = {CFX_PointF(fX + 2.5f, fY + 4.0f), + CFX_PointF(fX + 2.5f, fY + 3.0f), + CFX_PointF(fX + 4.5f, fY + 5.0f), + CFX_PointF(fX + 6.5f, fY + 3.0f), + CFX_PointF(fX + 6.5f, fY + 4.0f), + CFX_PointF(fX + 4.5f, fY + 6.0f), + CFX_PointF(fX + 2.5f, fY + 4.0f)}; if (IsEnabled()) CPWL_Utils::DrawFillArea( @@ -380,13 +374,13 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, FX_FLOAT fX = rectWnd.left + 1.5f; FX_FLOAT fY = rectWnd.bottom; - CFX_FloatPoint pts[7] = {CFX_FloatPoint(fX + 2.5f, fY + 5.0f), - CFX_FloatPoint(fX + 2.5f, fY + 6.0f), - CFX_FloatPoint(fX + 4.5f, fY + 4.0f), - CFX_FloatPoint(fX + 6.5f, fY + 6.0f), - CFX_FloatPoint(fX + 6.5f, fY + 5.0f), - CFX_FloatPoint(fX + 4.5f, fY + 3.0f), - CFX_FloatPoint(fX + 2.5f, fY + 5.0f)}; + CFX_PointF pts[7] = {CFX_PointF(fX + 2.5f, fY + 5.0f), + CFX_PointF(fX + 2.5f, fY + 6.0f), + CFX_PointF(fX + 4.5f, fY + 4.0f), + CFX_PointF(fX + 6.5f, fY + 6.0f), + CFX_PointF(fX + 6.5f, fY + 5.0f), + CFX_PointF(fX + 4.5f, fY + 3.0f), + CFX_PointF(fX + 2.5f, fY + 5.0f)}; if (IsEnabled()) CPWL_Utils::DrawFillArea( @@ -414,10 +408,9 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, if (IsEnabled()) { // draw shadow effect - CFX_FloatPoint ptTop = - CFX_FloatPoint(rectWnd.left, rectWnd.top - 1.0f); - CFX_FloatPoint ptBottom = - CFX_FloatPoint(rectWnd.left, rectWnd.bottom + 1.0f); + CFX_PointF ptTop = CFX_PointF(rectWnd.left, rectWnd.top - 1.0f); + CFX_PointF ptBottom = + CFX_PointF(rectWnd.left, rectWnd.bottom + 1.0f); ptTop.x += 1.5f; ptBottom.x += 1.5f; @@ -504,12 +497,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, FX_FLOAT nFrictionWidth = 5.0f; FX_FLOAT nFrictionHeight = 5.5f; - CFX_FloatPoint ptLeft = - CFX_FloatPoint(ptCenter.x - nFrictionWidth / 2.0f, - ptCenter.y - nFrictionHeight / 2.0f + 0.5f); - CFX_FloatPoint ptRight = - CFX_FloatPoint(ptCenter.x + nFrictionWidth / 2.0f, - ptCenter.y - nFrictionHeight / 2.0f + 0.5f); + CFX_PointF ptLeft = + CFX_PointF(ptCenter.x - nFrictionWidth / 2.0f, + ptCenter.y - nFrictionHeight / 2.0f + 0.5f); + CFX_PointF ptRight = + CFX_PointF(ptCenter.x + nFrictionWidth / 2.0f, + ptCenter.y - nFrictionHeight / 2.0f + 0.5f); CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, crStroke, 1.0f); @@ -536,7 +529,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -bool CPWL_SBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_SBButton::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) @@ -548,7 +541,7 @@ bool CPWL_SBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_SBButton::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_SBButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) @@ -560,7 +553,7 @@ bool CPWL_SBButton::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_SBButton::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_SBButton::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) { @@ -683,20 +676,19 @@ void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice, CPWL_Utils::DrawStrokeLine( pDevice, pUser2Device, - CFX_FloatPoint(rectWnd.left + 2.0f, rectWnd.top - 2.0f), - CFX_FloatPoint(rectWnd.left + 2.0f, rectWnd.bottom + 2.0f), + CFX_PointF(rectWnd.left + 2.0f, rectWnd.top - 2.0f), + CFX_PointF(rectWnd.left + 2.0f, rectWnd.bottom + 2.0f), ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f); CPWL_Utils::DrawStrokeLine( pDevice, pUser2Device, - CFX_FloatPoint(rectWnd.right - 2.0f, rectWnd.top - 2.0f), - CFX_FloatPoint(rectWnd.right - 2.0f, rectWnd.bottom + 2.0f), + CFX_PointF(rectWnd.right - 2.0f, rectWnd.top - 2.0f), + CFX_PointF(rectWnd.right - 2.0f, rectWnd.bottom + 2.0f), ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f); } } -bool CPWL_ScrollBar::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_ScrollBar::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (HasFlag(PWS_AUTOTRANSPARENT)) { @@ -751,7 +743,7 @@ bool CPWL_ScrollBar::OnLButtonDown(const CFX_FloatPoint& point, return true; } -bool CPWL_ScrollBar::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_ScrollBar::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (HasFlag(PWS_AUTOTRANSPARENT)) { @@ -776,41 +768,41 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, switch (msg) { case PNM_LBUTTONDOWN: if (pWnd == m_pMinButton) { - OnMinButtonLBDown(*(CFX_FloatPoint*)lParam); + OnMinButtonLBDown(*(CFX_PointF*)lParam); } if (pWnd == m_pMaxButton) { - OnMaxButtonLBDown(*(CFX_FloatPoint*)lParam); + OnMaxButtonLBDown(*(CFX_PointF*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonLBDown(*(CFX_FloatPoint*)lParam); + OnPosButtonLBDown(*(CFX_PointF*)lParam); } break; case PNM_LBUTTONUP: if (pWnd == m_pMinButton) { - OnMinButtonLBUp(*(CFX_FloatPoint*)lParam); + OnMinButtonLBUp(*(CFX_PointF*)lParam); } if (pWnd == m_pMaxButton) { - OnMaxButtonLBUp(*(CFX_FloatPoint*)lParam); + OnMaxButtonLBUp(*(CFX_PointF*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonLBUp(*(CFX_FloatPoint*)lParam); + OnPosButtonLBUp(*(CFX_PointF*)lParam); } break; case PNM_MOUSEMOVE: if (pWnd == m_pMinButton) { - OnMinButtonMouseMove(*(CFX_FloatPoint*)lParam); + OnMinButtonMouseMove(*(CFX_PointF*)lParam); } if (pWnd == m_pMaxButton) { - OnMaxButtonMouseMove(*(CFX_FloatPoint*)lParam); + OnMaxButtonMouseMove(*(CFX_PointF*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonMouseMove(*(CFX_FloatPoint*)lParam); + OnPosButtonMouseMove(*(CFX_PointF*)lParam); } break; case PNM_SETSCROLLINFO: { @@ -954,7 +946,7 @@ void CPWL_ScrollBar::MovePosButton(bool bRefresh) { } } -void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_FloatPoint& point) { +void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_PointF& point) { m_sData.SubSmall(); MovePosButton(true); NotifyScrollWindow(); @@ -965,11 +957,11 @@ void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_FloatPoint& point) { BeginTimer(100); } -void CPWL_ScrollBar::OnMinButtonLBUp(const CFX_FloatPoint& point) {} +void CPWL_ScrollBar::OnMinButtonLBUp(const CFX_PointF& point) {} -void CPWL_ScrollBar::OnMinButtonMouseMove(const CFX_FloatPoint& point) {} +void CPWL_ScrollBar::OnMinButtonMouseMove(const CFX_PointF& point) {} -void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_FloatPoint& point) { +void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_PointF& point) { m_sData.AddSmall(); MovePosButton(true); NotifyScrollWindow(); @@ -980,11 +972,11 @@ void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_FloatPoint& point) { BeginTimer(100); } -void CPWL_ScrollBar::OnMaxButtonLBUp(const CFX_FloatPoint& point) {} +void CPWL_ScrollBar::OnMaxButtonLBUp(const CFX_PointF& point) {} -void CPWL_ScrollBar::OnMaxButtonMouseMove(const CFX_FloatPoint& point) {} +void CPWL_ScrollBar::OnMaxButtonMouseMove(const CFX_PointF& point) {} -void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_FloatPoint& point) { +void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_PointF& point) { m_bMouseDown = true; if (m_pPosButton) { @@ -1003,7 +995,7 @@ void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_FloatPoint& point) { } } -void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_FloatPoint& point) { +void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_PointF& point) { if (m_bMouseDown) { if (!m_bNotifyForever) NotifyScrollWindow(); @@ -1011,7 +1003,7 @@ void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_FloatPoint& point) { m_bMouseDown = false; } -void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_FloatPoint& point) { +void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_PointF& point) { FX_FLOAT fOldScrollPos = m_sData.fScrollPos; FX_FLOAT fNewPos = 0; diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/pdfwindow/PWL_ScrollBar.h index bcfb0a6873..9546a9e577 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.h +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.h @@ -53,9 +53,9 @@ class CPWL_SBButton : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag) override; protected: PWL_SCROLLBAR_TYPE m_eScrollBarType; @@ -127,8 +127,8 @@ class CPWL_ScrollBar : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; void OnNotify(CPWL_Wnd* pWnd, uint32_t msg, intptr_t wParam = 0, @@ -152,17 +152,17 @@ class CPWL_ScrollBar : public CPWL_Wnd { private: void CreateButtons(const PWL_CREATEPARAM& cp); - void OnMinButtonLBDown(const CFX_FloatPoint& point); - void OnMinButtonLBUp(const CFX_FloatPoint& point); - void OnMinButtonMouseMove(const CFX_FloatPoint& point); + void OnMinButtonLBDown(const CFX_PointF& point); + void OnMinButtonLBUp(const CFX_PointF& point); + void OnMinButtonMouseMove(const CFX_PointF& point); - void OnMaxButtonLBDown(const CFX_FloatPoint& point); - void OnMaxButtonLBUp(const CFX_FloatPoint& point); - void OnMaxButtonMouseMove(const CFX_FloatPoint& point); + void OnMaxButtonLBDown(const CFX_PointF& point); + void OnMaxButtonLBUp(const CFX_PointF& point); + void OnMaxButtonMouseMove(const CFX_PointF& point); - void OnPosButtonLBDown(const CFX_FloatPoint& point); - void OnPosButtonLBUp(const CFX_FloatPoint& point); - void OnPosButtonMouseMove(const CFX_FloatPoint& point); + void OnPosButtonLBDown(const CFX_PointF& point); + void OnPosButtonLBUp(const CFX_PointF& point); + void OnPosButtonMouseMove(const CFX_PointF& point); FX_FLOAT TrueToFace(FX_FLOAT); FX_FLOAT FaceToTrue(FX_FLOAT); diff --git a/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp b/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp index defb992c57..1c46c375a9 100644 --- a/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp +++ b/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp @@ -37,7 +37,7 @@ bool CPWL_CheckBox::IsChecked() const { return m_bChecked; } -bool CPWL_CheckBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_CheckBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { if (IsReadOnly()) return false; @@ -58,8 +58,7 @@ CFX_ByteString CPWL_RadioButton::GetClassName() const { return "CPWL_RadioButton"; } -bool CPWL_RadioButton::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_RadioButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { if (IsReadOnly()) return false; diff --git a/fpdfsdk/pdfwindow/PWL_SpecialButton.h b/fpdfsdk/pdfwindow/PWL_SpecialButton.h index 0aa6c4510b..93f611b744 100644 --- a/fpdfsdk/pdfwindow/PWL_SpecialButton.h +++ b/fpdfsdk/pdfwindow/PWL_SpecialButton.h @@ -26,7 +26,7 @@ class CPWL_CheckBox : public CPWL_Button { // CPWL_Button CFX_ByteString GetClassName() const override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; void SetCheck(bool bCheck); @@ -43,7 +43,7 @@ class CPWL_RadioButton : public CPWL_Button { // CPWL_Button CFX_ByteString GetClassName() const override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; void SetCheck(bool bCheck); diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp index f3caf12af9..d4e31bcf73 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp @@ -105,10 +105,10 @@ bool CPWL_Utils::IntersectRect(const CFX_FloatRect& rect1, return left < right && bottom < top; } -CFX_FloatPoint CPWL_Utils::OffsetPoint(const CFX_FloatPoint& point, - FX_FLOAT x, - FX_FLOAT y) { - return CFX_FloatPoint(point.x + x, point.y + y); +CFX_PointF CPWL_Utils::OffsetPoint(const CFX_PointF& point, + FX_FLOAT x, + FX_FLOAT y) { + return CFX_PointF(point.x + x, point.y + y); } CPVT_WordRange CPWL_Utils::OverlapWordRange(const CPVT_WordRange& wr1, @@ -192,10 +192,10 @@ CFX_ByteString CPWL_Utils::GetAP_Circle(const CFX_FloatRect& crBBox) { FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CFX_FloatPoint pt1(crBBox.left, crBBox.bottom + fHeight / 2); - CFX_FloatPoint pt2(crBBox.left + fWidth / 2, crBBox.top); - CFX_FloatPoint pt3(crBBox.right, crBBox.bottom + fHeight / 2); - CFX_FloatPoint pt4(crBBox.left + fWidth / 2, crBBox.bottom); + CFX_PointF pt1(crBBox.left, crBBox.bottom + fHeight / 2); + CFX_PointF pt2(crBBox.left + fWidth / 2, crBBox.top); + CFX_PointF pt3(crBBox.right, crBBox.bottom + fHeight / 2); + CFX_PointF pt4(crBBox.left + fWidth / 2, crBBox.bottom); csAP << pt1.x << " " << pt1.y << " m\n"; @@ -245,10 +245,10 @@ CFX_ByteString CPWL_Utils::GetAP_Diamond(const CFX_FloatRect& crBBox) { FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CFX_FloatPoint pt1(crBBox.left, crBBox.bottom + fHeight / 2); - CFX_FloatPoint pt2(crBBox.left + fWidth / 2, crBBox.top); - CFX_FloatPoint pt3(crBBox.right, crBBox.bottom + fHeight / 2); - CFX_FloatPoint pt4(crBBox.left + fWidth / 2, crBBox.bottom); + CFX_PointF pt1(crBBox.left, crBBox.bottom + fHeight / 2); + CFX_PointF pt2(crBBox.left + fWidth / 2, crBBox.top); + CFX_PointF pt3(crBBox.right, crBBox.bottom + fHeight / 2); + CFX_PointF pt4(crBBox.left + fWidth / 2, crBBox.bottom); csAP << pt1.x << " " << pt1.y << " m\n"; csAP << pt2.x << " " << pt2.y << " l\n"; @@ -276,8 +276,8 @@ CFX_ByteString CPWL_Utils::GetAP_Star(const CFX_FloatRect& crBBox) { FX_FLOAT fRadius = (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f)); - CFX_FloatPoint ptCenter = CFX_FloatPoint((crBBox.left + crBBox.right) / 2.0f, - (crBBox.top + crBBox.bottom) / 2.0f); + CFX_PointF ptCenter = CFX_PointF((crBBox.left + crBBox.right) / 2.0f, + (crBBox.top + crBBox.bottom) / 2.0f); FX_FLOAT px[5], py[5]; @@ -310,9 +310,9 @@ CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CFX_FloatRect& crBBox, FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CFX_FloatPoint pt1(-fWidth / 2, 0); - CFX_FloatPoint pt2(0, fHeight / 2); - CFX_FloatPoint pt3(fWidth / 2, 0); + CFX_PointF pt1(-fWidth / 2, 0); + CFX_PointF pt2(0, fHeight / 2); + CFX_PointF pt3(fWidth / 2, 0); FX_FLOAT px, py; @@ -365,8 +365,8 @@ CFX_FloatRect CPWL_Utils::ScaleRect(const CFX_FloatRect& rcRect, FX_FLOAT fHalfWidth = (rcRect.right - rcRect.left) / 2.0f; FX_FLOAT fHalfHeight = (rcRect.top - rcRect.bottom) / 2.0f; - CFX_FloatPoint ptCenter = CFX_FloatPoint((rcRect.left + rcRect.right) / 2, - (rcRect.top + rcRect.bottom) / 2); + CFX_PointF ptCenter = CFX_PointF((rcRect.left + rcRect.right) / 2, + (rcRect.top + rcRect.bottom) / 2); return CFX_FloatRect( ptCenter.x - fHalfWidth * fScale, ptCenter.y - fHalfHeight * fScale, @@ -411,7 +411,7 @@ CFX_FloatRect CPWL_Utils::GetCenterSquare(const CFX_FloatRect& rect) { } CFX_ByteString CPWL_Utils::GetEditAppStream(CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, bool bContinuous, uint16_t SubWord) { @@ -420,7 +420,7 @@ CFX_ByteString CPWL_Utils::GetEditAppStream(CFX_Edit* pEdit, } CFX_ByteString CPWL_Utils::GetEditSelAppStream(CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange) { return CFX_Edit::GetSelectAppearanceStream(pEdit, ptOffset, pRange); } @@ -452,7 +452,7 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox, pEdit->SetText(sText); CFX_ByteString sEdit = - CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f)); + CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, 0.0f)); if (sEdit.GetLength() > 0) sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n"; @@ -664,7 +664,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, if (!rcLabel.IsEmpty()) { pEdit->SetPlateRect(rcLabel); CFX_ByteString sEdit = - CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f)); + CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, 0.0f)); if (sEdit.GetLength() > 0) { sTemp << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n"; @@ -1089,8 +1089,8 @@ CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CFX_FloatRect& rcBBox) { CPWL_Dash(3, 0, 0)) << "Q\n"; - CFX_FloatPoint ptCenter = CFX_FloatPoint((rcBBox.left + rcBBox.right) / 2, - (rcBBox.top + rcBBox.bottom) / 2); + CFX_PointF ptCenter = CFX_PointF((rcBBox.left + rcBBox.right) / 2, + (rcBBox.top + rcBBox.bottom) / 2); if (IsFloatBigger(rcBBox.right - rcBBox.left, 6) && IsFloatBigger(rcBBox.top - rcBBox.bottom, 6)) { sAppStream << "q\n" @@ -1230,7 +1230,7 @@ void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, void CPWL_Utils::DrawFillArea(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - const CFX_FloatPoint* pPts, + const CFX_PointF* pPts, int32_t nCount, const FX_COLORREF& color) { CFX_PathData path; @@ -1260,8 +1260,8 @@ void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice, void CPWL_Utils::DrawStrokeLine(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - const CFX_FloatPoint& ptMoveTo, - const CFX_FloatPoint& ptLineTo, + const CFX_PointF& ptMoveTo, + const CFX_PointF& ptLineTo, const FX_COLORREF& color, FX_FLOAT fWidth) { CFX_PathData path; @@ -1300,8 +1300,8 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, for (FX_FLOAT fy = rect.bottom + 0.5f; fy <= rect.top - 0.5f; fy += 1.0f) { int32_t nGray = nStartGray + (int32_t)(fStepGray * (fy - rect.bottom)); CPWL_Utils::DrawStrokeLine( - pDevice, pUser2Device, CFX_FloatPoint(rect.left, fy), - CFX_FloatPoint(rect.right, fy), + pDevice, pUser2Device, CFX_PointF(rect.left, fy), + CFX_PointF(rect.right, fy), ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f); } } @@ -1312,8 +1312,8 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, for (FX_FLOAT fx = rect.left + 0.5f; fx <= rect.right - 0.5f; fx += 1.0f) { int32_t nGray = nStartGray + (int32_t)(fStepGray * (fx - rect.left)); CPWL_Utils::DrawStrokeLine( - pDevice, pUser2Device, CFX_FloatPoint(fx, rect.bottom), - CFX_FloatPoint(fx, rect.top), + pDevice, pUser2Device, CFX_PointF(fx, rect.bottom), + CFX_PointF(fx, rect.top), ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f); } } @@ -2737,8 +2737,8 @@ void CPWL_Utils::GetGraphics_Star(CFX_ByteString& sPathData, (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f)); fLongRadius = fLongRadius * 0.7f; FX_FLOAT fShortRadius = fLongRadius * 0.55f; - CFX_FloatPoint ptCenter = CFX_FloatPoint((crBBox.left + crBBox.right) / 2.0f, - (crBBox.top + crBBox.bottom) / 2.0f); + CFX_PointF ptCenter = CFX_PointF((crBBox.left + crBBox.right) / 2.0f, + (crBBox.top + crBBox.bottom) / 2.0f); FX_FLOAT px1[5], py1[5]; FX_FLOAT px2[5], py2[5]; diff --git a/fpdfsdk/pdfwindow/PWL_Utils.h b/fpdfsdk/pdfwindow/PWL_Utils.h index f14c3c7963..f6b51d7098 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.h +++ b/fpdfsdk/pdfwindow/PWL_Utils.h @@ -74,11 +74,11 @@ T PWL_MAX(const T& i, const T& j) { #define PPBL_LABELLEFTICONRIGHT 5 #define PPBL_LABELOVERICON 6 -class CPWL_Point : public CFX_FloatPoint { +class CPWL_Point : public CFX_PointF { public: CPWL_Point() {} - CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CFX_FloatPoint(fx, fy) {} - CPWL_Point(const CPWL_Point& point) : CFX_FloatPoint(point.x, point.y) {} + CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CFX_PointF(fx, fy) {} + CPWL_Point(const CPWL_Point& point) : CFX_PointF(point.x, point.y) {} }; enum PWL_PATHDATA_TYPE { @@ -121,9 +121,9 @@ class CPWL_Utils { static CFX_FloatRect OffsetRect(const CFX_FloatRect& rect, FX_FLOAT x, FX_FLOAT y); - static CFX_FloatPoint OffsetPoint(const CFX_FloatPoint& point, - FX_FLOAT x, - FX_FLOAT y); + static CFX_PointF OffsetPoint(const CFX_PointF& point, + FX_FLOAT x, + FX_FLOAT y); static FX_COLORREF PWLColorToFXColor(const CPWL_Color& color, int32_t nTransparancy = 255); static bool IsBlackOrWhite(const CPWL_Color& color); @@ -167,13 +167,13 @@ class CPWL_Utils { const CPWL_Color& crText); static CFX_ByteString GetEditAppStream(CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange = nullptr, bool bContinuous = true, uint16_t SubWord = 0); static CFX_ByteString GetEditSelAppStream( CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange = nullptr); static CFX_ByteString GetTextAppStream(const CFX_FloatRect& rcBBox, IPVT_FontMap* pFontMap, @@ -202,8 +202,8 @@ class CPWL_Utils { FX_FLOAT fWidth); static void DrawStrokeLine(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - const CFX_FloatPoint& ptMoveTo, - const CFX_FloatPoint& ptLineTo, + const CFX_PointF& ptMoveTo, + const CFX_PointF& ptLineTo, const FX_COLORREF& color, FX_FLOAT fWidth); static void DrawBorder(CFX_RenderDevice* pDevice, @@ -217,7 +217,7 @@ class CPWL_Utils { int32_t nTransparancy); static void DrawFillArea(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - const CFX_FloatPoint* pPts, + const CFX_PointF* pPts, int32_t nCount, const FX_COLORREF& color); static void DrawShadow(CFX_RenderDevice* pDevice, diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp index 1170660f1c..cf573220b7 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp @@ -426,8 +426,7 @@ PWL_IMPLEMENT_KEY_METHOD(OnChar) #undef PWL_IMPLEMENT_KEY_METHOD #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \ - bool CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \ - uint32_t nFlag) { \ + bool CPWL_Wnd::mouse_method_name(const CFX_PointF& point, uint32_t nFlag) { \ if (!IsValid() || !IsVisible() || !IsEnabled()) \ return false; \ if (IsWndCaptureMouse(this)) { \ @@ -462,7 +461,7 @@ PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) #undef PWL_IMPLEMENT_MOUSE_METHOD bool CPWL_Wnd::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, + const CFX_PointF& point, uint32_t nFlag) { if (!IsValid() || !IsVisible() || !IsEnabled()) return false; @@ -534,10 +533,10 @@ CFX_FloatRect CPWL_Wnd::GetClientRect() const { return rcWindow.Contains(rcClient) ? rcClient : CFX_FloatRect(); } -CFX_FloatPoint CPWL_Wnd::GetCenterPoint() const { +CFX_PointF CPWL_Wnd::GetCenterPoint() const { CFX_FloatRect rcClient = GetClientRect(); - return CFX_FloatPoint((rcClient.left + rcClient.right) * 0.5f, - (rcClient.top + rcClient.bottom) * 0.5f); + return CFX_PointF((rcClient.left + rcClient.right) * 0.5f, + (rcClient.top + rcClient.bottom) * 0.5f); } bool CPWL_Wnd::HasFlag(uint32_t dwFlags) const { @@ -673,11 +672,11 @@ void CPWL_Wnd::OnSetFocus() {} void CPWL_Wnd::OnKillFocus() {} -bool CPWL_Wnd::WndHitTest(const CFX_FloatPoint& point) const { +bool CPWL_Wnd::WndHitTest(const CFX_PointF& point) const { return IsValid() && IsVisible() && GetWindowRect().Contains(point.x, point.y); } -bool CPWL_Wnd::ClientHitTest(const CFX_FloatPoint& point) const { +bool CPWL_Wnd::ClientHitTest(const CFX_PointF& point) const { return IsValid() && IsVisible() && GetClientRect().Contains(point.x, point.y); } @@ -850,11 +849,9 @@ CFX_Matrix CPWL_Wnd::GetWindowMatrix() const { return mt; } -void CPWL_Wnd::PWLtoWnd(const CFX_FloatPoint& point, - int32_t& x, - int32_t& y) const { +void CPWL_Wnd::PWLtoWnd(const CFX_PointF& point, int32_t& x, int32_t& y) const { CFX_Matrix mt = GetWindowMatrix(); - CFX_FloatPoint pt = point; + CFX_PointF pt = point; mt.TransformPoint(pt.x, pt.y); x = (int32_t)(pt.x + 0.5); y = (int32_t)(pt.y + 0.5); @@ -868,12 +865,12 @@ FX_RECT CPWL_Wnd::PWLtoWnd(const CFX_FloatRect& rect) const { (int32_t)(rcTemp.right + 0.5), (int32_t)(rcTemp.top + 0.5)); } -CFX_FloatPoint CPWL_Wnd::ChildToParent(const CFX_FloatPoint& point) const { +CFX_PointF CPWL_Wnd::ChildToParent(const CFX_PointF& point) const { CFX_Matrix mt = GetChildMatrix(); if (mt.IsIdentity()) return point; - CFX_FloatPoint pt = point; + CFX_PointF pt = point; mt.TransformPoint(pt.x, pt.y); return pt; } @@ -888,13 +885,13 @@ CFX_FloatRect CPWL_Wnd::ChildToParent(const CFX_FloatRect& rect) const { return rc; } -CFX_FloatPoint CPWL_Wnd::ParentToChild(const CFX_FloatPoint& point) const { +CFX_PointF CPWL_Wnd::ParentToChild(const CFX_PointF& point) const { CFX_Matrix mt = GetChildMatrix(); if (mt.IsIdentity()) return point; mt.SetReverse(mt); - CFX_FloatPoint pt = point; + CFX_PointF pt = point; mt.TransformPoint(pt.x, pt.y); return pt; } diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h index dd4f321d8a..12b29aeb7e 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/pdfwindow/PWL_Wnd.h @@ -264,17 +264,17 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual bool OnKeyDown(uint16_t nChar, uint32_t nFlag); virtual bool OnKeyUp(uint16_t nChar, uint32_t nFlag); virtual bool OnChar(uint16_t nChar, uint32_t nFlag); - virtual bool OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnMButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnMButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnMButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnRButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnLButtonDblClk(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnMButtonDblClk(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnMButtonDown(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnMButtonUp(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnRButtonDown(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnRButtonUp(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag); virtual bool OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, + const CFX_PointF& point, uint32_t nFlag); virtual void SetFocus(); @@ -308,7 +308,7 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual CFX_FloatRect GetWindowRect() const; virtual CFX_FloatRect GetClientRect() const; - CFX_FloatPoint GetCenterPoint() const; + CFX_PointF GetCenterPoint() const; int32_t GetBorderWidth() const; bool IsVisible() const { return m_bVisible; } bool HasFlag(uint32_t dwFlags) const; @@ -320,8 +320,8 @@ class CPWL_Wnd : public CPWL_TimerHandler { const CPWL_Dash& GetBorderDash() const; void* GetAttachedData() const; - bool WndHitTest(const CFX_FloatPoint& point) const; - bool ClientHitTest(const CFX_FloatPoint& point) const; + bool WndHitTest(const CFX_PointF& point) const; + bool ClientHitTest(const CFX_PointF& point) const; bool IsCaptureMouse() const; const CPWL_Wnd* GetFocused() const; @@ -341,9 +341,9 @@ class CPWL_Wnd : public CPWL_TimerHandler { void SetChildMatrix(const CFX_Matrix& mt); CFX_Matrix GetWindowMatrix() const; - virtual CFX_FloatPoint ChildToParent(const CFX_FloatPoint& point) const; + virtual CFX_PointF ChildToParent(const CFX_PointF& point) const; virtual CFX_FloatRect ChildToParent(const CFX_FloatRect& rect) const; - virtual CFX_FloatPoint ParentToChild(const CFX_FloatPoint& point) const; + virtual CFX_PointF ParentToChild(const CFX_PointF& point) const; virtual CFX_FloatRect ParentToChild(const CFX_FloatRect& rect) const; // those methods only implemented by listctrl item @@ -389,7 +389,7 @@ class CPWL_Wnd : public CPWL_TimerHandler { void InvalidateRectMove(const CFX_FloatRect& rcOld, const CFX_FloatRect& rcNew); - void PWLtoWnd(const CFX_FloatPoint& point, int32_t& x, int32_t& y) const; + void PWLtoWnd(const CFX_PointF& point, int32_t& x, int32_t& y) const; FX_RECT PWLtoWnd(const CFX_FloatRect& rect) const; bool IsWndCaptureMouse(const CPWL_Wnd* pWnd) const; -- cgit v1.2.3