diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-13 15:44:23 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-13 22:09:20 +0000 |
commit | 4797c4240cb9e2d8cd36c583d46cd52ff94af95d (patch) | |
tree | 0c7e856a1c82812fcc3fa038e07ff4f22e424130 /fpdfsdk/pdfwindow | |
parent | 58e4c5ac24a88f83d1ba8277dee87baf4cba36a0 (diff) | |
download | pdfium-4797c4240cb9e2d8cd36c583d46cd52ff94af95d.tar.xz |
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 <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Button.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Button.h | 4 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Caret.cpp | 16 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Caret.h | 18 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ComboBox.cpp | 34 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ComboBox.h | 6 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Edit.cpp | 37 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Edit.h | 23 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_EditCtrl.cpp | 40 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_EditCtrl.h | 20 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ListBox.cpp | 14 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ListBox.h | 12 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ScrollBar.cpp | 172 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ScrollBar.h | 28 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_SpecialButton.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_SpecialButton.h | 4 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Utils.cpp | 68 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Utils.h | 22 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Wnd.cpp | 29 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Wnd.h | 32 |
20 files changed, 286 insertions, 302 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_Button.cpp b/fpdfsdk/pdfwindow/PWL_Button.cpp index 972e55edad..96be469454 100644 --- a/fpdfsdk/pdfwindow/PWL_Button.cpp +++ b/fpdfsdk/pdfwindow/PWL_Button.cpp @@ -20,7 +20,7 @@ void CPWL_Button::OnCreate(PWL_CREATEPARAM& cp) { cp.eCursorType = FXCT_HAND; } -bool CPWL_Button::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Button::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); m_bMouseDown = true; @@ -29,7 +29,7 @@ bool CPWL_Button::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_Button::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Button::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); ReleaseCapture(); diff --git a/fpdfsdk/pdfwindow/PWL_Button.h b/fpdfsdk/pdfwindow/PWL_Button.h index f35e9adf36..2d1193f89d 100644 --- a/fpdfsdk/pdfwindow/PWL_Button.h +++ b/fpdfsdk/pdfwindow/PWL_Button.h @@ -17,8 +17,8 @@ class CPWL_Button : public CPWL_Wnd { // CPWL_Wnd CFX_ByteString GetClassName() const override; void OnCreate(PWL_CREATEPARAM& cp) override; - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; protected: bool m_bMouseDown; diff --git a/fpdfsdk/pdfwindow/PWL_Caret.cpp b/fpdfsdk/pdfwindow/PWL_Caret.cpp index 6636170e81..06c8e31ce7 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.cpp +++ b/fpdfsdk/pdfwindow/PWL_Caret.cpp @@ -14,6 +14,8 @@ #define PWL_CARET_FLASHINTERVAL 500 +PWL_CARET_INFO::PWL_CARET_INFO() : bVisible(false) {} + CPWL_Caret::CPWL_Caret() : m_bFlash(false), m_fWidth(0.4f), m_nDelay(0) {} CPWL_Caret::~CPWL_Caret() {} @@ -23,7 +25,7 @@ CFX_ByteString CPWL_Caret::GetClassName() const { } void CPWL_Caret::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { - GetCaretApp(sAppStream, CFX_FloatPoint(0.0f, 0.0f)); + GetCaretApp(sAppStream, CFX_PointF()); } void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, @@ -60,7 +62,7 @@ void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, } void CPWL_Caret::GetCaretApp(CFX_ByteTextBuf& sAppStream, - const CFX_FloatPoint& ptOffset) { + const CFX_PointF& ptOffset) { if (IsVisible() && m_bFlash) { CFX_ByteTextBuf sCaret; @@ -85,7 +87,7 @@ void CPWL_Caret::GetCaretApp(CFX_ByteTextBuf& sAppStream, } CFX_ByteString CPWL_Caret::GetCaretAppearanceStream( - const CFX_FloatPoint& ptOffset) { + const CFX_PointF& ptOffset) { CFX_ByteTextBuf sCaret; GetCaretApp(sCaret, ptOffset); return sCaret.MakeString(); @@ -106,8 +108,8 @@ CFX_FloatRect CPWL_Caret::GetCaretRect() const { } void CPWL_Caret::SetCaret(bool bVisible, - const CFX_FloatPoint& ptHead, - const CFX_FloatPoint& ptFoot) { + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot) { if (bVisible) { if (IsVisible()) { if (m_ptHead != ptHead || m_ptFoot != ptFoot) { @@ -126,8 +128,8 @@ void CPWL_Caret::SetCaret(bool bVisible, Move(m_rcInvalid, false, true); } } else { - m_ptHead = CFX_FloatPoint(); - m_ptFoot = CFX_FloatPoint(); + m_ptHead = CFX_PointF(); + m_ptFoot = CFX_PointF(); m_bFlash = false; if (IsVisible()) { EndTimer(); diff --git a/fpdfsdk/pdfwindow/PWL_Caret.h b/fpdfsdk/pdfwindow/PWL_Caret.h index ccee96109e..60ebbdc8e1 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.h +++ b/fpdfsdk/pdfwindow/PWL_Caret.h @@ -11,11 +11,11 @@ struct PWL_CARET_INFO { public: - PWL_CARET_INFO() : bVisible(false) {} + PWL_CARET_INFO(); bool bVisible; - CFX_FloatPoint ptHead; - CFX_FloatPoint ptFoot; + CFX_PointF ptHead; + CFX_PointF ptFoot; }; class CPWL_Caret : public CPWL_Wnd { @@ -33,18 +33,18 @@ class CPWL_Caret : public CPWL_Wnd { void TimerProc() override; void SetCaret(bool bVisible, - const CFX_FloatPoint& ptHead, - const CFX_FloatPoint& ptFoot); - CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset); + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot); + CFX_ByteString GetCaretAppearanceStream(const CFX_PointF& ptOffset); void SetInvalidRect(CFX_FloatRect rc) { m_rcInvalid = rc; } private: - void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CFX_FloatPoint& ptOffset); + void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CFX_PointF& ptOffset); CFX_FloatRect GetCaretRect() const; bool m_bFlash; - CFX_FloatPoint m_ptHead; - CFX_FloatPoint m_ptFoot; + CFX_PointF m_ptHead; + CFX_PointF m_ptFoot; FX_FLOAT m_fWidth; int32_t m_nDelay; CFX_FloatRect m_rcInvalid; diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp index acee850024..1bf1adfbcf 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp @@ -18,7 +18,7 @@ #define PWLCB_DEFAULTFONTSIZE 12.0f -bool CPWL_CBListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_CBListBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (!m_bMouseDown) @@ -102,14 +102,14 @@ void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (IsVisible() && !rectWnd.IsEmpty()) { CFX_ByteTextBuf sButton; - CFX_FloatPoint ptCenter = GetCenterPoint(); + CFX_PointF ptCenter = GetCenterPoint(); - CFX_FloatPoint pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, - ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, - ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt3(ptCenter.x, - ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, + ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, + ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt3(ptCenter.x, + ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); if (IsFloatBigger(rectWnd.right - rectWnd.left, PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) && @@ -133,14 +133,14 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_FloatRect rectWnd = CPWL_Wnd::GetWindowRect(); if (IsVisible() && !rectWnd.IsEmpty()) { - CFX_FloatPoint ptCenter = GetCenterPoint(); + CFX_PointF ptCenter = GetCenterPoint(); - CFX_FloatPoint pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, - ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, - ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt3(ptCenter.x, - ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, + ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, + ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt3(ptCenter.x, + ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); if (IsFloatBigger(rectWnd.right - rectWnd.left, PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) && @@ -162,7 +162,7 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -bool CPWL_CBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_CBButton::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); SetCapture(); @@ -175,7 +175,7 @@ bool CPWL_CBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_CBButton::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_CBButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); ReleaseCapture(); diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.h b/fpdfsdk/pdfwindow/PWL_ComboBox.h index 84261199e9..e1a8df7561 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.h +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.h @@ -23,7 +23,7 @@ class CPWL_CBListBox : public CPWL_ListBox { ~CPWL_CBListBox() override {} // CPWL_ListBox - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; bool OnKeyDownWithExit(uint16_t nChar, bool& bExit, uint32_t nFlag); bool OnCharWithExit(uint16_t nChar, bool& bExit, uint32_t nFlag); @@ -40,8 +40,8 @@ class CPWL_CBButton : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; }; class CPWL_ComboBox : public CPWL_Wnd { diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index b9958a3128..8b46d22f13 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -243,7 +243,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { sAppStream << sLine; CFX_ByteTextBuf sText; - CFX_FloatPoint ptOffset = CFX_FloatPoint(); + CFX_PointF ptOffset; CPVT_WordRange wrWhole = m_pEdit->GetWholeWordRange(); CPVT_WordRange wrSelect = GetSelectWordRange(); CPVT_WordRange wrVisible = @@ -395,10 +395,10 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, pDevice, pUser2Device, m_pEdit.get(), CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), - rcClip, CFX_FloatPoint(), pRange, pSysHandler, m_pFormFiller); + rcClip, CFX_PointF(), pRange, pSysHandler, m_pFormFiller); } -bool CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Edit::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { @@ -414,7 +414,7 @@ bool CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Edit::OnLButtonDblClk(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDblClk(point, nFlag); if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { @@ -424,7 +424,7 @@ bool CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Edit::OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) { if (m_bMouseDown) return false; @@ -454,7 +454,7 @@ void CPWL_Edit::OnSetFocus() { void CPWL_Edit::OnKillFocus() { ShowVScrollBar(false); m_pEdit->SelectNone(); - SetCaret(false, CFX_FloatPoint(), CFX_FloatPoint()); + SetCaret(false, CFX_PointF(), CFX_PointF()); SetCharSet(FXFONT_ANSI_CHARSET); m_bFocus = false; } @@ -464,7 +464,7 @@ void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace) { } CFX_ByteString CPWL_Edit::GetSelectAppearanceStream( - const CFX_FloatPoint& ptOffset) const { + const CFX_PointF& ptOffset) const { CPVT_WordRange wr = GetSelectWordRange(); return CPWL_Utils::GetEditSelAppStream(m_pEdit.get(), ptOffset, &wr); } @@ -486,7 +486,7 @@ CPVT_WordRange CPWL_Edit::GetSelectWordRange() const { } CFX_ByteString CPWL_Edit::GetTextAppearanceStream( - const CFX_FloatPoint& ptOffset) const { + const CFX_PointF& ptOffset) const { CFX_ByteTextBuf sRet; CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit.get(), ptOffset); if (sEdit.GetLength() > 0) { @@ -497,24 +497,22 @@ CFX_ByteString CPWL_Edit::GetTextAppearanceStream( } CFX_ByteString CPWL_Edit::GetCaretAppearanceStream( - const CFX_FloatPoint& ptOffset) const { + const CFX_PointF& ptOffset) const { if (m_pEditCaret) return m_pEditCaret->GetCaretAppearanceStream(ptOffset); return CFX_ByteString(); } -CFX_FloatPoint CPWL_Edit::GetWordRightBottomPoint( - const CPVT_WordPlace& wpWord) { +CFX_PointF CPWL_Edit::GetWordRightBottomPoint(const CPVT_WordPlace& wpWord) { CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); CPVT_WordPlace wpOld = pIterator->GetAt(); pIterator->SetAt(wpWord); - CFX_FloatPoint pt; + CFX_PointF pt; CPVT_Word word; if (pIterator->GetWord(word)) { - pt = CFX_FloatPoint(word.ptWord.x + word.fWidth, - word.ptWord.y + word.fDescent); + pt = CFX_PointF(word.ptWord.x + word.fWidth, word.ptWord.y + word.fDescent); } pIterator->SetAt(wpOld); return pt; @@ -720,10 +718,10 @@ bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { } bool CPWL_Edit::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, + const CFX_PointF& point, uint32_t nFlag) { if (HasFlag(PES_MULTILINE)) { - CFX_FloatPoint ptScroll = GetScrollPos(); + CFX_PointF ptScroll = GetScrollPos(); if (zDelta > 0) { ptScroll.y += GetFontSize(); @@ -805,8 +803,7 @@ CPVT_WordRange CPWL_Edit::CombineWordRange(const CPVT_WordRange& wr1, return wrRet; } -CPVT_WordRange CPWL_Edit::GetLatinWordsRange( - const CFX_FloatPoint& point) const { +CPVT_WordRange CPWL_Edit::GetLatinWordsRange(const CFX_PointF& point) const { return GetSameWordsRange(m_pEdit->SearchWordPlace(point), true, false); } @@ -876,7 +873,7 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place, } void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, std::vector<CPDF_TextObject*>* ObjArray) { CFX_Edit::GeneratePageObjects( pObjectHolder, m_pEdit.get(), ptOffset, nullptr, @@ -885,7 +882,7 @@ void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, } void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_FloatPoint& ptOffset) { + const CFX_PointF& ptOffset) { std::vector<CPDF_TextObject*> ObjArray; CFX_Edit::GeneratePageObjects( pObjectHolder, m_pEdit.get(), ptOffset, nullptr, diff --git a/fpdfsdk/pdfwindow/PWL_Edit.h b/fpdfsdk/pdfwindow/PWL_Edit.h index 801dedd0ac..5143c97424 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.h +++ b/fpdfsdk/pdfwindow/PWL_Edit.h @@ -60,11 +60,11 @@ class CPWL_Edit : public CPWL_EditCtrl { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonDblClk(const CFX_PointF& point, uint32_t nFlag) override; + bool OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) override; bool OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, + const CFX_PointF& point, uint32_t nFlag) override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; @@ -90,10 +90,9 @@ class CPWL_Edit : public CPWL_EditCtrl { void SetText(const CFX_WideString& csText); void ReplaceSel(const CFX_WideString& csText); - CFX_ByteString GetTextAppearanceStream(const CFX_FloatPoint& ptOffset) const; - CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset) const; - CFX_ByteString GetSelectAppearanceStream( - const CFX_FloatPoint& ptOffset) const; + CFX_ByteString GetTextAppearanceStream(const CFX_PointF& ptOffset) const; + CFX_ByteString GetCaretAppearanceStream(const CFX_PointF& ptOffset) const; + CFX_ByteString GetSelectAppearanceStream(const CFX_PointF& ptOffset) const; bool IsTextFull() const; @@ -106,10 +105,10 @@ class CPWL_Edit : public CPWL_EditCtrl { } void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, std::vector<CPDF_TextObject*>* ObjArray); void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_FloatPoint& ptOffset); + const CFX_PointF& ptOffset); bool IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag); void AttachFFLData(CFFL_FormFiller* pData) { m_pFormFiller = pData; } @@ -131,11 +130,11 @@ class CPWL_Edit : public CPWL_EditCtrl { void SetParamByFlag(); FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray); - CFX_FloatPoint GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); + CFX_PointF GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2); - CPVT_WordRange GetLatinWordsRange(const CFX_FloatPoint& point) const; + CPVT_WordRange GetLatinWordsRange(const CFX_PointF& point) const; CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const; CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace& place) const; CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place, diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp index 90b7a3c7c0..64272e34c5 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp @@ -40,8 +40,8 @@ void CPWL_EditCtrl::OnCreated() { bool CPWL_EditCtrl::IsWndHorV() { CFX_Matrix mt = GetWindowMatrix(); - CFX_FloatPoint point1(0, 1); - CFX_FloatPoint point2(1, 1); + CFX_PointF point1(0, 1); + CFX_PointF point2(1, 1); mt.TransformPoint(point1.x, point1.y); mt.TransformPoint(point2.x, point2.y); @@ -93,8 +93,7 @@ void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd, FX_FLOAT fPos = *(FX_FLOAT*)lParam; switch (wParam) { case SBT_VSCROLL: - m_pEdit->SetScrollPos( - CFX_FloatPoint(m_pEdit->GetScrollPos().x, fPos)); + m_pEdit->SetScrollPos(CFX_PointF(m_pEdit->GetScrollPos().x, fPos)); break; } } break; @@ -281,7 +280,7 @@ bool CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { return true; } -bool CPWL_EditCtrl::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_EditCtrl::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (ClientHitTest(point)) { @@ -297,7 +296,7 @@ bool CPWL_EditCtrl::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_EditCtrl::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_EditCtrl::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (m_bMouseDown) { @@ -312,7 +311,7 @@ bool CPWL_EditCtrl::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_EditCtrl::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_EditCtrl::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (m_bMouseDown) @@ -326,8 +325,8 @@ CFX_FloatRect CPWL_EditCtrl::GetContentRect() const { } void CPWL_EditCtrl::SetEditCaret(bool bVisible) { - CFX_FloatPoint ptHead; - CFX_FloatPoint ptFoot; + CFX_PointF ptHead; + CFX_PointF ptFoot; if (bVisible) GetCaretInfo(ptHead, ptFoot); @@ -335,8 +334,7 @@ void CPWL_EditCtrl::SetEditCaret(bool bVisible) { IOnSetCaret(bVisible, ptHead, ptFoot, wpTemp); } -void CPWL_EditCtrl::GetCaretInfo(CFX_FloatPoint& ptHead, - CFX_FloatPoint& ptFoot) const { +void CPWL_EditCtrl::GetCaretInfo(CFX_PointF& ptHead, CFX_PointF& ptFoot) const { CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); pIterator->SetAt(m_pEdit->GetCaret()); CPVT_Word word; @@ -355,15 +353,15 @@ void CPWL_EditCtrl::GetCaretInfo(CFX_FloatPoint& ptHead, } void CPWL_EditCtrl::GetCaretPos(int32_t& x, int32_t& y) const { - CFX_FloatPoint ptHead; - CFX_FloatPoint ptFoot; + CFX_PointF ptHead; + CFX_PointF ptFoot; GetCaretInfo(ptHead, ptFoot); PWLtoWnd(ptHead, x, y); } void CPWL_EditCtrl::SetCaret(bool bVisible, - const CFX_FloatPoint& ptHead, - const CFX_FloatPoint& ptFoot) { + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot) { if (m_pEditCaret) { if (!IsFocused() || m_pEdit->IsSelected()) bVisible = false; @@ -413,11 +411,11 @@ int32_t CPWL_EditCtrl::GetTotalWords() const { return m_pEdit->GetTotalWords(); } -void CPWL_EditCtrl::SetScrollPos(const CFX_FloatPoint& point) { +void CPWL_EditCtrl::SetScrollPos(const CFX_PointF& point) { m_pEdit->SetScrollPos(point); } -CFX_FloatPoint CPWL_EditCtrl::GetScrollPos() const { +CFX_PointF CPWL_EditCtrl::GetScrollPos() const { return m_pEdit->GetScrollPos(); } @@ -544,8 +542,8 @@ void CPWL_EditCtrl::IOnSetScrollPosY(FX_FLOAT fy) { } void CPWL_EditCtrl::IOnSetCaret(bool bVisible, - const CFX_FloatPoint& ptHead, - const CFX_FloatPoint& ptFoot, + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot, const CPVT_WordPlace& place) { PWL_CARET_INFO cInfo; cInfo.bVisible = bVisible; @@ -572,9 +570,9 @@ void CPWL_EditCtrl::GetTextRange(const CFX_FloatRect& rect, int32_t& nStartChar, int32_t& nEndChar) const { nStartChar = m_pEdit->WordPlaceToWordIndex( - m_pEdit->SearchWordPlace(CFX_FloatPoint(rect.left, rect.top))); + m_pEdit->SearchWordPlace(CFX_PointF(rect.left, rect.top))); nEndChar = m_pEdit->WordPlaceToWordIndex( - m_pEdit->SearchWordPlace(CFX_FloatPoint(rect.right, rect.bottom))); + m_pEdit->SearchWordPlace(CFX_PointF(rect.right, rect.bottom))); } CFX_WideString CPWL_EditCtrl::GetText(int32_t& nStartChar, diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/pdfwindow/PWL_EditCtrl.h index 3ff5cc66c9..8b65d4a7b5 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.h +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.h @@ -53,8 +53,8 @@ class CPWL_EditCtrl : public CPWL_Wnd { void Paint(); void EnableRefresh(bool bRefresh); - CFX_FloatPoint GetScrollPos() const; - void SetScrollPos(const CFX_FloatPoint& point); + CFX_PointF GetScrollPos() const; + void SetScrollPos(const CFX_PointF& point); void SetCharSet(uint8_t nCharSet) { m_nCharSet = nCharSet; } int32_t GetCharSet() const; @@ -77,9 +77,9 @@ class CPWL_EditCtrl : public CPWL_Wnd { void OnCreated() override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag) override; void OnNotify(CPWL_Wnd* pWnd, uint32_t msg, intptr_t wParam = 0, @@ -98,8 +98,8 @@ class CPWL_EditCtrl : public CPWL_Wnd { FX_FLOAT fBigStep); void IOnSetScrollPosY(FX_FLOAT fy); void IOnSetCaret(bool bVisible, - const CFX_FloatPoint& ptHead, - const CFX_FloatPoint& ptFoot, + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot, const CPVT_WordPlace& place); void IOnCaretChange(const CPVT_SecProps& secProps, const CPVT_WordProps& wordProps); @@ -121,10 +121,10 @@ class CPWL_EditCtrl : public CPWL_Wnd { void Delete(); void Backspace(); - void GetCaretInfo(CFX_FloatPoint& ptHead, CFX_FloatPoint& ptFoot) const; + void GetCaretInfo(CFX_PointF& ptHead, CFX_PointF& ptFoot) const; void SetCaret(bool bVisible, - const CFX_FloatPoint& ptHead, - const CFX_FloatPoint& ptFoot); + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot); void SetEditCaret(bool bVisible); diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp index 12cad7b9da..3f5dfef142 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp @@ -106,7 +106,7 @@ void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom) continue; - CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); + CFX_PointF ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); if (m_pList->IsItemSelected(i)) { sListItems << CPWL_Utils::GetRectFillAppStream(rcItem, PWL_DEFAULT_SELBACKCOLOR) @@ -158,7 +158,7 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom) continue; - CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); + CFX_PointF ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); if (CFX_Edit* pEdit = m_pList->GetItemEdit(i)) { CFX_FloatRect rcContent = pEdit->GetContentRect(); if (rcContent.Width() > rcClient.Width()) @@ -249,7 +249,7 @@ bool CPWL_ListBox::OnChar(uint16_t nChar, uint32_t nFlag) { return true; } -bool CPWL_ListBox::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_ListBox::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (ClientHitTest(point)) { @@ -263,7 +263,7 @@ bool CPWL_ListBox::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_ListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_ListBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (m_bMouseDown) { @@ -281,7 +281,7 @@ void CPWL_ListBox::SetHoverSel(bool bHoverSel) { m_bHoverSel = bHoverSel; } -bool CPWL_ListBox::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_ListBox::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (m_bHoverSel && !IsCaptureMouse() && ClientHitTest(point)) @@ -323,7 +323,7 @@ void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, fPos = *(FX_FLOAT*)lParam; switch (wParam) { case SBT_VSCROLL: - m_pList->SetScrollPos(CFX_FloatPoint(0, fPos)); + m_pList->SetScrollPos(CFX_PointF(0, fPos)); break; } break; @@ -449,7 +449,7 @@ CFX_FloatRect CPWL_ListBox::GetListRect() const { } bool CPWL_ListBox::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, + const CFX_PointF& point, uint32_t nFlag) { if (zDelta < 0) m_pList->OnVK_DOWN(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.h b/fpdfsdk/pdfwindow/PWL_ListBox.h index 6db4ecb381..f9108a17de 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.h +++ b/fpdfsdk/pdfwindow/PWL_ListBox.h @@ -35,8 +35,8 @@ class CPWL_List_Notify { void IOnInvalidateRect(CFX_FloatRect* pRect); void IOnSetCaret(bool bVisible, - const CFX_FloatPoint& ptHead, - const CFX_FloatPoint& ptFoot, + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot, const CPVT_WordPlace& place); private: @@ -57,11 +57,11 @@ class CPWL_ListBox : public CPWL_Wnd { CFX_Matrix* pUser2Device) override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag) override; bool OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, + const CFX_PointF& point, uint32_t nFlag) override; void KillFocus() override; void OnNotify(CPWL_Wnd* pWnd, diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp index c7e6bbfa99..2aa2c7e35f 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp @@ -137,18 +137,17 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { sAppStream << "q\n"; - CFX_FloatPoint ptCenter = GetCenterPoint(); + CFX_PointF ptCenter = GetCenterPoint(); switch (m_eScrollBarType) { case SBT_HSCROLL: switch (m_eSBButtonType) { case PSBT_MIN: { - CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y); - CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y + PWL_TRIANGLE_HALFLEN); - CFX_FloatPoint pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y - PWL_TRIANGLE_HALFLEN); + CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); + CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y + PWL_TRIANGLE_HALFLEN); + CFX_PointF pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y - PWL_TRIANGLE_HALFLEN); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -162,12 +161,11 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { } } break; case PSBT_MAX: { - CFX_FloatPoint pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y); - CFX_FloatPoint pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y + PWL_TRIANGLE_HALFLEN); - CFX_FloatPoint pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y - PWL_TRIANGLE_HALFLEN); + CFX_PointF pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); + CFX_PointF pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y + PWL_TRIANGLE_HALFLEN); + CFX_PointF pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y - PWL_TRIANGLE_HALFLEN); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -187,12 +185,11 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { case SBT_VSCROLL: switch (m_eSBButtonType) { case PSBT_MIN: { - CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN, - ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN, - ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt3(ptCenter.x, - ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN, + ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN, + ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt3(ptCenter.x, ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -206,12 +203,11 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { } } break; case PSBT_MAX: { - CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN, - ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN, - ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); - CFX_FloatPoint pt3(ptCenter.x, - ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN, + ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN, + ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_PointF pt3(ptCenter.x, ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -244,7 +240,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, if (rectWnd.IsEmpty()) return; - CFX_FloatPoint ptCenter = GetCenterPoint(); + CFX_PointF ptCenter = GetCenterPoint(); int32_t nTransparancy = GetTransparency(); switch (m_eScrollBarType) { @@ -252,12 +248,11 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); switch (m_eSBButtonType) { case PSBT_MIN: { - CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y); - CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y + PWL_TRIANGLE_HALFLEN); - CFX_FloatPoint pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y - PWL_TRIANGLE_HALFLEN); + CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); + CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y + PWL_TRIANGLE_HALFLEN); + CFX_PointF pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y - PWL_TRIANGLE_HALFLEN); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -276,12 +271,11 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } break; case PSBT_MAX: { - CFX_FloatPoint pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y); - CFX_FloatPoint pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y + PWL_TRIANGLE_HALFLEN); - CFX_FloatPoint pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y - PWL_TRIANGLE_HALFLEN); + CFX_PointF pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); + CFX_PointF pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y + PWL_TRIANGLE_HALFLEN); + CFX_PointF pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y - PWL_TRIANGLE_HALFLEN); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -334,13 +328,13 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, if (rectWnd.top - rectWnd.bottom > 6.0f) { FX_FLOAT fX = rectWnd.left + 1.5f; FX_FLOAT fY = rectWnd.bottom; - CFX_FloatPoint pts[7] = {CFX_FloatPoint(fX + 2.5f, fY + 4.0f), - CFX_FloatPoint(fX + 2.5f, fY + 3.0f), - CFX_FloatPoint(fX + 4.5f, fY + 5.0f), - CFX_FloatPoint(fX + 6.5f, fY + 3.0f), - CFX_FloatPoint(fX + 6.5f, fY + 4.0f), - CFX_FloatPoint(fX + 4.5f, fY + 6.0f), - CFX_FloatPoint(fX + 2.5f, fY + 4.0f)}; + CFX_PointF pts[7] = {CFX_PointF(fX + 2.5f, fY + 4.0f), + CFX_PointF(fX + 2.5f, fY + 3.0f), + CFX_PointF(fX + 4.5f, fY + 5.0f), + CFX_PointF(fX + 6.5f, fY + 3.0f), + CFX_PointF(fX + 6.5f, fY + 4.0f), + CFX_PointF(fX + 4.5f, fY + 6.0f), + CFX_PointF(fX + 2.5f, fY + 4.0f)}; if (IsEnabled()) CPWL_Utils::DrawFillArea( @@ -380,13 +374,13 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, FX_FLOAT fX = rectWnd.left + 1.5f; FX_FLOAT fY = rectWnd.bottom; - CFX_FloatPoint pts[7] = {CFX_FloatPoint(fX + 2.5f, fY + 5.0f), - CFX_FloatPoint(fX + 2.5f, fY + 6.0f), - CFX_FloatPoint(fX + 4.5f, fY + 4.0f), - CFX_FloatPoint(fX + 6.5f, fY + 6.0f), - CFX_FloatPoint(fX + 6.5f, fY + 5.0f), - CFX_FloatPoint(fX + 4.5f, fY + 3.0f), - CFX_FloatPoint(fX + 2.5f, fY + 5.0f)}; + CFX_PointF pts[7] = {CFX_PointF(fX + 2.5f, fY + 5.0f), + CFX_PointF(fX + 2.5f, fY + 6.0f), + CFX_PointF(fX + 4.5f, fY + 4.0f), + CFX_PointF(fX + 6.5f, fY + 6.0f), + CFX_PointF(fX + 6.5f, fY + 5.0f), + CFX_PointF(fX + 4.5f, fY + 3.0f), + CFX_PointF(fX + 2.5f, fY + 5.0f)}; if (IsEnabled()) CPWL_Utils::DrawFillArea( @@ -414,10 +408,9 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, if (IsEnabled()) { // draw shadow effect - CFX_FloatPoint ptTop = - CFX_FloatPoint(rectWnd.left, rectWnd.top - 1.0f); - CFX_FloatPoint ptBottom = - CFX_FloatPoint(rectWnd.left, rectWnd.bottom + 1.0f); + CFX_PointF ptTop = CFX_PointF(rectWnd.left, rectWnd.top - 1.0f); + CFX_PointF ptBottom = + CFX_PointF(rectWnd.left, rectWnd.bottom + 1.0f); ptTop.x += 1.5f; ptBottom.x += 1.5f; @@ -504,12 +497,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, FX_FLOAT nFrictionWidth = 5.0f; FX_FLOAT nFrictionHeight = 5.5f; - CFX_FloatPoint ptLeft = - CFX_FloatPoint(ptCenter.x - nFrictionWidth / 2.0f, - ptCenter.y - nFrictionHeight / 2.0f + 0.5f); - CFX_FloatPoint ptRight = - CFX_FloatPoint(ptCenter.x + nFrictionWidth / 2.0f, - ptCenter.y - nFrictionHeight / 2.0f + 0.5f); + CFX_PointF ptLeft = + CFX_PointF(ptCenter.x - nFrictionWidth / 2.0f, + ptCenter.y - nFrictionHeight / 2.0f + 0.5f); + CFX_PointF ptRight = + CFX_PointF(ptCenter.x + nFrictionWidth / 2.0f, + ptCenter.y - nFrictionHeight / 2.0f + 0.5f); CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, crStroke, 1.0f); @@ -536,7 +529,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -bool CPWL_SBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_SBButton::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) @@ -548,7 +541,7 @@ bool CPWL_SBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_SBButton::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_SBButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) @@ -560,7 +553,7 @@ bool CPWL_SBButton::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { return true; } -bool CPWL_SBButton::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_SBButton::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) { @@ -683,20 +676,19 @@ void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice, CPWL_Utils::DrawStrokeLine( pDevice, pUser2Device, - CFX_FloatPoint(rectWnd.left + 2.0f, rectWnd.top - 2.0f), - CFX_FloatPoint(rectWnd.left + 2.0f, rectWnd.bottom + 2.0f), + CFX_PointF(rectWnd.left + 2.0f, rectWnd.top - 2.0f), + CFX_PointF(rectWnd.left + 2.0f, rectWnd.bottom + 2.0f), ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f); CPWL_Utils::DrawStrokeLine( pDevice, pUser2Device, - CFX_FloatPoint(rectWnd.right - 2.0f, rectWnd.top - 2.0f), - CFX_FloatPoint(rectWnd.right - 2.0f, rectWnd.bottom + 2.0f), + CFX_PointF(rectWnd.right - 2.0f, rectWnd.top - 2.0f), + CFX_PointF(rectWnd.right - 2.0f, rectWnd.bottom + 2.0f), ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f); } } -bool CPWL_ScrollBar::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_ScrollBar::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (HasFlag(PWS_AUTOTRANSPARENT)) { @@ -751,7 +743,7 @@ bool CPWL_ScrollBar::OnLButtonDown(const CFX_FloatPoint& point, return true; } -bool CPWL_ScrollBar::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_ScrollBar::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (HasFlag(PWS_AUTOTRANSPARENT)) { @@ -776,41 +768,41 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, switch (msg) { case PNM_LBUTTONDOWN: if (pWnd == m_pMinButton) { - OnMinButtonLBDown(*(CFX_FloatPoint*)lParam); + OnMinButtonLBDown(*(CFX_PointF*)lParam); } if (pWnd == m_pMaxButton) { - OnMaxButtonLBDown(*(CFX_FloatPoint*)lParam); + OnMaxButtonLBDown(*(CFX_PointF*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonLBDown(*(CFX_FloatPoint*)lParam); + OnPosButtonLBDown(*(CFX_PointF*)lParam); } break; case PNM_LBUTTONUP: if (pWnd == m_pMinButton) { - OnMinButtonLBUp(*(CFX_FloatPoint*)lParam); + OnMinButtonLBUp(*(CFX_PointF*)lParam); } if (pWnd == m_pMaxButton) { - OnMaxButtonLBUp(*(CFX_FloatPoint*)lParam); + OnMaxButtonLBUp(*(CFX_PointF*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonLBUp(*(CFX_FloatPoint*)lParam); + OnPosButtonLBUp(*(CFX_PointF*)lParam); } break; case PNM_MOUSEMOVE: if (pWnd == m_pMinButton) { - OnMinButtonMouseMove(*(CFX_FloatPoint*)lParam); + OnMinButtonMouseMove(*(CFX_PointF*)lParam); } if (pWnd == m_pMaxButton) { - OnMaxButtonMouseMove(*(CFX_FloatPoint*)lParam); + OnMaxButtonMouseMove(*(CFX_PointF*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonMouseMove(*(CFX_FloatPoint*)lParam); + OnPosButtonMouseMove(*(CFX_PointF*)lParam); } break; case PNM_SETSCROLLINFO: { @@ -954,7 +946,7 @@ void CPWL_ScrollBar::MovePosButton(bool bRefresh) { } } -void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_FloatPoint& point) { +void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_PointF& point) { m_sData.SubSmall(); MovePosButton(true); NotifyScrollWindow(); @@ -965,11 +957,11 @@ void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_FloatPoint& point) { BeginTimer(100); } -void CPWL_ScrollBar::OnMinButtonLBUp(const CFX_FloatPoint& point) {} +void CPWL_ScrollBar::OnMinButtonLBUp(const CFX_PointF& point) {} -void CPWL_ScrollBar::OnMinButtonMouseMove(const CFX_FloatPoint& point) {} +void CPWL_ScrollBar::OnMinButtonMouseMove(const CFX_PointF& point) {} -void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_FloatPoint& point) { +void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_PointF& point) { m_sData.AddSmall(); MovePosButton(true); NotifyScrollWindow(); @@ -980,11 +972,11 @@ void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_FloatPoint& point) { BeginTimer(100); } -void CPWL_ScrollBar::OnMaxButtonLBUp(const CFX_FloatPoint& point) {} +void CPWL_ScrollBar::OnMaxButtonLBUp(const CFX_PointF& point) {} -void CPWL_ScrollBar::OnMaxButtonMouseMove(const CFX_FloatPoint& point) {} +void CPWL_ScrollBar::OnMaxButtonMouseMove(const CFX_PointF& point) {} -void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_FloatPoint& point) { +void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_PointF& point) { m_bMouseDown = true; if (m_pPosButton) { @@ -1003,7 +995,7 @@ void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_FloatPoint& point) { } } -void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_FloatPoint& point) { +void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_PointF& point) { if (m_bMouseDown) { if (!m_bNotifyForever) NotifyScrollWindow(); @@ -1011,7 +1003,7 @@ void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_FloatPoint& point) { m_bMouseDown = false; } -void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_FloatPoint& point) { +void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_PointF& point) { FX_FLOAT fOldScrollPos = m_sData.fScrollPos; FX_FLOAT fNewPos = 0; diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/pdfwindow/PWL_ScrollBar.h index bcfb0a6873..9546a9e577 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.h +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.h @@ -53,9 +53,9 @@ class CPWL_SBButton : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag) override; protected: PWL_SCROLLBAR_TYPE m_eScrollBarType; @@ -127,8 +127,8 @@ class CPWL_ScrollBar : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; void OnNotify(CPWL_Wnd* pWnd, uint32_t msg, intptr_t wParam = 0, @@ -152,17 +152,17 @@ class CPWL_ScrollBar : public CPWL_Wnd { private: void CreateButtons(const PWL_CREATEPARAM& cp); - void OnMinButtonLBDown(const CFX_FloatPoint& point); - void OnMinButtonLBUp(const CFX_FloatPoint& point); - void OnMinButtonMouseMove(const CFX_FloatPoint& point); + void OnMinButtonLBDown(const CFX_PointF& point); + void OnMinButtonLBUp(const CFX_PointF& point); + void OnMinButtonMouseMove(const CFX_PointF& point); - void OnMaxButtonLBDown(const CFX_FloatPoint& point); - void OnMaxButtonLBUp(const CFX_FloatPoint& point); - void OnMaxButtonMouseMove(const CFX_FloatPoint& point); + void OnMaxButtonLBDown(const CFX_PointF& point); + void OnMaxButtonLBUp(const CFX_PointF& point); + void OnMaxButtonMouseMove(const CFX_PointF& point); - void OnPosButtonLBDown(const CFX_FloatPoint& point); - void OnPosButtonLBUp(const CFX_FloatPoint& point); - void OnPosButtonMouseMove(const CFX_FloatPoint& point); + void OnPosButtonLBDown(const CFX_PointF& point); + void OnPosButtonLBUp(const CFX_PointF& point); + void OnPosButtonMouseMove(const CFX_PointF& point); FX_FLOAT TrueToFace(FX_FLOAT); FX_FLOAT FaceToTrue(FX_FLOAT); diff --git a/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp b/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp index defb992c57..1c46c375a9 100644 --- a/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp +++ b/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp @@ -37,7 +37,7 @@ bool CPWL_CheckBox::IsChecked() const { return m_bChecked; } -bool CPWL_CheckBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_CheckBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { if (IsReadOnly()) return false; @@ -58,8 +58,7 @@ CFX_ByteString CPWL_RadioButton::GetClassName() const { return "CPWL_RadioButton"; } -bool CPWL_RadioButton::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_RadioButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { if (IsReadOnly()) return false; diff --git a/fpdfsdk/pdfwindow/PWL_SpecialButton.h b/fpdfsdk/pdfwindow/PWL_SpecialButton.h index 0aa6c4510b..93f611b744 100644 --- a/fpdfsdk/pdfwindow/PWL_SpecialButton.h +++ b/fpdfsdk/pdfwindow/PWL_SpecialButton.h @@ -26,7 +26,7 @@ class CPWL_CheckBox : public CPWL_Button { // CPWL_Button CFX_ByteString GetClassName() const override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; void SetCheck(bool bCheck); @@ -43,7 +43,7 @@ class CPWL_RadioButton : public CPWL_Button { // CPWL_Button CFX_ByteString GetClassName() const override; - bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; void SetCheck(bool bCheck); diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp index f3caf12af9..d4e31bcf73 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp @@ -105,10 +105,10 @@ bool CPWL_Utils::IntersectRect(const CFX_FloatRect& rect1, return left < right && bottom < top; } -CFX_FloatPoint CPWL_Utils::OffsetPoint(const CFX_FloatPoint& point, - FX_FLOAT x, - FX_FLOAT y) { - return CFX_FloatPoint(point.x + x, point.y + y); +CFX_PointF CPWL_Utils::OffsetPoint(const CFX_PointF& point, + FX_FLOAT x, + FX_FLOAT y) { + return CFX_PointF(point.x + x, point.y + y); } CPVT_WordRange CPWL_Utils::OverlapWordRange(const CPVT_WordRange& wr1, @@ -192,10 +192,10 @@ CFX_ByteString CPWL_Utils::GetAP_Circle(const CFX_FloatRect& crBBox) { FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CFX_FloatPoint pt1(crBBox.left, crBBox.bottom + fHeight / 2); - CFX_FloatPoint pt2(crBBox.left + fWidth / 2, crBBox.top); - CFX_FloatPoint pt3(crBBox.right, crBBox.bottom + fHeight / 2); - CFX_FloatPoint pt4(crBBox.left + fWidth / 2, crBBox.bottom); + CFX_PointF pt1(crBBox.left, crBBox.bottom + fHeight / 2); + CFX_PointF pt2(crBBox.left + fWidth / 2, crBBox.top); + CFX_PointF pt3(crBBox.right, crBBox.bottom + fHeight / 2); + CFX_PointF pt4(crBBox.left + fWidth / 2, crBBox.bottom); csAP << pt1.x << " " << pt1.y << " m\n"; @@ -245,10 +245,10 @@ CFX_ByteString CPWL_Utils::GetAP_Diamond(const CFX_FloatRect& crBBox) { FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CFX_FloatPoint pt1(crBBox.left, crBBox.bottom + fHeight / 2); - CFX_FloatPoint pt2(crBBox.left + fWidth / 2, crBBox.top); - CFX_FloatPoint pt3(crBBox.right, crBBox.bottom + fHeight / 2); - CFX_FloatPoint pt4(crBBox.left + fWidth / 2, crBBox.bottom); + CFX_PointF pt1(crBBox.left, crBBox.bottom + fHeight / 2); + CFX_PointF pt2(crBBox.left + fWidth / 2, crBBox.top); + CFX_PointF pt3(crBBox.right, crBBox.bottom + fHeight / 2); + CFX_PointF pt4(crBBox.left + fWidth / 2, crBBox.bottom); csAP << pt1.x << " " << pt1.y << " m\n"; csAP << pt2.x << " " << pt2.y << " l\n"; @@ -276,8 +276,8 @@ CFX_ByteString CPWL_Utils::GetAP_Star(const CFX_FloatRect& crBBox) { FX_FLOAT fRadius = (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f)); - CFX_FloatPoint ptCenter = CFX_FloatPoint((crBBox.left + crBBox.right) / 2.0f, - (crBBox.top + crBBox.bottom) / 2.0f); + CFX_PointF ptCenter = CFX_PointF((crBBox.left + crBBox.right) / 2.0f, + (crBBox.top + crBBox.bottom) / 2.0f); FX_FLOAT px[5], py[5]; @@ -310,9 +310,9 @@ CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CFX_FloatRect& crBBox, FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CFX_FloatPoint pt1(-fWidth / 2, 0); - CFX_FloatPoint pt2(0, fHeight / 2); - CFX_FloatPoint pt3(fWidth / 2, 0); + CFX_PointF pt1(-fWidth / 2, 0); + CFX_PointF pt2(0, fHeight / 2); + CFX_PointF pt3(fWidth / 2, 0); FX_FLOAT px, py; @@ -365,8 +365,8 @@ CFX_FloatRect CPWL_Utils::ScaleRect(const CFX_FloatRect& rcRect, FX_FLOAT fHalfWidth = (rcRect.right - rcRect.left) / 2.0f; FX_FLOAT fHalfHeight = (rcRect.top - rcRect.bottom) / 2.0f; - CFX_FloatPoint ptCenter = CFX_FloatPoint((rcRect.left + rcRect.right) / 2, - (rcRect.top + rcRect.bottom) / 2); + CFX_PointF ptCenter = CFX_PointF((rcRect.left + rcRect.right) / 2, + (rcRect.top + rcRect.bottom) / 2); return CFX_FloatRect( ptCenter.x - fHalfWidth * fScale, ptCenter.y - fHalfHeight * fScale, @@ -411,7 +411,7 @@ CFX_FloatRect CPWL_Utils::GetCenterSquare(const CFX_FloatRect& rect) { } CFX_ByteString CPWL_Utils::GetEditAppStream(CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, bool bContinuous, uint16_t SubWord) { @@ -420,7 +420,7 @@ CFX_ByteString CPWL_Utils::GetEditAppStream(CFX_Edit* pEdit, } CFX_ByteString CPWL_Utils::GetEditSelAppStream(CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange) { return CFX_Edit::GetSelectAppearanceStream(pEdit, ptOffset, pRange); } @@ -452,7 +452,7 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox, pEdit->SetText(sText); CFX_ByteString sEdit = - CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f)); + CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, 0.0f)); if (sEdit.GetLength() > 0) sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n"; @@ -664,7 +664,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, if (!rcLabel.IsEmpty()) { pEdit->SetPlateRect(rcLabel); CFX_ByteString sEdit = - CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f)); + CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, 0.0f)); if (sEdit.GetLength() > 0) { sTemp << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n"; @@ -1089,8 +1089,8 @@ CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CFX_FloatRect& rcBBox) { CPWL_Dash(3, 0, 0)) << "Q\n"; - CFX_FloatPoint ptCenter = CFX_FloatPoint((rcBBox.left + rcBBox.right) / 2, - (rcBBox.top + rcBBox.bottom) / 2); + CFX_PointF ptCenter = CFX_PointF((rcBBox.left + rcBBox.right) / 2, + (rcBBox.top + rcBBox.bottom) / 2); if (IsFloatBigger(rcBBox.right - rcBBox.left, 6) && IsFloatBigger(rcBBox.top - rcBBox.bottom, 6)) { sAppStream << "q\n" @@ -1230,7 +1230,7 @@ void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, void CPWL_Utils::DrawFillArea(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - const CFX_FloatPoint* pPts, + const CFX_PointF* pPts, int32_t nCount, const FX_COLORREF& color) { CFX_PathData path; @@ -1260,8 +1260,8 @@ void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice, void CPWL_Utils::DrawStrokeLine(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - const CFX_FloatPoint& ptMoveTo, - const CFX_FloatPoint& ptLineTo, + const CFX_PointF& ptMoveTo, + const CFX_PointF& ptLineTo, const FX_COLORREF& color, FX_FLOAT fWidth) { CFX_PathData path; @@ -1300,8 +1300,8 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, for (FX_FLOAT fy = rect.bottom + 0.5f; fy <= rect.top - 0.5f; fy += 1.0f) { int32_t nGray = nStartGray + (int32_t)(fStepGray * (fy - rect.bottom)); CPWL_Utils::DrawStrokeLine( - pDevice, pUser2Device, CFX_FloatPoint(rect.left, fy), - CFX_FloatPoint(rect.right, fy), + pDevice, pUser2Device, CFX_PointF(rect.left, fy), + CFX_PointF(rect.right, fy), ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f); } } @@ -1312,8 +1312,8 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, for (FX_FLOAT fx = rect.left + 0.5f; fx <= rect.right - 0.5f; fx += 1.0f) { int32_t nGray = nStartGray + (int32_t)(fStepGray * (fx - rect.left)); CPWL_Utils::DrawStrokeLine( - pDevice, pUser2Device, CFX_FloatPoint(fx, rect.bottom), - CFX_FloatPoint(fx, rect.top), + pDevice, pUser2Device, CFX_PointF(fx, rect.bottom), + CFX_PointF(fx, rect.top), ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f); } } @@ -2737,8 +2737,8 @@ void CPWL_Utils::GetGraphics_Star(CFX_ByteString& sPathData, (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f)); fLongRadius = fLongRadius * 0.7f; FX_FLOAT fShortRadius = fLongRadius * 0.55f; - CFX_FloatPoint ptCenter = CFX_FloatPoint((crBBox.left + crBBox.right) / 2.0f, - (crBBox.top + crBBox.bottom) / 2.0f); + CFX_PointF ptCenter = CFX_PointF((crBBox.left + crBBox.right) / 2.0f, + (crBBox.top + crBBox.bottom) / 2.0f); FX_FLOAT px1[5], py1[5]; FX_FLOAT px2[5], py2[5]; diff --git a/fpdfsdk/pdfwindow/PWL_Utils.h b/fpdfsdk/pdfwindow/PWL_Utils.h index f14c3c7963..f6b51d7098 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.h +++ b/fpdfsdk/pdfwindow/PWL_Utils.h @@ -74,11 +74,11 @@ T PWL_MAX(const T& i, const T& j) { #define PPBL_LABELLEFTICONRIGHT 5 #define PPBL_LABELOVERICON 6 -class CPWL_Point : public CFX_FloatPoint { +class CPWL_Point : public CFX_PointF { public: CPWL_Point() {} - CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CFX_FloatPoint(fx, fy) {} - CPWL_Point(const CPWL_Point& point) : CFX_FloatPoint(point.x, point.y) {} + CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CFX_PointF(fx, fy) {} + CPWL_Point(const CPWL_Point& point) : CFX_PointF(point.x, point.y) {} }; enum PWL_PATHDATA_TYPE { @@ -121,9 +121,9 @@ class CPWL_Utils { static CFX_FloatRect OffsetRect(const CFX_FloatRect& rect, FX_FLOAT x, FX_FLOAT y); - static CFX_FloatPoint OffsetPoint(const CFX_FloatPoint& point, - FX_FLOAT x, - FX_FLOAT y); + static CFX_PointF OffsetPoint(const CFX_PointF& point, + FX_FLOAT x, + FX_FLOAT y); static FX_COLORREF PWLColorToFXColor(const CPWL_Color& color, int32_t nTransparancy = 255); static bool IsBlackOrWhite(const CPWL_Color& color); @@ -167,13 +167,13 @@ class CPWL_Utils { const CPWL_Color& crText); static CFX_ByteString GetEditAppStream(CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange = nullptr, bool bContinuous = true, uint16_t SubWord = 0); static CFX_ByteString GetEditSelAppStream( CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange = nullptr); static CFX_ByteString GetTextAppStream(const CFX_FloatRect& rcBBox, IPVT_FontMap* pFontMap, @@ -202,8 +202,8 @@ class CPWL_Utils { FX_FLOAT fWidth); static void DrawStrokeLine(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - const CFX_FloatPoint& ptMoveTo, - const CFX_FloatPoint& ptLineTo, + const CFX_PointF& ptMoveTo, + const CFX_PointF& ptLineTo, const FX_COLORREF& color, FX_FLOAT fWidth); static void DrawBorder(CFX_RenderDevice* pDevice, @@ -217,7 +217,7 @@ class CPWL_Utils { int32_t nTransparancy); static void DrawFillArea(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - const CFX_FloatPoint* pPts, + const CFX_PointF* pPts, int32_t nCount, const FX_COLORREF& color); static void DrawShadow(CFX_RenderDevice* pDevice, diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp index 1170660f1c..cf573220b7 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp @@ -426,8 +426,7 @@ PWL_IMPLEMENT_KEY_METHOD(OnChar) #undef PWL_IMPLEMENT_KEY_METHOD #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \ - bool CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \ - uint32_t nFlag) { \ + bool CPWL_Wnd::mouse_method_name(const CFX_PointF& point, uint32_t nFlag) { \ if (!IsValid() || !IsVisible() || !IsEnabled()) \ return false; \ if (IsWndCaptureMouse(this)) { \ @@ -462,7 +461,7 @@ PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) #undef PWL_IMPLEMENT_MOUSE_METHOD bool CPWL_Wnd::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, + const CFX_PointF& point, uint32_t nFlag) { if (!IsValid() || !IsVisible() || !IsEnabled()) return false; @@ -534,10 +533,10 @@ CFX_FloatRect CPWL_Wnd::GetClientRect() const { return rcWindow.Contains(rcClient) ? rcClient : CFX_FloatRect(); } -CFX_FloatPoint CPWL_Wnd::GetCenterPoint() const { +CFX_PointF CPWL_Wnd::GetCenterPoint() const { CFX_FloatRect rcClient = GetClientRect(); - return CFX_FloatPoint((rcClient.left + rcClient.right) * 0.5f, - (rcClient.top + rcClient.bottom) * 0.5f); + return CFX_PointF((rcClient.left + rcClient.right) * 0.5f, + (rcClient.top + rcClient.bottom) * 0.5f); } bool CPWL_Wnd::HasFlag(uint32_t dwFlags) const { @@ -673,11 +672,11 @@ void CPWL_Wnd::OnSetFocus() {} void CPWL_Wnd::OnKillFocus() {} -bool CPWL_Wnd::WndHitTest(const CFX_FloatPoint& point) const { +bool CPWL_Wnd::WndHitTest(const CFX_PointF& point) const { return IsValid() && IsVisible() && GetWindowRect().Contains(point.x, point.y); } -bool CPWL_Wnd::ClientHitTest(const CFX_FloatPoint& point) const { +bool CPWL_Wnd::ClientHitTest(const CFX_PointF& point) const { return IsValid() && IsVisible() && GetClientRect().Contains(point.x, point.y); } @@ -850,11 +849,9 @@ CFX_Matrix CPWL_Wnd::GetWindowMatrix() const { return mt; } -void CPWL_Wnd::PWLtoWnd(const CFX_FloatPoint& point, - int32_t& x, - int32_t& y) const { +void CPWL_Wnd::PWLtoWnd(const CFX_PointF& point, int32_t& x, int32_t& y) const { CFX_Matrix mt = GetWindowMatrix(); - CFX_FloatPoint pt = point; + CFX_PointF pt = point; mt.TransformPoint(pt.x, pt.y); x = (int32_t)(pt.x + 0.5); y = (int32_t)(pt.y + 0.5); @@ -868,12 +865,12 @@ FX_RECT CPWL_Wnd::PWLtoWnd(const CFX_FloatRect& rect) const { (int32_t)(rcTemp.right + 0.5), (int32_t)(rcTemp.top + 0.5)); } -CFX_FloatPoint CPWL_Wnd::ChildToParent(const CFX_FloatPoint& point) const { +CFX_PointF CPWL_Wnd::ChildToParent(const CFX_PointF& point) const { CFX_Matrix mt = GetChildMatrix(); if (mt.IsIdentity()) return point; - CFX_FloatPoint pt = point; + CFX_PointF pt = point; mt.TransformPoint(pt.x, pt.y); return pt; } @@ -888,13 +885,13 @@ CFX_FloatRect CPWL_Wnd::ChildToParent(const CFX_FloatRect& rect) const { return rc; } -CFX_FloatPoint CPWL_Wnd::ParentToChild(const CFX_FloatPoint& point) const { +CFX_PointF CPWL_Wnd::ParentToChild(const CFX_PointF& point) const { CFX_Matrix mt = GetChildMatrix(); if (mt.IsIdentity()) return point; mt.SetReverse(mt); - CFX_FloatPoint pt = point; + CFX_PointF pt = point; mt.TransformPoint(pt.x, pt.y); return pt; } diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h index dd4f321d8a..12b29aeb7e 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/pdfwindow/PWL_Wnd.h @@ -264,17 +264,17 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual bool OnKeyDown(uint16_t nChar, uint32_t nFlag); virtual bool OnKeyUp(uint16_t nChar, uint32_t nFlag); virtual bool OnChar(uint16_t nChar, uint32_t nFlag); - virtual bool OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnMButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnMButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnMButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnRButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); - virtual bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnLButtonDblClk(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnMButtonDblClk(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnMButtonDown(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnMButtonUp(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnRButtonDown(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnRButtonUp(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag); virtual bool OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, + const CFX_PointF& point, uint32_t nFlag); virtual void SetFocus(); @@ -308,7 +308,7 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual CFX_FloatRect GetWindowRect() const; virtual CFX_FloatRect GetClientRect() const; - CFX_FloatPoint GetCenterPoint() const; + CFX_PointF GetCenterPoint() const; int32_t GetBorderWidth() const; bool IsVisible() const { return m_bVisible; } bool HasFlag(uint32_t dwFlags) const; @@ -320,8 +320,8 @@ class CPWL_Wnd : public CPWL_TimerHandler { const CPWL_Dash& GetBorderDash() const; void* GetAttachedData() const; - bool WndHitTest(const CFX_FloatPoint& point) const; - bool ClientHitTest(const CFX_FloatPoint& point) const; + bool WndHitTest(const CFX_PointF& point) const; + bool ClientHitTest(const CFX_PointF& point) const; bool IsCaptureMouse() const; const CPWL_Wnd* GetFocused() const; @@ -341,9 +341,9 @@ class CPWL_Wnd : public CPWL_TimerHandler { void SetChildMatrix(const CFX_Matrix& mt); CFX_Matrix GetWindowMatrix() const; - virtual CFX_FloatPoint ChildToParent(const CFX_FloatPoint& point) const; + virtual CFX_PointF ChildToParent(const CFX_PointF& point) const; virtual CFX_FloatRect ChildToParent(const CFX_FloatRect& rect) const; - virtual CFX_FloatPoint ParentToChild(const CFX_FloatPoint& point) const; + virtual CFX_PointF ParentToChild(const CFX_PointF& point) const; virtual CFX_FloatRect ParentToChild(const CFX_FloatRect& rect) const; // those methods only implemented by listctrl item @@ -389,7 +389,7 @@ class CPWL_Wnd : public CPWL_TimerHandler { void InvalidateRectMove(const CFX_FloatRect& rcOld, const CFX_FloatRect& rcNew); - void PWLtoWnd(const CFX_FloatPoint& point, int32_t& x, int32_t& y) const; + void PWLtoWnd(const CFX_PointF& point, int32_t& x, int32_t& y) const; FX_RECT PWLtoWnd(const CFX_FloatRect& rect) const; bool IsWndCaptureMouse(const CPWL_Wnd* pWnd) const; |