From 05df075154a832fcb476e1dfcfb865722d0ea898 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 14 Mar 2017 14:43:42 -0400 Subject: Replace FX_FLOAT with underlying float type. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I158b7d80b0ec28b742a9f2d5a96f3dde7fb3ab56 Reviewed-on: https://pdfium-review.googlesource.com/3031 Commit-Queue: dsinclair Reviewed-by: Tom Sepez Reviewed-by: Nicolás Peña --- fpdfsdk/pdfwindow/PWL_Caret.cpp | 6 +- fpdfsdk/pdfwindow/PWL_Caret.h | 2 +- fpdfsdk/pdfwindow/PWL_ComboBox.cpp | 12 ++-- fpdfsdk/pdfwindow/PWL_Edit.cpp | 28 ++++---- fpdfsdk/pdfwindow/PWL_Edit.h | 21 +++--- fpdfsdk/pdfwindow/PWL_EditCtrl.cpp | 24 +++---- fpdfsdk/pdfwindow/PWL_EditCtrl.h | 20 +++--- fpdfsdk/pdfwindow/PWL_Icon.cpp | 38 +++++------ fpdfsdk/pdfwindow/PWL_Icon.h | 12 ++-- fpdfsdk/pdfwindow/PWL_ListBox.cpp | 26 +++---- fpdfsdk/pdfwindow/PWL_ListBox.h | 20 +++--- fpdfsdk/pdfwindow/PWL_ScrollBar.cpp | 78 ++++++++++----------- fpdfsdk/pdfwindow/PWL_ScrollBar.h | 56 +++++++-------- fpdfsdk/pdfwindow/PWL_SpecialButton.cpp | 2 +- fpdfsdk/pdfwindow/PWL_Utils.cpp | 116 ++++++++++++++++---------------- fpdfsdk/pdfwindow/PWL_Utils.h | 24 +++---- fpdfsdk/pdfwindow/PWL_Wnd.cpp | 14 ++-- fpdfsdk/pdfwindow/PWL_Wnd.h | 6 +- fpdfsdk/pdfwindow/cpwl_color.cpp | 27 ++++---- fpdfsdk/pdfwindow/cpwl_color.h | 20 +++--- 20 files changed, 272 insertions(+), 280 deletions(-) (limited to 'fpdfsdk/pdfwindow') diff --git a/fpdfsdk/pdfwindow/PWL_Caret.cpp b/fpdfsdk/pdfwindow/PWL_Caret.cpp index 3360bbf62a..3658fbc23a 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.cpp +++ b/fpdfsdk/pdfwindow/PWL_Caret.cpp @@ -35,9 +35,9 @@ void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_FloatRect rcClip = GetClipRect(); CFX_PathData path; - FX_FLOAT fCaretX = rcRect.left + m_fWidth * 0.5f; - FX_FLOAT fCaretTop = rcRect.top; - FX_FLOAT fCaretBottom = rcRect.bottom; + float fCaretX = rcRect.left + m_fWidth * 0.5f; + float fCaretTop = rcRect.top; + float fCaretBottom = rcRect.bottom; if (!rcClip.IsEmpty()) { rcRect.Intersect(rcClip); if (rcRect.IsEmpty()) diff --git a/fpdfsdk/pdfwindow/PWL_Caret.h b/fpdfsdk/pdfwindow/PWL_Caret.h index 60ebbdc8e1..7c041f4f5e 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.h +++ b/fpdfsdk/pdfwindow/PWL_Caret.h @@ -45,7 +45,7 @@ class CPWL_Caret : public CPWL_Wnd { bool m_bFlash; CFX_PointF m_ptHead; CFX_PointF m_ptFoot; - FX_FLOAT m_fWidth; + 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 bc6909a07d..5adf4561f2 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp @@ -339,8 +339,8 @@ void CPWL_ComboBox::RePosChildWnd() { CFX_FloatRect rcEdit = rcClient; CFX_FloatRect rcList = CPWL_Wnd::GetWindowRect(); - FX_FLOAT fOldWindowHeight = m_rcOldWindow.Height(); - FX_FLOAT fOldClientHeight = fOldWindowHeight - GetBorderWidth() * 2; + float fOldWindowHeight = m_rcOldWindow.Height(); + float fOldClientHeight = fOldWindowHeight - GetBorderWidth() * 2; switch (m_nPopupWhere) { case 0: @@ -440,7 +440,7 @@ void CPWL_ComboBox::SetPopup(bool bPopup) { return; if (bPopup == m_bPopup) return; - FX_FLOAT fListHeight = m_pList->GetContentRect().Height(); + float fListHeight = m_pList->GetContentRect().Height(); if (!IsFloatBigger(fListHeight, 0.0f)) return; @@ -453,12 +453,12 @@ void CPWL_ComboBox::SetPopup(bool bPopup) { return; #endif // PDF_ENABLE_XFA int32_t nWhere = 0; - FX_FLOAT fPopupRet = 0.0f; - FX_FLOAT fPopupMin = 0.0f; + float fPopupRet = 0.0f; + float fPopupMin = 0.0f; if (m_pList->GetCount() > 3) fPopupMin = m_pList->GetFirstHeight() * 3 + m_pList->GetBorderWidth() * 2; - FX_FLOAT fPopupMax = fListHeight + m_pList->GetBorderWidth() * 2; + float fPopupMax = fListHeight + m_pList->GetBorderWidth() * 2; m_pFillerNotify->QueryWherePopup(GetAttachedData(), fPopupMin, fPopupMax, nWhere, fPopupRet); diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index b77aad9ab0..f84c38e23b 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -101,7 +101,7 @@ void CPWL_Edit::RePosChildWnd() { CFX_FloatRect CPWL_Edit::GetClientRect() const { CFX_FloatRect rcClient = CPWL_Utils::DeflateRect( - GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); + GetWindowRect(), (float)(GetBorderWidth() + GetInnerBorderWidth())); if (CPWL_ScrollBar* pVSB = GetVScrollBar()) { if (pVSB->IsVisible()) { @@ -329,7 +329,7 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, switch (GetBorderStyle()) { case BorderStyle::SOLID: { CFX_GraphStateData gsd; - gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); + gsd.m_LineWidth = (float)GetBorderWidth(); CFX_PathData path; @@ -355,12 +355,12 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, } case BorderStyle::DASH: { CFX_GraphStateData gsd; - gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); + gsd.m_LineWidth = (float)GetBorderWidth(); gsd.SetDashCount(2); - gsd.m_DashArray[0] = (FX_FLOAT)GetBorderDash().nDash; - gsd.m_DashArray[1] = (FX_FLOAT)GetBorderDash().nGap; - gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPhase; + gsd.m_DashArray[0] = (float)GetBorderDash().nDash; + gsd.m_DashArray[1] = (float)GetBorderDash().nGap; + gsd.m_DashPhase = (float)GetBorderDash().nPhase; CFX_PathData path; for (int32_t i = 0; i < nCharArray - 1; i++) { @@ -463,7 +463,7 @@ void CPWL_Edit::OnKillFocus() { m_bFocus = false; } -void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace) { +void CPWL_Edit::SetCharSpace(float fCharSpace) { m_pEdit->SetCharSpace(fCharSpace); } @@ -527,16 +527,16 @@ bool CPWL_Edit::IsTextFull() const { return m_pEdit->IsTextFull(); } -FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, - const CFX_FloatRect& rcPlate, - int32_t nCharArray) { +float CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, + const CFX_FloatRect& rcPlate, + int32_t nCharArray) { if (pFont && !pFont->IsStandardFont()) { FX_RECT rcBBox; pFont->GetFontBBox(rcBBox); CFX_FloatRect rcCell = rcPlate; - FX_FLOAT xdiv = rcCell.Width() / nCharArray * 1000.0f / rcBBox.Width(); - FX_FLOAT ydiv = -rcCell.Height() * 1000.0f / rcBBox.Height(); + float xdiv = rcCell.Width() / nCharArray * 1000.0f / rcBBox.Width(); + float ydiv = -rcCell.Height() * 1000.0f / rcBBox.Height(); return xdiv < ydiv ? xdiv : ydiv; } @@ -551,8 +551,8 @@ void CPWL_Edit::SetCharArray(int32_t nCharArray) { if (HasFlag(PWS_AUTOFONTSIZE)) { if (IPVT_FontMap* pFontMap = GetFontMap()) { - FX_FLOAT fFontSize = GetCharArrayAutoFontSize( - pFontMap->GetPDFFont(0), GetClientRect(), nCharArray); + float fFontSize = GetCharArrayAutoFontSize(pFontMap->GetPDFFont(0), + GetClientRect(), nCharArray); if (fFontSize > 0.0f) { m_pEdit->SetAutoFontSize(false, true); m_pEdit->SetFontSize(fFontSize); diff --git a/fpdfsdk/pdfwindow/PWL_Edit.h b/fpdfsdk/pdfwindow/PWL_Edit.h index b6d01300f0..5e1a36610d 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.h +++ b/fpdfsdk/pdfwindow/PWL_Edit.h @@ -21,12 +21,11 @@ class IFX_Edit_UndoItem; class IPWL_Filler_Notify { public: virtual ~IPWL_Filler_Notify() {} - virtual void QueryWherePopup( - void* pPrivateData, - FX_FLOAT fPopupMin, - FX_FLOAT fPopupMax, - int32_t& nRet, - FX_FLOAT& fPopupRet) = 0; // nRet: (0:bottom 1:top) + virtual void QueryWherePopup(void* pPrivateData, + float fPopupMin, + float fPopupMax, + int32_t& nRet, + float& fPopupRet) = 0; // nRet: (0:bottom 1:top) virtual void OnBeforeKeyStroke(void* pPrivateData, CFX_WideString& strChange, const CFX_WideString& strChangeEx, @@ -78,7 +77,7 @@ class CPWL_Edit : public CPWL_EditCtrl { void SetCharArray(int32_t nCharArray); void SetLimitChar(int32_t nLimitChar); - void SetCharSpace(FX_FLOAT fCharSpace); + void SetCharSpace(float fCharSpace); bool CanSelectAll() const; bool CanClear() const; @@ -96,9 +95,9 @@ class CPWL_Edit : public CPWL_EditCtrl { bool IsTextFull() const; - static FX_FLOAT GetCharArrayAutoFontSize(CPDF_Font* pFont, - const CFX_FloatRect& rcPlate, - int32_t nCharArray); + static float GetCharArrayAutoFontSize(CPDF_Font* pFont, + const CFX_FloatRect& rcPlate, + int32_t nCharArray); void SetFillerNotify(IPWL_Filler_Notify* pNotify) { m_pFillerNotify = pNotify; @@ -123,7 +122,7 @@ class CPWL_Edit : public CPWL_EditCtrl { bool IsVScrollBarVisible() const; void SetParamByFlag(); - FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray); + float GetCharArrayAutoFontSize(int32_t nCharArray); CFX_PointF GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp index 4921ab7a08..e7371fd0e7 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp @@ -84,7 +84,7 @@ void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd, } break; case PNM_SCROLLWINDOW: { - FX_FLOAT fPos = *(FX_FLOAT*)lParam; + float fPos = *(float*)lParam; switch (wParam) { case SBT_VSCROLL: m_pEdit->SetScrollPos(CFX_PointF(m_pEdit->GetScrollPos().x, fPos)); @@ -121,11 +121,11 @@ void CPWL_EditCtrl::CreateEditCaret(const PWL_CREATEPARAM& cp) { m_pEditCaret->Create(ecp); } -void CPWL_EditCtrl::SetFontSize(FX_FLOAT fFontSize) { +void CPWL_EditCtrl::SetFontSize(float fFontSize) { m_pEdit->SetFontSize(fFontSize); } -FX_FLOAT CPWL_EditCtrl::GetFontSize() const { +float CPWL_EditCtrl::GetFontSize() const { return m_pEdit->GetFontSize(); } @@ -427,8 +427,8 @@ CPDF_Font* CPWL_EditCtrl::GetCaretFont() const { return nullptr; } -FX_FLOAT CPWL_EditCtrl::GetCaretFontSize() const { - FX_FLOAT fFontSize = GetFontSize(); +float CPWL_EditCtrl::GetCaretFontSize() const { + float fFontSize = GetFontSize(); CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); pIterator->SetAt(m_pEdit->GetCaret()); @@ -500,12 +500,12 @@ void CPWL_EditCtrl::Undo() { m_pEdit->Undo(); } -void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin, - FX_FLOAT fPlateMax, - FX_FLOAT fContentMin, - FX_FLOAT fContentMax, - FX_FLOAT fSmallStep, - FX_FLOAT fBigStep) { +void CPWL_EditCtrl::IOnSetScrollInfoY(float fPlateMin, + float fPlateMax, + float fContentMin, + float fContentMax, + float fSmallStep, + float fBigStep) { PWL_SCROLL_INFO Info; Info.fPlateWidth = fPlateMax - fPlateMin; @@ -524,7 +524,7 @@ void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin, } } -void CPWL_EditCtrl::IOnSetScrollPosY(FX_FLOAT fy) { +void CPWL_EditCtrl::IOnSetScrollPosY(float fy) { OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&fy); } diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/pdfwindow/PWL_EditCtrl.h index 498570b3b0..6977673eac 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.h +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.h @@ -62,7 +62,7 @@ class CPWL_EditCtrl : public CPWL_Wnd { int32_t GetCodePage() const { return m_nCodePage; } CPDF_Font* GetCaretFont() const; - FX_FLOAT GetCaretFontSize() const; + float GetCaretFontSize() const; bool CanUndo() const; bool CanRedo() const; @@ -85,17 +85,17 @@ class CPWL_EditCtrl : public CPWL_Wnd { intptr_t lParam = 0) override; void CreateChildWnd(const PWL_CREATEPARAM& cp) override; void RePosChildWnd() override; - void SetFontSize(FX_FLOAT fFontSize) override; - FX_FLOAT GetFontSize() const override; + void SetFontSize(float fFontSize) override; + float GetFontSize() const override; void SetCursor() override; - void IOnSetScrollInfoY(FX_FLOAT fPlateMin, - FX_FLOAT fPlateMax, - FX_FLOAT fContentMin, - FX_FLOAT fContentMax, - FX_FLOAT fSmallStep, - FX_FLOAT fBigStep); - void IOnSetScrollPosY(FX_FLOAT fy); + void IOnSetScrollInfoY(float fPlateMin, + float fPlateMax, + float fContentMin, + float fContentMax, + float fSmallStep, + float fBigStep); + void IOnSetScrollPosY(float fy); void IOnSetCaret(bool bVisible, const CFX_PointF& ptHead, const CFX_PointF& ptFoot, diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp index 4ce63299e4..3ae7244552 100644 --- a/fpdfsdk/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp @@ -25,12 +25,12 @@ CFX_ByteString CPWL_Image::GetImageAppStream() { CFX_Matrix mt; mt.SetReverse(GetImageMatrix()); - FX_FLOAT fHScale = 1.0f; - FX_FLOAT fVScale = 1.0f; + float fHScale = 1.0f; + float fVScale = 1.0f; GetScale(fHScale, fVScale); - FX_FLOAT fx = 0.0f; - FX_FLOAT fy = 0.0f; + float fx = 0.0f; + float fy = 0.0f; GetImageOffset(fx, fy); if (m_pPDFStream && sAlias.GetLength() > 0) { @@ -59,7 +59,7 @@ CPDF_Stream* CPWL_Image::GetPDFStream() { return m_pPDFStream; } -void CPWL_Image::GetImageSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight) { +void CPWL_Image::GetImageSize(float& fWidth, float& fHeight) { fWidth = 0.0f; fHeight = 0.0f; @@ -100,12 +100,12 @@ void CPWL_Image::SetImageAlias(const char* sImageAlias) { m_sImageAlias = sImageAlias; } -void CPWL_Image::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) { +void CPWL_Image::GetScale(float& fHScale, float& fVScale) { fHScale = 1.0f; fVScale = 1.0f; } -void CPWL_Image::GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) { +void CPWL_Image::GetImageOffset(float& x, float& y) { x = 0.0f; y = 0.0f; } @@ -132,7 +132,7 @@ bool CPWL_Icon::IsProportionalScale() { return false; } -void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { +void CPWL_Icon::GetIconPosition(float& fLeft, float& fBottom) { if (m_pIconFit) { fLeft = 0.0f; fBottom = 0.0f; @@ -152,13 +152,13 @@ void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { } } -void CPWL_Icon::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) { +void CPWL_Icon::GetScale(float& fHScale, float& fVScale) { fHScale = 1.0f; fVScale = 1.0f; if (m_pPDFStream) { - FX_FLOAT fImageWidth, fImageHeight; - FX_FLOAT fPlateWidth, fPlateHeight; + float fImageWidth, fImageHeight; + float fPlateWidth, fPlateHeight; CFX_FloatRect rcPlate = GetClientRect(); fPlateWidth = rcPlate.right - rcPlate.left; @@ -190,7 +190,7 @@ void CPWL_Icon::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) { break; } - FX_FLOAT fMinScale; + float fMinScale; if (IsProportionalScale()) { fMinScale = std::min(fHScale, fVScale); fHScale = fMinScale; @@ -199,23 +199,23 @@ void CPWL_Icon::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) { } } -void CPWL_Icon::GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) { - FX_FLOAT fLeft, fBottom; +void CPWL_Icon::GetImageOffset(float& x, float& y) { + float fLeft, fBottom; GetIconPosition(fLeft, fBottom); x = 0.0f; y = 0.0f; - FX_FLOAT fImageWidth, fImageHeight; + float fImageWidth, fImageHeight; GetImageSize(fImageWidth, fImageHeight); - FX_FLOAT fHScale, fVScale; + float fHScale, fVScale; GetScale(fHScale, fVScale); - FX_FLOAT fImageFactWidth = fImageWidth * fHScale; - FX_FLOAT fImageFactHeight = fImageHeight * fVScale; + float fImageFactWidth = fImageWidth * fHScale; + float fImageFactHeight = fImageHeight * fVScale; - FX_FLOAT fPlateWidth, fPlateHeight; + float fPlateWidth, fPlateHeight; CFX_FloatRect rcPlate = GetClientRect(); fPlateWidth = rcPlate.right - rcPlate.left; fPlateHeight = rcPlate.top - rcPlate.bottom; diff --git a/fpdfsdk/pdfwindow/PWL_Icon.h b/fpdfsdk/pdfwindow/PWL_Icon.h index bdcae9f7bd..49ac1f3f3d 100644 --- a/fpdfsdk/pdfwindow/PWL_Icon.h +++ b/fpdfsdk/pdfwindow/PWL_Icon.h @@ -17,13 +17,13 @@ class CPWL_Image : public CPWL_Wnd { virtual CFX_ByteString GetImageAppStream(); - virtual void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale); - virtual void GetImageOffset(FX_FLOAT& x, FX_FLOAT& y); + virtual void GetScale(float& fHScale, float& fVScale); + virtual void GetImageOffset(float& x, float& y); virtual CPDF_Stream* GetPDFStream(); public: void SetPDFStream(CPDF_Stream* pStream); - void GetImageSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight); + void GetImageSize(float& fWidth, float& fHeight); CFX_Matrix GetImageMatrix(); CFX_ByteString GetImageAlias(); void SetImageAlias(const char* sImageAlias); @@ -41,12 +41,12 @@ class CPWL_Icon : public CPWL_Image { virtual CPDF_IconFit* GetIconFit(); // CPWL_Image - void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) override; - void GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) override; + void GetScale(float& fHScale, float& fVScale) override; + void GetImageOffset(float& x, float& y) override; int32_t GetScaleMethod(); bool IsProportionalScale(); - void GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom); + void GetIconPosition(float& fLeft, float& fBottom); void SetIconFit(CPDF_IconFit* pIconFit) { m_pIconFit = pIconFit; } diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp index 18b45b5c3f..8448204a74 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp @@ -22,12 +22,12 @@ CPWL_List_Notify::CPWL_List_Notify(CPWL_ListBox* pList) : m_pList(pList) { CPWL_List_Notify::~CPWL_List_Notify() {} -void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin, - FX_FLOAT fPlateMax, - FX_FLOAT fContentMin, - FX_FLOAT fContentMax, - FX_FLOAT fSmallStep, - FX_FLOAT fBigStep) { +void CPWL_List_Notify::IOnSetScrollInfoY(float fPlateMin, + float fPlateMax, + float fContentMin, + float fContentMax, + float fSmallStep, + float fBigStep) { PWL_SCROLL_INFO Info; Info.fPlateWidth = fPlateMax - fPlateMin; @@ -54,7 +54,7 @@ void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin, } } -void CPWL_List_Notify::IOnSetScrollPosY(FX_FLOAT fy) { +void CPWL_List_Notify::IOnSetScrollPosY(float fy) { m_pList->OnNotify(m_pList, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&fy); } @@ -295,7 +295,7 @@ void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, intptr_t lParam) { CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); - FX_FLOAT fPos; + float fPos; switch (msg) { case PNM_SETSCROLLINFO: @@ -317,7 +317,7 @@ void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, } break; case PNM_SCROLLWINDOW: - fPos = *(FX_FLOAT*)lParam; + fPos = *(float*)lParam; switch (wParam) { case SBT_VSCROLL: m_pList->SetScrollPos(CFX_PointF(0, fPos)); @@ -371,11 +371,11 @@ CFX_WideString CPWL_ListBox::GetText() const { return m_pList->GetText(); } -void CPWL_ListBox::SetFontSize(FX_FLOAT fFontSize) { +void CPWL_ListBox::SetFontSize(float fFontSize) { m_pList->SetFontSize(fFontSize); } -FX_FLOAT CPWL_ListBox::GetFontSize() const { +float CPWL_ListBox::GetFontSize() const { return m_pList->GetFontSize(); } @@ -436,13 +436,13 @@ CFX_FloatRect CPWL_ListBox::GetContentRect() const { return m_pList->GetContentRect(); } -FX_FLOAT CPWL_ListBox::GetFirstHeight() const { +float CPWL_ListBox::GetFirstHeight() const { return m_pList->GetFirstHeight(); } CFX_FloatRect CPWL_ListBox::GetListRect() const { return CPWL_Utils::DeflateRect( - GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); + GetWindowRect(), (float)(GetBorderWidth() + GetInnerBorderWidth())); } bool CPWL_ListBox::OnMouseWheel(short zDelta, diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.h b/fpdfsdk/pdfwindow/PWL_ListBox.h index fa78b37bcb..9f8f464efb 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.h +++ b/fpdfsdk/pdfwindow/PWL_ListBox.h @@ -25,13 +25,13 @@ class CPWL_List_Notify { explicit CPWL_List_Notify(CPWL_ListBox* pList); ~CPWL_List_Notify(); - void IOnSetScrollInfoY(FX_FLOAT fPlateMin, - FX_FLOAT fPlateMax, - FX_FLOAT fContentMin, - FX_FLOAT fContentMax, - FX_FLOAT fSmallStep, - FX_FLOAT fBigStep); - void IOnSetScrollPosY(FX_FLOAT fy); + void IOnSetScrollInfoY(float fPlateMin, + float fPlateMax, + float fContentMin, + float fContentMax, + float fSmallStep, + float fBigStep); + void IOnSetScrollPosY(float fy); void IOnInvalidateRect(CFX_FloatRect* pRect); void IOnSetCaret(bool bVisible, @@ -70,8 +70,8 @@ class CPWL_ListBox : public CPWL_Wnd { intptr_t lParam = 0) override; void RePosChildWnd() override; CFX_FloatRect GetFocusRect() const override; - void SetFontSize(FX_FLOAT fFontSize) override; - FX_FLOAT GetFontSize() const override; + void SetFontSize(float fFontSize) override; + float GetFontSize() const override; virtual CFX_WideString GetText() const; @@ -94,7 +94,7 @@ class CPWL_ListBox : public CPWL_Wnd { int32_t GetTopVisibleIndex() const; int32_t FindNext(int32_t nIndex, wchar_t nChar) const; CFX_FloatRect GetContentRect() const; - FX_FLOAT GetFirstHeight() const; + float GetFirstHeight() const; CFX_FloatRect GetListRect() const; void SetFillerNotify(IPWL_Filler_Notify* pNotify) { diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp index e3799366a5..9289f44aa0 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp @@ -15,7 +15,7 @@ PWL_FLOATRANGE::PWL_FLOATRANGE() { Default(); } -PWL_FLOATRANGE::PWL_FLOATRANGE(FX_FLOAT min, FX_FLOAT max) { +PWL_FLOATRANGE::PWL_FLOATRANGE(float min, float max) { Set(min, max); } @@ -24,7 +24,7 @@ void PWL_FLOATRANGE::Default() { fMax = 0; } -void PWL_FLOATRANGE::Set(FX_FLOAT min, FX_FLOAT max) { +void PWL_FLOATRANGE::Set(float min, float max) { if (min > max) { fMin = max; fMax = min; @@ -34,12 +34,12 @@ void PWL_FLOATRANGE::Set(FX_FLOAT min, FX_FLOAT max) { } } -bool PWL_FLOATRANGE::In(FX_FLOAT x) const { +bool PWL_FLOATRANGE::In(float x) const { return (IsFloatBigger(x, fMin) || IsFloatEqual(x, fMin)) && (IsFloatSmaller(x, fMax) || IsFloatEqual(x, fMax)); } -FX_FLOAT PWL_FLOATRANGE::GetWidth() const { +float PWL_FLOATRANGE::GetWidth() const { return fMax - fMin; } @@ -55,7 +55,7 @@ void PWL_SCROLL_PRIVATEDATA::Default() { fSmallStep = 1; } -void PWL_SCROLL_PRIVATEDATA::SetScrollRange(FX_FLOAT min, FX_FLOAT max) { +void PWL_SCROLL_PRIVATEDATA::SetScrollRange(float min, float max) { ScrollRange.Set(min, max); if (IsFloatSmaller(fScrollPos, ScrollRange.fMin)) @@ -64,19 +64,19 @@ void PWL_SCROLL_PRIVATEDATA::SetScrollRange(FX_FLOAT min, FX_FLOAT max) { fScrollPos = ScrollRange.fMax; } -void PWL_SCROLL_PRIVATEDATA::SetClientWidth(FX_FLOAT width) { +void PWL_SCROLL_PRIVATEDATA::SetClientWidth(float width) { fClientWidth = width; } -void PWL_SCROLL_PRIVATEDATA::SetSmallStep(FX_FLOAT step) { +void PWL_SCROLL_PRIVATEDATA::SetSmallStep(float step) { fSmallStep = step; } -void PWL_SCROLL_PRIVATEDATA::SetBigStep(FX_FLOAT step) { +void PWL_SCROLL_PRIVATEDATA::SetBigStep(float step) { fBigStep = step; } -bool PWL_SCROLL_PRIVATEDATA::SetPos(FX_FLOAT pos) { +bool PWL_SCROLL_PRIVATEDATA::SetPos(float pos) { if (ScrollRange.In(pos)) { fScrollPos = pos; return true; @@ -320,8 +320,8 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, // draw arrow if (rectWnd.top - rectWnd.bottom > 6.0f) { - FX_FLOAT fX = rectWnd.left + 1.5f; - FX_FLOAT fY = rectWnd.bottom; + float fX = rectWnd.left + 1.5f; + 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), @@ -365,8 +365,8 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, // draw arrow if (rectWnd.top - rectWnd.bottom > 6.0f) { - FX_FLOAT fX = rectWnd.left + 1.5f; - FX_FLOAT fY = rectWnd.bottom; + float fX = rectWnd.left + 1.5f; + float fY = rectWnd.bottom; CFX_PointF pts[7] = {CFX_PointF(fX + 2.5f, fY + 5.0f), CFX_PointF(fX + 2.5f, fY + 6.0f), @@ -487,8 +487,8 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, if (!IsEnabled()) crStroke = PWL_DEFAULT_HEAVYGRAYCOLOR.ToFXColor(255); - FX_FLOAT nFrictionWidth = 5.0f; - FX_FLOAT nFrictionHeight = 5.5f; + float nFrictionWidth = 5.0f; + float nFrictionHeight = 5.5f; CFX_PointF ptLeft = CFX_PointF(ptCenter.x - nFrictionWidth / 2.0f, @@ -578,7 +578,7 @@ void CPWL_ScrollBar::OnCreate(PWL_CREATEPARAM& cp) { void CPWL_ScrollBar::RePosChildWnd() { CFX_FloatRect rcClient = GetClientRect(); CFX_FloatRect rcMinButton, rcMaxButton; - FX_FLOAT fBWidth = 0; + float fBWidth = 0; switch (m_sbType) { case SBT_HSCROLL: @@ -802,7 +802,7 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, PWL_SCROLL_INFO* pInfo = reinterpret_cast(lParam); if (pInfo && *pInfo != m_OriginInfo) { m_OriginInfo = *pInfo; - FX_FLOAT fMax = + float fMax = pInfo->fContentMax - pInfo->fContentMin - pInfo->fPlateWidth; fMax = fMax > 0.0f ? fMax : 0.0f; SetScrollRange(0, fMax, pInfo->fPlateWidth); @@ -810,7 +810,7 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, } } break; case PNM_SETSCROLLPOS: { - FX_FLOAT fPos = *(FX_FLOAT*)lParam; + float fPos = *(float*)lParam; switch (m_sbType) { case SBT_HSCROLL: fPos = fPos - m_OriginInfo.fContentMin; @@ -850,16 +850,16 @@ void CPWL_ScrollBar::CreateButtons(const PWL_CREATEPARAM& cp) { } } -FX_FLOAT CPWL_ScrollBar::GetScrollBarWidth() const { +float CPWL_ScrollBar::GetScrollBarWidth() const { if (!IsVisible()) return 0; return PWL_SCROLLBAR_WIDTH; } -void CPWL_ScrollBar::SetScrollRange(FX_FLOAT fMin, - FX_FLOAT fMax, - FX_FLOAT fClientWidth) { +void CPWL_ScrollBar::SetScrollRange(float fMin, + float fMax, + float fClientWidth) { if (m_pPosButton) { m_sData.SetScrollRange(fMin, fMax); m_sData.SetClientWidth(fClientWidth); @@ -873,8 +873,8 @@ void CPWL_ScrollBar::SetScrollRange(FX_FLOAT fMin, } } -void CPWL_ScrollBar::SetScrollPos(FX_FLOAT fPos) { - FX_FLOAT fOldPos = m_sData.fScrollPos; +void CPWL_ScrollBar::SetScrollPos(float fPos) { + float fOldPos = m_sData.fScrollPos; m_sData.SetPos(fPos); @@ -882,7 +882,7 @@ void CPWL_ScrollBar::SetScrollPos(FX_FLOAT fPos) { MovePosButton(true); } -void CPWL_ScrollBar::SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep) { +void CPWL_ScrollBar::SetScrollStep(float fBigStep, float fSmallStep) { m_sData.SetBigStep(fBigStep); m_sData.SetSmallStep(fSmallStep); } @@ -898,7 +898,7 @@ void CPWL_ScrollBar::MovePosButton(bool bRefresh) { rcClient = GetClientRect(); rcPosArea = GetScrollArea(); - FX_FLOAT fLeft, fRight, fTop, fBottom; + float fLeft, fRight, fTop, fBottom; switch (m_sbType) { case SBT_HSCROLL: @@ -997,9 +997,9 @@ void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_PointF& point) { } void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_PointF& point) { - FX_FLOAT fOldScrollPos = m_sData.fScrollPos; + float fOldScrollPos = m_sData.fScrollPos; - FX_FLOAT fNewPos = 0; + float fNewPos = 0; switch (m_sbType) { case SBT_HSCROLL: @@ -1055,7 +1055,7 @@ void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_PointF& point) { void CPWL_ScrollBar::NotifyScrollWindow() { if (CPWL_Wnd* pParent = GetParentWindow()) { - FX_FLOAT fPos; + float fPos; switch (m_sbType) { case SBT_HSCROLL: fPos = m_OriginInfo.fContentMin + m_sData.fScrollPos; @@ -1079,10 +1079,10 @@ CFX_FloatRect CPWL_ScrollBar::GetScrollArea() const { CFX_FloatRect rcMin = m_pMinButton->GetWindowRect(); CFX_FloatRect rcMax = m_pMaxButton->GetWindowRect(); - FX_FLOAT fMinWidth = rcMin.right - rcMin.left; - FX_FLOAT fMinHeight = rcMin.top - rcMin.bottom; - FX_FLOAT fMaxWidth = rcMax.right - rcMax.left; - FX_FLOAT fMaxHeight = rcMax.top - rcMax.bottom; + float fMinWidth = rcMin.right - rcMin.left; + float fMinHeight = rcMin.top - rcMin.bottom; + float fMaxWidth = rcMax.right - rcMax.left; + float fMaxHeight = rcMax.top - rcMax.bottom; switch (m_sbType) { case SBT_HSCROLL: @@ -1111,14 +1111,14 @@ CFX_FloatRect CPWL_ScrollBar::GetScrollArea() const { return rcArea; } -FX_FLOAT CPWL_ScrollBar::TrueToFace(FX_FLOAT fTrue) { +float CPWL_ScrollBar::TrueToFace(float fTrue) { CFX_FloatRect rcPosArea; rcPosArea = GetScrollArea(); - FX_FLOAT fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth; + float fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth; fFactWidth = fFactWidth == 0 ? 1 : fFactWidth; - FX_FLOAT fFace = 0; + float fFace = 0; switch (m_sbType) { case SBT_HSCROLL: @@ -1134,14 +1134,14 @@ FX_FLOAT CPWL_ScrollBar::TrueToFace(FX_FLOAT fTrue) { return fFace; } -FX_FLOAT CPWL_ScrollBar::FaceToTrue(FX_FLOAT fFace) { +float CPWL_ScrollBar::FaceToTrue(float fFace) { CFX_FloatRect rcPosArea; rcPosArea = GetScrollArea(); - FX_FLOAT fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth; + float fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth; fFactWidth = fFactWidth == 0 ? 1 : fFactWidth; - FX_FLOAT fTrue = 0; + float fTrue = 0; switch (m_sbType) { case SBT_HSCROLL: diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/pdfwindow/PWL_ScrollBar.h index 9546a9e577..50b0801ca3 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.h +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.h @@ -30,11 +30,11 @@ struct PWL_SCROLL_INFO { return !(*this == that); } - FX_FLOAT fContentMin; - FX_FLOAT fContentMax; - FX_FLOAT fPlateWidth; - FX_FLOAT fBigStep; - FX_FLOAT fSmallStep; + float fContentMin; + float fContentMax; + float fPlateWidth; + float fBigStep; + float fSmallStep; }; enum PWL_SCROLLBAR_TYPE { SBT_HSCROLL, SBT_VSCROLL }; @@ -67,7 +67,7 @@ class CPWL_SBButton : public CPWL_Wnd { struct PWL_FLOATRANGE { public: PWL_FLOATRANGE(); - PWL_FLOATRANGE(FX_FLOAT min, FX_FLOAT max); + PWL_FLOATRANGE(float min, float max); bool operator==(const PWL_FLOATRANGE& that) const { return fMin == that.fMin && fMax == that.fMax; @@ -75,12 +75,12 @@ struct PWL_FLOATRANGE { bool operator!=(const PWL_FLOATRANGE& that) const { return !(*this == that); } void Default(); - void Set(FX_FLOAT min, FX_FLOAT max); - bool In(FX_FLOAT x) const; - FX_FLOAT GetWidth() const; + void Set(float min, float max); + bool In(float x) const; + float GetWidth() const; - FX_FLOAT fMin; - FX_FLOAT fMax; + float fMin; + float fMax; }; struct PWL_SCROLL_PRIVATEDATA { @@ -97,11 +97,11 @@ struct PWL_SCROLL_PRIVATEDATA { } void Default(); - void SetScrollRange(FX_FLOAT min, FX_FLOAT max); - void SetClientWidth(FX_FLOAT width); - void SetSmallStep(FX_FLOAT step); - void SetBigStep(FX_FLOAT step); - bool SetPos(FX_FLOAT pos); + void SetScrollRange(float min, float max); + void SetClientWidth(float width); + void SetSmallStep(float step); + void SetBigStep(float step); + bool SetPos(float pos); void AddSmall(); void SubSmall(); @@ -109,10 +109,10 @@ struct PWL_SCROLL_PRIVATEDATA { void SubBig(); PWL_FLOATRANGE ScrollRange; - FX_FLOAT fClientWidth; - FX_FLOAT fScrollPos; - FX_FLOAT fBigStep; - FX_FLOAT fSmallStep; + float fClientWidth; + float fScrollPos; + float fBigStep; + float fSmallStep; }; class CPWL_ScrollBar : public CPWL_Wnd { @@ -136,16 +136,16 @@ class CPWL_ScrollBar : public CPWL_Wnd { void CreateChildWnd(const PWL_CREATEPARAM& cp) override; void TimerProc() override; - FX_FLOAT GetScrollBarWidth() const; + float GetScrollBarWidth() const; PWL_SCROLLBAR_TYPE GetScrollBarType() const { return m_sbType; } void SetNotifyForever(bool bForever) { m_bNotifyForever = bForever; } protected: - void SetScrollRange(FX_FLOAT fMin, FX_FLOAT fMax, FX_FLOAT fClientWidth); - void SetScrollPos(FX_FLOAT fPos); + void SetScrollRange(float fMin, float fMax, float fClientWidth); + void SetScrollPos(float fPos); void MovePosButton(bool bRefresh); - void SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep); + void SetScrollStep(float fBigStep, float fSmallStep); void NotifyScrollWindow(); CFX_FloatRect GetScrollArea() const; @@ -164,8 +164,8 @@ class CPWL_ScrollBar : public CPWL_Wnd { void OnPosButtonLBUp(const CFX_PointF& point); void OnPosButtonMouseMove(const CFX_PointF& point); - FX_FLOAT TrueToFace(FX_FLOAT); - FX_FLOAT FaceToTrue(FX_FLOAT); + float TrueToFace(float); + float FaceToTrue(float); PWL_SCROLLBAR_TYPE m_sbType; PWL_SCROLL_INFO m_OriginInfo; @@ -176,8 +176,8 @@ class CPWL_ScrollBar : public CPWL_Wnd { bool m_bMouseDown; bool m_bMinOrMax; bool m_bNotifyForever; - FX_FLOAT m_nOldPos; - FX_FLOAT m_fOldPosButton; + float m_nOldPos; + float m_fOldPosButton; }; #endif // FPDFSDK_PDFWINDOW_PWL_SCROLLBAR_H_ diff --git a/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp b/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp index 1c46c375a9..d2a13219d2 100644 --- a/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp +++ b/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp @@ -18,7 +18,7 @@ CFX_ByteString CPWL_PushButton::GetClassName() const { } CFX_FloatRect CPWL_PushButton::GetFocusRect() const { - return CPWL_Utils::DeflateRect(GetWindowRect(), (FX_FLOAT)GetBorderWidth()); + return CPWL_Utils::DeflateRect(GetWindowRect(), (float)GetBorderWidth()); } CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(false) {} diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp index 45668b6a25..f78b590150 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp @@ -18,8 +18,8 @@ #include "fpdfsdk/pdfwindow/PWL_Wnd.h" CFX_FloatRect CPWL_Utils::OffsetRect(const CFX_FloatRect& rect, - FX_FLOAT x, - FX_FLOAT y) { + float x, + float y) { return CFX_FloatRect(rect.left + x, rect.bottom + y, rect.right + x, rect.top + y); } @@ -51,8 +51,8 @@ CPVT_WordRange CPWL_Utils::OverlapWordRange(const CPVT_WordRange& wr1, } CFX_ByteString CPWL_Utils::GetAP_Check(const CFX_FloatRect& crBBox) { - const FX_FLOAT fWidth = crBBox.right - crBBox.left; - const FX_FLOAT fHeight = crBBox.top - crBBox.bottom; + const float fWidth = crBBox.right - crBBox.left; + const float fHeight = crBBox.top - crBBox.bottom; CFX_PointF pts[8][3] = {{CFX_PointF(0.28f, 0.52f), CFX_PointF(0.27f, 0.48f), CFX_PointF(0.29f, 0.40f)}, @@ -84,10 +84,10 @@ CFX_ByteString CPWL_Utils::GetAP_Check(const CFX_FloatRect& crBBox) { for (size_t i = 0; i < FX_ArraySize(pts); ++i) { size_t nNext = i < FX_ArraySize(pts) - 1 ? i + 1 : 0; - FX_FLOAT px1 = pts[i][1].x - pts[i][0].x; - FX_FLOAT py1 = pts[i][1].y - pts[i][0].y; - FX_FLOAT px2 = pts[i][2].x - pts[nNext][0].x; - FX_FLOAT py2 = pts[i][2].y - pts[nNext][0].y; + float px1 = pts[i][1].x - pts[i][0].x; + float py1 = pts[i][1].y - pts[i][0].y; + float px2 = pts[i][2].x - pts[nNext][0].x; + float py2 = pts[i][2].y - pts[nNext][0].y; csAP << pts[i][0].x + px1 * FX_BEZIER << " " << pts[i][0].y + py1 * FX_BEZIER << " " @@ -102,8 +102,8 @@ CFX_ByteString CPWL_Utils::GetAP_Check(const CFX_FloatRect& crBBox) { CFX_ByteString CPWL_Utils::GetAP_Circle(const CFX_FloatRect& crBBox) { CFX_ByteTextBuf csAP; - FX_FLOAT fWidth = crBBox.right - crBBox.left; - FX_FLOAT fHeight = crBBox.top - crBBox.bottom; + float fWidth = crBBox.right - crBBox.left; + float fHeight = crBBox.top - crBBox.bottom; CFX_PointF pt1(crBBox.left, crBBox.bottom + fHeight / 2); CFX_PointF pt2(crBBox.left + fWidth / 2, crBBox.top); @@ -112,8 +112,8 @@ CFX_ByteString CPWL_Utils::GetAP_Circle(const CFX_FloatRect& crBBox) { csAP << pt1.x << " " << pt1.y << " m\n"; - FX_FLOAT px = pt2.x - pt1.x; - FX_FLOAT py = pt2.y - pt1.y; + float px = pt2.x - pt1.x; + float py = pt2.y - pt1.y; csAP << pt1.x << " " << pt1.y + py * FX_BEZIER << " " << pt2.x - px * FX_BEZIER << " " << pt2.y << " " << pt2.x << " " << pt2.y @@ -155,8 +155,8 @@ CFX_ByteString CPWL_Utils::GetAP_Cross(const CFX_FloatRect& crBBox) { CFX_ByteString CPWL_Utils::GetAP_Diamond(const CFX_FloatRect& crBBox) { CFX_ByteTextBuf csAP; - FX_FLOAT fWidth = crBBox.right - crBBox.left; - FX_FLOAT fHeight = crBBox.top - crBBox.bottom; + float fWidth = crBBox.right - crBBox.left; + float fHeight = crBBox.top - crBBox.bottom; CFX_PointF pt1(crBBox.left, crBBox.bottom + fHeight / 2); CFX_PointF pt2(crBBox.left + fWidth / 2, crBBox.top); @@ -187,18 +187,17 @@ CFX_ByteString CPWL_Utils::GetAP_Square(const CFX_FloatRect& crBBox) { CFX_ByteString CPWL_Utils::GetAP_Star(const CFX_FloatRect& crBBox) { CFX_ByteTextBuf csAP; - FX_FLOAT fRadius = - (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f)); + float fRadius = (crBBox.top - crBBox.bottom) / (1 + (float)cos(FX_PI / 5.0f)); CFX_PointF ptCenter = CFX_PointF((crBBox.left + crBBox.right) / 2.0f, (crBBox.top + crBBox.bottom) / 2.0f); - FX_FLOAT px[5], py[5]; + float px[5], py[5]; - FX_FLOAT fAngel = FX_PI / 10.0f; + float fAngel = FX_PI / 10.0f; for (int32_t i = 0; i < 5; i++) { - px[i] = ptCenter.x + fRadius * (FX_FLOAT)cos(fAngel); - py[i] = ptCenter.y + fRadius * (FX_FLOAT)sin(fAngel); + px[i] = ptCenter.x + fRadius * (float)cos(fAngel); + py[i] = ptCenter.y + fRadius * (float)sin(fAngel); fAngel += FX_PI * 2 / 5.0f; } @@ -217,17 +216,17 @@ CFX_ByteString CPWL_Utils::GetAP_Star(const CFX_FloatRect& crBBox) { } CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CFX_FloatRect& crBBox, - FX_FLOAT fRotate) { + float fRotate) { CFX_ByteTextBuf csAP; - FX_FLOAT fWidth = crBBox.right - crBBox.left; - FX_FLOAT fHeight = crBBox.top - crBBox.bottom; + float fWidth = crBBox.right - crBBox.left; + float fHeight = crBBox.top - crBBox.bottom; CFX_PointF pt1(-fWidth / 2, 0); CFX_PointF pt2(0, fHeight / 2); CFX_PointF pt3(fWidth / 2, 0); - FX_FLOAT px, py; + float px, py; csAP << cos(fRotate) << " " << sin(fRotate) << " " << -sin(fRotate) << " " << cos(fRotate) << " " << crBBox.left + fWidth / 2 << " " @@ -252,7 +251,7 @@ CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CFX_FloatRect& crBBox, } CFX_FloatRect CPWL_Utils::InflateRect(const CFX_FloatRect& rcRect, - FX_FLOAT fSize) { + float fSize) { if (rcRect.IsEmpty()) return rcRect; @@ -263,7 +262,7 @@ CFX_FloatRect CPWL_Utils::InflateRect(const CFX_FloatRect& rcRect, } CFX_FloatRect CPWL_Utils::DeflateRect(const CFX_FloatRect& rcRect, - FX_FLOAT fSize) { + float fSize) { if (rcRect.IsEmpty()) return rcRect; @@ -273,10 +272,9 @@ CFX_FloatRect CPWL_Utils::DeflateRect(const CFX_FloatRect& rcRect, return rcNew; } -CFX_FloatRect CPWL_Utils::ScaleRect(const CFX_FloatRect& rcRect, - FX_FLOAT fScale) { - FX_FLOAT fHalfWidth = (rcRect.right - rcRect.left) / 2.0f; - FX_FLOAT fHalfHeight = (rcRect.top - rcRect.bottom) / 2.0f; +CFX_FloatRect CPWL_Utils::ScaleRect(const CFX_FloatRect& rcRect, float fScale) { + float fHalfWidth = (rcRect.right - rcRect.left) / 2.0f; + float fHalfHeight = (rcRect.top - rcRect.bottom) / 2.0f; CFX_PointF ptCenter = CFX_PointF((rcRect.left + rcRect.right) / 2, (rcRect.top + rcRect.bottom) / 2); @@ -311,13 +309,13 @@ CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CFX_FloatRect& rect, } CFX_FloatRect CPWL_Utils::GetCenterSquare(const CFX_FloatRect& rect) { - FX_FLOAT fWidth = rect.right - rect.left; - FX_FLOAT fHeight = rect.top - rect.bottom; + float fWidth = rect.right - rect.left; + float fHeight = rect.top - rect.bottom; - FX_FLOAT fCenterX = (rect.left + rect.right) / 2.0f; - FX_FLOAT fCenterY = (rect.top + rect.bottom) / 2.0f; + float fCenterX = (rect.left + rect.right) / 2.0f; + float fCenterY = (rect.top + rect.bottom) / 2.0f; - FX_FLOAT fRadius = (fWidth > fHeight) ? fHeight / 2 : fWidth / 2; + float fRadius = (fWidth > fHeight) ? fHeight / 2 : fWidth / 2; return CFX_FloatRect(fCenterX - fRadius, fCenterY - fRadius, fCenterX + fRadius, fCenterY + fRadius); @@ -344,9 +342,9 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, CPDF_IconFit& IconFit, const CFX_WideString& sLabel, const CPWL_Color& crText, - FX_FLOAT fFontSize, + float fFontSize, int32_t nLayOut) { - const FX_FLOAT fAutoFontScale = 1.0f / 3.0f; + const float fAutoFontScale = 1.0f / 3.0f; std::unique_ptr pEdit(new CFX_Edit); pEdit->SetFontMap(pFontMap); @@ -372,8 +370,8 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, CFX_FloatRect rcLabel = CFX_FloatRect(0, 0, 0, 0); CFX_FloatRect rcIcon = CFX_FloatRect(0, 0, 0, 0); - FX_FLOAT fWidth = 0.0f; - FX_FLOAT fHeight = 0.0f; + float fWidth = 0.0f; + float fHeight = 0.0f; switch (nLayOut) { case PPBL_LABEL: @@ -585,7 +583,7 @@ CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color& color, } CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, - FX_FLOAT fWidth, + float fWidth, const CPWL_Color& color, const CPWL_Color& crLeftTop, const CPWL_Color& crRightBottom, @@ -594,13 +592,13 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, CFX_ByteTextBuf sAppStream; CFX_ByteString sColor; - FX_FLOAT fLeft = rect.left; - FX_FLOAT fRight = rect.right; - FX_FLOAT fTop = rect.top; - FX_FLOAT fBottom = rect.bottom; + float fLeft = rect.left; + float fRight = rect.right; + float fTop = rect.top; + float fBottom = rect.bottom; if (fWidth > 0.0f) { - FX_FLOAT fHalfWidth = fWidth / 2.0f; + float fHalfWidth = fWidth / 2.0f; sAppStream << "q\n"; @@ -702,7 +700,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( const CFX_FloatRect& rect, - FX_FLOAT fWidth, + float fWidth, const CPWL_Color& color, const CPWL_Color& crLeftTop, const CPWL_Color& crRightBottom, @@ -738,7 +736,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( } } break; case BorderStyle::BEVELED: { - FX_FLOAT fHalfWidth = fWidth / 2.0f; + float fHalfWidth = fWidth / 2.0f; sColor = CPWL_Utils::GetColorAppStream(color, false); if (sColor.GetLength() > 0) { @@ -765,7 +763,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( } } break; case BorderStyle::INSET: { - FX_FLOAT fHalfWidth = fWidth / 2.0f; + float fHalfWidth = fWidth / 2.0f; sColor = CPWL_Utils::GetColorAppStream(color, false); if (sColor.GetLength() > 0) { @@ -961,7 +959,7 @@ void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, const CFX_FloatRect& rect, const FX_COLORREF& color, - FX_FLOAT fWidth) { + float fWidth) { CFX_PathData path; CFX_FloatRect rcTemp(rect); path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top); @@ -977,7 +975,7 @@ void CPWL_Utils::DrawStrokeLine(CFX_RenderDevice* pDevice, const CFX_PointF& ptMoveTo, const CFX_PointF& ptLineTo, const FX_COLORREF& color, - FX_FLOAT fWidth) { + float fWidth) { CFX_PathData path; path.AppendPoint(ptMoveTo, FXPT_TYPE::MoveTo, false); path.AppendPoint(ptLineTo, FXPT_TYPE::LineTo, false); @@ -1005,12 +1003,12 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, int32_t nTransparency, int32_t nStartGray, int32_t nEndGray) { - FX_FLOAT fStepGray = 1.0f; + float fStepGray = 1.0f; if (bVertical) { fStepGray = (nEndGray - nStartGray) / rect.Height(); - for (FX_FLOAT fy = rect.bottom + 0.5f; fy <= rect.top - 0.5f; fy += 1.0f) { + for (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), @@ -1022,7 +1020,7 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, if (bHorizontal) { fStepGray = (nEndGray - nStartGray) / rect.Width(); - for (FX_FLOAT fx = rect.left + 0.5f; fx <= rect.right - 0.5f; fx += 1.0f) { + for (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), @@ -1035,19 +1033,19 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, const CFX_FloatRect& rect, - FX_FLOAT fWidth, + float fWidth, const CPWL_Color& color, const CPWL_Color& crLeftTop, const CPWL_Color& crRightBottom, BorderStyle nStyle, int32_t nTransparency) { - FX_FLOAT fLeft = rect.left; - FX_FLOAT fRight = rect.right; - FX_FLOAT fTop = rect.top; - FX_FLOAT fBottom = rect.bottom; + float fLeft = rect.left; + float fRight = rect.right; + float fTop = rect.top; + float fBottom = rect.bottom; if (fWidth > 0.0f) { - FX_FLOAT fHalfWidth = fWidth / 2.0f; + float fHalfWidth = fWidth / 2.0f; switch (nStyle) { default: diff --git a/fpdfsdk/pdfwindow/PWL_Utils.h b/fpdfsdk/pdfwindow/PWL_Utils.h index a4ecc19ee5..29fe239635 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.h +++ b/fpdfsdk/pdfwindow/PWL_Utils.h @@ -35,21 +35,19 @@ struct CPWL_Color; class CPWL_Utils { public: - static CFX_FloatRect InflateRect(const CFX_FloatRect& rcRect, FX_FLOAT fSize); - static CFX_FloatRect DeflateRect(const CFX_FloatRect& rcRect, FX_FLOAT fSize); + static CFX_FloatRect InflateRect(const CFX_FloatRect& rcRect, float fSize); + static CFX_FloatRect DeflateRect(const CFX_FloatRect& rcRect, float fSize); static CPVT_WordRange OverlapWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2); static CFX_FloatRect GetCenterSquare(const CFX_FloatRect& rect); - static CFX_FloatRect OffsetRect(const CFX_FloatRect& rect, - FX_FLOAT x, - FX_FLOAT y); + static CFX_FloatRect OffsetRect(const CFX_FloatRect& rect, float x, float y); static CFX_ByteString GetColorAppStream(const CPWL_Color& color, const bool& bFillOrStroke = true); static CFX_ByteString GetBorderAppStream(const CFX_FloatRect& rect, - FX_FLOAT fWidth, + float fWidth, const CPWL_Color& color, const CPWL_Color& crLeftTop, const CPWL_Color& crRightBottom, @@ -57,7 +55,7 @@ class CPWL_Utils { const CPWL_Dash& dash); static CFX_ByteString GetCircleBorderAppStream( const CFX_FloatRect& rect, - FX_FLOAT fWidth, + float fWidth, const CPWL_Color& color, const CPWL_Color& crLeftTop, const CPWL_Color& crRightBottom, @@ -73,7 +71,7 @@ class CPWL_Utils { CPDF_IconFit& IconFit, const CFX_WideString& sLabel, const CPWL_Color& crText, - FX_FLOAT fFontSize, + float fFontSize, int32_t nLayOut); static CFX_ByteString GetCheckBoxAppStream(const CFX_FloatRect& rcBBox, int32_t nStyle, @@ -105,17 +103,17 @@ class CPWL_Utils { CFX_Matrix* pUser2Device, const CFX_FloatRect& rect, const FX_COLORREF& color, - FX_FLOAT fWidth); + float fWidth); static void DrawStrokeLine(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, const CFX_PointF& ptMoveTo, const CFX_PointF& ptLineTo, const FX_COLORREF& color, - FX_FLOAT fWidth); + float fWidth); static void DrawBorder(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, const CFX_FloatRect& rect, - FX_FLOAT fWidth, + float fWidth, const CPWL_Color& color, const CPWL_Color& crLeftTop, const CPWL_Color& crRightBottom, @@ -136,7 +134,7 @@ class CPWL_Utils { int32_t nEndGray); private: - static CFX_FloatRect ScaleRect(const CFX_FloatRect& rcRect, FX_FLOAT fScale); + static CFX_FloatRect ScaleRect(const CFX_FloatRect& rcRect, float fScale); static CFX_ByteString GetAppStream_Check(const CFX_FloatRect& rcBBox, const CPWL_Color& crText); @@ -158,7 +156,7 @@ class CPWL_Utils { static CFX_ByteString GetAP_Square(const CFX_FloatRect& crBBox); static CFX_ByteString GetAP_Star(const CFX_FloatRect& crBBox); static CFX_ByteString GetAP_HalfCircle(const CFX_FloatRect& crBBox, - FX_FLOAT fRotate); + float fRotate); }; #endif // FPDFSDK_PDFWINDOW_PWL_UTILS_H_ diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp index dc307a1be3..075b74651b 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp @@ -319,7 +319,7 @@ void CPWL_Wnd::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (HasFlag(PWS_BORDER)) { sThis << CPWL_Utils::GetBorderAppStream( - rectWnd, (FX_FLOAT)GetBorderWidth(), GetBorderColor(), + rectWnd, (float)GetBorderWidth(), GetBorderColor(), GetBorderLeftTopColor(GetBorderStyle()), GetBorderRightBottomColor(GetBorderStyle()), GetBorderStyle(), GetBorderDash()); @@ -350,14 +350,14 @@ void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice, if (!rectWnd.IsEmpty()) { if (HasFlag(PWS_BACKGROUND)) { CFX_FloatRect rcClient = CPWL_Utils::DeflateRect( - rectWnd, (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); + rectWnd, (float)(GetBorderWidth() + GetInnerBorderWidth())); CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient, GetBackgroundColor(), GetTransparency()); } if (HasFlag(PWS_BORDER)) CPWL_Utils::DrawBorder(pDevice, pUser2Device, rectWnd, - (FX_FLOAT)GetBorderWidth(), GetBorderColor(), + (float)GetBorderWidth(), GetBorderColor(), GetBorderLeftTopColor(GetBorderStyle()), GetBorderRightBottomColor(GetBorderStyle()), GetBorderStyle(), GetTransparency()); @@ -520,7 +520,7 @@ CFX_FloatRect CPWL_Wnd::GetWindowRect() const { CFX_FloatRect CPWL_Wnd::GetClientRect() const { CFX_FloatRect rcWindow = GetWindowRect(); CFX_FloatRect rcClient = CPWL_Utils::DeflateRect( - rcWindow, (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); + rcWindow, (float)(GetBorderWidth() + GetInnerBorderWidth())); if (CPWL_ScrollBar* pVSB = GetVScrollBar()) rcClient.right -= pVSB->GetScrollBarWidth(); @@ -700,7 +700,7 @@ bool CPWL_Wnd::IsReadOnly() const { void CPWL_Wnd::RePosChildWnd() { CFX_FloatRect rcContent = CPWL_Utils::DeflateRect( - GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); + GetWindowRect(), (float)(GetBorderWidth() + GetInnerBorderWidth())); CPWL_ScrollBar* pVSB = GetVScrollBar(); @@ -767,11 +767,11 @@ CFX_FloatRect CPWL_Wnd::GetFocusRect() const { return CPWL_Utils::InflateRect(GetWindowRect(), 1); } -FX_FLOAT CPWL_Wnd::GetFontSize() const { +float CPWL_Wnd::GetFontSize() const { return m_sPrivateParam.fFontSize; } -void CPWL_Wnd::SetFontSize(FX_FLOAT fFontSize) { +void CPWL_Wnd::SetFontSize(float fFontSize) { m_sPrivateParam.fFontSize = fFontSize; } diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h index 55836d43a2..ded003c31b 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/pdfwindow/PWL_Wnd.h @@ -204,7 +204,7 @@ struct PWL_CREATEPARAM { CPWL_Color sBorderColor; // optional CPWL_Color sTextColor; // optional int32_t nTransparency; // optional - FX_FLOAT fFontSize; // optional + float fFontSize; // optional CPWL_Dash sDash; // optional void* pAttachedData; // optional CPWL_Wnd* pParentWnd; // ignore @@ -269,8 +269,8 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual void KillFocus(); virtual void SetCursor(); virtual void SetVisible(bool bVisible); - virtual void SetFontSize(FX_FLOAT fFontSize); - virtual FX_FLOAT GetFontSize() const; + virtual void SetFontSize(float fFontSize); + virtual float GetFontSize() const; virtual CFX_FloatRect GetFocusRect() const; virtual CFX_FloatRect GetClientRect() const; diff --git a/fpdfsdk/pdfwindow/cpwl_color.cpp b/fpdfsdk/pdfwindow/cpwl_color.cpp index 9c9ca3eff0..689c3dec45 100644 --- a/fpdfsdk/pdfwindow/cpwl_color.cpp +++ b/fpdfsdk/pdfwindow/cpwl_color.cpp @@ -10,14 +10,11 @@ namespace { -bool InRange(FX_FLOAT comp) { +bool InRange(float comp) { return comp >= 0.0f && comp <= 1.0f; } -CPWL_Color ConvertCMYK2GRAY(FX_FLOAT dC, - FX_FLOAT dM, - FX_FLOAT dY, - FX_FLOAT dK) { +CPWL_Color ConvertCMYK2GRAY(float dC, float dM, float dY, float dK) { if (!InRange(dC) || !InRange(dM) || !InRange(dY) || !InRange(dK)) return CPWL_Color(COLORTYPE_GRAY); return CPWL_Color( @@ -25,25 +22,25 @@ CPWL_Color ConvertCMYK2GRAY(FX_FLOAT dC, 1.0f - std::min(1.0f, 0.3f * dC + 0.59f * dM + 0.11f * dY + dK)); } -CPWL_Color ConvertGRAY2CMYK(FX_FLOAT dGray) { +CPWL_Color ConvertGRAY2CMYK(float dGray) { if (!InRange(dGray)) return CPWL_Color(COLORTYPE_CMYK); return CPWL_Color(COLORTYPE_CMYK, 0.0f, 0.0f, 0.0f, 1.0f - dGray); } -CPWL_Color ConvertGRAY2RGB(FX_FLOAT dGray) { +CPWL_Color ConvertGRAY2RGB(float dGray) { if (!InRange(dGray)) return CPWL_Color(COLORTYPE_RGB); return CPWL_Color(COLORTYPE_RGB, dGray, dGray, dGray); } -CPWL_Color ConvertRGB2GRAY(FX_FLOAT dR, FX_FLOAT dG, FX_FLOAT dB) { +CPWL_Color ConvertRGB2GRAY(float dR, float dG, float dB) { if (!InRange(dR) || !InRange(dG) || !InRange(dB)) return CPWL_Color(COLORTYPE_GRAY); return CPWL_Color(COLORTYPE_GRAY, 0.3f * dR + 0.59f * dG + 0.11f * dB); } -CPWL_Color ConvertCMYK2RGB(FX_FLOAT dC, FX_FLOAT dM, FX_FLOAT dY, FX_FLOAT dK) { +CPWL_Color ConvertCMYK2RGB(float dC, float dM, float dY, float dK) { if (!InRange(dC) || !InRange(dM) || !InRange(dY) || !InRange(dK)) return CPWL_Color(COLORTYPE_RGB); return CPWL_Color(COLORTYPE_RGB, 1.0f - std::min(1.0f, dC + dK), @@ -51,13 +48,13 @@ CPWL_Color ConvertCMYK2RGB(FX_FLOAT dC, FX_FLOAT dM, FX_FLOAT dY, FX_FLOAT dK) { 1.0f - std::min(1.0f, dY + dK)); } -CPWL_Color ConvertRGB2CMYK(FX_FLOAT dR, FX_FLOAT dG, FX_FLOAT dB) { +CPWL_Color ConvertRGB2CMYK(float dR, float dG, float dB) { if (!InRange(dR) || !InRange(dG) || !InRange(dB)) return CPWL_Color(COLORTYPE_CMYK); - FX_FLOAT c = 1.0f - dR; - FX_FLOAT m = 1.0f - dG; - FX_FLOAT y = 1.0f - dB; + float c = 1.0f - dR; + float m = 1.0f - dG; + float y = 1.0f - dB; return CPWL_Color(COLORTYPE_CMYK, c, m, y, std::min(c, std::min(m, y))); } @@ -135,7 +132,7 @@ FX_COLORREF CPWL_Color::ToFXColor(int32_t nTransparency) const { static_cast(ret.fColor3 * 255)); } -CPWL_Color CPWL_Color::operator-(FX_FLOAT fColorSub) const { +CPWL_Color CPWL_Color::operator-(float fColorSub) const { CPWL_Color sRet(nColorType); switch (nColorType) { case COLORTYPE_TRANSPARENT: @@ -156,7 +153,7 @@ CPWL_Color CPWL_Color::operator-(FX_FLOAT fColorSub) const { return sRet; } -CPWL_Color CPWL_Color::operator/(FX_FLOAT fColorDivide) const { +CPWL_Color CPWL_Color::operator/(float fColorDivide) const { CPWL_Color sRet(nColorType); switch (nColorType) { case COLORTYPE_TRANSPARENT: diff --git a/fpdfsdk/pdfwindow/cpwl_color.h b/fpdfsdk/pdfwindow/cpwl_color.h index f1b34c7eb8..6eae48738f 100644 --- a/fpdfsdk/pdfwindow/cpwl_color.h +++ b/fpdfsdk/pdfwindow/cpwl_color.h @@ -11,10 +11,10 @@ struct CPWL_Color { CPWL_Color(int32_t type = COLORTYPE_TRANSPARENT, - FX_FLOAT color1 = 0.0f, - FX_FLOAT color2 = 0.0f, - FX_FLOAT color3 = 0.0f, - FX_FLOAT color4 = 0.0f) + float color1 = 0.0f, + float color2 = 0.0f, + float color3 = 0.0f, + float color4 = 0.0f) : nColorType(type), fColor1(color1), fColor2(color2), @@ -28,8 +28,8 @@ struct CPWL_Color { fColor3(b / 255.0f), fColor4(0) {} - CPWL_Color operator/(FX_FLOAT fColorDivide) const; - CPWL_Color operator-(FX_FLOAT fColorSub) const; + CPWL_Color operator/(float fColorDivide) const; + CPWL_Color operator-(float fColorSub) const; CPWL_Color ConvertColorType(int32_t other_nColorType) const; @@ -44,10 +44,10 @@ struct CPWL_Color { } int32_t nColorType; - FX_FLOAT fColor1; - FX_FLOAT fColor2; - FX_FLOAT fColor3; - FX_FLOAT fColor4; + float fColor1; + float fColor2; + float fColor3; + float fColor4; }; #endif // FPDFSDK_PDFWINDOW_CPWL_COLOR_H_ -- cgit v1.2.3