diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-14 14:43:42 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-14 19:05:58 +0000 |
commit | 05df075154a832fcb476e1dfcfb865722d0ea898 (patch) | |
tree | b8b771b62adae74d5d5ee561db75d10de3a848bf /xfa/fde | |
parent | 6b94f01d1c8ad386d497428c7397b1a99614aeba (diff) | |
download | pdfium-05df075154a832fcb476e1dfcfb865722d0ea898.tar.xz |
Replace FX_FLOAT with underlying float type.
Change-Id: I158b7d80b0ec28b742a9f2d5a96f3dde7fb3ab56
Reviewed-on: https://pdfium-review.googlesource.com/3031
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fde')
-rw-r--r-- | xfa/fde/cfde_path.cpp | 41 | ||||
-rw-r--r-- | xfa/fde/cfde_path.h | 10 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtengine.cpp | 2 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtengine.h | 2 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtpage.cpp | 20 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtpage.h | 2 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedttextset.cpp | 2 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedttextset.h | 2 | ||||
-rw-r--r-- | xfa/fde/css/cfde_csscomputedstyle.cpp | 12 | ||||
-rw-r--r-- | xfa/fde/css/cfde_csscomputedstyle.h | 18 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssdeclaration.cpp | 12 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssnumbervalue.cpp | 4 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssnumbervalue.h | 8 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssstyleselector.cpp | 12 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssstyleselector.h | 8 | ||||
-rw-r--r-- | xfa/fde/css/fde_css.h | 12 | ||||
-rw-r--r-- | xfa/fde/fde_gedevice.cpp | 48 | ||||
-rw-r--r-- | xfa/fde/fde_gedevice.h | 32 | ||||
-rw-r--r-- | xfa/fde/fde_render.cpp | 6 | ||||
-rw-r--r-- | xfa/fde/ifde_txtedtengine.h | 12 | ||||
-rw-r--r-- | xfa/fde/tto/fde_textout.cpp | 69 | ||||
-rw-r--r-- | xfa/fde/tto/fde_textout.h | 29 | ||||
-rw-r--r-- | xfa/fde/xml/fde_xml_imp.cpp | 13 | ||||
-rw-r--r-- | xfa/fde/xml/fde_xml_imp.h | 8 |
24 files changed, 188 insertions, 196 deletions
diff --git a/xfa/fde/cfde_path.cpp b/xfa/fde/cfde_path.cpp index 5e6cf5cf56..32f67e31a0 100644 --- a/xfa/fde/cfde_path.cpp +++ b/xfa/fde/cfde_path.cpp @@ -36,16 +36,15 @@ void CFDE_Path::BezierTo(const CFX_PointF& p1, void CFDE_Path::ArcTo(bool bStart, const CFX_RectF& rect, - FX_FLOAT startAngle, - FX_FLOAT endAngle) { - FX_FLOAT rx = rect.width / 2; - FX_FLOAT ry = rect.height / 2; - FX_FLOAT cx = rect.left + rx; - FX_FLOAT cy = rect.top + ry; - FX_FLOAT alpha = + float startAngle, + float endAngle) { + float rx = rect.width / 2; + float ry = rect.height / 2; + float cx = rect.left + rx; + float cy = rect.top + ry; + float alpha = FXSYS_atan2(rx * FXSYS_sin(startAngle), ry * FXSYS_cos(startAngle)); - FX_FLOAT beta = - FXSYS_atan2(rx * FXSYS_sin(endAngle), ry * FXSYS_cos(endAngle)); + float beta = FXSYS_atan2(rx * FXSYS_sin(endAngle), ry * FXSYS_cos(endAngle)); if (FXSYS_fabs(beta - alpha) > FX_PI) { if (beta > alpha) beta -= 2 * FX_PI; @@ -53,12 +52,12 @@ void CFDE_Path::ArcTo(bool bStart, alpha -= 2 * FX_PI; } - FX_FLOAT half_delta = (beta - alpha) / 2; - FX_FLOAT bcp = 4.0f / 3 * (1 - FXSYS_cos(half_delta)) / FXSYS_sin(half_delta); - FX_FLOAT sin_alpha = FXSYS_sin(alpha); - FX_FLOAT sin_beta = FXSYS_sin(beta); - FX_FLOAT cos_alpha = FXSYS_cos(alpha); - FX_FLOAT cos_beta = FXSYS_cos(beta); + float half_delta = (beta - alpha) / 2; + float bcp = 4.0f / 3 * (1 - FXSYS_cos(half_delta)) / FXSYS_sin(half_delta); + float sin_alpha = FXSYS_sin(alpha); + float sin_beta = FXSYS_sin(beta); + float cos_alpha = FXSYS_cos(alpha); + float cos_beta = FXSYS_cos(beta); if (bStart) MoveTo(CFX_PointF(cx + rx * cos_alpha, cy + ry * sin_alpha)); @@ -92,13 +91,13 @@ void CFDE_Path::AddBeziers(const std::vector<CFX_PointF>& points) { void CFDE_Path::GetCurveTangents(const std::vector<CFX_PointF>& points, std::vector<CFX_PointF>* tangents, bool bClosed, - FX_FLOAT fTension) const { + float fTension) const { int32_t iCount = pdfium::CollectionSize<int32_t>(points); tangents->resize(iCount); if (iCount < 3) return; - FX_FLOAT fCoefficient = fTension / 3.0f; + float fCoefficient = fTension / 3.0f; const CFX_PointF* pPoints = points.data(); CFX_PointF* pTangents = tangents->data(); for (int32_t i = 0; i < iCount; ++i) { @@ -116,7 +115,7 @@ void CFDE_Path::GetCurveTangents(const std::vector<CFX_PointF>& points, void CFDE_Path::AddCurve(const std::vector<CFX_PointF>& points, bool bClosed, - FX_FLOAT fTension) { + float fTension) { int32_t iLast = pdfium::CollectionSize<int32_t>(points) - 1; if (iLast < 1) return; @@ -144,8 +143,8 @@ void CFDE_Path::AddCurve(const std::vector<CFX_PointF>& points, } void CFDE_Path::AddEllipse(const CFX_RectF& rect) { - FX_FLOAT fStartAngle = 0; - FX_FLOAT fEndAngle = FX_PI / 2; + float fStartAngle = 0; + float fEndAngle = FX_PI / 2; for (int32_t i = 0; i < 4; ++i) { ArcTo(i == 0, rect, fStartAngle, fEndAngle); fStartAngle += FX_PI / 2; @@ -216,7 +215,7 @@ CFX_RectF CFDE_Path::GetBBox() const { return bbox; } -CFX_RectF CFDE_Path::GetBBox(FX_FLOAT fLineWidth, FX_FLOAT fMiterLimit) const { +CFX_RectF CFDE_Path::GetBBox(float fLineWidth, float fMiterLimit) const { CFX_FloatRect rect = m_Path.GetBoundingBox(fLineWidth, fMiterLimit); CFX_RectF bbox = CFX_RectF(rect.left, rect.top, rect.Width(), rect.Height()); bbox.Normalize(); diff --git a/xfa/fde/cfde_path.h b/xfa/fde/cfde_path.h index 99ff4d3680..b0a229f172 100644 --- a/xfa/fde/cfde_path.h +++ b/xfa/fde/cfde_path.h @@ -20,7 +20,7 @@ class CFDE_Path { void AddBeziers(const std::vector<CFX_PointF>& points); void AddCurve(const std::vector<CFX_PointF>& points, bool bClosed, - FX_FLOAT fTension = 0.5f); + float fTension = 0.5f); void AddEllipse(const CFX_RectF& rect); void AddLines(const std::vector<CFX_PointF>& points); void AddLine(const CFX_PointF& pt1, const CFX_PointF& pt2); @@ -29,7 +29,7 @@ class CFDE_Path { void AddRectangle(const CFX_RectF& rect); CFX_RectF GetBBox() const; - CFX_RectF GetBBox(FX_FLOAT fLineWidth, FX_FLOAT fMiterLimit) const; + CFX_RectF GetBBox(float fLineWidth, float fMiterLimit) const; bool FigureClosed() const; void BezierTo(const CFX_PointF& p1, @@ -37,15 +37,15 @@ class CFDE_Path { const CFX_PointF& p3); void ArcTo(bool bStart, const CFX_RectF& rect, - FX_FLOAT startAngle, - FX_FLOAT endAngle); + float startAngle, + float endAngle); void MoveTo(const CFX_PointF& p); void LineTo(const CFX_PointF& p); void GetCurveTangents(const std::vector<CFX_PointF>& points, std::vector<CFX_PointF>* tangents, bool bClosed, - FX_FLOAT fTension) const; + float fTension) const; CFX_PathData m_Path; }; diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp index 33efa2ddf0..380948e899 100644 --- a/xfa/fde/cfde_txtedtengine.cpp +++ b/xfa/fde/cfde_txtedtengine.cpp @@ -1029,7 +1029,7 @@ void CFDE_TxtEdtEngine::UpdateTxtBreak() { m_nPageLineCount = m_Param.nLineCount; if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText) { - FX_FLOAT fCombWidth = m_Param.fPlateWidth; + float fCombWidth = m_Param.fPlateWidth; if (m_nLimit > 0) fCombWidth /= m_nLimit; diff --git a/xfa/fde/cfde_txtedtengine.h b/xfa/fde/cfde_txtedtengine.h index 63d97d33a3..5499189295 100644 --- a/xfa/fde/cfde_txtedtengine.h +++ b/xfa/fde/cfde_txtedtengine.h @@ -157,7 +157,7 @@ class CFDE_TxtEdtEngine { int32_t m_nLineCount; int32_t m_nAnchorPos; int32_t m_nLayoutPos; - FX_FLOAT m_fCaretPosReserve; + float m_fCaretPosReserve; int32_t m_nCaret; bool m_bBefore; int32_t m_nCaretPage; diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp index f229a01fcb..4bf3e9fb5e 100644 --- a/xfa/fde/cfde_txtedtpage.cpp +++ b/xfa/fde/cfde_txtedtpage.cpp @@ -262,9 +262,9 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, m_pEndParag->GetLineRange(nEndLine - nEndLineInParag, nPageEnd, nTemp); nPageEnd += (nTemp - 1); - FX_FLOAT fLineStart = 0.0f; - FX_FLOAT fLineStep = pParams->fLineSpace; - FX_FLOAT fLinePos = fLineStart; + float fLineStart = 0.0f; + float fLineStep = pParams->fLineSpace; + float fLinePos = fLineStart; if (!m_pTextSet) m_pTextSet = pdfium::MakeUnique<CFDE_TxtEdtTextSet>(this); @@ -278,7 +278,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, m_nPageStart = nPageStart; m_nCharCount = nPageEnd - nPageStart + 1; bool bReload = false; - FX_FLOAT fDefCharWidth = 0; + float fDefCharWidth = 0; std::unique_ptr<IFX_CharIter> pIter(m_pIter->Clone()); pIter->SetAt(nPageStart); m_pIter->SetAt(nPageStart); @@ -306,7 +306,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, if (FX_IsOdd(pPiece->m_iBidiLevel)) { TxtEdtPiece.dwCharStyles |= FX_TXTCHARSTYLE_OddBidiLevel; } - FX_FLOAT fParaBreakWidth = 0.0f; + float fParaBreakWidth = 0.0f; if (!CFX_BreakTypeNoneOrPiece(pPiece->m_dwStatus)) { wchar_t wRtChar = pParams->wLineBreakChar; if (TxtEdtPiece.nCount >= 2) { @@ -329,10 +329,10 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, } } - TxtEdtPiece.rtPiece.left = (FX_FLOAT)pPiece->m_iStartPos / 20000.0f; + TxtEdtPiece.rtPiece.left = (float)pPiece->m_iStartPos / 20000.0f; TxtEdtPiece.rtPiece.top = fLinePos; TxtEdtPiece.rtPiece.width = - (FX_FLOAT)pPiece->m_iWidth / 20000.0f + fParaBreakWidth; + (float)pPiece->m_iWidth / 20000.0f + fParaBreakWidth; TxtEdtPiece.rtPiece.height = pParams->fLineSpace; if (bFirstPiece) { @@ -357,7 +357,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, } } while (pIter->Next(false) && (pIter->GetAt() <= nPageEnd)); if (m_rtPageContents.left != 0) { - FX_FLOAT fDelta = 0.0f; + float fDelta = 0.0f; if (m_rtPageContents.width < pParams->fPlateWidth) { if (pParams->dwAlignment & FDE_TEXTEDITALIGN_Right) { fDelta = pParams->fPlateWidth - m_rtPageContents.width; @@ -372,7 +372,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, } } } - FX_FLOAT fOffset = m_rtPageContents.left - fDelta; + float fOffset = m_rtPageContents.left - fDelta; for (auto& piece : m_Pieces) piece.rtPiece.Offset(-fOffset, 0.0f); @@ -453,7 +453,7 @@ int32_t CFDE_TxtEdtPage::GetWidth(const FDE_TEXTEDITPIECE* pIdentity, void CFDE_TxtEdtPage::NormalizePt2Rect(CFX_PointF& ptF, const CFX_RectF& rtF, - FX_FLOAT fTolerance) const { + float fTolerance) const { if (rtF.Contains(ptF)) return; if (ptF.x < rtF.left) diff --git a/xfa/fde/cfde_txtedtpage.h b/xfa/fde/cfde_txtedtpage.h index 11c8050735..d2496195a5 100644 --- a/xfa/fde/cfde_txtedtpage.h +++ b/xfa/fde/cfde_txtedtpage.h @@ -55,7 +55,7 @@ class CFDE_TxtEdtPage : public IFDE_VisualSet { private: void NormalizePt2Rect(CFX_PointF& ptF, const CFX_RectF& rtF, - FX_FLOAT fTolerance) const; + float fTolerance) const; std::unique_ptr<IFX_CharIter> m_pIter; std::unique_ptr<CFDE_TxtEdtTextSet> m_pTextSet; diff --git a/xfa/fde/cfde_txtedttextset.cpp b/xfa/fde/cfde_txtedttextset.cpp index 78a7ec49d5..ff7b39bb9f 100644 --- a/xfa/fde/cfde_txtedttextset.cpp +++ b/xfa/fde/cfde_txtedttextset.cpp @@ -38,7 +38,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFDE_TxtEdtTextSet::GetFont() { return m_pPage->GetEngine()->GetEditParams()->pFont; } -FX_FLOAT CFDE_TxtEdtTextSet::GetFontSize() { +float CFDE_TxtEdtTextSet::GetFontSize() { return m_pPage->GetEngine()->GetEditParams()->fFontSize; } diff --git a/xfa/fde/cfde_txtedttextset.h b/xfa/fde/cfde_txtedttextset.h index 8046d38d79..35f7472b1f 100644 --- a/xfa/fde/cfde_txtedttextset.h +++ b/xfa/fde/cfde_txtedttextset.h @@ -24,7 +24,7 @@ class CFDE_TxtEdtTextSet : public IFDE_VisualSet { int32_t GetString(FDE_TEXTEDITPIECE* pPiece, CFX_WideString& wsText); CFX_RetainPtr<CFGAS_GEFont> GetFont(); - FX_FLOAT GetFontSize(); + float GetFontSize(); FX_ARGB GetFontColor(); int32_t GetDisplayPos(const FDE_TEXTEDITPIECE& pPiece, FXTEXT_CHARPOS* pCharPos, diff --git a/xfa/fde/css/cfde_csscomputedstyle.cpp b/xfa/fde/css/cfde_csscomputedstyle.cpp index 01872d18fc..92184d4259 100644 --- a/xfa/fde/css/cfde_csscomputedstyle.cpp +++ b/xfa/fde/css/cfde_csscomputedstyle.cpp @@ -50,7 +50,7 @@ FDE_CSSFontStyle CFDE_CSSComputedStyle::GetFontStyle() const { return m_InheritedData.m_eFontStyle; } -FX_FLOAT CFDE_CSSComputedStyle::GetFontSize() const { +float CFDE_CSSComputedStyle::GetFontSize() const { return m_InheritedData.m_fFontSize; } @@ -70,7 +70,7 @@ void CFDE_CSSComputedStyle::SetFontStyle(FDE_CSSFontStyle eFontStyle) { m_InheritedData.m_eFontStyle = eFontStyle; } -void CFDE_CSSComputedStyle::SetFontSize(FX_FLOAT fFontSize) { +void CFDE_CSSComputedStyle::SetFontSize(float fFontSize) { m_InheritedData.m_fFontSize = fFontSize; } @@ -107,7 +107,7 @@ FDE_CSSDisplay CFDE_CSSComputedStyle::GetDisplay() const { return m_NonInheritedData.m_eDisplay; } -FX_FLOAT CFDE_CSSComputedStyle::GetLineHeight() const { +float CFDE_CSSComputedStyle::GetLineHeight() const { return m_InheritedData.m_fLineHeight; } @@ -123,7 +123,7 @@ FDE_CSSVerticalAlign CFDE_CSSComputedStyle::GetVerticalAlign() const { return m_NonInheritedData.m_eVerticalAlign; } -FX_FLOAT CFDE_CSSComputedStyle::GetNumberVerticalAlign() const { +float CFDE_CSSComputedStyle::GetNumberVerticalAlign() const { return m_NonInheritedData.m_fVerticalAlign; } @@ -135,7 +135,7 @@ const FDE_CSSLength& CFDE_CSSComputedStyle::GetLetterSpacing() const { return m_InheritedData.m_LetterSpacing; } -void CFDE_CSSComputedStyle::SetLineHeight(FX_FLOAT fLineHeight) { +void CFDE_CSSComputedStyle::SetLineHeight(float fLineHeight) { m_InheritedData.m_fLineHeight = fLineHeight; } @@ -147,7 +147,7 @@ void CFDE_CSSComputedStyle::SetTextAlign(FDE_CSSTextAlign eTextAlign) { m_InheritedData.m_eTextAlign = eTextAlign; } -void CFDE_CSSComputedStyle::SetNumberVerticalAlign(FX_FLOAT fAlign) { +void CFDE_CSSComputedStyle::SetNumberVerticalAlign(float fAlign) { m_NonInheritedData.m_eVerticalAlign = FDE_CSSVerticalAlign::Number, m_NonInheritedData.m_fVerticalAlign = fAlign; } diff --git a/xfa/fde/css/cfde_csscomputedstyle.h b/xfa/fde/css/cfde_csscomputedstyle.h index bba4ccbcd4..448d2467ab 100644 --- a/xfa/fde/css/cfde_csscomputedstyle.h +++ b/xfa/fde/css/cfde_csscomputedstyle.h @@ -27,8 +27,8 @@ class CFDE_CSSComputedStyle : public CFX_Retainable { FDE_CSSLength m_WordSpacing; FDE_CSSLength m_TextIndent; CFX_RetainPtr<CFDE_CSSValueList> m_pFontFamily; - FX_FLOAT m_fFontSize; - FX_FLOAT m_fLineHeight; + float m_fFontSize; + float m_fLineHeight; FX_ARGB m_dwFontColor; uint16_t m_wFontWeight; FDE_CSSFontVariant m_eFontVariant; @@ -47,7 +47,7 @@ class CFDE_CSSComputedStyle : public CFX_Retainable { FDE_CSSLength m_Bottom; FDE_CSSLength m_Left; FDE_CSSLength m_Right; - FX_FLOAT m_fVerticalAlign; + float m_fVerticalAlign; FDE_CSSDisplay m_eDisplay; FDE_CSSVerticalAlign m_eVerticalAlign; uint8_t m_dwTextDecoration; @@ -61,12 +61,12 @@ class CFDE_CSSComputedStyle : public CFX_Retainable { uint16_t GetFontWeight() const; FDE_CSSFontVariant GetFontVariant() const; FDE_CSSFontStyle GetFontStyle() const; - FX_FLOAT GetFontSize() const; + float GetFontSize() const; FX_ARGB GetColor() const; void SetFontWeight(uint16_t wFontWeight); void SetFontVariant(FDE_CSSFontVariant eFontVariant); void SetFontStyle(FDE_CSSFontStyle eFontStyle); - void SetFontSize(FX_FLOAT fFontSize); + void SetFontSize(float fFontSize); void SetColor(FX_ARGB dwFontColor); const FDE_CSSRect* GetBorderWidth() const; @@ -77,17 +77,17 @@ class CFDE_CSSComputedStyle : public CFX_Retainable { FDE_CSSDisplay GetDisplay() const; - FX_FLOAT GetLineHeight() const; + float GetLineHeight() const; const FDE_CSSLength& GetTextIndent() const; FDE_CSSTextAlign GetTextAlign() const; FDE_CSSVerticalAlign GetVerticalAlign() const; - FX_FLOAT GetNumberVerticalAlign() const; + float GetNumberVerticalAlign() const; uint32_t GetTextDecoration() const; const FDE_CSSLength& GetLetterSpacing() const; - void SetLineHeight(FX_FLOAT fLineHeight); + void SetLineHeight(float fLineHeight); void SetTextIndent(const FDE_CSSLength& textIndent); void SetTextAlign(FDE_CSSTextAlign eTextAlign); - void SetNumberVerticalAlign(FX_FLOAT fAlign); + void SetNumberVerticalAlign(float fAlign); void SetTextDecoration(uint32_t dwTextDecoration); void SetLetterSpacing(const FDE_CSSLength& letterSpacing); void AddCustomStyle(const CFDE_CSSCustomProperty& prop); diff --git a/xfa/fde/css/cfde_cssdeclaration.cpp b/xfa/fde/css/cfde_cssdeclaration.cpp index 2d1e707caa..8983059220 100644 --- a/xfa/fde/css/cfde_cssdeclaration.cpp +++ b/xfa/fde/css/cfde_cssdeclaration.cpp @@ -25,7 +25,7 @@ uint8_t Hex2Dec(uint8_t hexHigh, uint8_t hexLow) { bool ParseCSSNumber(const wchar_t* pszValue, int32_t iValueLen, - FX_FLOAT& fValue, + float& fValue, FDE_CSSNumberType& eUnit) { ASSERT(pszValue && iValueLen > 0); int32_t iUsedLen = 0; @@ -100,7 +100,7 @@ bool CFDE_CSSDeclaration::ParseCSSColor(const wchar_t* pszValue, return false; uint8_t rgb[3] = {0}; - FX_FLOAT fValue; + float fValue; FDE_CSSPrimitiveType eType; CFDE_CSSValueListParser list(pszValue + 4, iValueLen - 5, ','); for (int32_t i = 0; i < 3; ++i) { @@ -279,7 +279,7 @@ void CFDE_CSSDeclaration::AddProperty(const CFX_WideString& prop, CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseNumber( const wchar_t* pszValue, int32_t iValueLen) { - FX_FLOAT fValue; + float fValue; FDE_CSSNumberType eUnit; if (!ParseCSSNumber(pszValue, iValueLen, fValue, eUnit)) return nullptr; @@ -334,7 +334,7 @@ void CFDE_CSSDeclaration::ParseValueListProperty( switch (eType) { case FDE_CSSPrimitiveType::Number: if (dwType & FDE_CSSVALUETYPE_MaybeNumber) { - FX_FLOAT fValue; + float fValue; FDE_CSSNumberType eNumType; if (ParseCSSNumber(pszValue, iValueLen, fValue, eNumType)) list.push_back( @@ -457,7 +457,7 @@ bool CFDE_CSSDeclaration::ParseBorderProperty( if (pWidth) continue; - FX_FLOAT fValue; + float fValue; FDE_CSSNumberType eNumType; if (ParseCSSNumber(pszValue, iValueLen, fValue, eNumType)) pWidth = pdfium::MakeRetain<CFDE_CSSNumberValue>(eNumType, fValue); @@ -569,7 +569,7 @@ void CFDE_CSSDeclaration::ParseFontProperty(const wchar_t* pszValue, break; } case FDE_CSSPrimitiveType::Number: { - FX_FLOAT fValue; + float fValue; FDE_CSSNumberType eNumType; if (!ParseCSSNumber(pszValue, iValueLen, fValue, eNumType)) break; diff --git a/xfa/fde/css/cfde_cssnumbervalue.cpp b/xfa/fde/css/cfde_cssnumbervalue.cpp index 71566ca5a3..e74ca5b859 100644 --- a/xfa/fde/css/cfde_cssnumbervalue.cpp +++ b/xfa/fde/css/cfde_cssnumbervalue.cpp @@ -6,7 +6,7 @@ #include "xfa/fde/css/cfde_cssnumbervalue.h" -CFDE_CSSNumberValue::CFDE_CSSNumberValue(FDE_CSSNumberType type, FX_FLOAT value) +CFDE_CSSNumberValue::CFDE_CSSNumberValue(FDE_CSSNumberType type, float value) : CFDE_CSSValue(FDE_CSSPrimitiveType::Number), type_(type), value_(value) { if (type_ == FDE_CSSNumberType::Number && FXSYS_fabs(value_) < 0.001f) value_ = 0.0f; @@ -14,7 +14,7 @@ CFDE_CSSNumberValue::CFDE_CSSNumberValue(FDE_CSSNumberType type, FX_FLOAT value) CFDE_CSSNumberValue::~CFDE_CSSNumberValue() {} -FX_FLOAT CFDE_CSSNumberValue::Apply(FX_FLOAT percentBase) const { +float CFDE_CSSNumberValue::Apply(float percentBase) const { switch (type_) { case FDE_CSSNumberType::Pixels: case FDE_CSSNumberType::Number: diff --git a/xfa/fde/css/cfde_cssnumbervalue.h b/xfa/fde/css/cfde_cssnumbervalue.h index 29e562e1e3..c4d0bd25f0 100644 --- a/xfa/fde/css/cfde_cssnumbervalue.h +++ b/xfa/fde/css/cfde_cssnumbervalue.h @@ -25,17 +25,17 @@ enum class FDE_CSSNumberType { class CFDE_CSSNumberValue : public CFDE_CSSValue { public: - CFDE_CSSNumberValue(FDE_CSSNumberType type, FX_FLOAT value); + CFDE_CSSNumberValue(FDE_CSSNumberType type, float value); ~CFDE_CSSNumberValue() override; - FX_FLOAT Value() const { return value_; } + float Value() const { return value_; } FDE_CSSNumberType Kind() const { return type_; } - FX_FLOAT Apply(FX_FLOAT percentBase) const; + float Apply(float percentBase) const; private: FDE_CSSNumberType type_; - FX_FLOAT value_; + float value_; }; #endif // XFA_FDE_CSS_CFDE_CSSNUMBERVALUE_H_ diff --git a/xfa/fde/css/cfde_cssstyleselector.cpp b/xfa/fde/css/cfde_cssstyleselector.cpp index 08cd0e9251..42cc7afc23 100644 --- a/xfa/fde/css/cfde_cssstyleselector.cpp +++ b/xfa/fde/css/cfde_cssstyleselector.cpp @@ -27,7 +27,7 @@ CFDE_CSSStyleSelector::CFDE_CSSStyleSelector(CFGAS_FontMgr* pFontMgr) CFDE_CSSStyleSelector::~CFDE_CSSStyleSelector() {} -void CFDE_CSSStyleSelector::SetDefFontSize(FX_FLOAT fFontSize) { +void CFDE_CSSStyleSelector::SetDefFontSize(float fFontSize) { ASSERT(fFontSize > 0); m_fDefFontSize = fFontSize; } @@ -185,7 +185,7 @@ void CFDE_CSSStyleSelector::ApplyProperty( } break; case FDE_CSSProperty::FontSize: { - FX_FLOAT& fFontSize = pComputedStyle->m_InheritedData.m_fFontSize; + float& fFontSize = pComputedStyle->m_InheritedData.m_fFontSize; if (eType == FDE_CSSPrimitiveType::Number) { fFontSize = pValue.As<CFDE_CSSNumberValue>()->Apply(fFontSize); } else if (eType == FDE_CSSPrimitiveType::Enum) { @@ -478,7 +478,7 @@ bool CFDE_CSSStyleSelector::SetLengthWithPercent( FDE_CSSLength& width, FDE_CSSPrimitiveType eType, const CFX_RetainPtr<CFDE_CSSValue>& pValue, - FX_FLOAT fFontSize) { + float fFontSize) { if (eType == FDE_CSSPrimitiveType::Number) { CFX_RetainPtr<CFDE_CSSNumberValue> v = pValue.As<CFDE_CSSNumberValue>(); if (v->Kind() == FDE_CSSNumberType::Percent) { @@ -487,7 +487,7 @@ bool CFDE_CSSStyleSelector::SetLengthWithPercent( return width.NonZero(); } - FX_FLOAT fValue = v->Apply(fFontSize); + float fValue = v->Apply(fFontSize); width.Set(FDE_CSSLengthUnit::Point, fValue); return width.NonZero(); } else if (eType == FDE_CSSPrimitiveType::Enum) { @@ -514,8 +514,8 @@ bool CFDE_CSSStyleSelector::SetLengthWithPercent( return false; } -FX_FLOAT CFDE_CSSStyleSelector::ToFontSize(FDE_CSSPropertyValue eValue, - FX_FLOAT fCurFontSize) { +float CFDE_CSSStyleSelector::ToFontSize(FDE_CSSPropertyValue eValue, + float fCurFontSize) { switch (eValue) { case FDE_CSSPropertyValue::XxSmall: return m_fDefFontSize / 1.2f / 1.2f / 1.2f; diff --git a/xfa/fde/css/cfde_cssstyleselector.h b/xfa/fde/css/cfde_cssstyleselector.h index c7b6b4164a..0783e72541 100644 --- a/xfa/fde/css/cfde_cssstyleselector.h +++ b/xfa/fde/css/cfde_cssstyleselector.h @@ -30,7 +30,7 @@ class CFDE_CSSStyleSelector { explicit CFDE_CSSStyleSelector(CFGAS_FontMgr* pFontMgr); ~CFDE_CSSStyleSelector(); - void SetDefFontSize(FX_FLOAT fFontSize); + void SetDefFontSize(float fFontSize); void SetUAStyleSheet(std::unique_ptr<CFDE_CSSStyleSheet> pSheet); void UpdateStyleIndex(); @@ -68,8 +68,8 @@ class CFDE_CSSStyleSelector { bool SetLengthWithPercent(FDE_CSSLength& width, FDE_CSSPrimitiveType eType, const CFX_RetainPtr<CFDE_CSSValue>& pValue, - FX_FLOAT fFontSize); - FX_FLOAT ToFontSize(FDE_CSSPropertyValue eValue, FX_FLOAT fCurFontSize); + float fFontSize); + float ToFontSize(FDE_CSSPropertyValue eValue, float fCurFontSize); FDE_CSSDisplay ToDisplay(FDE_CSSPropertyValue eValue); FDE_CSSTextAlign ToTextAlign(FDE_CSSPropertyValue eValue); uint16_t ToFontWeight(FDE_CSSPropertyValue eValue); @@ -79,7 +79,7 @@ class CFDE_CSSStyleSelector { FDE_CSSFontVariant ToFontVariant(FDE_CSSPropertyValue eValue); CFGAS_FontMgr* const m_pFontMgr; - FX_FLOAT m_fDefFontSize; + float m_fDefFontSize; std::unique_ptr<CFDE_CSSStyleSheet> m_UAStyles; CFDE_CSSRuleCollection m_UARules; }; diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h index 344b709487..58a6778732 100644 --- a/xfa/fde/css/fde_css.h +++ b/xfa/fde/css/fde_css.h @@ -188,7 +188,7 @@ class FDE_CSSLength { explicit FDE_CSSLength(FDE_CSSLengthUnit eUnit) : m_unit(eUnit) {} - FDE_CSSLength(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue) + FDE_CSSLength(FDE_CSSLengthUnit eUnit, float fValue) : m_unit(eUnit), m_fValue(fValue) {} FDE_CSSLength& Set(FDE_CSSLengthUnit eUnit) { @@ -196,7 +196,7 @@ class FDE_CSSLength { return *this; } - FDE_CSSLength& Set(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue) { + FDE_CSSLength& Set(FDE_CSSLengthUnit eUnit, float fValue) { m_unit = eUnit; m_fValue = fValue; return *this; @@ -204,19 +204,19 @@ class FDE_CSSLength { FDE_CSSLengthUnit GetUnit() const { return m_unit; } - FX_FLOAT GetValue() const { return m_fValue; } + float GetValue() const { return m_fValue; } bool NonZero() const { return static_cast<int>(m_fValue) != 0; } private: FDE_CSSLengthUnit m_unit; - FX_FLOAT m_fValue; + float m_fValue; }; class FDE_CSSRect { public: FDE_CSSRect() {} - FDE_CSSRect(FDE_CSSLengthUnit eUnit, FX_FLOAT val) + FDE_CSSRect(FDE_CSSLengthUnit eUnit, float val) : left(eUnit, val), top(eUnit, val), right(eUnit, val), @@ -229,7 +229,7 @@ class FDE_CSSRect { bottom.Set(eUnit); return *this; } - FDE_CSSRect& Set(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue) { + FDE_CSSRect& Set(FDE_CSSLengthUnit eUnit, float fValue) { left.Set(eUnit, fValue); top.Set(eUnit, fValue); right.Set(eUnit, fValue); diff --git a/xfa/fde/fde_gedevice.cpp b/xfa/fde/fde_gedevice.cpp index db05f76241..3c6ca9b37e 100644 --- a/xfa/fde/fde_gedevice.cpp +++ b/xfa/fde/fde_gedevice.cpp @@ -24,9 +24,9 @@ CFDE_RenderDevice::CFDE_RenderDevice(CFX_RenderDevice* pDevice, ASSERT(pDevice); FX_RECT rt = m_pDevice->GetClipBox(); - m_rtClip = CFX_RectF( - static_cast<FX_FLOAT>(rt.left), static_cast<FX_FLOAT>(rt.top), - static_cast<FX_FLOAT>(rt.Width()), static_cast<FX_FLOAT>(rt.Height())); + m_rtClip = CFX_RectF(static_cast<float>(rt.left), static_cast<float>(rt.top), + static_cast<float>(rt.Width()), + static_cast<float>(rt.Height())); } CFDE_RenderDevice::~CFDE_RenderDevice() { @@ -49,9 +49,9 @@ void CFDE_RenderDevice::SaveState() { void CFDE_RenderDevice::RestoreState() { m_pDevice->RestoreState(false); const FX_RECT& rt = m_pDevice->GetClipBox(); - m_rtClip = CFX_RectF( - static_cast<FX_FLOAT>(rt.left), static_cast<FX_FLOAT>(rt.top), - static_cast<FX_FLOAT>(rt.Width()), static_cast<FX_FLOAT>(rt.Height())); + m_rtClip = CFX_RectF(static_cast<float>(rt.left), static_cast<float>(rt.top), + static_cast<float>(rt.Width()), + static_cast<float>(rt.Height())); } bool CFDE_RenderDevice::SetClipRect(const CFX_RectF& rtClip) { @@ -74,11 +74,11 @@ CFDE_Path* CFDE_RenderDevice::GetClipPath() const { return nullptr; } -FX_FLOAT CFDE_RenderDevice::GetDpiX() const { +float CFDE_RenderDevice::GetDpiX() const { return 96; } -FX_FLOAT CFDE_RenderDevice::GetDpiY() const { +float CFDE_RenderDevice::GetDpiY() const { return 96; } @@ -91,8 +91,8 @@ bool CFDE_RenderDevice::DrawImage(CFX_DIBSource* pDib, if (pSrcRect) { srcRect = *pSrcRect; } else { - srcRect = CFX_RectF(0, 0, static_cast<FX_FLOAT>(pDib->GetWidth()), - static_cast<FX_FLOAT>(pDib->GetHeight())); + srcRect = CFX_RectF(0, 0, static_cast<float>(pDib->GetWidth()), + static_cast<float>(pDib->GetHeight())); } if (srcRect.IsEmpty()) @@ -124,7 +124,7 @@ bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, const CFX_RetainPtr<CFGAS_GEFont>& pFont, const FXTEXT_CHARPOS* pCharPos, int32_t iCount, - FX_FLOAT fFontSize, + float fFontSize, const CFX_Matrix* pMatrix) { ASSERT(pBrush && pFont && pCharPos && iCount > 0); CFX_Font* pFxFont = pFont->GetDevFont(); @@ -132,9 +132,9 @@ bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 && !pFxFont->IsItalic()) { FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; - FX_FLOAT* pAM; + float* pAM; for (int32_t i = 0; i < iCount; ++i) { - static const FX_FLOAT mc = 0.267949f; + static const float mc = 0.267949f; pAM = pCP->m_AdjustMatrix; pAM[2] = mc * pAM[0] + pAM[2]; pAM[3] = mc * pAM[1] + pAM[3]; @@ -205,7 +205,7 @@ bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, } bool CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const CFX_PointF& pt1, const CFX_PointF& pt2, const CFX_PointF& pt3, @@ -222,10 +222,10 @@ bool CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen, } bool CFDE_RenderDevice::DrawCurve(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const std::vector<CFX_PointF>& points, bool bClosed, - FX_FLOAT fTension, + float fTension, const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddCurve(points, bClosed, fTension); @@ -233,7 +233,7 @@ bool CFDE_RenderDevice::DrawCurve(CFDE_Pen* pPen, } bool CFDE_RenderDevice::DrawEllipse(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const CFX_RectF& rect, const CFX_Matrix* pMatrix) { CFDE_Path path; @@ -242,7 +242,7 @@ bool CFDE_RenderDevice::DrawEllipse(CFDE_Pen* pPen, } bool CFDE_RenderDevice::DrawLines(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const std::vector<CFX_PointF>& points, const CFX_Matrix* pMatrix) { CFDE_Path path; @@ -251,7 +251,7 @@ bool CFDE_RenderDevice::DrawLines(CFDE_Pen* pPen, } bool CFDE_RenderDevice::DrawLine(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const CFX_PointF& pt1, const CFX_PointF& pt2, const CFX_Matrix* pMatrix) { @@ -261,7 +261,7 @@ bool CFDE_RenderDevice::DrawLine(CFDE_Pen* pPen, } bool CFDE_RenderDevice::DrawPath(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const CFDE_Path* pPath, const CFX_Matrix* pMatrix) { CFDE_Path* pGePath = (CFDE_Path*)pPath; @@ -277,7 +277,7 @@ bool CFDE_RenderDevice::DrawPath(CFDE_Pen* pPen, } bool CFDE_RenderDevice::DrawPolygon(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const std::vector<CFX_PointF>& points, const CFX_Matrix* pMatrix) { CFDE_Path path; @@ -286,7 +286,7 @@ bool CFDE_RenderDevice::DrawPolygon(CFDE_Pen* pPen, } bool CFDE_RenderDevice::DrawRectangle(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const CFX_RectF& rect, const CFX_Matrix* pMatrix) { CFDE_Path path; @@ -296,7 +296,7 @@ bool CFDE_RenderDevice::DrawRectangle(CFDE_Pen* pPen, bool CFDE_RenderDevice::FillClosedCurve(CFDE_Brush* pBrush, const std::vector<CFX_PointF>& points, - FX_FLOAT fTension, + float fTension, const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddCurve(points, true, fTension); @@ -328,7 +328,7 @@ bool CFDE_RenderDevice::FillRectangle(CFDE_Brush* pBrush, } bool CFDE_RenderDevice::CreatePen(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, CFX_GraphStateData& graphState) { if (!pPen) return false; diff --git a/xfa/fde/fde_gedevice.h b/xfa/fde/fde_gedevice.h index 7c772cfd03..976e1bde6f 100644 --- a/xfa/fde/fde_gedevice.h +++ b/xfa/fde/fde_gedevice.h @@ -31,8 +31,8 @@ class CFDE_RenderDevice { bool SetClipRect(const CFX_RectF& rtClip); const CFX_RectF& GetClipRect(); - FX_FLOAT GetDpiX() const; - FX_FLOAT GetDpiY() const; + float GetDpiX() const; + float GetDpiY() const; bool DrawImage(CFX_DIBSource* pDib, const CFX_RectF* pSrcRect, @@ -43,49 +43,49 @@ class CFDE_RenderDevice { const CFX_RetainPtr<CFGAS_GEFont>& pFont, const FXTEXT_CHARPOS* pCharPos, int32_t iCount, - FX_FLOAT fFontSize, + float fFontSize, const CFX_Matrix* pMatrix = nullptr); bool DrawBezier(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const CFX_PointF& pt1, const CFX_PointF& pt2, const CFX_PointF& pt3, const CFX_PointF& pt4, const CFX_Matrix* pMatrix = nullptr); bool DrawCurve(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const std::vector<CFX_PointF>& points, bool bClosed, - FX_FLOAT fTension = 0.5f, + float fTension = 0.5f, const CFX_Matrix* pMatrix = nullptr); bool DrawEllipse(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const CFX_RectF& rect, const CFX_Matrix* pMatrix = nullptr); bool DrawLines(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const std::vector<CFX_PointF>& points, const CFX_Matrix* pMatrix = nullptr); bool DrawLine(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const CFX_PointF& pt1, const CFX_PointF& pt2, const CFX_Matrix* pMatrix = nullptr); bool DrawPath(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const CFDE_Path* pPath, const CFX_Matrix* pMatrix = nullptr); bool DrawPolygon(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const std::vector<CFX_PointF>& points, const CFX_Matrix* pMatrix = nullptr); bool DrawRectangle(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, const CFX_RectF& rect, const CFX_Matrix* pMatrix = nullptr); bool FillClosedCurve(CFDE_Brush* pBrush, const std::vector<CFX_PointF>& points, - FX_FLOAT fTension = 0.5f, + float fTension = 0.5f, const CFX_Matrix* pMatrix = nullptr); bool FillEllipse(CFDE_Brush* pBrush, const CFX_RectF& rect, @@ -104,18 +104,18 @@ class CFDE_RenderDevice { const CFX_RetainPtr<CFGAS_GEFont>& pFont, const FXTEXT_CHARPOS* pCharPos, int32_t iCount, - FX_FLOAT fFontSize, + float fFontSize, const CFX_Matrix* pMatrix); bool DrawStringPath(CFDE_Brush* pBrush, const CFX_RetainPtr<CFGAS_GEFont>& pFont, const FXTEXT_CHARPOS* pCharPos, int32_t iCount, - FX_FLOAT fFontSize, + float fFontSize, const CFX_Matrix* pMatrix); protected: bool CreatePen(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, + float fPenWidth, CFX_GraphStateData& graphState); CFX_RenderDevice* const m_pDevice; diff --git a/xfa/fde/fde_render.cpp b/xfa/fde/fde_render.cpp index 371f9ca9e2..a502c7b6d8 100644 --- a/xfa/fde/fde_render.cpp +++ b/xfa/fde/fde_render.cpp @@ -56,8 +56,8 @@ FDE_RENDERSTATUS CFDE_RenderContext::DoRender(IFX_Pause* pPause) { CFX_RectF rtDocClip = m_pRenderDevice->GetClipRect(); if (rtDocClip.IsEmpty()) { rtDocClip.left = rtDocClip.top = 0; - rtDocClip.width = (FX_FLOAT)m_pRenderDevice->GetWidth(); - rtDocClip.height = (FX_FLOAT)m_pRenderDevice->GetHeight(); + rtDocClip.width = (float)m_pRenderDevice->GetWidth(); + rtDocClip.height = (float)m_pRenderDevice->GetHeight(); } rm.TransformRect(rtDocClip); IFDE_VisualSet* pVisualSet; @@ -120,7 +120,7 @@ void CFDE_RenderContext::RenderText(CFDE_TxtEdtTextSet* pTextSet, m_CharPos.resize(iCount, FXTEXT_CHARPOS()); iCount = pTextSet->GetDisplayPos(*pText, m_CharPos.data(), false); - FX_FLOAT fFontSize = pTextSet->GetFontSize(); + float fFontSize = pTextSet->GetFontSize(); FX_ARGB dwColor = pTextSet->GetFontColor(); m_pBrush->SetColor(dwColor); m_pRenderDevice->DrawString(m_pBrush.get(), pFont, m_CharPos.data(), iCount, diff --git a/xfa/fde/ifde_txtedtengine.h b/xfa/fde/ifde_txtedtengine.h index f803eff079..488e8ea271 100644 --- a/xfa/fde/ifde_txtedtengine.h +++ b/xfa/fde/ifde_txtedtengine.h @@ -73,23 +73,23 @@ struct FDE_TXTEDTPARAMS { FDE_TXTEDTPARAMS(); ~FDE_TXTEDTPARAMS(); - FX_FLOAT fPlateWidth; - FX_FLOAT fPlateHeight; + float fPlateWidth; + float fPlateHeight; int32_t nLineCount; uint32_t dwLayoutStyles; uint32_t dwAlignment; uint32_t dwMode; CFX_RetainPtr<CFGAS_GEFont> pFont; - FX_FLOAT fFontSize; + float fFontSize; FX_ARGB dwFontColor; - FX_FLOAT fLineSpace; - FX_FLOAT fTabWidth; + float fLineSpace; + float fTabWidth; bool bTabEquidistant; wchar_t wDefChar; wchar_t wLineBreakChar; int32_t nLineEnd; int32_t nHorzScale; - FX_FLOAT fCharSpace; + float fCharSpace; CFWL_Edit* pEventSink; }; diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index 36f341b39c..c9f5ec84ef 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -53,7 +53,7 @@ void CFDE_TextOut::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont) { m_pTxtBreak->SetFont(pFont); } -void CFDE_TextOut::SetFontSize(FX_FLOAT fFontSize) { +void CFDE_TextOut::SetFontSize(float fFontSize) { ASSERT(fFontSize > 0); m_fFontSize = fFontSize; m_pTxtBreak->SetFontSize(fFontSize); @@ -72,7 +72,7 @@ void CFDE_TextOut::SetStyles(uint32_t dwStyles) { m_pTxtBreak->SetLayoutStyles(m_dwTxtBkStyles); } -void CFDE_TextOut::SetTabWidth(FX_FLOAT fTabWidth) { +void CFDE_TextOut::SetTabWidth(float fTabWidth) { ASSERT(fTabWidth > 1.0f); m_pTxtBreak->SetTabWidth(fTabWidth, false); } @@ -107,7 +107,7 @@ void CFDE_TextOut::SetAlignment(int32_t iAlignment) { m_pTxtBreak->SetAlignment(m_iTxtBkAlignment); } -void CFDE_TextOut::SetLineSpace(FX_FLOAT fLineSpace) { +void CFDE_TextOut::SetLineSpace(float fLineSpace) { ASSERT(fLineSpace > 1.0f); m_fLineSpace = fLineSpace; } @@ -127,7 +127,7 @@ void CFDE_TextOut::SetRenderDevice(CFX_RenderDevice* pDevice) { } void CFDE_TextOut::SetClipRect(const CFX_Rect& rtClip) { - m_rtClip = rtClip.As<FX_FLOAT>(); + m_rtClip = rtClip.As<float>(); } void CFDE_TextOut::SetClipRect(const CFX_RectF& rtClip) { @@ -142,7 +142,7 @@ void CFDE_TextOut::SetMatrix(const CFX_Matrix& matrix) { m_Matrix = matrix; } -void CFDE_TextOut::SetLineBreakTolerance(FX_FLOAT fTolerance) { +void CFDE_TextOut::SetLineBreakTolerance(float fTolerance) { m_fTolerance = fTolerance; m_pTxtBreak->SetLineBreakTolerance(m_fTolerance); } @@ -178,9 +178,9 @@ void CFDE_TextOut::CalcTextSize(const wchar_t* pwsStr, m_iTotalLines = 0; const wchar_t* pStr = pwsStr; bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); - FX_FLOAT fWidth = 0.0f; - FX_FLOAT fHeight = 0.0f; - FX_FLOAT fStartPos = rect.right(); + float fWidth = 0.0f; + float fHeight = 0.0f; + float fStartPos = rect.right(); CFX_BreakType dwBreakStatus = CFX_BreakType::None; wchar_t wPreChar = 0; wchar_t wch; @@ -206,7 +206,7 @@ void CFDE_TextOut::CalcTextSize(const wchar_t* pwsStr, RetrieveLineWidth(dwBreakStatus, fStartPos, fWidth, fHeight); m_pTxtBreak->Reset(); - FX_FLOAT fInc = rect.Height() - fHeight; + float fInc = rect.Height() - fHeight; if (m_iAlignment >= FDE_TTOALIGNMENT_CenterLeft && m_iAlignment < FDE_TTOALIGNMENT_BottomLeft) { fInc /= 2.0f; @@ -223,7 +223,7 @@ void CFDE_TextOut::CalcTextSize(const wchar_t* pwsStr, void CFDE_TextOut::SetLineWidth(CFX_RectF& rect) { if ((m_dwStyles & FDE_TTOSTYLE_SingleLine) == 0) { - FX_FLOAT fLineWidth = 0.0f; + float fLineWidth = 0.0f; if (rect.Width() < 1.0f) rect.width = m_fFontSize * 1000.0f; @@ -233,22 +233,21 @@ void CFDE_TextOut::SetLineWidth(CFX_RectF& rect) { } bool CFDE_TextOut::RetrieveLineWidth(CFX_BreakType dwBreakStatus, - FX_FLOAT& fStartPos, - FX_FLOAT& fWidth, - FX_FLOAT& fHeight) { + float& fStartPos, + float& fWidth, + float& fHeight) { if (CFX_BreakTypeNoneOrPiece(dwBreakStatus)) return false; - FX_FLOAT fLineStep = - (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; + float fLineStep = (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; bool bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); - FX_FLOAT fLineWidth = 0.0f; + float fLineWidth = 0.0f; int32_t iCount = m_pTxtBreak->CountBreakPieces(); for (int32_t i = 0; i < iCount; i++) { const CFX_BreakPiece* pPiece = m_pTxtBreak->GetBreakPiece(i); - fLineWidth += static_cast<FX_FLOAT>(pPiece->m_iWidth) / 20000.0f; - fStartPos = std::min(fStartPos, - static_cast<FX_FLOAT>(pPiece->m_iStartPos) / 20000.0f); + fLineWidth += static_cast<float>(pPiece->m_iWidth) / 20000.0f; + fStartPos = + std::min(fStartPos, static_cast<float>(pPiece->m_iStartPos) / 20000.0f); } m_pTxtBreak->ClearBreakPieces(); if (dwBreakStatus == CFX_BreakType::Paragraph) { @@ -268,15 +267,15 @@ void CFDE_TextOut::DrawText(const wchar_t* pwsStr, int32_t iLength, int32_t x, int32_t y) { - CFX_RectF rtText(static_cast<FX_FLOAT>(x), static_cast<FX_FLOAT>(y), + CFX_RectF rtText(static_cast<float>(x), static_cast<float>(y), m_fFontSize * 1000.0f, m_fFontSize * 1000.0f); DrawText(pwsStr, iLength, rtText); } void CFDE_TextOut::DrawText(const wchar_t* pwsStr, int32_t iLength, - FX_FLOAT x, - FX_FLOAT y) { + float x, + float y) { DrawText(pwsStr, iLength, CFX_RectF(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f)); } @@ -284,7 +283,7 @@ void CFDE_TextOut::DrawText(const wchar_t* pwsStr, void CFDE_TextOut::DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_Rect& rect) { - DrawText(pwsStr, iLength, rect.As<FX_FLOAT>()); + DrawText(pwsStr, iLength, rect.As<float>()); } void CFDE_TextOut::DrawText(const wchar_t* pwsStr, @@ -299,8 +298,8 @@ void CFDE_TextOut::DrawText(const wchar_t* pwsStr, void CFDE_TextOut::DrawLogicText(const wchar_t* pwsStr, int32_t iLength, - FX_FLOAT x, - FX_FLOAT y) { + float x, + float y) { CFX_RectF rtText(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f); DrawLogicText(pwsStr, iLength, rtText); } @@ -324,7 +323,7 @@ void CFDE_TextOut::DrawText(const wchar_t* pwsStr, if (rect.width < m_fFontSize || rect.height < m_fFontSize) return; - FX_FLOAT fLineWidth = rect.width; + float fLineWidth = rect.width; m_pTxtBreak->SetLineWidth(fLineWidth); m_ttoLines.clear(); m_wsText.clear(); @@ -407,9 +406,8 @@ void CFDE_TextOut::LoadText(const wchar_t* pwsStr, ExpandBuffer(iTxtLength, 0); bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); bool bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); - FX_FLOAT fLineStep = - (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; - FX_FLOAT fLineStop = rect.bottom(); + float fLineStep = (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; + float fLineStop = rect.bottom(); m_fLinePos = rect.top; m_hotKeys.RemoveAll(); int32_t iStartChar = 0; @@ -462,10 +460,9 @@ bool CFDE_TextOut::RetrievePieces(CFX_BreakType dwBreakStatus, const CFX_RectF& rect) { bool bSingleLine = !!(m_dwStyles & FDE_TTOSTYLE_SingleLine); bool bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); - FX_FLOAT fLineStep = - (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; + float fLineStep = (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; bool bNeedReload = false; - FX_FLOAT fLineWidth = rect.Width(); + float fLineWidth = rect.Width(); int32_t iLineWidth = FXSYS_round(fLineWidth * 20000.0f); int32_t iCount = m_pTxtBreak->CountBreakPieces(); for (int32_t i = 0; i < iCount; i++) { @@ -490,7 +487,7 @@ bool CFDE_TextOut::RetrievePieces(CFX_BreakType dwBreakStatus, m_ttoLines[m_iCurLine].SetNewReload(true); } else if (j > 0) { CFX_RectF rtPiece; - rtPiece.left = rect.left + (FX_FLOAT)pPiece->m_iStartPos / 20000.0f; + rtPiece.left = rect.left + (float)pPiece->m_iStartPos / 20000.0f; rtPiece.top = m_fLinePos; rtPiece.width = iWidth / 20000.0f; rtPiece.height = fLineStep; @@ -624,13 +621,13 @@ void CFDE_TextOut::DoAlignment(const CFX_RectF& rect) { if (m_ttoLines.empty()) return; - FX_FLOAT fLineStopS = rect.bottom(); + float fLineStopS = rect.bottom(); FDE_TTOPIECE* pFirstPiece = m_ttoLines.back().GetPtrAt(0); if (!pFirstPiece) return; - FX_FLOAT fLineStopD = pFirstPiece->rtPiece.bottom(); - FX_FLOAT fInc = fLineStopS - fLineStopD; + float fLineStopD = pFirstPiece->rtPiece.bottom(); + float fInc = fLineStopS - fLineStopD; if (m_iAlignment >= FDE_TTOALIGNMENT_CenterLeft && m_iAlignment < FDE_TTOALIGNMENT_BottomLeft) { fInc /= 2.0f; diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h index 224a584a4e..bbc796d7ac 100644 --- a/xfa/fde/tto/fde_textout.h +++ b/xfa/fde/tto/fde_textout.h @@ -79,33 +79,30 @@ class CFDE_TextOut { ~CFDE_TextOut(); void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont); - void SetFontSize(FX_FLOAT fFontSize); + void SetFontSize(float fFontSize); void SetTextColor(FX_ARGB color); void SetStyles(uint32_t dwStyles); - void SetTabWidth(FX_FLOAT fTabWidth); + void SetTabWidth(float fTabWidth); void SetEllipsisString(const CFX_WideString& wsEllipsis); void SetParagraphBreakChar(wchar_t wch); void SetAlignment(int32_t iAlignment); - void SetLineSpace(FX_FLOAT fLineSpace); + void SetLineSpace(float fLineSpace); void SetDIBitmap(CFX_DIBitmap* pDIB); void SetRenderDevice(CFX_RenderDevice* pDevice); void SetClipRect(const CFX_Rect& rtClip); void SetClipRect(const CFX_RectF& rtClip); void SetMatrix(const CFX_Matrix& matrix); - void SetLineBreakTolerance(FX_FLOAT fTolerance); + void SetLineBreakTolerance(float fTolerance); void DrawText(const wchar_t* pwsStr, int32_t iLength, int32_t x, int32_t y); - void DrawText(const wchar_t* pwsStr, int32_t iLength, FX_FLOAT x, FX_FLOAT y); + void DrawText(const wchar_t* pwsStr, int32_t iLength, float x, float y); void DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_Rect& rect); void DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect); void SetLogicClipRect(const CFX_RectF& rtClip); void CalcLogicSize(const wchar_t* pwsStr, int32_t iLength, CFX_SizeF& size); void CalcLogicSize(const wchar_t* pwsStr, int32_t iLength, CFX_RectF& rect); - void DrawLogicText(const wchar_t* pwsStr, - int32_t iLength, - FX_FLOAT x, - FX_FLOAT y); + void DrawLogicText(const wchar_t* pwsStr, int32_t iLength, float x, float y); void DrawLogicText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect); @@ -114,9 +111,9 @@ class CFDE_TextOut { protected: void CalcTextSize(const wchar_t* pwsStr, int32_t iLength, CFX_RectF& rect); bool RetrieveLineWidth(CFX_BreakType dwBreakStatus, - FX_FLOAT& fStartPos, - FX_FLOAT& fWidth, - FX_FLOAT& fHeight); + float& fStartPos, + float& fWidth, + float& fHeight); void SetLineWidth(CFX_RectF& rect); void DrawText(const wchar_t* pwsStr, int32_t iLength, @@ -146,10 +143,10 @@ class CFDE_TextOut { std::unique_ptr<CFX_TxtBreak> m_pTxtBreak; CFX_RetainPtr<CFGAS_GEFont> m_pFont; - FX_FLOAT m_fFontSize; - FX_FLOAT m_fLineSpace; - FX_FLOAT m_fLinePos; - FX_FLOAT m_fTolerance; + float m_fFontSize; + float m_fLineSpace; + float m_fLinePos; + float m_fTolerance; int32_t m_iAlignment; int32_t m_iTxtBkAlignment; std::vector<int32_t> m_CharWidths; diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp index 541fd98a00..0959661b26 100644 --- a/xfa/fde/xml/fde_xml_imp.cpp +++ b/xfa/fde/xml/fde_xml_imp.cpp @@ -618,8 +618,8 @@ void CFDE_XMLInstruction::SetInteger(const wchar_t* pwsAttriName, SetString(pwsAttriName, wsValue); } -FX_FLOAT CFDE_XMLInstruction::GetFloat(const wchar_t* pwsAttriName, - FX_FLOAT fDefValue) const { +float CFDE_XMLInstruction::GetFloat(const wchar_t* pwsAttriName, + float fDefValue) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { @@ -630,7 +630,7 @@ FX_FLOAT CFDE_XMLInstruction::GetFloat(const wchar_t* pwsAttriName, } void CFDE_XMLInstruction::SetFloat(const wchar_t* pwsAttriName, - FX_FLOAT fAttriValue) { + float fAttriValue) { CFX_WideString wsValue; wsValue.Format(L"%f", fAttriValue); SetString(pwsAttriName, wsValue); @@ -829,8 +829,8 @@ void CFDE_XMLElement::SetInteger(const wchar_t* pwsAttriName, SetString(pwsAttriName, wsValue); } -FX_FLOAT CFDE_XMLElement::GetFloat(const wchar_t* pwsAttriName, - FX_FLOAT fDefValue) const { +float CFDE_XMLElement::GetFloat(const wchar_t* pwsAttriName, + float fDefValue) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { @@ -840,8 +840,7 @@ FX_FLOAT CFDE_XMLElement::GetFloat(const wchar_t* pwsAttriName, return fDefValue; } -void CFDE_XMLElement::SetFloat(const wchar_t* pwsAttriName, - FX_FLOAT fAttriValue) { +void CFDE_XMLElement::SetFloat(const wchar_t* pwsAttriName, float fAttriValue) { CFX_WideString wsValue; wsValue.Format(L"%f", fAttriValue); SetString(pwsAttriName, wsValue); diff --git a/xfa/fde/xml/fde_xml_imp.h b/xfa/fde/xml/fde_xml_imp.h index 7ae05a4936..ab5ab9be24 100644 --- a/xfa/fde/xml/fde_xml_imp.h +++ b/xfa/fde/xml/fde_xml_imp.h @@ -95,8 +95,8 @@ class CFDE_XMLInstruction : public CFDE_XMLNode { const CFX_WideString& wsAttriValue); int32_t GetInteger(const wchar_t* pwsAttriName, int32_t iDefValue = 0) const; void SetInteger(const wchar_t* pwsAttriName, int32_t iAttriValue); - FX_FLOAT GetFloat(const wchar_t* pwsAttriName, FX_FLOAT fDefValue = 0) const; - void SetFloat(const wchar_t* pwsAttriName, FX_FLOAT fAttriValue); + float GetFloat(const wchar_t* pwsAttriName, float fDefValue = 0) const; + void SetFloat(const wchar_t* pwsAttriName, float fAttriValue); void RemoveAttribute(const wchar_t* pwsAttriName); int32_t CountData() const; bool GetData(int32_t index, CFX_WideString& wsData) const; @@ -139,8 +139,8 @@ class CFDE_XMLElement : public CFDE_XMLNode { int32_t GetInteger(const wchar_t* pwsAttriName, int32_t iDefValue = 0) const; void SetInteger(const wchar_t* pwsAttriName, int32_t iAttriValue); - FX_FLOAT GetFloat(const wchar_t* pwsAttriName, FX_FLOAT fDefValue = 0) const; - void SetFloat(const wchar_t* pwsAttriName, FX_FLOAT fAttriValue); + float GetFloat(const wchar_t* pwsAttriName, float fDefValue = 0) const; + void SetFloat(const wchar_t* pwsAttriName, float fAttriValue); void GetTextData(CFX_WideString& wsText) const; void SetTextData(const CFX_WideString& wsText); |