From 92a32db931c1303388158f8a9e045e922d0b8dfa Mon Sep 17 00:00:00 2001 From: dsinclair Date: Tue, 14 Feb 2017 14:58:49 +0000 Subject: Revert "Convert CFX_FloatPoint to CFX_PointF" This reverts commit 4797c4240cb9e2d8cd36c583d46cd52ff94af95d. Reason for revert: Reverting chain to see if fixes Chrome roll. Original change's description: > Convert CFX_FloatPoint to CFX_PointF > > The two classes store the same information, remove the CFX_FloatPoint variant. > > Change-Id: Ie598c2ba5af04fb2bb3347dd48c30fd5e4845e62 > Reviewed-on: https://pdfium-review.googlesource.com/2612 > Commit-Queue: dsinclair > Reviewed-by: Tom Sepez > TBR=tsepez@chromium.org,dsinclair@chromium.org,pdfium-reviews@googlegroups.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Ia42074e706983c62d2e57497c3079b3c338343a3 Reviewed-on: https://pdfium-review.googlesource.com/2694 Commit-Queue: dsinclair Reviewed-by: dsinclair --- core/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, 695 insertions(+), 631 deletions(-) diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp index 94b3425a09..546bd9f740 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_PointF(pWord->fWordX + pSection->m_SecInfo.rcSection.left, - pWord->fWordY + pSection->m_SecInfo.rcSection.top)); + CFX_FloatPoint(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_PointF( + line.ptLine = m_pVT->InToOut(CFX_FloatPoint( 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_PointF& point) const { - CFX_PointF pt = OutToIn(point); + const CFX_FloatPoint& point) const { + CFX_FloatPoint 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_PointF(pt.x - pSection->m_SecInfo.rcSection.left, - pt.y - pSection->m_SecInfo.rcSection.top)); + CFX_FloatPoint(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_PointF& point) const { + const CFX_FloatPoint& point) const { if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) { CPVT_WordPlace temp = place; - CFX_PointF pt = OutToIn(point); + CFX_FloatPoint 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_PointF& point) const { + const CFX_FloatPoint& point) const { if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) { CPVT_WordPlace temp = place; - CFX_PointF pt = OutToIn(point); + CFX_FloatPoint pt = OutToIn(point); if (temp.nLineIndex++ < pSection->m_LineArray.GetSize() - 1) { return pSection->SearchWordPlace( pt.x - pSection->m_SecInfo.rcSection.left, temp); @@ -1109,32 +1109,34 @@ CFX_SizeF CPDF_VariableText::GetPlateSize() const { return CFX_SizeF(GetPlateWidth(), GetPlateHeight()); } -CFX_PointF CPDF_VariableText::GetBTPoint() const { - return CFX_PointF(m_rcPlate.left, m_rcPlate.top); +CFX_FloatPoint CPDF_VariableText::GetBTPoint() const { + return CFX_FloatPoint(m_rcPlate.left, m_rcPlate.top); } -CFX_PointF CPDF_VariableText::GetETPoint() const { - return CFX_PointF(m_rcPlate.right, m_rcPlate.bottom); +CFX_FloatPoint CPDF_VariableText::GetETPoint() const { + return CFX_FloatPoint(m_rcPlate.right, m_rcPlate.bottom); } -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::InToOut(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_FloatPoint CPDF_VariableText::OutToIn(const CFX_FloatPoint& point) const { + return CFX_FloatPoint(point.x - GetBTPoint().x, GetBTPoint().y - point.y); } CFX_FloatRect CPDF_VariableText::InToOut(const CPVT_FloatRect& rect) const { - CFX_PointF ptLeftTop = InToOut(CFX_PointF(rect.left, rect.top)); - CFX_PointF ptRightBottom = InToOut(CFX_PointF(rect.right, rect.bottom)); + CFX_FloatPoint ptLeftTop = InToOut(CFX_FloatPoint(rect.left, rect.top)); + CFX_FloatPoint ptRightBottom = + InToOut(CFX_FloatPoint(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_PointF ptLeftTop = OutToIn(CFX_PointF(rect.left, rect.top)); - CFX_PointF ptRightBottom = OutToIn(CFX_PointF(rect.right, rect.bottom)); + CFX_FloatPoint ptLeftTop = OutToIn(CFX_FloatPoint(rect.left, rect.top)); + CFX_FloatPoint ptRightBottom = + OutToIn(CFX_FloatPoint(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 8e7c0c964a..5983a2978b 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_PointF& point) const; + CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place, - const CFX_PointF& point) const; + const CFX_FloatPoint& point) const; CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace& place, - const CFX_PointF& point) const; + const CFX_FloatPoint& 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_PointF GetBTPoint() const; - CFX_PointF GetETPoint() const; + CFX_FloatPoint GetBTPoint() const; + CFX_FloatPoint GetETPoint() const; - CFX_PointF InToOut(const CFX_PointF& point) const; - CFX_PointF OutToIn(const CFX_PointF& point) const; + CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const; + CFX_FloatPoint OutToIn(const CFX_FloatPoint& 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 15515151bc..4bb244f29e 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_PointF ptOffset; + CFX_FloatPoint ptOffset; if (!bMultiLine) { ptOffset = - CFX_PointF(0.0f, (rcContent.Height() - rcBody.Height()) / 2.0f); + CFX_FloatPoint(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_PointF ptOffset = - CFX_PointF(0.0f, (rcContent.Height() - rcEdit.Height()) / 2.0f); + CFX_FloatPoint ptOffset = + CFX_FloatPoint(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,8 +328,9 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, if (sButtonBorder.GetLength() > 0) sAppStream << "q\n" << sButtonBorder << "Q\n"; - CFX_PointF ptCenter = CFX_PointF((rcButton.left + rcButton.right) / 2, - (rcButton.top + rcButton.bottom) / 2); + CFX_FloatPoint ptCenter = + CFX_FloatPoint((rcButton.left + rcButton.right) / 2, + (rcButton.top + rcButton.bottom) / 2); if (IsFloatBigger(rcButton.Width(), 6) && IsFloatBigger(rcButton.Height(), 6)) { sAppStream << "q\n" @@ -401,7 +402,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, CPVT_Color(CPVT_Color::kGray, 1), PaintOperation::FILL) << CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(), - CFX_PointF(0.0f, fy), + CFX_FloatPoint(0.0f, fy), true, 0) << "ET\n"; } else { @@ -409,7 +410,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, << CPVT_GenerateAP::GenerateColorAP(crText, PaintOperation::FILL) << CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(), - CFX_PointF(0.0f, fy), + CFX_FloatPoint(0.0f, fy), true, 0) << "ET\n"; } @@ -528,7 +529,7 @@ CFX_ByteString GetPopupContentsString(CPDF_Document* pDoc, vt.Initialize(); vt.SetText(swValue); vt.RearrangeAll(); - CFX_PointF ptOffset(3.0f, -3.0f); + CFX_FloatPoint ptOffset(3.0f, -3.0f); CFX_ByteString sContent = CPVT_GenerateAP::GenerateEditAP( &map, vt.GetIterator(), ptOffset, false, 0); @@ -1101,14 +1102,14 @@ bool CPVT_GenerateAP::GenerateStrikeOutAP(CPDF_Document* pDoc, CFX_ByteString CPVT_GenerateAP::GenerateEditAP( IPVT_FontMap* pFontMap, CPDF_VariableText::Iterator* pIterator, - const CFX_PointF& ptOffset, + const CFX_FloatPoint& ptOffset, bool bContinuous, uint16_t SubWord) { CFX_ByteTextBuf sEditStream; CFX_ByteTextBuf sLineStream; CFX_ByteTextBuf sWords; - CFX_PointF ptOld; - CFX_PointF ptNew; + CFX_FloatPoint ptOld; + CFX_FloatPoint ptNew; int32_t nCurFontIndex = -1; CPVT_WordPlace oldplace; @@ -1125,13 +1126,13 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP( } CPVT_Word word; if (pIterator->GetWord(word)) { - ptNew = CFX_PointF(word.ptWord.x + ptOffset.x, - word.ptWord.y + ptOffset.y); + ptNew = CFX_FloatPoint(word.ptWord.x + ptOffset.x, + word.ptWord.y + ptOffset.y); } else { CPVT_Line line; pIterator->GetLine(line); - ptNew = CFX_PointF(line.ptLine.x + ptOffset.x, - line.ptLine.y + ptOffset.y); + ptNew = CFX_FloatPoint(line.ptLine.x + ptOffset.x, + line.ptLine.y + ptOffset.y); } if (ptNew != ptOld) { sLineStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y @@ -1156,8 +1157,8 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP( } else { CPVT_Word word; if (pIterator->GetWord(word)) { - ptNew = - CFX_PointF(word.ptWord.x + ptOffset.x, word.ptWord.y + ptOffset.y); + ptNew = CFX_FloatPoint(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 62a84531ee..16c939fe92 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_PointF& ptOffset, + const CFX_FloatPoint& 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 47c3e84d6a..25ae34af16 100644 --- a/core/fpdfdoc/cpvt_line.h +++ b/core/fpdfdoc/cpvt_line.h @@ -11,19 +11,15 @@ #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" -class CPVT_Line { - public: - CPVT_Line(); +struct CPVT_Line { + CPVT_Line() : fLineWidth(0.0f), fLineAscent(0.0f), fLineDescent(0.0f) {} CPVT_WordPlace lineplace; CPVT_WordPlace lineEnd; - CFX_PointF ptLine; + CFX_FloatPoint 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 8fb10de250..2ebc51cb8e 100644 --- a/core/fpdfdoc/cpvt_lineinfo.h +++ b/core/fpdfdoc/cpvt_lineinfo.h @@ -9,9 +9,16 @@ #include "core/fxcrt/fx_system.h" -class CPVT_LineInfo { - public: - CPVT_LineInfo(); +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) {} int32_t nTotalWord; int32_t nBeginWordIndex; @@ -23,14 +30,4 @@ class 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 540f0416ad..92a4ce1e94 100644 --- a/core/fpdfdoc/cpvt_word.h +++ b/core/fpdfdoc/cpvt_word.h @@ -11,14 +11,13 @@ #include "core/fpdfdoc/cpvt_wordprops.h" #include "core/fxcrt/fx_system.h" -class CPVT_Word { - public: +struct CPVT_Word { CPVT_Word(); uint16_t Word; int32_t nCharset; CPVT_WordPlace WordPlace; - CFX_PointF ptWord; + CFX_FloatPoint ptWord; FX_FLOAT fAscent; FX_FLOAT fDescent; FX_FLOAT fWidth; diff --git a/core/fpdfdoc/csection.cpp b/core/fpdfdoc/csection.cpp index 490ef1b230..4964504175 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_PointF& point) const { +CPVT_WordPlace CSection::SearchWordPlace(const CFX_FloatPoint& 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 a2ac43b102..706f5b67bb 100644 --- a/core/fpdfdoc/csection.h +++ b/core/fpdfdoc/csection.h @@ -14,7 +14,8 @@ #include "core/fxcrt/fx_system.h" class CPDF_VariableText; -class CPVT_LineInfo; + +struct CPVT_LineInfo; struct CPVT_WordLine; struct CPVT_WordPlace; @@ -39,7 +40,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_PointF& point) const; + CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& 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 17bab02a7c..bd068a596b 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(const CFX_PointF& point, +int CPDF_TextPage::GetIndexAtPos(CFX_FloatPoint 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_PointF point(x, y); + CFX_FloatPoint point(x, y); return GetIndexAtPos(point, xTolerance, yTolerance); } diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h index 946a2d658d..d22cba3e40 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(const CFX_PointF& point, + int GetIndexAtPos(CFX_FloatPoint 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 35364e8030..c5ee4048a2 100644 --- a/core/fxcrt/fx_basic_coords.cpp +++ b/core/fxcrt/fx_basic_coords.cpp @@ -197,6 +197,10 @@ FX_RECT CFX_FloatRect::GetClosestRect() const { return rect; } +bool CFX_FloatRect::Contains(const CFX_FloatPoint& point) const { + return Contains(point.x, point.y); +} + bool CFX_FloatRect::Contains(const CFX_PointF& point) const { return Contains(point.x, point.y); } diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index 3a5b1feabe..172d794e97 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -245,6 +245,21 @@ struct FX_RECT { int32_t bottom; }; +// LBRT rectangles (y-axis runs upwards). +class CFX_FloatPoint { + public: + CFX_FloatPoint() : x(0.0f), y(0.0f) {} + CFX_FloatPoint(FX_FLOAT xx, FX_FLOAT yy) : x(xx), y(yy) {} + + bool operator==(const CFX_FloatPoint& that) const { + return x == that.x && y == that.y; + } + bool operator!=(const CFX_FloatPoint& that) const { return !(*this == that); } + + FX_FLOAT x; + FX_FLOAT y; +}; + // LTWH rectangles (y-axis runs downwards). template class CFX_RTemplate { @@ -480,6 +495,7 @@ class CFX_FloatRect { } bool IsEmpty() const { return left >= right || bottom >= top; } + bool Contains(const CFX_FloatPoint& point) const; bool Contains(const CFX_PointF& point) const; bool Contains(const CFX_FloatRect& other_rect) const; bool Contains(FX_FLOAT x, FX_FLOAT y) const; diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp index 966dd63d4c..b897a3e0bb 100644 --- a/fpdfsdk/cfx_systemhandler.cpp +++ b/fpdfsdk/cfx_systemhandler.cpp @@ -65,8 +65,10 @@ void CFX_SystemHandler::OutputSelectedRect(CFFL_FormFiller* pFormFiller, if (!pFormFiller) return; - CFX_PointF ptA = pFormFiller->PWLtoFFL(CFX_PointF(rect.left, rect.bottom)); - CFX_PointF ptB = pFormFiller->PWLtoFFL(CFX_PointF(rect.right, rect.top)); + 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); CPDFSDK_Annot* pAnnot = pFormFiller->GetSDKAnnot(); UnderlyingPageType* pPage = pAnnot->GetUnderlyingPage(); diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp index c4990674de..898b9ccc0f 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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 cbda02cbed..7742fd6ed3 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_PointF& point); + const CFX_FloatPoint& point); bool Annot_OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& point); bool Annot_OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& point); bool Annot_OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& point); bool Annot_OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_PointF& point); + const CFX_FloatPoint& point); bool Annot_OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& point); bool Annot_OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& 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_PointF& point); + const CFX_FloatPoint& point); private: IPDFSDK_AnnotHandler* GetAnnotHandler(CPDF_Annot::Subtype nSubtype) const; diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp index 475ee4bf0e..617d88fd41 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_PointF& point) { + const CFX_FloatPoint& point) { return false; } bool CPDFSDK_BAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) { + const CFX_FloatPoint& point) { return false; } bool CPDFSDK_BAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) { + const CFX_FloatPoint& point) { return false; } bool CPDFSDK_BAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& point) { return false; } bool CPDFSDK_BAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) { + const CFX_FloatPoint& point) { return false; } bool CPDFSDK_BAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) { + const CFX_FloatPoint& point) { return false; } bool CPDFSDK_BAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& point) { ASSERT(pPageView); ASSERT(pAnnot); diff --git a/fpdfsdk/cpdfsdk_baannothandler.h b/fpdfsdk/cpdfsdk_baannothandler.h index d5f170f452..2efed0e269 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_PointF& point) override; + const CFX_FloatPoint& 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_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& 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 0136077df5..aae903eeb1 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()); - if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot.Get(), - CFX_PointF(pageX, pageY))) + CFX_FloatPoint point(pageX, pageY); + if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot.Get(), point)) return pSDKAnnot.Get(); } } @@ -246,7 +246,8 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByXFAWidget(CXFA_FFWidget* hWidget) { } #endif // PDF_ENABLE_XFA -bool CPDFSDK_PageView::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { +bool CPDFSDK_PageView::OnLButtonDown(const CFX_FloatPoint& point, + uint32_t nFlag) { CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point.x, point.y)); if (!pAnnot) { m_pFormFillEnv->KillFocusAnnot(nFlag); @@ -266,7 +267,8 @@ bool CPDFSDK_PageView::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { } #ifdef PDF_ENABLE_XFA -bool CPDFSDK_PageView::OnRButtonDown(const CFX_PointF& point, uint32_t nFlag) { +bool CPDFSDK_PageView::OnRButtonDown(const CFX_FloatPoint& point, + uint32_t nFlag) { CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point.x, point.y)); if (!pAnnot) return false; @@ -283,7 +285,8 @@ bool CPDFSDK_PageView::OnRButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPDFSDK_PageView::OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPDFSDK_PageView::OnRButtonUp(const CFX_FloatPoint& point, + uint32_t nFlag) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point.x, point.y)); @@ -297,7 +300,8 @@ bool CPDFSDK_PageView::OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) { } #endif // PDF_ENABLE_XFA -bool CPDFSDK_PageView::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPDFSDK_PageView::OnLButtonUp(const CFX_FloatPoint& point, + uint32_t nFlag) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point.x, point.y)); @@ -311,7 +315,7 @@ bool CPDFSDK_PageView::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { pAnnotHandlerMgr->Annot_OnLButtonUp(this, &pFXAnnot, nFlag, point); } -bool CPDFSDK_PageView::OnMouseMove(const CFX_PointF& point, int nFlag) { +bool CPDFSDK_PageView::OnMouseMove(const CFX_FloatPoint& point, int nFlag) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXAnnotAtPoint(point.x, point.y)); @@ -345,7 +349,7 @@ bool CPDFSDK_PageView::OnMouseMove(const CFX_PointF& point, int nFlag) { bool CPDFSDK_PageView::OnMouseWheel(double deltaX, double deltaY, - const CFX_PointF& point, + const CFX_FloatPoint& 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 495f1685d6..9a3443b4b0 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_PointF& point, uint32_t nFlag); - bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag); + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); #ifdef PDF_ENABLE_XFA - bool OnRButtonDown(const CFX_PointF& point, uint32_t nFlag); - bool OnRButtonUp(const CFX_PointF& point, uint32_t nFlag); + bool OnRButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); + bool OnRButtonUp(const CFX_FloatPoint& 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_PointF& point, int nFlag); + bool OnMouseMove(const CFX_FloatPoint& point, int nFlag); bool OnMouseWheel(double deltaX, double deltaY, - const CFX_PointF& point, + const CFX_FloatPoint& point, int nFlag); void GetCurrentMatrix(CFX_Matrix& matrix) { matrix = m_curMatrix; } diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index 7821e1f528..1af4703da0 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_PointF()); + CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint()); if (sEdit.GetLength() > 0) { sBody << "/Tx BMC\n" << "q\n"; @@ -1469,13 +1469,15 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() { sList << "BT\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY, 1), true) - << CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, fy)) + << CPWL_Utils::GetEditAppStream(pEdit.get(), + CFX_FloatPoint(0.0f, fy)) << "ET\n"; } else { CPWL_Color crText = GetTextPWLColor(); sList << "BT\n" << CPWL_Utils::GetColorAppStream(crText, true) - << CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, fy)) + << CPWL_Utils::GetEditAppStream(pEdit.get(), + CFX_FloatPoint(0.0f, fy)) << "ET\n"; } @@ -1564,7 +1566,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) { CFX_FloatRect rcContent = pEdit->GetContentRect(); CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream( - pEdit.get(), CFX_PointF(), nullptr, !bCharArray, subWord); + pEdit.get(), CFX_FloatPoint(), nullptr, !bCharArray, subWord); if (sEdit.GetLength() > 0) { sBody << "/Tx BMC\n" diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp index bc085464ca..4105ae4f3c 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& point) { ASSERT(pPageView); ASSERT(pAnnot); diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h index 6e4d50b272..7154bda6fd 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_PointF& point) override; + const CFX_FloatPoint& 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_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& 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 d7bef32acd..0259be3995 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& point) { if (!pPageView || !(*pAnnot)) return false; diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.h b/fpdfsdk/cpdfsdk_xfawidgethandler.h index 3903103eeb..1a1a48081d 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_PointF& point) override; + const CFX_FloatPoint& 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_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& 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 c233c136c1..ffa3a032cf 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_PointF& point) { + const CFX_FloatPoint& 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 79ddc847cc..65dba29f2e 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_PointF& point) override; + const CFX_FloatPoint& 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 cad8dafdbc..9ccca2b04a 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF CFFL_FormFiller::FFLtoPWL(const CFX_PointF& point) { +CFX_FloatPoint CFFL_FormFiller::FFLtoPWL(const CFX_FloatPoint& point) { CFX_Matrix mt; mt.SetReverse(GetCurMatrix()); - CFX_PointF pt = point; - mt.Transform(pt); + CFX_FloatPoint pt = point; + mt.TransformPoint(pt.x, pt.y); return pt; } -CFX_PointF CFFL_FormFiller::PWLtoFFL(const CFX_PointF& point) { +CFX_FloatPoint CFFL_FormFiller::PWLtoFFL(const CFX_FloatPoint& point) { CFX_Matrix mt = GetCurMatrix(); - CFX_PointF pt = point; - mt.Transform(pt); + CFX_FloatPoint pt = point; + mt.TransformPoint(pt.x, pt.y); return pt; } -CFX_PointF CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, - const CFX_PointF& pt) { +CFX_FloatPoint CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& point) { CFX_FloatRect rcAnnot = pAnnot->GetRect(); - if (!rcAnnot.Contains(point)) + if (!rcAnnot.Contains(point.x, point.y)) 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_PointF& point) { + const CFX_FloatPoint& point) { CFX_FloatRect rcAnnot = pAnnot->GetRect(); if (!rcAnnot.Contains(point.x, point.y)) return false; @@ -664,8 +664,9 @@ bool CFFL_Button::OnLButtonUp(CPDFSDK_PageView* pPageView, bool CFFL_Button::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_PointF& point) { + const CFX_FloatPoint& point) { ASSERT(m_pFormFillEnv); + return true; } diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h index 7462b40e97..cf1aaf7205 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_PointF& point); + const CFX_FloatPoint& point); virtual bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& point); virtual bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& point); virtual bool OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& point); virtual bool OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, short zDelta, - const CFX_PointF& point); + const CFX_FloatPoint& point); virtual bool OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& point); virtual bool OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& point); virtual bool OnKeyDown(CPDFSDK_Annot* pAnnot, uint32_t nKeyCode, @@ -104,10 +104,11 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { CFX_FloatRect FFLtoPWL(const CFX_FloatRect& rect); CFX_FloatRect PWLtoFFL(const CFX_FloatRect& rect); - CFX_PointF FFLtoPWL(const CFX_PointF& point); - CFX_PointF PWLtoFFL(const CFX_PointF& point); + CFX_FloatPoint FFLtoPWL(const CFX_FloatPoint& point); + CFX_FloatPoint PWLtoFFL(const CFX_FloatPoint& point); - CFX_PointF WndtoPWL(CPDFSDK_PageView* pPageView, const CFX_PointF& pt); + CFX_FloatPoint WndtoPWL(CPDFSDK_PageView* pPageView, + const CFX_FloatPoint& pt); CFX_FloatRect FFLtoWnd(CPDFSDK_PageView* pPageView, const CFX_FloatRect& rect); @@ -158,9 +159,10 @@ 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_PointF m_ptOldPos; + CFX_FloatPoint m_ptOldPos; }; class CFFL_Button : public CFFL_FormFiller { @@ -176,15 +178,15 @@ class CFFL_Button : public CFFL_FormFiller { bool OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& point) override; bool OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - const CFX_PointF& point) override; + const CFX_FloatPoint& 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 a8368f4352..82b9549a1c 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, - const CFX_PointF& point) { + CFX_FloatPoint 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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_PointF& point) { + const CFX_FloatPoint& 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 90fd98c0e8..e81d3c88d0 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, - const CFX_PointF& point); + CFX_FloatPoint 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_PointF& point); + const CFX_FloatPoint& point); bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& point); bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& point); bool OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& point); bool OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_PointF& point); + const CFX_FloatPoint& point); bool OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& point); bool OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point); + const CFX_FloatPoint& 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 e78160e5dc..70d4c0dee6 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_PointF& point) { + const CFX_FloatPoint& 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 10ac37dcb8..49a658f84e 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_PointF& point) override; + const CFX_FloatPoint& 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 a891db9019..37ecce509d 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -292,7 +292,9 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView) return false; - return pPageView->OnMouseMove(CFX_PointF(page_x, page_y), modifier); + + CFX_FloatPoint pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); + return pPageView->OnMouseMove(pt, modifier); } DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle, @@ -303,7 +305,9 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle, CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView) return false; - return pPageView->OnLButtonDown(CFX_PointF(page_x, page_y), modifier); + + CFX_FloatPoint pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); + return pPageView->OnLButtonDown(pt, modifier); } DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle, @@ -315,7 +319,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle, if (!pPageView) return false; - CFX_PointF pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); + CFX_FloatPoint pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); return pPageView->OnLButtonUp(pt, modifier); } @@ -328,7 +332,9 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle, CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView) return false; - return pPageView->OnRButtonDown(CFX_PointF(page_x, page_y), modifier); + + CFX_FloatPoint pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); + return pPageView->OnRButtonDown(pt, modifier); } DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, @@ -340,7 +346,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, if (!pPageView) return false; - CFX_PointF pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); + CFX_FloatPoint 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 1d2269c0a0..1942232553 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_PointF& pt, + const CFX_FloatPoint& 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_PointF pt1; - CFX_PointF pt2; + CFX_FloatPoint pt1; + CFX_FloatPoint 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_PointF pt1; - CFX_PointF pt2; + CFX_FloatPoint pt1; + CFX_FloatPoint 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_PointF& point, + const CFX_FloatPoint& 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_PointF& ptOffset, + const CFX_FloatPoint& 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_PointF ptOld; - CFX_PointF ptNew; + CFX_FloatPoint ptOld; + CFX_FloatPoint 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_PointF(word.ptWord.x + ptOffset.x, - word.ptWord.y + ptOffset.y); + ptNew = CFX_FloatPoint(word.ptWord.x + ptOffset.x, + word.ptWord.y + ptOffset.y); } else { CPVT_Line line; pIterator->GetLine(line); - ptNew = CFX_PointF(line.ptLine.x + ptOffset.x, - line.ptLine.y + ptOffset.y); + ptNew = CFX_FloatPoint(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_PointF(word.ptWord.x + ptOffset.x, word.ptWord.y + ptOffset.y); + ptNew = CFX_FloatPoint(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_PointF& ptOffset, + const CFX_FloatPoint& 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_PointF& ptOffset, + const CFX_FloatPoint& 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_PointF ptBT; + CFX_FloatPoint ptBT; pDevice->SaveState(); if (!rcClip.IsEmpty()) { CFX_FloatRect rcTemp = rcClip; @@ -866,7 +866,8 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, crOldFill != crCurFill) { if (sTextBuf.GetLength() > 0) { DrawTextString( - pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + pDevice, + CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, sTextBuf.MakeString(), crOldFill, crTextStroke, nHorzScale); @@ -882,8 +883,8 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, .AsStringC(); } else { DrawTextString( - pDevice, CFX_PointF(word.ptWord.x + ptOffset.x, - word.ptWord.y + ptOffset.y), + pDevice, CFX_FloatPoint(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); @@ -894,7 +895,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, if (sTextBuf.GetLength() > 0) { DrawTextString( - pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, sTextBuf.MakeString(), crOldFill, crTextStroke, nHorzScale); } @@ -906,7 +907,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, // static void CFX_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, CFX_Edit* pEdit, - const CFX_PointF& ptOffset, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF crText, std::vector* ObjArray) { @@ -920,7 +921,7 @@ void CFX_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, int32_t nOldFontIndex = -1; CFX_ByteTextBuf sTextBuf; CPVT_WordPlace oldplace; - CFX_PointF ptBT(0.0f, 0.0f); + CFX_FloatPoint ptBT(0.0f, 0.0f); CFX_Edit_Iterator* pIterator = pEdit->GetIterator(); if (pRange) pIterator->SetAt(pRange->BeginPos); @@ -941,7 +942,7 @@ void CFX_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, ObjArray->push_back(AddTextObjToPageObjects( pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), fFontSize, 0.0f, 100, - CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), sTextBuf.MakeString())); sTextBuf.Clear(); @@ -956,7 +957,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_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + 0.0f, 100, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), sTextBuf.MakeString())); } } @@ -1016,7 +1017,7 @@ IPVT_FontMap* CFX_Edit::GetFontMap() { void CFX_Edit::SetPlateRect(const CFX_FloatRect& rect) { m_pVT->SetPlateRect(rect); - m_ptScrollPos = CFX_PointF(rect.left, rect.top); + m_ptScrollPos = CFX_FloatPoint(rect.left, rect.top); Paint(); } @@ -1304,10 +1305,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_PointF(rcPlate.left, rcPlate.top))); + CPVT_WordPlace place1 = m_pVT->SearchWordPlace( + EditToVT(CFX_FloatPoint(rcPlate.left, rcPlate.top))); CPVT_WordPlace place2 = m_pVT->SearchWordPlace( - EditToVT(CFX_PointF(rcPlate.right, rcPlate.bottom))); + EditToVT(CFX_FloatPoint(rcPlate.right, rcPlate.bottom))); return CPVT_WordRange(place1, place2); } @@ -1315,7 +1316,7 @@ CPVT_WordRange CFX_Edit::GetVisibleWordRange() const { return CPVT_WordRange(); } -CPVT_WordPlace CFX_Edit::SearchWordPlace(const CFX_PointF& point) const { +CPVT_WordPlace CFX_Edit::SearchWordPlace(const CFX_FloatPoint& point) const { if (m_pVT->IsValid()) { return m_pVT->SearchWordPlace(EditToVT(point)); } @@ -1392,7 +1393,7 @@ bool CFX_Edit::IsSelected() const { return m_SelState.IsExist(); } -CFX_PointF CFX_Edit::VTToEdit(const CFX_PointF& point) const { +CFX_FloatPoint CFX_Edit::VTToEdit(const CFX_FloatPoint& point) const { CFX_FloatRect rcContent = m_pVT->GetContentRect(); CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); @@ -1410,11 +1411,11 @@ CFX_PointF CFX_Edit::VTToEdit(const CFX_PointF& point) const { break; } - return CFX_PointF(point.x - (m_ptScrollPos.x - rcPlate.left), - point.y - (m_ptScrollPos.y + fPadding - rcPlate.top)); + return CFX_FloatPoint(point.x - (m_ptScrollPos.x - rcPlate.left), + point.y - (m_ptScrollPos.y + fPadding - rcPlate.top)); } -CFX_PointF CFX_Edit::EditToVT(const CFX_PointF& point) const { +CFX_FloatPoint CFX_Edit::EditToVT(const CFX_FloatPoint& point) const { CFX_FloatRect rcContent = m_pVT->GetContentRect(); CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); @@ -1432,13 +1433,14 @@ CFX_PointF CFX_Edit::EditToVT(const CFX_PointF& point) const { break; } - return CFX_PointF(point.x + (m_ptScrollPos.x - rcPlate.left), - point.y + (m_ptScrollPos.y + fPadding - rcPlate.top)); + return CFX_FloatPoint(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_PointF ptLeftBottom = VTToEdit(CFX_PointF(rect.left, rect.bottom)); - CFX_PointF ptRightTop = VTToEdit(CFX_PointF(rect.right, rect.top)); + CFX_FloatPoint ptLeftBottom = + VTToEdit(CFX_FloatPoint(rect.left, rect.bottom)); + CFX_FloatPoint ptRightTop = VTToEdit(CFX_FloatPoint(rect.right, rect.top)); return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y); @@ -1491,14 +1493,14 @@ void CFX_Edit::SetScrollPosY(FX_FLOAT fy) { } } -void CFX_Edit::SetScrollPos(const CFX_PointF& point) { +void CFX_Edit::SetScrollPos(const CFX_FloatPoint& point) { SetScrollPosX(point.x); SetScrollPosY(point.y); SetScrollLimit(); SetCaretInfo(); } -CFX_PointF CFX_Edit::GetScrollPos() const { +CFX_FloatPoint CFX_Edit::GetScrollPos() const { return m_ptScrollPos; } @@ -1540,8 +1542,8 @@ void CFX_Edit::ScrollToCaret() { CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); pIterator->SetAt(m_wpCaret); - CFX_PointF ptHead; - CFX_PointF ptFoot; + CFX_FloatPoint ptHead; + CFX_FloatPoint ptFoot; CPVT_Word word; CPVT_Line line; if (pIterator->GetWord(word)) { @@ -1556,8 +1558,8 @@ void CFX_Edit::ScrollToCaret() { ptFoot.y = line.ptLine.y + line.fLineDescent; } - CFX_PointF ptHeadEdit = VTToEdit(ptHead); - CFX_PointF ptFootEdit = VTToEdit(ptFoot); + CFX_FloatPoint ptHeadEdit = VTToEdit(ptHead); + CFX_FloatPoint ptFootEdit = VTToEdit(ptFoot); CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); if (!IsFloatEqual(rcPlate.left, rcPlate.right)) { if (IsFloatSmaller(ptHeadEdit.x, rcPlate.left) || @@ -1699,8 +1701,8 @@ void CFX_Edit::SetCaretInfo() { CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); pIterator->SetAt(m_wpCaret); - CFX_PointF ptHead; - CFX_PointF ptFoot; + CFX_FloatPoint ptHead; + CFX_FloatPoint ptFoot; CPVT_Word word; CPVT_Line line; if (pIterator->GetWord(word)) { @@ -1735,7 +1737,9 @@ void CFX_Edit::SetCaret(int32_t nPos) { } } -void CFX_Edit::OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl) { +void CFX_Edit::OnMouseDown(const CFX_FloatPoint& point, + bool bShift, + bool bCtrl) { if (m_pVT->IsValid()) { SelectNone(); SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); @@ -1747,7 +1751,9 @@ void CFX_Edit::OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl) { } } -void CFX_Edit::OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl) { +void CFX_Edit::OnMouseMove(const CFX_FloatPoint& 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 448207894b..555c58b0a3 100644 --- a/fpdfsdk/fxedit/fxet_edit.h +++ b/fpdfsdk/fxedit/fxet_edit.h @@ -313,26 +313,27 @@ class CFXEU_InsertText : public CFX_Edit_UndoItem { class CFX_Edit { public: static CFX_ByteString GetEditAppearanceStream(CFX_Edit* pEdit, - const CFX_PointF& ptOffset, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, bool bContinuous, uint16_t SubWord); - static CFX_ByteString GetSelectAppearanceStream(CFX_Edit* pEdit, - const CFX_PointF& ptOffset, - const CPVT_WordRange* pRange); + static CFX_ByteString GetSelectAppearanceStream( + CFX_Edit* pEdit, + const CFX_FloatPoint& 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_PointF& ptOffset, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, CFX_SystemHandler* pSystemHandler, CFFL_FormFiller* pFFLData); static void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, CFX_Edit* pEdit, - const CFX_PointF& ptOffset, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF crText, std::vector* ObjArray); @@ -351,7 +352,7 @@ class CFX_Edit { // Set the bounding box of the text area. void SetPlateRect(const CFX_FloatRect& rect); - void SetScrollPos(const CFX_PointF& point); + void SetScrollPos(const CFX_FloatPoint& point); // Set the horizontal text alignment. (nFormat [0:left, 1:middle, 2:right]) void SetAlignmentH(int32_t nFormat, bool bPaint); @@ -371,8 +372,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_PointF& point, bool bShift, bool bCtrl); - void OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl); + void OnMouseDown(const CFX_FloatPoint& point, bool bShift, bool bCtrl); + void OnMouseMove(const CFX_FloatPoint& 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); @@ -390,14 +391,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_PointF& point) const; + CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& 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_PointF GetScrollPos() const; + CFX_FloatPoint GetScrollPos() const; int32_t GetCharArray() const; CFX_FloatRect GetContentRect() const; CFX_WideString GetRangeText(const CPVT_WordRange& range) const; @@ -471,8 +472,8 @@ class CFX_Edit { void PaintInsertText(const CPVT_WordPlace& wpOld, const CPVT_WordPlace& wpNew); - inline CFX_PointF VTToEdit(const CFX_PointF& point) const; - inline CFX_PointF EditToVT(const CFX_PointF& point) const; + inline CFX_FloatPoint VTToEdit(const CFX_FloatPoint& point) const; + inline CFX_FloatPoint EditToVT(const CFX_FloatPoint& point) const; inline CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const; void Refresh(); @@ -489,15 +490,17 @@ 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_PointF m_ptScrollPos; - CFX_PointF m_ptRefreshScrollPos; + + CFX_FloatPoint m_ptScrollPos; + CFX_FloatPoint m_ptRefreshScrollPos; bool m_bEnableScroll; std::unique_ptr m_pIterator; CFX_Edit_Refresh m_Refresh; - CFX_PointF m_ptCaret; + CFX_FloatPoint 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 39877c955f..cf718b9acb 100644 --- a/fpdfsdk/fxedit/fxet_list.cpp +++ b/fpdfsdk/fxedit/fxet_list.cpp @@ -207,33 +207,37 @@ void CFX_ListCtrl::SetNotify(CPWL_List_Notify* pNotify) { m_pNotify = pNotify; } -CFX_PointF CFX_ListCtrl::InToOut(const CFX_PointF& point) const { +CFX_FloatPoint CFX_ListCtrl::InToOut(const CFX_FloatPoint& point) const { CFX_FloatRect rcPlate = GetPlateRect(); - return CFX_PointF(point.x - (m_ptScrollPos.x - rcPlate.left), - point.y - (m_ptScrollPos.y - rcPlate.top)); + + return CFX_FloatPoint(point.x - (m_ptScrollPos.x - rcPlate.left), + point.y - (m_ptScrollPos.y - rcPlate.top)); } -CFX_PointF CFX_ListCtrl::OutToIn(const CFX_PointF& point) const { +CFX_FloatPoint CFX_ListCtrl::OutToIn(const CFX_FloatPoint& point) const { CFX_FloatRect rcPlate = GetPlateRect(); - return CFX_PointF(point.x + (m_ptScrollPos.x - rcPlate.left), - point.y + (m_ptScrollPos.y - rcPlate.top)); + + return CFX_FloatPoint(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_PointF ptLeftBottom = InToOut(CFX_PointF(rect.left, rect.bottom)); - CFX_PointF ptRightTop = InToOut(CFX_PointF(rect.right, rect.top)); + CFX_FloatPoint ptLeftBottom = InToOut(CFX_FloatPoint(rect.left, rect.bottom)); + CFX_FloatPoint ptRightTop = InToOut(CFX_FloatPoint(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_PointF ptLeftBottom = OutToIn(CFX_PointF(rect.left, rect.bottom)); - CFX_PointF ptRightTop = OutToIn(CFX_PointF(rect.right, rect.top)); + CFX_FloatPoint ptLeftBottom = OutToIn(CFX_FloatPoint(rect.left, rect.bottom)); + CFX_FloatPoint ptRightTop = OutToIn(CFX_FloatPoint(rect.right, rect.top)); + return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y); } -void CFX_ListCtrl::OnMouseDown(const CFX_PointF& point, +void CFX_ListCtrl::OnMouseDown(const CFX_FloatPoint& point, bool bShift, bool bCtrl) { int32_t nHitIndex = GetItemIndex(point); @@ -272,7 +276,7 @@ void CFX_ListCtrl::OnMouseDown(const CFX_PointF& point, ScrollToListItem(nHitIndex); } -void CFX_ListCtrl::OnMouseMove(const CFX_PointF& point, +void CFX_ListCtrl::OnMouseMove(const CFX_FloatPoint& point, bool bShift, bool bCtrl) { int32_t nHitIndex = GetItemIndex(point); @@ -363,7 +367,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_PointF(rect.left, rect.top)); + SetScrollPos(CFX_FloatPoint(rect.left, rect.top)); ReArrange(0); InvalidateItem(-1); } @@ -538,7 +542,7 @@ void CFX_ListCtrl::SetScrollInfo() { } } -void CFX_ListCtrl::SetScrollPos(const CFX_PointF& point) { +void CFX_ListCtrl::SetScrollPos(const CFX_FloatPoint& point) { SetScrollPosY(point.y); } @@ -626,8 +630,8 @@ void CFX_ListCtrl::Cancel() { m_aSelItems.DeselectAll(); } -int32_t CFX_ListCtrl::GetItemIndex(const CFX_PointF& point) const { - CFX_PointF pt = OuterToInner(OutToIn(point)); +int32_t CFX_ListCtrl::GetItemIndex(const CFX_FloatPoint& point) const { + CFX_FloatPoint 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 01e18bc000..38d1957e00 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_PointF LeftTop() const { return CFX_PointF(left, top); } + CFX_FloatPoint LeftTop() const { return CFX_FloatPoint(left, top); } - CFX_PointF RightBottom() const { return CFX_PointF(right, bottom); } + CFX_FloatPoint RightBottom() const { return CFX_FloatPoint(right, bottom); } - const CLST_Rect operator+=(const CFX_PointF& point) { + const CLST_Rect operator+=(const CFX_FloatPoint& 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_PointF& point) { + const CLST_Rect operator-=(const CFX_FloatPoint& 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_PointF& point) const { + CLST_Rect operator+(const CFX_FloatPoint& point) const { return CLST_Rect(left + point.x, top + point.y, right + point.x, bottom + point.y); } - CLST_Rect operator-(const CFX_PointF& point) const { + CLST_Rect operator-(const CFX_FloatPoint& point) const { return CLST_Rect(left - point.x, top - point.y, right - point.x, bottom - point.y); } @@ -134,31 +134,33 @@ 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_PointF GetBTPoint() const { - return CFX_PointF(m_rcPlate.left, m_rcPlate.top); + CFX_FloatPoint GetBTPoint() const { + return CFX_FloatPoint(m_rcPlate.left, m_rcPlate.top); } - CFX_PointF GetETPoint() const { - return CFX_PointF(m_rcPlate.right, m_rcPlate.bottom); + CFX_FloatPoint GetETPoint() const { + return CFX_FloatPoint(m_rcPlate.right, m_rcPlate.bottom); } public: - CFX_PointF InnerToOuter(const CFX_PointF& point) const { - return CFX_PointF(point.x + GetBTPoint().x, GetBTPoint().y - point.y); + CFX_FloatPoint InnerToOuter(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_FloatPoint OuterToInner(const CFX_FloatPoint& point) const { + return CFX_FloatPoint(point.x - GetBTPoint().x, GetBTPoint().y - point.y); } CFX_FloatRect InnerToOuter(const CLST_Rect& rect) const { - CFX_PointF ptLeftTop = InnerToOuter(CFX_PointF(rect.left, rect.top)); - CFX_PointF ptRightBottom = - InnerToOuter(CFX_PointF(rect.right, rect.bottom)); + CFX_FloatPoint ptLeftTop = + InnerToOuter(CFX_FloatPoint(rect.left, rect.top)); + CFX_FloatPoint ptRightBottom = + InnerToOuter(CFX_FloatPoint(rect.right, rect.bottom)); return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, ptLeftTop.y); } CLST_Rect OuterToInner(const CFX_FloatRect& rect) const { - CFX_PointF ptLeftTop = OuterToInner(CFX_PointF(rect.left, rect.top)); - CFX_PointF ptRightBottom = - OuterToInner(CFX_PointF(rect.right, rect.bottom)); + CFX_FloatPoint ptLeftTop = + OuterToInner(CFX_FloatPoint(rect.left, rect.top)); + CFX_FloatPoint ptRightBottom = + OuterToInner(CFX_FloatPoint(rect.right, rect.bottom)); return CLST_Rect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, ptRightBottom.y); } @@ -224,8 +226,8 @@ class CFX_ListCtrl : protected CFX_ListContainer { void SetPlateRect(const CFX_FloatRect& rect) override; void SetNotify(CPWL_List_Notify* pNotify); - void OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl); - void OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl); + void OnMouseDown(const CFX_FloatPoint& point, bool bShift, bool bCtrl); + void OnMouseMove(const CFX_FloatPoint& 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); @@ -235,14 +237,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_PointF& point); + void SetScrollPos(const CFX_FloatPoint& 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_PointF& point) const; + int32_t GetItemIndex(const CFX_FloatPoint& point) const; void AddString(const CFX_WideString& str); void SetTopItem(int32_t nIndex); void Select(int32_t nItemIndex); @@ -265,8 +267,8 @@ class CFX_ListCtrl : protected CFX_ListContainer { int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; int32_t GetFirstSelected() const; - CFX_PointF InToOut(const CFX_PointF& point) const; - CFX_PointF OutToIn(const CFX_PointF& point) const; + CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const; + CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const; CFX_FloatRect InToOut(const CFX_FloatRect& rect) const; CFX_FloatRect OutToIn(const CFX_FloatRect& rect) const; @@ -289,7 +291,7 @@ class CFX_ListCtrl : protected CFX_ListContainer { CPWL_List_Notify* m_pNotify; bool m_bNotifyFlag; - CFX_PointF m_ptScrollPos; + CFX_FloatPoint 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 636d161fea..408dcceae2 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_PointF& point) = 0; + const CFX_FloatPoint& 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_PointF& point) = 0; + const CFX_FloatPoint& point) = 0; virtual bool OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) = 0; + const CFX_FloatPoint& point) = 0; virtual bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) = 0; + const CFX_FloatPoint& point) = 0; virtual bool OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) = 0; + const CFX_FloatPoint& point) = 0; virtual bool OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, - const CFX_PointF& point) = 0; + const CFX_FloatPoint& point) = 0; virtual bool OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) = 0; + const CFX_FloatPoint& point) = 0; virtual bool OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) = 0; + const CFX_FloatPoint& point) = 0; virtual bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - const CFX_PointF& point) = 0; + const CFX_FloatPoint& 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 96be469454..972e55edad 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_PointF& point, uint32_t nFlag) { +bool CPWL_Button::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); m_bMouseDown = true; @@ -29,7 +29,7 @@ bool CPWL_Button::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_Button::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_Button::OnLButtonUp(const CFX_FloatPoint& 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 2d1193f89d..f35e9adf36 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_PointF& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; protected: bool m_bMouseDown; diff --git a/fpdfsdk/pdfwindow/PWL_Caret.cpp b/fpdfsdk/pdfwindow/PWL_Caret.cpp index 06c8e31ce7..6636170e81 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.cpp +++ b/fpdfsdk/pdfwindow/PWL_Caret.cpp @@ -14,8 +14,6 @@ #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() {} @@ -25,7 +23,7 @@ CFX_ByteString CPWL_Caret::GetClassName() const { } void CPWL_Caret::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { - GetCaretApp(sAppStream, CFX_PointF()); + GetCaretApp(sAppStream, CFX_FloatPoint(0.0f, 0.0f)); } void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, @@ -62,7 +60,7 @@ void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, } void CPWL_Caret::GetCaretApp(CFX_ByteTextBuf& sAppStream, - const CFX_PointF& ptOffset) { + const CFX_FloatPoint& ptOffset) { if (IsVisible() && m_bFlash) { CFX_ByteTextBuf sCaret; @@ -87,7 +85,7 @@ void CPWL_Caret::GetCaretApp(CFX_ByteTextBuf& sAppStream, } CFX_ByteString CPWL_Caret::GetCaretAppearanceStream( - const CFX_PointF& ptOffset) { + const CFX_FloatPoint& ptOffset) { CFX_ByteTextBuf sCaret; GetCaretApp(sCaret, ptOffset); return sCaret.MakeString(); @@ -108,8 +106,8 @@ CFX_FloatRect CPWL_Caret::GetCaretRect() const { } void CPWL_Caret::SetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot) { + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& ptFoot) { if (bVisible) { if (IsVisible()) { if (m_ptHead != ptHead || m_ptFoot != ptFoot) { @@ -128,8 +126,8 @@ void CPWL_Caret::SetCaret(bool bVisible, Move(m_rcInvalid, false, true); } } else { - m_ptHead = CFX_PointF(); - m_ptFoot = CFX_PointF(); + m_ptHead = CFX_FloatPoint(); + m_ptFoot = CFX_FloatPoint(); m_bFlash = false; if (IsVisible()) { EndTimer(); diff --git a/fpdfsdk/pdfwindow/PWL_Caret.h b/fpdfsdk/pdfwindow/PWL_Caret.h index 60ebbdc8e1..ccee96109e 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(); + PWL_CARET_INFO() : bVisible(false) {} bool bVisible; - CFX_PointF ptHead; - CFX_PointF ptFoot; + CFX_FloatPoint ptHead; + CFX_FloatPoint 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_PointF& ptHead, - const CFX_PointF& ptFoot); - CFX_ByteString GetCaretAppearanceStream(const CFX_PointF& ptOffset); + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& ptFoot); + CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset); void SetInvalidRect(CFX_FloatRect rc) { m_rcInvalid = rc; } private: - void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CFX_PointF& ptOffset); + void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CFX_FloatPoint& ptOffset); CFX_FloatRect GetCaretRect() const; bool m_bFlash; - CFX_PointF m_ptHead; - CFX_PointF m_ptFoot; + CFX_FloatPoint m_ptHead; + CFX_FloatPoint 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 1bf1adfbcf..acee850024 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_PointF& point, uint32_t nFlag) { +bool CPWL_CBListBox::OnLButtonUp(const CFX_FloatPoint& 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_PointF ptCenter = GetCenterPoint(); + CFX_FloatPoint ptCenter = GetCenterPoint(); - 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); + 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); 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_PointF ptCenter = GetCenterPoint(); + CFX_FloatPoint ptCenter = GetCenterPoint(); - 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); + 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); 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_PointF& point, uint32_t nFlag) { +bool CPWL_CBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); SetCapture(); @@ -175,7 +175,7 @@ bool CPWL_CBButton::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_CBButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_CBButton::OnLButtonUp(const CFX_FloatPoint& 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 e1a8df7561..84261199e9 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_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& 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_PointF& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& 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 8b46d22f13..b9958a3128 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_PointF ptOffset; + CFX_FloatPoint ptOffset = CFX_FloatPoint(); 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_PointF(), pRange, pSysHandler, m_pFormFiller); + rcClip, CFX_FloatPoint(), pRange, pSysHandler, m_pFormFiller); } -bool CPWL_Edit::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& 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_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_Edit::OnLButtonDblClk(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& 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_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_Edit::OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& 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_PointF(), CFX_PointF()); + SetCaret(false, CFX_FloatPoint(), CFX_FloatPoint()); 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_PointF& ptOffset) const { + const CFX_FloatPoint& 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_PointF& ptOffset) const { + const CFX_FloatPoint& ptOffset) const { CFX_ByteTextBuf sRet; CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit.get(), ptOffset); if (sEdit.GetLength() > 0) { @@ -497,22 +497,24 @@ CFX_ByteString CPWL_Edit::GetTextAppearanceStream( } CFX_ByteString CPWL_Edit::GetCaretAppearanceStream( - const CFX_PointF& ptOffset) const { + const CFX_FloatPoint& ptOffset) const { if (m_pEditCaret) return m_pEditCaret->GetCaretAppearanceStream(ptOffset); return CFX_ByteString(); } -CFX_PointF CPWL_Edit::GetWordRightBottomPoint(const CPVT_WordPlace& wpWord) { +CFX_FloatPoint CPWL_Edit::GetWordRightBottomPoint( + const CPVT_WordPlace& wpWord) { CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); CPVT_WordPlace wpOld = pIterator->GetAt(); pIterator->SetAt(wpWord); - CFX_PointF pt; + CFX_FloatPoint pt; CPVT_Word word; if (pIterator->GetWord(word)) { - pt = CFX_PointF(word.ptWord.x + word.fWidth, word.ptWord.y + word.fDescent); + pt = CFX_FloatPoint(word.ptWord.x + word.fWidth, + word.ptWord.y + word.fDescent); } pIterator->SetAt(wpOld); return pt; @@ -718,10 +720,10 @@ bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { } bool CPWL_Edit::OnMouseWheel(short zDelta, - const CFX_PointF& point, + const CFX_FloatPoint& point, uint32_t nFlag) { if (HasFlag(PES_MULTILINE)) { - CFX_PointF ptScroll = GetScrollPos(); + CFX_FloatPoint ptScroll = GetScrollPos(); if (zDelta > 0) { ptScroll.y += GetFontSize(); @@ -803,7 +805,8 @@ CPVT_WordRange CPWL_Edit::CombineWordRange(const CPVT_WordRange& wr1, return wrRet; } -CPVT_WordRange CPWL_Edit::GetLatinWordsRange(const CFX_PointF& point) const { +CPVT_WordRange CPWL_Edit::GetLatinWordsRange( + const CFX_FloatPoint& point) const { return GetSameWordsRange(m_pEdit->SearchWordPlace(point), true, false); } @@ -873,7 +876,7 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place, } void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_PointF& ptOffset, + const CFX_FloatPoint& ptOffset, std::vector* ObjArray) { CFX_Edit::GeneratePageObjects( pObjectHolder, m_pEdit.get(), ptOffset, nullptr, @@ -882,7 +885,7 @@ void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, } void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_PointF& ptOffset) { + const CFX_FloatPoint& 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 5143c97424..801dedd0ac 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_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 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 OnMouseWheel(short zDelta, - const CFX_PointF& point, + const CFX_FloatPoint& point, uint32_t nFlag) override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; @@ -90,9 +90,10 @@ class CPWL_Edit : public CPWL_EditCtrl { void SetText(const CFX_WideString& csText); void ReplaceSel(const CFX_WideString& csText); - CFX_ByteString GetTextAppearanceStream(const CFX_PointF& ptOffset) const; - CFX_ByteString GetCaretAppearanceStream(const CFX_PointF& ptOffset) const; - CFX_ByteString GetSelectAppearanceStream(const CFX_PointF& ptOffset) const; + CFX_ByteString GetTextAppearanceStream(const CFX_FloatPoint& ptOffset) const; + CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset) const; + CFX_ByteString GetSelectAppearanceStream( + const CFX_FloatPoint& ptOffset) const; bool IsTextFull() const; @@ -105,10 +106,10 @@ class CPWL_Edit : public CPWL_EditCtrl { } void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_PointF& ptOffset, + const CFX_FloatPoint& ptOffset, std::vector* ObjArray); void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_PointF& ptOffset); + const CFX_FloatPoint& ptOffset); bool IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag); void AttachFFLData(CFFL_FormFiller* pData) { m_pFormFiller = pData; } @@ -130,11 +131,11 @@ class CPWL_Edit : public CPWL_EditCtrl { void SetParamByFlag(); FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray); - CFX_PointF GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); + CFX_FloatPoint GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2); - CPVT_WordRange GetLatinWordsRange(const CFX_PointF& point) const; + CPVT_WordRange GetLatinWordsRange(const CFX_FloatPoint& 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 64272e34c5..90b7a3c7c0 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_PointF point1(0, 1); - CFX_PointF point2(1, 1); + CFX_FloatPoint point1(0, 1); + CFX_FloatPoint point2(1, 1); mt.TransformPoint(point1.x, point1.y); mt.TransformPoint(point2.x, point2.y); @@ -93,7 +93,8 @@ void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd, FX_FLOAT fPos = *(FX_FLOAT*)lParam; switch (wParam) { case SBT_VSCROLL: - m_pEdit->SetScrollPos(CFX_PointF(m_pEdit->GetScrollPos().x, fPos)); + m_pEdit->SetScrollPos( + CFX_FloatPoint(m_pEdit->GetScrollPos().x, fPos)); break; } } break; @@ -280,7 +281,7 @@ bool CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { return true; } -bool CPWL_EditCtrl::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_EditCtrl::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (ClientHitTest(point)) { @@ -296,7 +297,7 @@ bool CPWL_EditCtrl::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_EditCtrl::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_EditCtrl::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (m_bMouseDown) { @@ -311,7 +312,7 @@ bool CPWL_EditCtrl::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_EditCtrl::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_EditCtrl::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (m_bMouseDown) @@ -325,8 +326,8 @@ CFX_FloatRect CPWL_EditCtrl::GetContentRect() const { } void CPWL_EditCtrl::SetEditCaret(bool bVisible) { - CFX_PointF ptHead; - CFX_PointF ptFoot; + CFX_FloatPoint ptHead; + CFX_FloatPoint ptFoot; if (bVisible) GetCaretInfo(ptHead, ptFoot); @@ -334,7 +335,8 @@ void CPWL_EditCtrl::SetEditCaret(bool bVisible) { IOnSetCaret(bVisible, ptHead, ptFoot, wpTemp); } -void CPWL_EditCtrl::GetCaretInfo(CFX_PointF& ptHead, CFX_PointF& ptFoot) const { +void CPWL_EditCtrl::GetCaretInfo(CFX_FloatPoint& ptHead, + CFX_FloatPoint& ptFoot) const { CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); pIterator->SetAt(m_pEdit->GetCaret()); CPVT_Word word; @@ -353,15 +355,15 @@ void CPWL_EditCtrl::GetCaretInfo(CFX_PointF& ptHead, CFX_PointF& ptFoot) const { } void CPWL_EditCtrl::GetCaretPos(int32_t& x, int32_t& y) const { - CFX_PointF ptHead; - CFX_PointF ptFoot; + CFX_FloatPoint ptHead; + CFX_FloatPoint ptFoot; GetCaretInfo(ptHead, ptFoot); PWLtoWnd(ptHead, x, y); } void CPWL_EditCtrl::SetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot) { + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& ptFoot) { if (m_pEditCaret) { if (!IsFocused() || m_pEdit->IsSelected()) bVisible = false; @@ -411,11 +413,11 @@ int32_t CPWL_EditCtrl::GetTotalWords() const { return m_pEdit->GetTotalWords(); } -void CPWL_EditCtrl::SetScrollPos(const CFX_PointF& point) { +void CPWL_EditCtrl::SetScrollPos(const CFX_FloatPoint& point) { m_pEdit->SetScrollPos(point); } -CFX_PointF CPWL_EditCtrl::GetScrollPos() const { +CFX_FloatPoint CPWL_EditCtrl::GetScrollPos() const { return m_pEdit->GetScrollPos(); } @@ -542,8 +544,8 @@ void CPWL_EditCtrl::IOnSetScrollPosY(FX_FLOAT fy) { } void CPWL_EditCtrl::IOnSetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot, + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& ptFoot, const CPVT_WordPlace& place) { PWL_CARET_INFO cInfo; cInfo.bVisible = bVisible; @@ -570,9 +572,9 @@ void CPWL_EditCtrl::GetTextRange(const CFX_FloatRect& rect, int32_t& nStartChar, int32_t& nEndChar) const { nStartChar = m_pEdit->WordPlaceToWordIndex( - m_pEdit->SearchWordPlace(CFX_PointF(rect.left, rect.top))); + m_pEdit->SearchWordPlace(CFX_FloatPoint(rect.left, rect.top))); nEndChar = m_pEdit->WordPlaceToWordIndex( - m_pEdit->SearchWordPlace(CFX_PointF(rect.right, rect.bottom))); + m_pEdit->SearchWordPlace(CFX_FloatPoint(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 8b65d4a7b5..3ff5cc66c9 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_PointF GetScrollPos() const; - void SetScrollPos(const CFX_PointF& point); + CFX_FloatPoint GetScrollPos() const; + void SetScrollPos(const CFX_FloatPoint& 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_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 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; 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_PointF& ptHead, - const CFX_PointF& ptFoot, + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& 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_PointF& ptHead, CFX_PointF& ptFoot) const; + void GetCaretInfo(CFX_FloatPoint& ptHead, CFX_FloatPoint& ptFoot) const; void SetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot); + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& ptFoot); void SetEditCaret(bool bVisible); diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp index 3f5dfef142..12cad7b9da 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_PointF ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); + CFX_FloatPoint 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_PointF ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); + CFX_FloatPoint 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_PointF& point, uint32_t nFlag) { +bool CPWL_ListBox::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (ClientHitTest(point)) { @@ -263,7 +263,7 @@ bool CPWL_ListBox::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_ListBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_ListBox::OnLButtonUp(const CFX_FloatPoint& 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_PointF& point, uint32_t nFlag) { +bool CPWL_ListBox::OnMouseMove(const CFX_FloatPoint& 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_PointF(0, fPos)); + m_pList->SetScrollPos(CFX_FloatPoint(0, fPos)); break; } break; @@ -449,7 +449,7 @@ CFX_FloatRect CPWL_ListBox::GetListRect() const { } bool CPWL_ListBox::OnMouseWheel(short zDelta, - const CFX_PointF& point, + const CFX_FloatPoint& 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 f9108a17de..6db4ecb381 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_PointF& ptHead, - const CFX_PointF& ptFoot, + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& 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_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 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 OnMouseWheel(short zDelta, - const CFX_PointF& point, + const CFX_FloatPoint& 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 2aa2c7e35f..c7e6bbfa99 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp @@ -137,17 +137,18 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { sAppStream << "q\n"; - CFX_PointF ptCenter = GetCenterPoint(); + CFX_FloatPoint ptCenter = GetCenterPoint(); switch (m_eScrollBarType) { case SBT_HSCROLL: switch (m_eSBButtonType) { case PSBT_MIN: { - 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); + 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); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -161,11 +162,12 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { } } break; case PSBT_MAX: { - 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); + 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); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -185,11 +187,12 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { case SBT_VSCROLL: switch (m_eSBButtonType) { case PSBT_MIN: { - 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); + 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); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -203,11 +206,12 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { } } break; case PSBT_MAX: { - 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); + 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); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -240,7 +244,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, if (rectWnd.IsEmpty()) return; - CFX_PointF ptCenter = GetCenterPoint(); + CFX_FloatPoint ptCenter = GetCenterPoint(); int32_t nTransparancy = GetTransparency(); switch (m_eScrollBarType) { @@ -248,11 +252,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); switch (m_eSBButtonType) { case PSBT_MIN: { - 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); + 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); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -271,11 +276,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } break; case PSBT_MAX: { - 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); + 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); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -328,13 +334,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_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)}; + 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)}; if (IsEnabled()) CPWL_Utils::DrawFillArea( @@ -374,13 +380,13 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, FX_FLOAT fX = rectWnd.left + 1.5f; FX_FLOAT fY = rectWnd.bottom; - 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)}; + 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)}; if (IsEnabled()) CPWL_Utils::DrawFillArea( @@ -408,9 +414,10 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, if (IsEnabled()) { // draw shadow effect - CFX_PointF ptTop = CFX_PointF(rectWnd.left, rectWnd.top - 1.0f); - CFX_PointF ptBottom = - CFX_PointF(rectWnd.left, rectWnd.bottom + 1.0f); + CFX_FloatPoint ptTop = + CFX_FloatPoint(rectWnd.left, rectWnd.top - 1.0f); + CFX_FloatPoint ptBottom = + CFX_FloatPoint(rectWnd.left, rectWnd.bottom + 1.0f); ptTop.x += 1.5f; ptBottom.x += 1.5f; @@ -497,12 +504,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, FX_FLOAT nFrictionWidth = 5.0f; FX_FLOAT nFrictionHeight = 5.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); + 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); CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, crStroke, 1.0f); @@ -529,7 +536,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -bool CPWL_SBButton::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_SBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) @@ -541,7 +548,7 @@ bool CPWL_SBButton::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_SBButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_SBButton::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) @@ -553,7 +560,7 @@ bool CPWL_SBButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_SBButton::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_SBButton::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) { @@ -676,19 +683,20 @@ void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice, CPWL_Utils::DrawStrokeLine( pDevice, pUser2Device, - CFX_PointF(rectWnd.left + 2.0f, rectWnd.top - 2.0f), - CFX_PointF(rectWnd.left + 2.0f, rectWnd.bottom + 2.0f), + CFX_FloatPoint(rectWnd.left + 2.0f, rectWnd.top - 2.0f), + CFX_FloatPoint(rectWnd.left + 2.0f, rectWnd.bottom + 2.0f), ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f); CPWL_Utils::DrawStrokeLine( pDevice, pUser2Device, - CFX_PointF(rectWnd.right - 2.0f, rectWnd.top - 2.0f), - CFX_PointF(rectWnd.right - 2.0f, rectWnd.bottom + 2.0f), + CFX_FloatPoint(rectWnd.right - 2.0f, rectWnd.top - 2.0f), + CFX_FloatPoint(rectWnd.right - 2.0f, rectWnd.bottom + 2.0f), ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f); } } -bool CPWL_ScrollBar::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_ScrollBar::OnLButtonDown(const CFX_FloatPoint& point, + uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (HasFlag(PWS_AUTOTRANSPARENT)) { @@ -743,7 +751,7 @@ bool CPWL_ScrollBar::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_ScrollBar::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_ScrollBar::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (HasFlag(PWS_AUTOTRANSPARENT)) { @@ -768,41 +776,41 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, switch (msg) { case PNM_LBUTTONDOWN: if (pWnd == m_pMinButton) { - OnMinButtonLBDown(*(CFX_PointF*)lParam); + OnMinButtonLBDown(*(CFX_FloatPoint*)lParam); } if (pWnd == m_pMaxButton) { - OnMaxButtonLBDown(*(CFX_PointF*)lParam); + OnMaxButtonLBDown(*(CFX_FloatPoint*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonLBDown(*(CFX_PointF*)lParam); + OnPosButtonLBDown(*(CFX_FloatPoint*)lParam); } break; case PNM_LBUTTONUP: if (pWnd == m_pMinButton) { - OnMinButtonLBUp(*(CFX_PointF*)lParam); + OnMinButtonLBUp(*(CFX_FloatPoint*)lParam); } if (pWnd == m_pMaxButton) { - OnMaxButtonLBUp(*(CFX_PointF*)lParam); + OnMaxButtonLBUp(*(CFX_FloatPoint*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonLBUp(*(CFX_PointF*)lParam); + OnPosButtonLBUp(*(CFX_FloatPoint*)lParam); } break; case PNM_MOUSEMOVE: if (pWnd == m_pMinButton) { - OnMinButtonMouseMove(*(CFX_PointF*)lParam); + OnMinButtonMouseMove(*(CFX_FloatPoint*)lParam); } if (pWnd == m_pMaxButton) { - OnMaxButtonMouseMove(*(CFX_PointF*)lParam); + OnMaxButtonMouseMove(*(CFX_FloatPoint*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonMouseMove(*(CFX_PointF*)lParam); + OnPosButtonMouseMove(*(CFX_FloatPoint*)lParam); } break; case PNM_SETSCROLLINFO: { @@ -946,7 +954,7 @@ void CPWL_ScrollBar::MovePosButton(bool bRefresh) { } } -void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_PointF& point) { +void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_FloatPoint& point) { m_sData.SubSmall(); MovePosButton(true); NotifyScrollWindow(); @@ -957,11 +965,11 @@ void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_PointF& point) { BeginTimer(100); } -void CPWL_ScrollBar::OnMinButtonLBUp(const CFX_PointF& point) {} +void CPWL_ScrollBar::OnMinButtonLBUp(const CFX_FloatPoint& point) {} -void CPWL_ScrollBar::OnMinButtonMouseMove(const CFX_PointF& point) {} +void CPWL_ScrollBar::OnMinButtonMouseMove(const CFX_FloatPoint& point) {} -void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_PointF& point) { +void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_FloatPoint& point) { m_sData.AddSmall(); MovePosButton(true); NotifyScrollWindow(); @@ -972,11 +980,11 @@ void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_PointF& point) { BeginTimer(100); } -void CPWL_ScrollBar::OnMaxButtonLBUp(const CFX_PointF& point) {} +void CPWL_ScrollBar::OnMaxButtonLBUp(const CFX_FloatPoint& point) {} -void CPWL_ScrollBar::OnMaxButtonMouseMove(const CFX_PointF& point) {} +void CPWL_ScrollBar::OnMaxButtonMouseMove(const CFX_FloatPoint& point) {} -void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_PointF& point) { +void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_FloatPoint& point) { m_bMouseDown = true; if (m_pPosButton) { @@ -995,7 +1003,7 @@ void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_PointF& point) { } } -void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_PointF& point) { +void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_FloatPoint& point) { if (m_bMouseDown) { if (!m_bNotifyForever) NotifyScrollWindow(); @@ -1003,7 +1011,7 @@ void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_PointF& point) { m_bMouseDown = false; } -void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_PointF& point) { +void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_FloatPoint& 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 9546a9e577..bcfb0a6873 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_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 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; 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_PointF& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& 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_PointF& point); - void OnMinButtonLBUp(const CFX_PointF& point); - void OnMinButtonMouseMove(const CFX_PointF& point); + void OnMinButtonLBDown(const CFX_FloatPoint& point); + void OnMinButtonLBUp(const CFX_FloatPoint& point); + void OnMinButtonMouseMove(const CFX_FloatPoint& point); - void OnMaxButtonLBDown(const CFX_PointF& point); - void OnMaxButtonLBUp(const CFX_PointF& point); - void OnMaxButtonMouseMove(const CFX_PointF& point); + void OnMaxButtonLBDown(const CFX_FloatPoint& point); + void OnMaxButtonLBUp(const CFX_FloatPoint& point); + void OnMaxButtonMouseMove(const CFX_FloatPoint& point); - void OnPosButtonLBDown(const CFX_PointF& point); - void OnPosButtonLBUp(const CFX_PointF& point); - void OnPosButtonMouseMove(const CFX_PointF& point); + void OnPosButtonLBDown(const CFX_FloatPoint& point); + void OnPosButtonLBUp(const CFX_FloatPoint& point); + void OnPosButtonMouseMove(const CFX_FloatPoint& 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 1c46c375a9..defb992c57 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_PointF& point, uint32_t nFlag) { +bool CPWL_CheckBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { if (IsReadOnly()) return false; @@ -58,7 +58,8 @@ CFX_ByteString CPWL_RadioButton::GetClassName() const { return "CPWL_RadioButton"; } -bool CPWL_RadioButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_RadioButton::OnLButtonUp(const CFX_FloatPoint& point, + uint32_t nFlag) { if (IsReadOnly()) return false; diff --git a/fpdfsdk/pdfwindow/PWL_SpecialButton.h b/fpdfsdk/pdfwindow/PWL_SpecialButton.h index 93f611b744..0aa6c4510b 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_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& 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_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& 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 d4e31bcf73..f3caf12af9 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_PointF CPWL_Utils::OffsetPoint(const CFX_PointF& point, - FX_FLOAT x, - FX_FLOAT y) { - return CFX_PointF(point.x + x, point.y + y); +CFX_FloatPoint CPWL_Utils::OffsetPoint(const CFX_FloatPoint& point, + FX_FLOAT x, + FX_FLOAT y) { + return CFX_FloatPoint(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_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); + 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); 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_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); + 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); 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_PointF ptCenter = CFX_PointF((crBBox.left + crBBox.right) / 2.0f, - (crBBox.top + crBBox.bottom) / 2.0f); + CFX_FloatPoint ptCenter = CFX_FloatPoint((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_PointF pt1(-fWidth / 2, 0); - CFX_PointF pt2(0, fHeight / 2); - CFX_PointF pt3(fWidth / 2, 0); + CFX_FloatPoint pt1(-fWidth / 2, 0); + CFX_FloatPoint pt2(0, fHeight / 2); + CFX_FloatPoint 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_PointF ptCenter = CFX_PointF((rcRect.left + rcRect.right) / 2, - (rcRect.top + rcRect.bottom) / 2); + CFX_FloatPoint ptCenter = CFX_FloatPoint((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_PointF& ptOffset, + const CFX_FloatPoint& 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_PointF& ptOffset, + const CFX_FloatPoint& 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_PointF(0.0f, 0.0f)); + CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(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_PointF(0.0f, 0.0f)); + CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(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_PointF ptCenter = CFX_PointF((rcBBox.left + rcBBox.right) / 2, - (rcBBox.top + rcBBox.bottom) / 2); + CFX_FloatPoint ptCenter = CFX_FloatPoint((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_PointF* pPts, + const CFX_FloatPoint* 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_PointF& ptMoveTo, - const CFX_PointF& ptLineTo, + const CFX_FloatPoint& ptMoveTo, + const CFX_FloatPoint& 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_PointF(rect.left, fy), - CFX_PointF(rect.right, fy), + pDevice, pUser2Device, CFX_FloatPoint(rect.left, fy), + CFX_FloatPoint(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_PointF(fx, rect.bottom), - CFX_PointF(fx, rect.top), + pDevice, pUser2Device, CFX_FloatPoint(fx, rect.bottom), + CFX_FloatPoint(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_PointF ptCenter = CFX_PointF((crBBox.left + crBBox.right) / 2.0f, - (crBBox.top + crBBox.bottom) / 2.0f); + CFX_FloatPoint ptCenter = CFX_FloatPoint((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 f6b51d7098..f14c3c7963 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_PointF { +class CPWL_Point : public CFX_FloatPoint { public: CPWL_Point() {} - CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CFX_PointF(fx, fy) {} - CPWL_Point(const CPWL_Point& point) : CFX_PointF(point.x, point.y) {} + CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CFX_FloatPoint(fx, fy) {} + CPWL_Point(const CPWL_Point& point) : CFX_FloatPoint(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_PointF OffsetPoint(const CFX_PointF& point, - FX_FLOAT x, - FX_FLOAT y); + static CFX_FloatPoint OffsetPoint(const CFX_FloatPoint& 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_PointF& ptOffset, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange = nullptr, bool bContinuous = true, uint16_t SubWord = 0); static CFX_ByteString GetEditSelAppStream( CFX_Edit* pEdit, - const CFX_PointF& ptOffset, + const CFX_FloatPoint& 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_PointF& ptMoveTo, - const CFX_PointF& ptLineTo, + const CFX_FloatPoint& ptMoveTo, + const CFX_FloatPoint& 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_PointF* pPts, + const CFX_FloatPoint* 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 cf573220b7..1170660f1c 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp @@ -426,7 +426,8 @@ 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_PointF& point, uint32_t nFlag) { \ + bool CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \ + uint32_t nFlag) { \ if (!IsValid() || !IsVisible() || !IsEnabled()) \ return false; \ if (IsWndCaptureMouse(this)) { \ @@ -461,7 +462,7 @@ PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) #undef PWL_IMPLEMENT_MOUSE_METHOD bool CPWL_Wnd::OnMouseWheel(short zDelta, - const CFX_PointF& point, + const CFX_FloatPoint& point, uint32_t nFlag) { if (!IsValid() || !IsVisible() || !IsEnabled()) return false; @@ -533,10 +534,10 @@ CFX_FloatRect CPWL_Wnd::GetClientRect() const { return rcWindow.Contains(rcClient) ? rcClient : CFX_FloatRect(); } -CFX_PointF CPWL_Wnd::GetCenterPoint() const { +CFX_FloatPoint CPWL_Wnd::GetCenterPoint() const { CFX_FloatRect rcClient = GetClientRect(); - return CFX_PointF((rcClient.left + rcClient.right) * 0.5f, - (rcClient.top + rcClient.bottom) * 0.5f); + return CFX_FloatPoint((rcClient.left + rcClient.right) * 0.5f, + (rcClient.top + rcClient.bottom) * 0.5f); } bool CPWL_Wnd::HasFlag(uint32_t dwFlags) const { @@ -672,11 +673,11 @@ void CPWL_Wnd::OnSetFocus() {} void CPWL_Wnd::OnKillFocus() {} -bool CPWL_Wnd::WndHitTest(const CFX_PointF& point) const { +bool CPWL_Wnd::WndHitTest(const CFX_FloatPoint& point) const { return IsValid() && IsVisible() && GetWindowRect().Contains(point.x, point.y); } -bool CPWL_Wnd::ClientHitTest(const CFX_PointF& point) const { +bool CPWL_Wnd::ClientHitTest(const CFX_FloatPoint& point) const { return IsValid() && IsVisible() && GetClientRect().Contains(point.x, point.y); } @@ -849,9 +850,11 @@ CFX_Matrix CPWL_Wnd::GetWindowMatrix() const { return mt; } -void CPWL_Wnd::PWLtoWnd(const CFX_PointF& point, int32_t& x, int32_t& y) const { +void CPWL_Wnd::PWLtoWnd(const CFX_FloatPoint& point, + int32_t& x, + int32_t& y) const { CFX_Matrix mt = GetWindowMatrix(); - CFX_PointF pt = point; + CFX_FloatPoint pt = point; mt.TransformPoint(pt.x, pt.y); x = (int32_t)(pt.x + 0.5); y = (int32_t)(pt.y + 0.5); @@ -865,12 +868,12 @@ FX_RECT CPWL_Wnd::PWLtoWnd(const CFX_FloatRect& rect) const { (int32_t)(rcTemp.right + 0.5), (int32_t)(rcTemp.top + 0.5)); } -CFX_PointF CPWL_Wnd::ChildToParent(const CFX_PointF& point) const { +CFX_FloatPoint CPWL_Wnd::ChildToParent(const CFX_FloatPoint& point) const { CFX_Matrix mt = GetChildMatrix(); if (mt.IsIdentity()) return point; - CFX_PointF pt = point; + CFX_FloatPoint pt = point; mt.TransformPoint(pt.x, pt.y); return pt; } @@ -885,13 +888,13 @@ CFX_FloatRect CPWL_Wnd::ChildToParent(const CFX_FloatRect& rect) const { return rc; } -CFX_PointF CPWL_Wnd::ParentToChild(const CFX_PointF& point) const { +CFX_FloatPoint CPWL_Wnd::ParentToChild(const CFX_FloatPoint& point) const { CFX_Matrix mt = GetChildMatrix(); if (mt.IsIdentity()) return point; mt.SetReverse(mt); - CFX_PointF pt = point; + CFX_FloatPoint 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 12b29aeb7e..dd4f321d8a 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_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 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 OnMouseWheel(short zDelta, - const CFX_PointF& point, + const CFX_FloatPoint& 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_PointF GetCenterPoint() const; + CFX_FloatPoint 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_PointF& point) const; - bool ClientHitTest(const CFX_PointF& point) const; + bool WndHitTest(const CFX_FloatPoint& point) const; + bool ClientHitTest(const CFX_FloatPoint& 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_PointF ChildToParent(const CFX_PointF& point) const; + virtual CFX_FloatPoint ChildToParent(const CFX_FloatPoint& point) const; virtual CFX_FloatRect ChildToParent(const CFX_FloatRect& rect) const; - virtual CFX_PointF ParentToChild(const CFX_PointF& point) const; + virtual CFX_FloatPoint ParentToChild(const CFX_FloatPoint& 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_PointF& point, int32_t& x, int32_t& y) const; + void PWLtoWnd(const CFX_FloatPoint& 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