diff options
362 files changed, 3611 insertions, 3844 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp index 35595b3e1f..20af9b7c2e 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp @@ -33,7 +33,7 @@ CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& ar, const CFX_Matrix& matrix) { return ar; } -bool GetColor(const CPDF_Color* pColor, FX_FLOAT* rgb) { +bool GetColor(const CPDF_Color* pColor, float* rgb) { int intRGB[3]; if (!pColor || pColor->GetColorSpace() != CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB) || @@ -201,17 +201,17 @@ void CPDF_PageContentGenerator::ProcessPath(CFX_ByteTextBuf* buf, void CPDF_PageContentGenerator::ProcessGraphics(CFX_ByteTextBuf* buf, CPDF_PageObject* pPageObj) { *buf << "q "; - FX_FLOAT fillColor[3]; + float fillColor[3]; if (GetColor(pPageObj->m_ColorState.GetFillColor(), fillColor)) { *buf << fillColor[0] << " " << fillColor[1] << " " << fillColor[2] << " rg "; } - FX_FLOAT strokeColor[3]; + float strokeColor[3]; if (GetColor(pPageObj->m_ColorState.GetStrokeColor(), strokeColor)) { *buf << strokeColor[0] << " " << strokeColor[1] << " " << strokeColor[2] << " RG "; } - FX_FLOAT lineWidth = pPageObj->m_GraphState.GetLineWidth(); + float lineWidth = pPageObj->m_GraphState.GetLineWidth(); if (lineWidth != 1.0f) *buf << lineWidth << " w "; diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp index d8813ba30f..b9510b7803 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp @@ -107,11 +107,11 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessGraphics) { pPathObj->m_FillType = FXFILL_WINDING; pPathObj->m_bStroke = true; - FX_FLOAT rgb[3] = {0.5f, 0.7f, 0.35f}; + float rgb[3] = {0.5f, 0.7f, 0.35f}; CPDF_ColorSpace* pCS = CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB); pPathObj->m_ColorState.SetFillColor(pCS, rgb, 3); - FX_FLOAT rgb2[3] = {1, 0.9f, 0}; + float rgb2[3] = {1, 0.9f, 0}; pPathObj->m_ColorState.SetStrokeColor(pCS, rgb2, 3); pPathObj->m_GeneralState.SetFillAlpha(0.5f); pPathObj->m_GeneralState.SetStrokeAlpha(0.8f); diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp index 6e050c4bc7..7d14a9ea0a 100644 --- a/core/fpdfapi/font/cpdf_cidfont.cpp +++ b/core/fpdfapi/font/cpdf_cidfont.cpp @@ -823,7 +823,7 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, } // static -FX_FLOAT CPDF_CIDFont::CIDTransformToFloat(uint8_t ch) { +float CPDF_CIDFont::CIDTransformToFloat(uint8_t ch) { return (ch < 128 ? ch : ch - 255) * (1.0f / 127); } diff --git a/core/fpdfapi/font/cpdf_cidfont.h b/core/fpdfapi/font/cpdf_cidfont.h index e256be1af5..ec7da6a9bf 100644 --- a/core/fpdfapi/font/cpdf_cidfont.h +++ b/core/fpdfapi/font/cpdf_cidfont.h @@ -36,7 +36,7 @@ class CPDF_CIDFont : public CPDF_Font { CPDF_CIDFont(); ~CPDF_CIDFont() override; - static FX_FLOAT CIDTransformToFloat(uint8_t ch); + static float CIDTransformToFloat(uint8_t ch); // CPDF_Font: bool IsCIDFont() const override; diff --git a/core/fpdfapi/font/cpdf_type3font.cpp b/core/fpdfapi/font/cpdf_type3font.cpp index b7ff8c9cf0..10a116ab46 100644 --- a/core/fpdfapi/font/cpdf_type3font.cpp +++ b/core/fpdfapi/font/cpdf_type3font.cpp @@ -44,7 +44,7 @@ CPDF_Type3Font* CPDF_Type3Font::AsType3Font() { bool CPDF_Type3Font::Load() { m_pFontResources = m_pFontDict->GetDictFor("Resources"); CPDF_Array* pMatrix = m_pFontDict->GetArrayFor("FontMatrix"); - FX_FLOAT xscale = 1.0f, yscale = 1.0f; + float xscale = 1.0f, yscale = 1.0f; if (pMatrix) { m_FontMatrix = pMatrix->GetMatrix(); xscale = m_FontMatrix.a; @@ -112,12 +112,12 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) { if (it != m_CacheMap.end()) return it->second.get(); - FX_FLOAT scale = m_FontMatrix.GetXUnit(); + float scale = m_FontMatrix.GetXUnit(); pNewChar->m_Width = (int32_t)(pNewChar->m_Width * scale + 0.5f); FX_RECT& rcBBox = pNewChar->m_BBox; CFX_FloatRect char_rect( - (FX_FLOAT)rcBBox.left / 1000.0f, (FX_FLOAT)rcBBox.bottom / 1000.0f, - (FX_FLOAT)rcBBox.right / 1000.0f, (FX_FLOAT)rcBBox.top / 1000.0f); + (float)rcBBox.left / 1000.0f, (float)rcBBox.bottom / 1000.0f, + (float)rcBBox.right / 1000.0f, (float)rcBBox.top / 1000.0f); if (rcBBox.right <= rcBBox.left || rcBBox.bottom >= rcBBox.top) char_rect = pNewChar->m_pForm->CalcBoundingBox(); diff --git a/core/fpdfapi/page/cpdf_allstates.cpp b/core/fpdfapi/page/cpdf_allstates.cpp index 282a47fe29..a30696e8b7 100644 --- a/core/fpdfapi/page/cpdf_allstates.cpp +++ b/core/fpdfapi/page/cpdf_allstates.cpp @@ -17,7 +17,7 @@ namespace { -FX_FLOAT ClipFloat(FX_FLOAT f) { +float ClipFloat(float f) { return std::max(0.0f, std::min(1.0f, f)); } @@ -40,9 +40,7 @@ void CPDF_AllStates::Copy(const CPDF_AllStates& src) { m_TextHorzScale = src.m_TextHorzScale; } -void CPDF_AllStates::SetLineDash(CPDF_Array* pArray, - FX_FLOAT phase, - FX_FLOAT scale) { +void CPDF_AllStates::SetLineDash(CPDF_Array* pArray, float phase, float scale) { m_GraphState.SetLineDash(pArray, phase, scale); } diff --git a/core/fpdfapi/page/cpdf_allstates.h b/core/fpdfapi/page/cpdf_allstates.h index dad1b8502b..730003a96a 100644 --- a/core/fpdfapi/page/cpdf_allstates.h +++ b/core/fpdfapi/page/cpdf_allstates.h @@ -22,16 +22,16 @@ class CPDF_AllStates : public CPDF_GraphicStates { void Copy(const CPDF_AllStates& src); void ProcessExtGS(CPDF_Dictionary* pGS, CPDF_StreamContentParser* pParser); - void SetLineDash(CPDF_Array*, FX_FLOAT, FX_FLOAT scale); + void SetLineDash(CPDF_Array*, float, float scale); CFX_Matrix m_TextMatrix; CFX_Matrix m_CTM; CFX_Matrix m_ParentMatrix; CFX_PointF m_TextPos; CFX_PointF m_TextLinePos; - FX_FLOAT m_TextLeading; - FX_FLOAT m_TextRise; - FX_FLOAT m_TextHorzScale; + float m_TextLeading; + float m_TextRise; + float m_TextHorzScale; }; #endif // CORE_FPDFAPI_PAGE_CPDF_ALLSTATES_H_ diff --git a/core/fpdfapi/page/cpdf_color.cpp b/core/fpdfapi/page/cpdf_color.cpp index 4ba28ce314..b191b24808 100644 --- a/core/fpdfapi/page/cpdf_color.cpp +++ b/core/fpdfapi/page/cpdf_color.cpp @@ -67,14 +67,14 @@ void CPDF_Color::SetColorSpace(CPDF_ColorSpace* pCS) { } } -void CPDF_Color::SetValue(FX_FLOAT* comps) { +void CPDF_Color::SetValue(float* comps) { if (!m_pBuffer) return; if (m_pCS->GetFamily() != PDFCS_PATTERN) - FXSYS_memcpy(m_pBuffer, comps, m_pCS->CountComponents() * sizeof(FX_FLOAT)); + FXSYS_memcpy(m_pBuffer, comps, m_pCS->CountComponents() * sizeof(float)); } -void CPDF_Color::SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comps, int ncomps) { +void CPDF_Color::SetValue(CPDF_Pattern* pPattern, float* comps, int ncomps) { if (ncomps > MAX_PATTERN_COLORCOMPS) return; @@ -94,7 +94,7 @@ void CPDF_Color::SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comps, int ncomps) { pvalue->m_nComps = ncomps; pvalue->m_pPattern = pPattern; if (ncomps) - FXSYS_memcpy(pvalue->m_Comps, comps, ncomps * sizeof(FX_FLOAT)); + FXSYS_memcpy(pvalue->m_Comps, comps, ncomps * sizeof(float)); pvalue->m_pCountedPattern = nullptr; if (pPattern && pPattern->document()) { @@ -136,7 +136,7 @@ bool CPDF_Color::GetRGB(int& R, int& G, int& B) const { if (!m_pCS || !m_pBuffer) return false; - FX_FLOAT r = 0.0f, g = 0.0f, b = 0.0f; + float r = 0.0f, g = 0.0f, b = 0.0f; if (!m_pCS->GetRGB(m_pBuffer, r, g, b)) return false; diff --git a/core/fpdfapi/page/cpdf_color.h b/core/fpdfapi/page/cpdf_color.h index e81b531055..9b6eff85a3 100644 --- a/core/fpdfapi/page/cpdf_color.h +++ b/core/fpdfapi/page/cpdf_color.h @@ -23,8 +23,8 @@ class CPDF_Color { void Copy(const CPDF_Color* pSrc); void SetColorSpace(CPDF_ColorSpace* pCS); - void SetValue(FX_FLOAT* comp); - void SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comp, int ncomps); + void SetValue(float* comp); + void SetValue(CPDF_Pattern* pPattern, float* comp, int ncomps); bool GetRGB(int& R, int& G, int& B) const; CPDF_Pattern* GetPattern() const; @@ -35,7 +35,7 @@ class CPDF_Color { void ReleaseColorSpace(); CPDF_ColorSpace* m_pCS; - FX_FLOAT* m_pBuffer; + float* m_pBuffer; }; #endif // CORE_FPDFAPI_PAGE_CPDF_COLOR_H_ diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp index 6cd0075e8e..a88edb1828 100644 --- a/core/fpdfapi/page/cpdf_colorspace.cpp +++ b/core/fpdfapi/page/cpdf_colorspace.cpp @@ -65,14 +65,8 @@ class CPDF_CalGray : public CPDF_ColorSpace { bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; - bool GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const override; - bool SetRGB(FX_FLOAT* pBuf, - FX_FLOAT R, - FX_FLOAT G, - FX_FLOAT B) const override; + bool GetRGB(float* pBuf, float& R, float& G, float& B) const override; + bool SetRGB(float* pBuf, float R, float G, float B) const override; void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, @@ -82,9 +76,9 @@ class CPDF_CalGray : public CPDF_ColorSpace { bool bTransMask = false) const override; private: - FX_FLOAT m_WhitePoint[3]; - FX_FLOAT m_BlackPoint[3]; - FX_FLOAT m_Gamma; + float m_WhitePoint[3]; + float m_BlackPoint[3]; + float m_Gamma; }; class CPDF_CalRGB : public CPDF_ColorSpace { @@ -93,14 +87,8 @@ class CPDF_CalRGB : public CPDF_ColorSpace { bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; - bool GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const override; - bool SetRGB(FX_FLOAT* pBuf, - FX_FLOAT R, - FX_FLOAT G, - FX_FLOAT B) const override; + bool GetRGB(float* pBuf, float& R, float& G, float& B) const override; + bool SetRGB(float* pBuf, float R, float G, float B) const override; void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, @@ -109,10 +97,10 @@ class CPDF_CalRGB : public CPDF_ColorSpace { int image_height, bool bTransMask = false) const override; - FX_FLOAT m_WhitePoint[3]; - FX_FLOAT m_BlackPoint[3]; - FX_FLOAT m_Gamma[3]; - FX_FLOAT m_Matrix[9]; + float m_WhitePoint[3]; + float m_BlackPoint[3]; + float m_Gamma[3]; + float m_Matrix[9]; bool m_bGamma; bool m_bMatrix; }; @@ -124,17 +112,11 @@ class CPDF_LabCS : public CPDF_ColorSpace { bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; void GetDefaultValue(int iComponent, - FX_FLOAT& value, - FX_FLOAT& min, - FX_FLOAT& max) const override; - bool GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const override; - bool SetRGB(FX_FLOAT* pBuf, - FX_FLOAT R, - FX_FLOAT G, - FX_FLOAT B) const override; + float& value, + float& min, + float& max) const override; + bool GetRGB(float* pBuf, float& R, float& G, float& B) const override; + bool SetRGB(float* pBuf, float R, float G, float B) const override; void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, @@ -143,9 +125,9 @@ class CPDF_LabCS : public CPDF_ColorSpace { int image_height, bool bTransMask = false) const override; - FX_FLOAT m_WhitePoint[3]; - FX_FLOAT m_BlackPoint[3]; - FX_FLOAT m_Ranges[4]; + float m_WhitePoint[3]; + float m_BlackPoint[3]; + float m_Ranges[4]; }; class CPDF_ICCBasedCS : public CPDF_ColorSpace { @@ -155,20 +137,14 @@ class CPDF_ICCBasedCS : public CPDF_ColorSpace { bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; - bool GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const override; - bool SetRGB(FX_FLOAT* pBuf, - FX_FLOAT R, - FX_FLOAT G, - FX_FLOAT B) const override; - - bool v_GetCMYK(FX_FLOAT* pBuf, - FX_FLOAT& c, - FX_FLOAT& m, - FX_FLOAT& y, - FX_FLOAT& k) const override; + bool GetRGB(float* pBuf, float& R, float& G, float& B) const override; + bool SetRGB(float* pBuf, float R, float G, float B) const override; + + bool v_GetCMYK(float* pBuf, + float& c, + float& m, + float& y, + float& k) const override; void EnableStdConversion(bool bEnabled) override; void TranslateImageLine(uint8_t* pDestBuf, @@ -181,7 +157,7 @@ class CPDF_ICCBasedCS : public CPDF_ColorSpace { CFX_MaybeOwned<CPDF_ColorSpace> m_pAlterCS; CPDF_IccProfile* m_pProfile; uint8_t* m_pCache; - FX_FLOAT* m_pRanges; + float* m_pRanges; }; class CPDF_IndexedCS : public CPDF_ColorSpace { @@ -191,10 +167,7 @@ class CPDF_IndexedCS : public CPDF_ColorSpace { bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; - bool GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const override; + bool GetRGB(float* pBuf, float& R, float& G, float& B) const override; CPDF_ColorSpace* GetBaseCS() const override; void EnableStdConversion(bool bEnabled) override; @@ -204,7 +177,7 @@ class CPDF_IndexedCS : public CPDF_ColorSpace { int m_nBaseComponents; int m_MaxIndex; CFX_ByteString m_Table; - FX_FLOAT* m_pCompMinMax; + float* m_pCompMinMax; }; class CPDF_SeparationCS : public CPDF_ColorSpace { @@ -214,14 +187,11 @@ class CPDF_SeparationCS : public CPDF_ColorSpace { // CPDF_ColorSpace: void GetDefaultValue(int iComponent, - FX_FLOAT& value, - FX_FLOAT& min, - FX_FLOAT& max) const override; + float& value, + float& min, + float& max) const override; bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; - bool GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const override; + bool GetRGB(float* pBuf, float& R, float& G, float& B) const override; void EnableStdConversion(bool bEnabled) override; std::unique_ptr<CPDF_ColorSpace> m_pAltCS; @@ -236,21 +206,18 @@ class CPDF_DeviceNCS : public CPDF_ColorSpace { // CPDF_ColorSpace: void GetDefaultValue(int iComponent, - FX_FLOAT& value, - FX_FLOAT& min, - FX_FLOAT& max) const override; + float& value, + float& min, + float& max) const override; bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; - bool GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const override; + bool GetRGB(float* pBuf, float& R, float& G, float& B) const override; void EnableStdConversion(bool bEnabled) override; std::unique_ptr<CPDF_ColorSpace> m_pAltCS; std::unique_ptr<CPDF_Function> m_pFunc; }; -FX_FLOAT RGB_Conversion(FX_FLOAT colorComponent) { +float RGB_Conversion(float colorComponent) { if (colorComponent > 1) colorComponent = 1; if (colorComponent < 0) @@ -266,36 +233,31 @@ FX_FLOAT RGB_Conversion(FX_FLOAT colorComponent) { return colorComponent; } -void XYZ_to_sRGB(FX_FLOAT X, - FX_FLOAT Y, - FX_FLOAT Z, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) { - FX_FLOAT R1 = 3.2410f * X - 1.5374f * Y - 0.4986f * Z; - FX_FLOAT G1 = -0.9692f * X + 1.8760f * Y + 0.0416f * Z; - FX_FLOAT B1 = 0.0556f * X - 0.2040f * Y + 1.0570f * Z; +void XYZ_to_sRGB(float X, float Y, float Z, float& R, float& G, float& B) { + float R1 = 3.2410f * X - 1.5374f * Y - 0.4986f * Z; + float G1 = -0.9692f * X + 1.8760f * Y + 0.0416f * Z; + float B1 = 0.0556f * X - 0.2040f * Y + 1.0570f * Z; R = RGB_Conversion(R1); G = RGB_Conversion(G1); B = RGB_Conversion(B1); } -void XYZ_to_sRGB_WhitePoint(FX_FLOAT X, - FX_FLOAT Y, - FX_FLOAT Z, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B, - FX_FLOAT Xw, - FX_FLOAT Yw, - FX_FLOAT Zw) { +void XYZ_to_sRGB_WhitePoint(float X, + float Y, + float Z, + float& R, + float& G, + float& B, + float Xw, + float Yw, + float Zw) { // The following RGB_xyz is based on // sRGB value {Rx,Ry}={0.64, 0.33}, {Gx,Gy}={0.30, 0.60}, {Bx,By}={0.15, 0.06} - FX_FLOAT Rx = 0.64f, Ry = 0.33f; - FX_FLOAT Gx = 0.30f, Gy = 0.60f; - FX_FLOAT Bx = 0.15f, By = 0.06f; + float Rx = 0.64f, Ry = 0.33f; + float Gx = 0.30f, Gy = 0.60f; + float Bx = 0.15f, By = 0.06f; CFX_Matrix_3by3 RGB_xyz(Rx, Gx, Bx, Ry, Gy, By, 1 - Rx - Ry, 1 - Gx - Gy, 1 - Bx - By); CFX_Vector_3by1 whitePoint(Xw, Yw, Zw); @@ -411,13 +373,13 @@ int CPDF_ColorSpace::GetBufSize() const { if (m_Family == PDFCS_PATTERN) { return sizeof(PatternValue); } - return m_nComponents * sizeof(FX_FLOAT); + return m_nComponents * sizeof(float); } -FX_FLOAT* CPDF_ColorSpace::CreateBuf() { +float* CPDF_ColorSpace::CreateBuf() { int size = GetBufSize(); uint8_t* pBuf = FX_Alloc(uint8_t, size); - return (FX_FLOAT*)pBuf; + return (float*)pBuf; } bool CPDF_ColorSpace::sRGB() const { @@ -431,22 +393,19 @@ bool CPDF_ColorSpace::sRGB() const { return pCS->m_pProfile->m_bsRGB; } -bool CPDF_ColorSpace::SetRGB(FX_FLOAT* pBuf, - FX_FLOAT R, - FX_FLOAT G, - FX_FLOAT B) const { +bool CPDF_ColorSpace::SetRGB(float* pBuf, float R, float G, float B) const { return false; } -bool CPDF_ColorSpace::GetCMYK(FX_FLOAT* pBuf, - FX_FLOAT& c, - FX_FLOAT& m, - FX_FLOAT& y, - FX_FLOAT& k) const { +bool CPDF_ColorSpace::GetCMYK(float* pBuf, + float& c, + float& m, + float& y, + float& k) const { if (v_GetCMYK(pBuf, c, m, y, k)) { return true; } - FX_FLOAT R, G, B; + float R, G, B; if (!GetRGB(pBuf, R, G, B)) { return false; } @@ -454,24 +413,24 @@ bool CPDF_ColorSpace::GetCMYK(FX_FLOAT* pBuf, return true; } -bool CPDF_ColorSpace::SetCMYK(FX_FLOAT* pBuf, - FX_FLOAT c, - FX_FLOAT m, - FX_FLOAT y, - FX_FLOAT k) const { +bool CPDF_ColorSpace::SetCMYK(float* pBuf, + float c, + float m, + float y, + float k) const { if (v_SetCMYK(pBuf, c, m, y, k)) { return true; } - FX_FLOAT R, G, B; + float R, G, B; AdobeCMYK_to_sRGB(c, m, y, k, R, G, B); return SetRGB(pBuf, R, G, B); } -void CPDF_ColorSpace::GetDefaultColor(FX_FLOAT* buf) const { +void CPDF_ColorSpace::GetDefaultColor(float* buf) const { if (!buf || m_Family == PDFCS_PATTERN) { return; } - FX_FLOAT min, max; + float min, max; for (uint32_t i = 0; i < m_nComponents; i++) { GetDefaultValue(i, buf[i], min, max); } @@ -482,9 +441,9 @@ uint32_t CPDF_ColorSpace::CountComponents() const { } void CPDF_ColorSpace::GetDefaultValue(int iComponent, - FX_FLOAT& value, - FX_FLOAT& min, - FX_FLOAT& max) const { + float& value, + float& min, + float& max) const { value = 0; min = 0; max = 1.0f; @@ -496,15 +455,15 @@ void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf, int image_width, int image_height, bool bTransMask) const { - CFX_FixedBufGrow<FX_FLOAT, 16> srcbuf(m_nComponents); - FX_FLOAT* src = srcbuf; - FX_FLOAT R, G, B; + CFX_FixedBufGrow<float, 16> srcbuf(m_nComponents); + float* src = srcbuf; + float R, G, B; for (int i = 0; i < pixels; i++) { for (uint32_t j = 0; j < m_nComponents; j++) if (m_Family == PDFCS_INDEXED) { - src[j] = (FX_FLOAT)(*src_buf++); + src[j] = (float)(*src_buf++); } else { - src[j] = (FX_FLOAT)(*src_buf++) / 255; + src[j] = (float)(*src_buf++) / 255; } GetRGB(src, R, G, B); *dest_buf++ = (int32_t)(B * 255); @@ -539,19 +498,19 @@ bool CPDF_ColorSpace::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { return true; } -bool CPDF_ColorSpace::v_GetCMYK(FX_FLOAT* pBuf, - FX_FLOAT& c, - FX_FLOAT& m, - FX_FLOAT& y, - FX_FLOAT& k) const { +bool CPDF_ColorSpace::v_GetCMYK(float* pBuf, + float& c, + float& m, + float& y, + float& k) const { return false; } -bool CPDF_ColorSpace::v_SetCMYK(FX_FLOAT* pBuf, - FX_FLOAT c, - FX_FLOAT m, - FX_FLOAT y, - FX_FLOAT k) const { +bool CPDF_ColorSpace::v_SetCMYK(float* pBuf, + float c, + float m, + float y, + float k) const { return false; } @@ -578,18 +537,12 @@ bool CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { return true; } -bool CPDF_CalGray::GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const { +bool CPDF_CalGray::GetRGB(float* pBuf, float& R, float& G, float& B) const { R = G = B = *pBuf; return true; } -bool CPDF_CalGray::SetRGB(FX_FLOAT* pBuf, - FX_FLOAT R, - FX_FLOAT G, - FX_FLOAT B) const { +bool CPDF_CalGray::SetRGB(float* pBuf, float R, float G, float B) const { if (R == G && R == B) { *pBuf = R; return true; @@ -647,22 +600,19 @@ bool CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { return true; } -bool CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const { - FX_FLOAT A_ = pBuf[0]; - FX_FLOAT B_ = pBuf[1]; - FX_FLOAT C_ = pBuf[2]; +bool CPDF_CalRGB::GetRGB(float* pBuf, float& R, float& G, float& B) const { + float A_ = pBuf[0]; + float B_ = pBuf[1]; + float C_ = pBuf[2]; if (m_bGamma) { - A_ = (FX_FLOAT)FXSYS_pow(A_, m_Gamma[0]); - B_ = (FX_FLOAT)FXSYS_pow(B_, m_Gamma[1]); - C_ = (FX_FLOAT)FXSYS_pow(C_, m_Gamma[2]); + A_ = (float)FXSYS_pow(A_, m_Gamma[0]); + B_ = (float)FXSYS_pow(B_, m_Gamma[1]); + C_ = (float)FXSYS_pow(C_, m_Gamma[2]); } - FX_FLOAT X; - FX_FLOAT Y; - FX_FLOAT Z; + float X; + float Y; + float Z; if (m_bMatrix) { X = m_Matrix[0] * A_ + m_Matrix[3] * B_ + m_Matrix[6] * C_; Y = m_Matrix[1] * A_ + m_Matrix[4] * B_ + m_Matrix[7] * C_; @@ -677,10 +627,7 @@ bool CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf, return true; } -bool CPDF_CalRGB::SetRGB(FX_FLOAT* pBuf, - FX_FLOAT R, - FX_FLOAT G, - FX_FLOAT B) const { +bool CPDF_CalRGB::SetRGB(float* pBuf, float R, float G, float B) const { pBuf[0] = R; pBuf[1] = G; pBuf[2] = B; @@ -694,14 +641,14 @@ void CPDF_CalRGB::TranslateImageLine(uint8_t* pDestBuf, int image_height, bool bTransMask) const { if (bTransMask) { - FX_FLOAT Cal[3]; - FX_FLOAT R; - FX_FLOAT G; - FX_FLOAT B; + float Cal[3]; + float R; + float G; + float B; for (int i = 0; i < pixels; i++) { - Cal[0] = ((FX_FLOAT)pSrcBuf[2]) / 255; - Cal[1] = ((FX_FLOAT)pSrcBuf[1]) / 255; - Cal[2] = ((FX_FLOAT)pSrcBuf[0]) / 255; + Cal[0] = ((float)pSrcBuf[2]) / 255; + Cal[1] = ((float)pSrcBuf[1]) / 255; + Cal[2] = ((float)pSrcBuf[0]) / 255; GetRGB(Cal, R, G, B); pDestBuf[0] = FXSYS_round(B * 255); pDestBuf[1] = FXSYS_round(G * 255); @@ -717,9 +664,9 @@ CPDF_LabCS::CPDF_LabCS(CPDF_Document* pDoc) : CPDF_ColorSpace(pDoc, PDFCS_LAB, 3) {} void CPDF_LabCS::GetDefaultValue(int iComponent, - FX_FLOAT& value, - FX_FLOAT& min, - FX_FLOAT& max) const { + float& value, + float& min, + float& max) const { ASSERT(iComponent < 3); value = 0; if (iComponent == 0) { @@ -750,24 +697,21 @@ bool CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { m_BlackPoint[i] = pParam ? pParam->GetNumberAt(i) : 0; pParam = pDict->GetArrayFor("Range"); - const FX_FLOAT def_ranges[4] = {-100 * 1.0f, 100 * 1.0f, -100 * 1.0f, - 100 * 1.0f}; + const float def_ranges[4] = {-100 * 1.0f, 100 * 1.0f, -100 * 1.0f, + 100 * 1.0f}; for (i = 0; i < 4; i++) m_Ranges[i] = pParam ? pParam->GetNumberAt(i) : def_ranges[i]; return true; } -bool CPDF_LabCS::GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const { - FX_FLOAT Lstar = pBuf[0]; - FX_FLOAT astar = pBuf[1]; - FX_FLOAT bstar = pBuf[2]; - FX_FLOAT M = (Lstar + 16.0f) / 116.0f; - FX_FLOAT L = M + astar / 500.0f; - FX_FLOAT N = M - bstar / 200.0f; - FX_FLOAT X, Y, Z; +bool CPDF_LabCS::GetRGB(float* pBuf, float& R, float& G, float& B) const { + float Lstar = pBuf[0]; + float astar = pBuf[1]; + float bstar = pBuf[2]; + float M = (Lstar + 16.0f) / 116.0f; + float L = M + astar / 500.0f; + float N = M - bstar / 200.0f; + float X, Y, Z; if (L < 0.2069f) X = 0.957f * 0.12842f * (L - 0.1379f); else @@ -787,10 +731,7 @@ bool CPDF_LabCS::GetRGB(FX_FLOAT* pBuf, return true; } -bool CPDF_LabCS::SetRGB(FX_FLOAT* pBuf, - FX_FLOAT R, - FX_FLOAT G, - FX_FLOAT B) const { +bool CPDF_LabCS::SetRGB(float* pBuf, float R, float G, float B) const { return false; } @@ -801,11 +742,11 @@ void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf, int image_height, bool bTransMask) const { for (int i = 0; i < pixels; i++) { - FX_FLOAT lab[3]; - FX_FLOAT R, G, B; + float lab[3]; + float R, G, B; lab[0] = (pSrcBuf[0] * 100 / 255.0f); - lab[1] = (FX_FLOAT)(pSrcBuf[1] - 128); - lab[2] = (FX_FLOAT)(pSrcBuf[2] - 128); + lab[1] = (float)(pSrcBuf[1] - 128); + lab[2] = (float)(pSrcBuf[2] - 128); GetRGB(lab, R, G, B); pDestBuf[0] = (int32_t)(B * 255); pDestBuf[1] = (int32_t)(G * 255); @@ -875,7 +816,7 @@ bool CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { } } CPDF_Array* pRanges = pDict->GetArrayFor("Range"); - m_pRanges = FX_Alloc2D(FX_FLOAT, m_nComponents, 2); + m_pRanges = FX_Alloc2D(float, m_nComponents, 2); for (uint32_t i = 0; i < m_nComponents * 2; i++) { if (pRanges) m_pRanges[i] = pRanges->GetNumberAt(i); @@ -887,10 +828,7 @@ bool CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { return true; } -bool CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const { +bool CPDF_ICCBasedCS::GetRGB(float* pBuf, float& R, float& G, float& B) const { if (m_pProfile && m_pProfile->m_bsRGB) { R = pBuf[0]; G = pBuf[1]; @@ -907,7 +845,7 @@ bool CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, B = 0.0f; return true; } - FX_FLOAT rgb[3]; + float rgb[3]; pIccModule->SetComponents(m_nComponents); pIccModule->Translate(m_pProfile->m_pTransform, pBuf, rgb); R = rgb[0]; @@ -916,18 +854,15 @@ bool CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, return true; } -bool CPDF_ICCBasedCS::SetRGB(FX_FLOAT* pBuf, - FX_FLOAT R, - FX_FLOAT G, - FX_FLOAT B) const { +bool CPDF_ICCBasedCS::SetRGB(float* pBuf, float R, float G, float B) const { return false; } -bool CPDF_ICCBasedCS::v_GetCMYK(FX_FLOAT* pBuf, - FX_FLOAT& c, - FX_FLOAT& m, - FX_FLOAT& y, - FX_FLOAT& k) const { +bool CPDF_ICCBasedCS::v_GetCMYK(float* pBuf, + float& c, + float& m, + float& y, + float& k) const { if (m_nComponents != 4) return false; @@ -1025,8 +960,8 @@ bool CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { } m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray()); m_nBaseComponents = m_pBaseCS->CountComponents(); - m_pCompMinMax = FX_Alloc2D(FX_FLOAT, m_nBaseComponents, 2); - FX_FLOAT defvalue; + m_pCompMinMax = FX_Alloc2D(float, m_nBaseComponents, 2); + float defvalue; for (int i = 0; i < m_nBaseComponents; i++) { m_pBaseCS->GetDefaultValue(i, defvalue, m_pCompMinMax[i * 2], m_pCompMinMax[i * 2 + 1]); @@ -1048,10 +983,7 @@ bool CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { return true; } -bool CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const { +bool CPDF_IndexedCS::GetRGB(float* pBuf, float& R, float& G, float& B) const { int index = (int32_t)(*pBuf); if (index < 0 || index > m_MaxIndex) { return false; @@ -1063,8 +995,8 @@ bool CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, return false; } } - CFX_FixedBufGrow<FX_FLOAT, 16> Comps(m_nBaseComponents); - FX_FLOAT* comps = Comps; + CFX_FixedBufGrow<float, 16> Comps(m_nBaseComponents); + float* comps = Comps; const uint8_t* pTable = m_Table.raw_str(); for (int i = 0; i < m_nBaseComponents; i++) { comps[i] = @@ -1119,10 +1051,7 @@ bool CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { return true; } -bool CPDF_PatternCS::GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const { +bool CPDF_PatternCS::GetRGB(float* pBuf, float& R, float& G, float& B) const { if (m_pBaseCS) { ASSERT(m_pBaseCS->GetFamily() != PDFCS_PATTERN); PatternValue* pvalue = (PatternValue*)pBuf; @@ -1144,9 +1073,9 @@ CPDF_SeparationCS::CPDF_SeparationCS(CPDF_Document* pDoc) CPDF_SeparationCS::~CPDF_SeparationCS() {} void CPDF_SeparationCS::GetDefaultValue(int iComponent, - FX_FLOAT& value, - FX_FLOAT& min, - FX_FLOAT& max) const { + float& value, + float& min, + float& max) const { value = 1.0f; min = 0; max = 1.0f; @@ -1177,10 +1106,10 @@ bool CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { return true; } -bool CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const { +bool CPDF_SeparationCS::GetRGB(float* pBuf, + float& R, + float& G, + float& B) const { if (m_Type == None) return false; @@ -1189,13 +1118,13 @@ bool CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, return false; int nComps = m_pAltCS->CountComponents(); - CFX_FixedBufGrow<FX_FLOAT, 16> results(nComps); + CFX_FixedBufGrow<float, 16> results(nComps); for (int i = 0; i < nComps; i++) results[i] = *pBuf; return m_pAltCS->GetRGB(results, R, G, B); } - CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs()); + CFX_FixedBufGrow<float, 16> results(m_pFunc->CountOutputs()); int nresults = 0; m_pFunc->Call(pBuf, 1, results, nresults); if (nresults == 0) @@ -1222,9 +1151,9 @@ CPDF_DeviceNCS::CPDF_DeviceNCS(CPDF_Document* pDoc) CPDF_DeviceNCS::~CPDF_DeviceNCS() {} void CPDF_DeviceNCS::GetDefaultValue(int iComponent, - FX_FLOAT& value, - FX_FLOAT& min, - FX_FLOAT& max) const { + float& value, + float& min, + float& max) const { value = 1.0f; min = 0; max = 1.0f; @@ -1248,14 +1177,11 @@ bool CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { return m_pFunc->CountOutputs() >= m_pAltCS->CountComponents(); } -bool CPDF_DeviceNCS::GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const { +bool CPDF_DeviceNCS::GetRGB(float* pBuf, float& R, float& G, float& B) const { if (!m_pFunc) return false; - CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs()); + CFX_FixedBufGrow<float, 16> results(m_pFunc->CountOutputs()); int nresults = 0; m_pFunc->Call(pBuf, m_nComponents, results, nresults); if (nresults == 0) diff --git a/core/fpdfapi/page/cpdf_colorspace.h b/core/fpdfapi/page/cpdf_colorspace.h index c4d62ed849..e3c369e5ce 100644 --- a/core/fpdfapi/page/cpdf_colorspace.h +++ b/core/fpdfapi/page/cpdf_colorspace.h @@ -38,32 +38,21 @@ class CPDF_ColorSpace { void Release(); int GetBufSize() const; - FX_FLOAT* CreateBuf(); - void GetDefaultColor(FX_FLOAT* buf) const; + float* CreateBuf(); + void GetDefaultColor(float* buf) const; uint32_t CountComponents() const; int GetFamily() const { return m_Family; } virtual void GetDefaultValue(int iComponent, - FX_FLOAT& value, - FX_FLOAT& min, - FX_FLOAT& max) const; + float& value, + float& min, + float& max) const; bool sRGB() const; - virtual bool GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const = 0; - virtual bool SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const; - - bool GetCMYK(FX_FLOAT* pBuf, - FX_FLOAT& c, - FX_FLOAT& m, - FX_FLOAT& y, - FX_FLOAT& k) const; - bool SetCMYK(FX_FLOAT* pBuf, - FX_FLOAT c, - FX_FLOAT m, - FX_FLOAT y, - FX_FLOAT k) const; + virtual bool GetRGB(float* pBuf, float& R, float& G, float& B) const = 0; + virtual bool SetRGB(float* pBuf, float R, float G, float B) const; + + bool GetCMYK(float* pBuf, float& c, float& m, float& y, float& k) const; + bool SetCMYK(float* pBuf, float c, float m, float y, float k) const; virtual void TranslateImageLine(uint8_t* dest_buf, const uint8_t* src_buf, @@ -84,16 +73,12 @@ class CPDF_ColorSpace { virtual ~CPDF_ColorSpace(); virtual bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray); - virtual bool v_GetCMYK(FX_FLOAT* pBuf, - FX_FLOAT& c, - FX_FLOAT& m, - FX_FLOAT& y, - FX_FLOAT& k) const; - virtual bool v_SetCMYK(FX_FLOAT* pBuf, - FX_FLOAT c, - FX_FLOAT m, - FX_FLOAT y, - FX_FLOAT k) const; + virtual bool v_GetCMYK(float* pBuf, + float& c, + float& m, + float& y, + float& k) const; + virtual bool v_SetCMYK(float* pBuf, float c, float m, float y, float k) const; int m_Family; uint32_t m_nComponents; diff --git a/core/fpdfapi/page/cpdf_colorstate.cpp b/core/fpdfapi/page/cpdf_colorstate.cpp index c43a331c64..8ab182acc6 100644 --- a/core/fpdfapi/page/cpdf_colorstate.cpp +++ b/core/fpdfapi/page/cpdf_colorstate.cpp @@ -70,21 +70,21 @@ bool CPDF_ColorState::HasStrokeColor() const { } void CPDF_ColorState::SetFillColor(CPDF_ColorSpace* pCS, - FX_FLOAT* pValue, + float* pValue, uint32_t nValues) { ColorData* pData = m_Ref.GetPrivateCopy(); SetColor(pData->m_FillColor, pData->m_FillRGB, pCS, pValue, nValues); } void CPDF_ColorState::SetStrokeColor(CPDF_ColorSpace* pCS, - FX_FLOAT* pValue, + float* pValue, uint32_t nValues) { ColorData* pData = m_Ref.GetPrivateCopy(); SetColor(pData->m_StrokeColor, pData->m_StrokeRGB, pCS, pValue, nValues); } void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern, - FX_FLOAT* pValue, + float* pValue, uint32_t nValues) { ColorData* pData = m_Ref.GetPrivateCopy(); pData->m_FillColor.SetValue(pPattern, pValue, nValues); @@ -100,7 +100,7 @@ void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern, } void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern, - FX_FLOAT* pValue, + float* pValue, uint32_t nValues) { ColorData* pData = m_Ref.GetPrivateCopy(); pData->m_StrokeColor.SetValue(pPattern, pValue, nValues); @@ -119,7 +119,7 @@ void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern, void CPDF_ColorState::SetColor(CPDF_Color& color, uint32_t& rgb, CPDF_ColorSpace* pCS, - FX_FLOAT* pValue, + float* pValue, uint32_t nValues) { if (pCS) color.SetColorSpace(pCS); diff --git a/core/fpdfapi/page/cpdf_colorstate.h b/core/fpdfapi/page/cpdf_colorstate.h index 49c71b66f9..f66eac3d81 100644 --- a/core/fpdfapi/page/cpdf_colorstate.h +++ b/core/fpdfapi/page/cpdf_colorstate.h @@ -39,14 +39,10 @@ class CPDF_ColorState { CPDF_Color* GetMutableStrokeColor(); bool HasStrokeColor() const; - void SetFillColor(CPDF_ColorSpace* pCS, FX_FLOAT* pValue, uint32_t nValues); - void SetStrokeColor(CPDF_ColorSpace* pCS, FX_FLOAT* pValue, uint32_t nValues); - void SetFillPattern(CPDF_Pattern* pattern, - FX_FLOAT* pValue, - uint32_t nValues); - void SetStrokePattern(CPDF_Pattern* pattern, - FX_FLOAT* pValue, - uint32_t nValues); + void SetFillColor(CPDF_ColorSpace* pCS, float* pValue, uint32_t nValues); + void SetStrokeColor(CPDF_ColorSpace* pCS, float* pValue, uint32_t nValues); + void SetFillPattern(CPDF_Pattern* pattern, float* pValue, uint32_t nValues); + void SetStrokePattern(CPDF_Pattern* pattern, float* pValue, uint32_t nValues); explicit operator bool() const { return !!m_Ref; } @@ -68,7 +64,7 @@ class CPDF_ColorState { void SetColor(CPDF_Color& color, uint32_t& rgb, CPDF_ColorSpace* pCS, - FX_FLOAT* pValue, + float* pValue, uint32_t nValues); CFX_SharedCopyOnWrite<ColorData> m_Ref; diff --git a/core/fpdfapi/page/cpdf_devicecs_unittest.cpp b/core/fpdfapi/page/cpdf_devicecs_unittest.cpp index 287fc02fc4..b1b30094aa 100644 --- a/core/fpdfapi/page/cpdf_devicecs_unittest.cpp +++ b/core/fpdfapi/page/cpdf_devicecs_unittest.cpp @@ -8,13 +8,13 @@ #include "testing/gtest/include/gtest/gtest.h" TEST(CPDF_DeviceCSTest, GetRGBFromGray) { - FX_FLOAT R; - FX_FLOAT G; - FX_FLOAT B; + float R; + float G; + float B; CPDF_DeviceCS deviceGray(nullptr, PDFCS_DEVICEGRAY); // Test normal values. For gray, only first value from buf should be used. - FX_FLOAT buf[3] = {0.43f, 0.11f, 0.34f}; + float buf[3] = {0.43f, 0.11f, 0.34f}; ASSERT_TRUE(deviceGray.GetRGB(buf, R, G, B)); EXPECT_EQ(0.43f, R); EXPECT_EQ(0.43f, G); @@ -51,13 +51,13 @@ TEST(CPDF_DeviceCSTest, GetRGBFromGray) { } TEST(CPDF_DeviceCSTest, GetRGBFromRGB) { - FX_FLOAT R; - FX_FLOAT G; - FX_FLOAT B; + float R; + float G; + float B; CPDF_DeviceCS deviceRGB(nullptr, PDFCS_DEVICERGB); // Test normal values - FX_FLOAT buf[3] = {0.13f, 1.0f, 0.652f}; + float buf[3] = {0.13f, 1.0f, 0.652f}; ASSERT_TRUE(deviceRGB.GetRGB(buf, R, G, B)); EXPECT_EQ(0.13f, R); EXPECT_EQ(1.0f, G); @@ -80,14 +80,14 @@ TEST(CPDF_DeviceCSTest, GetRGBFromRGB) { } TEST(CPDF_DeviceCSTest, GetRGBFromCMYK) { - FX_FLOAT R; - FX_FLOAT G; - FX_FLOAT B; + float R; + float G; + float B; CPDF_DeviceCS deviceCMYK(nullptr, PDFCS_DEVICECMYK); // Use an error threshold because of the calculations used here. - FX_FLOAT eps = 1e-6f; + float eps = 1e-6f; // Test normal values - FX_FLOAT buf[4] = {0.6f, 0.5f, 0.3f, 0.9f}; + float buf[4] = {0.6f, 0.5f, 0.3f, 0.9f}; ASSERT_TRUE(deviceCMYK.GetRGB(buf, R, G, B)); EXPECT_TRUE(std::abs(0.0627451f - R) < eps); EXPECT_TRUE(std::abs(0.0627451f - G) < eps); diff --git a/core/fpdfapi/page/cpdf_generalstate.cpp b/core/fpdfapi/page/cpdf_generalstate.cpp index 4edd9b2a3c..dd5c5af878 100644 --- a/core/fpdfapi/page/cpdf_generalstate.cpp +++ b/core/fpdfapi/page/cpdf_generalstate.cpp @@ -88,21 +88,21 @@ void CPDF_GeneralState::SetBlendType(int type) { m_Ref.GetPrivateCopy()->m_BlendType = type; } -FX_FLOAT CPDF_GeneralState::GetFillAlpha() const { +float CPDF_GeneralState::GetFillAlpha() const { const StateData* pData = m_Ref.GetObject(); return pData ? pData->m_FillAlpha : 1.0f; } -void CPDF_GeneralState::SetFillAlpha(FX_FLOAT alpha) { +void CPDF_GeneralState::SetFillAlpha(float alpha) { m_Ref.GetPrivateCopy()->m_FillAlpha = alpha; } -FX_FLOAT CPDF_GeneralState::GetStrokeAlpha() const { +float CPDF_GeneralState::GetStrokeAlpha() const { const StateData* pData = m_Ref.GetObject(); return pData ? pData->m_StrokeAlpha : 1.0f; } -void CPDF_GeneralState::SetStrokeAlpha(FX_FLOAT alpha) { +void CPDF_GeneralState::SetStrokeAlpha(float alpha) { m_Ref.GetPrivateCopy()->m_StrokeAlpha = alpha; } @@ -186,11 +186,11 @@ void CPDF_GeneralState::SetHT(CPDF_Object* pObject) { m_Ref.GetPrivateCopy()->m_pHT = pObject; } -void CPDF_GeneralState::SetFlatness(FX_FLOAT flatness) { +void CPDF_GeneralState::SetFlatness(float flatness) { m_Ref.GetPrivateCopy()->m_Flatness = flatness; } -void CPDF_GeneralState::SetSmoothness(FX_FLOAT smoothness) { +void CPDF_GeneralState::SetSmoothness(float smoothness) { m_Ref.GetPrivateCopy()->m_Smoothness = smoothness; } diff --git a/core/fpdfapi/page/cpdf_generalstate.h b/core/fpdfapi/page/cpdf_generalstate.h index 5211c52e5b..ddc33ac800 100644 --- a/core/fpdfapi/page/cpdf_generalstate.h +++ b/core/fpdfapi/page/cpdf_generalstate.h @@ -28,11 +28,11 @@ class CPDF_GeneralState { int GetBlendType() const; void SetBlendType(int type); - FX_FLOAT GetFillAlpha() const; - void SetFillAlpha(FX_FLOAT alpha); + float GetFillAlpha() const; + void SetFillAlpha(float alpha); - FX_FLOAT GetStrokeAlpha() const; - void SetStrokeAlpha(FX_FLOAT alpha); + float GetStrokeAlpha() const; + void SetStrokeAlpha(float alpha); CPDF_Object* GetSoftMask() const; void SetSoftMask(CPDF_Object* pObject); @@ -61,8 +61,8 @@ class CPDF_GeneralState { void SetUCR(CPDF_Object* pObject); void SetHT(CPDF_Object* pObject); - void SetFlatness(FX_FLOAT flatness); - void SetSmoothness(FX_FLOAT smoothness); + void SetFlatness(float flatness); + void SetSmoothness(float smoothness); bool GetStrokeAdjust() const; void SetStrokeAdjust(bool adjust); @@ -84,8 +84,8 @@ class CPDF_GeneralState { int m_BlendType; CPDF_Object* m_pSoftMask; CFX_Matrix m_SMaskMatrix; - FX_FLOAT m_StrokeAlpha; - FX_FLOAT m_FillAlpha; + float m_StrokeAlpha; + float m_FillAlpha; CPDF_Object* m_pTR; CPDF_TransferFunc* m_pTransferFunc; CFX_Matrix m_Matrix; @@ -99,8 +99,8 @@ class CPDF_GeneralState { CPDF_Object* m_pBG; CPDF_Object* m_pUCR; CPDF_Object* m_pHT; - FX_FLOAT m_Flatness; - FX_FLOAT m_Smoothness; + float m_Flatness; + float m_Smoothness; }; CFX_SharedCopyOnWrite<StateData> m_Ref; diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp index fea03c70e1..3de0511771 100644 --- a/core/fpdfapi/page/cpdf_image.cpp +++ b/core/fpdfapi/page/cpdf_image.cpp @@ -298,7 +298,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap) { for (int32_t row = 0; row < BitmapHeight; row++) { src_offset = row * src_pitch; for (int32_t column = 0; column < BitmapWidth; column++) { - FX_FLOAT alpha = 1; + float alpha = 1; pDest[dest_offset] = (uint8_t)(src_buf[src_offset + 2] * alpha); pDest[dest_offset + 1] = (uint8_t)(src_buf[src_offset + 1] * alpha); pDest[dest_offset + 2] = (uint8_t)(src_buf[src_offset] * alpha); diff --git a/core/fpdfapi/page/cpdf_meshstream.cpp b/core/fpdfapi/page/cpdf_meshstream.cpp index 24ef9b271e..6450d14904 100644 --- a/core/fpdfapi/page/cpdf_meshstream.cpp +++ b/core/fpdfapi/page/cpdf_meshstream.cpp @@ -191,25 +191,25 @@ CFX_PointF CPDF_MeshStream::ReadCoords() { return pos; } -std::tuple<FX_FLOAT, FX_FLOAT, FX_FLOAT> CPDF_MeshStream::ReadColor() { +std::tuple<float, float, float> CPDF_MeshStream::ReadColor() { ASSERT(ShouldCheckBPC(m_type)); - FX_FLOAT color_value[kMaxComponents]; + float color_value[kMaxComponents]; for (uint32_t i = 0; i < m_nComponents; ++i) { color_value[i] = m_ColorMin[i] + m_BitStream.GetBits(m_nComponentBits) * (m_ColorMax[i] - m_ColorMin[i]) / m_ComponentMax; } - FX_FLOAT r; - FX_FLOAT g; - FX_FLOAT b; + float r; + float g; + float b; if (m_funcs.empty()) { m_pCS->GetRGB(color_value, r, g, b); - return std::tuple<FX_FLOAT, FX_FLOAT, FX_FLOAT>(r, g, b); + return std::tuple<float, float, float>(r, g, b); } - FX_FLOAT result[kMaxComponents]; + float result[kMaxComponents]; FXSYS_memset(result, 0, sizeof(result)); int nResults; for (const auto& func : m_funcs) { @@ -218,7 +218,7 @@ std::tuple<FX_FLOAT, FX_FLOAT, FX_FLOAT> CPDF_MeshStream::ReadColor() { } m_pCS->GetRGB(result, r, g, b); - return std::tuple<FX_FLOAT, FX_FLOAT, FX_FLOAT>(r, g, b); + return std::tuple<float, float, float>(r, g, b); } bool CPDF_MeshStream::ReadVertex(const CFX_Matrix& pObject2Bitmap, diff --git a/core/fpdfapi/page/cpdf_meshstream.h b/core/fpdfapi/page/cpdf_meshstream.h index d40de4a013..e58e354b35 100644 --- a/core/fpdfapi/page/cpdf_meshstream.h +++ b/core/fpdfapi/page/cpdf_meshstream.h @@ -23,9 +23,9 @@ class CPDF_MeshVertex { ~CPDF_MeshVertex(); CFX_PointF position; - FX_FLOAT r; - FX_FLOAT g; - FX_FLOAT b; + float r; + float g; + float b; }; class CFX_Matrix; @@ -48,7 +48,7 @@ class CPDF_MeshStream { uint32_t ReadFlag(); CFX_PointF ReadCoords(); - std::tuple<FX_FLOAT, FX_FLOAT, FX_FLOAT> ReadColor(); + std::tuple<float, float, float> ReadColor(); bool ReadVertex(const CFX_Matrix& pObject2Bitmap, CPDF_MeshVertex* vertex, @@ -74,12 +74,12 @@ class CPDF_MeshStream { uint32_t m_nComponents; uint32_t m_CoordMax; uint32_t m_ComponentMax; - FX_FLOAT m_xmin; - FX_FLOAT m_xmax; - FX_FLOAT m_ymin; - FX_FLOAT m_ymax; - FX_FLOAT m_ColorMin[kMaxComponents]; - FX_FLOAT m_ColorMax[kMaxComponents]; + float m_xmin; + float m_xmax; + float m_ymin; + float m_ymax; + float m_ColorMin[kMaxComponents]; + float m_ColorMax[kMaxComponents]; CPDF_StreamAcc m_Stream; CFX_BitStream m_BitStream; }; diff --git a/core/fpdfapi/page/cpdf_page.h b/core/fpdfapi/page/cpdf_page.h index 9e303562c6..76587d8c32 100644 --- a/core/fpdfapi/page/cpdf_page.h +++ b/core/fpdfapi/page/cpdf_page.h @@ -24,8 +24,8 @@ class CPDF_PageRenderContext; // These structs are used to keep track of resources that have already been // generated in the page. struct GraphicsData { - FX_FLOAT fillAlpha; - FX_FLOAT strokeAlpha; + float fillAlpha; + float strokeAlpha; bool operator<(const GraphicsData& other) const; }; @@ -51,8 +51,8 @@ class CPDF_Page : public CPDF_PageObjectHolder { int ySize, int iRotate) const; - FX_FLOAT GetPageWidth() const { return m_PageWidth; } - FX_FLOAT GetPageHeight() const { return m_PageHeight; } + float GetPageWidth() const { return m_PageWidth; } + float GetPageHeight() const { return m_PageHeight; } CFX_FloatRect GetPageBBox() const { return m_BBox; } const CFX_Matrix& GetPageMatrix() const { return m_PageMatrix; } CPDF_Object* GetPageAttr(const CFX_ByteString& name) const; @@ -72,8 +72,8 @@ class CPDF_Page : public CPDF_PageObjectHolder { protected: void StartParse(); - FX_FLOAT m_PageWidth; - FX_FLOAT m_PageHeight; + float m_PageWidth; + float m_PageHeight; CFX_Matrix m_PageMatrix; View* m_pView; std::unique_ptr<CPDF_PageRenderCache> m_pPageRender; diff --git a/core/fpdfapi/page/cpdf_pageobject.h b/core/fpdfapi/page/cpdf_pageobject.h index d2b84a5d40..668621ff51 100644 --- a/core/fpdfapi/page/cpdf_pageobject.h +++ b/core/fpdfapi/page/cpdf_pageobject.h @@ -57,10 +57,10 @@ class CPDF_PageObject : public CPDF_GraphicStates { } FX_RECT GetBBox(const CFX_Matrix* pMatrix) const; - FX_FLOAT m_Left; - FX_FLOAT m_Right; - FX_FLOAT m_Top; - FX_FLOAT m_Bottom; + float m_Left; + float m_Right; + float m_Top; + float m_Bottom; CPDF_ContentMark m_ContentMark; protected: diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.cpp b/core/fpdfapi/page/cpdf_pageobjectholder.cpp index 3304d4eec4..974baa65a0 100644 --- a/core/fpdfapi/page/cpdf_pageobjectholder.cpp +++ b/core/fpdfapi/page/cpdf_pageobjectholder.cpp @@ -46,10 +46,10 @@ CFX_FloatRect CPDF_PageObjectHolder::CalcBoundingBox() const { if (m_PageObjectList.empty()) return CFX_FloatRect(0, 0, 0, 0); - FX_FLOAT left = 1000000.0f; - FX_FLOAT right = -1000000.0f; - FX_FLOAT bottom = 1000000.0f; - FX_FLOAT top = -1000000.0f; + float left = 1000000.0f; + float right = -1000000.0f; + float bottom = 1000000.0f; + float top = -1000000.0f; for (const auto& pObj : m_PageObjectList) { left = std::min(left, pObj->m_Left); right = std::max(right, pObj->m_Right); diff --git a/core/fpdfapi/page/cpdf_path.cpp b/core/fpdfapi/page/cpdf_path.cpp index ddc6bbd1d6..b56249cd62 100644 --- a/core/fpdfapi/page/cpdf_path.cpp +++ b/core/fpdfapi/page/cpdf_path.cpp @@ -28,8 +28,8 @@ CFX_FloatRect CPDF_Path::GetBoundingBox() const { return m_Ref.GetObject()->GetBoundingBox(); } -CFX_FloatRect CPDF_Path::GetBoundingBox(FX_FLOAT line_width, - FX_FLOAT miter_limit) const { +CFX_FloatRect CPDF_Path::GetBoundingBox(float line_width, + float miter_limit) const { return m_Ref.GetObject()->GetBoundingBox(line_width, miter_limit); } @@ -49,10 +49,7 @@ void CPDF_Path::Append(const CFX_PathData* pData, const CFX_Matrix* pMatrix) { m_Ref.GetPrivateCopy()->Append(pData, pMatrix); } -void CPDF_Path::AppendRect(FX_FLOAT left, - FX_FLOAT bottom, - FX_FLOAT right, - FX_FLOAT top) { +void CPDF_Path::AppendRect(float left, float bottom, float right, float top) { m_Ref.GetPrivateCopy()->AppendRect(left, bottom, right, top); } diff --git a/core/fpdfapi/page/cpdf_path.h b/core/fpdfapi/page/cpdf_path.h index b0c5a68a44..84b844e798 100644 --- a/core/fpdfapi/page/cpdf_path.h +++ b/core/fpdfapi/page/cpdf_path.h @@ -29,14 +29,14 @@ class CPDF_Path { CFX_PointF GetPoint(int index) const; CFX_FloatRect GetBoundingBox() const; - CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const; + CFX_FloatRect GetBoundingBox(float line_width, float miter_limit) const; bool IsRect() const; void Transform(const CFX_Matrix* pMatrix); void Append(const CPDF_Path& other, const CFX_Matrix* pMatrix); void Append(const CFX_PathData* pData, const CFX_Matrix* pMatrix); - void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top); + void AppendRect(float left, float bottom, float right, float top); void AppendPoint(const CFX_PointF& point, FXPT_TYPE type, bool close); // TODO(tsepez): Remove when all access thru this class. diff --git a/core/fpdfapi/page/cpdf_pathobject.cpp b/core/fpdfapi/page/cpdf_pathobject.cpp index b5bb89390c..1dd0a88f78 100644 --- a/core/fpdfapi/page/cpdf_pathobject.cpp +++ b/core/fpdfapi/page/cpdf_pathobject.cpp @@ -35,7 +35,7 @@ void CPDF_PathObject::CalcBoundingBox() { if (!m_Path) return; CFX_FloatRect rect; - FX_FLOAT width = m_GraphState.GetLineWidth(); + float width = m_GraphState.GetLineWidth(); if (m_bStroke && width != 0) { rect = m_Path.GetBoundingBox(width, m_GraphState.GetMiterLimit()); } else { diff --git a/core/fpdfapi/page/cpdf_psengine.h b/core/fpdfapi/page/cpdf_psengine.h index eba3e9bbf2..607d81065d 100644 --- a/core/fpdfapi/page/cpdf_psengine.h +++ b/core/fpdfapi/page/cpdf_psengine.h @@ -87,12 +87,12 @@ class CPDF_PSEngine { bool Execute(); bool DoOperator(PDF_PSOP op); void Reset() { m_StackCount = 0; } - void Push(FX_FLOAT value); - FX_FLOAT Pop(); + void Push(float value); + float Pop(); uint32_t GetStackSize() const { return m_StackCount; } private: - FX_FLOAT m_Stack[PSENGINE_STACKSIZE]; + float m_Stack[PSENGINE_STACKSIZE]; uint32_t m_StackCount; CPDF_PSProc m_MainProc; }; diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index fe277f2839..798b9d4f4e 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -415,7 +415,7 @@ CFX_ByteString CPDF_StreamContentParser::GetString(uint32_t index) { return CFX_ByteString(); } -FX_FLOAT CPDF_StreamContentParser::GetNumber(uint32_t index) { +float CPDF_StreamContentParser::GetNumber(uint32_t index) { if (index >= m_ParamCount) { return 0; } @@ -425,7 +425,7 @@ FX_FLOAT CPDF_StreamContentParser::GetNumber(uint32_t index) { } ContentParam& param = m_ParamBuf[real_index]; if (param.m_Type == ContentParam::NUMBER) { - return param.m_Number.m_bInteger ? (FX_FLOAT)param.m_Number.m_Integer + return param.m_Number.m_bInteger ? (float)param.m_Number.m_Integer : param.m_Number.m_Float; } if (param.m_Type == 0 && param.m_pObject) { @@ -864,13 +864,13 @@ void CPDF_StreamContentParser::Handle_EOFillPath() { } void CPDF_StreamContentParser::Handle_SetGray_Fill() { - FX_FLOAT value = GetNumber(0); + float value = GetNumber(0); CPDF_ColorSpace* pCS = CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY); m_pCurStates->m_ColorState.SetFillColor(pCS, &value, 1); } void CPDF_StreamContentParser::Handle_SetGray_Stroke() { - FX_FLOAT value = GetNumber(0); + float value = GetNumber(0); CPDF_ColorSpace* pCS = CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY); m_pCurStates->m_ColorState.SetStrokeColor(pCS, &value, 1); } @@ -916,7 +916,7 @@ void CPDF_StreamContentParser::Handle_SetCMYKColor_Fill() { if (m_ParamCount != 4) return; - FX_FLOAT values[4]; + float values[4]; for (int i = 0; i < 4; i++) { values[i] = GetNumber(3 - i); } @@ -928,7 +928,7 @@ void CPDF_StreamContentParser::Handle_SetCMYKColor_Stroke() { if (m_ParamCount != 4) return; - FX_FLOAT values[4]; + float values[4]; for (int i = 0; i < 4; i++) { values[i] = GetNumber(3 - i); } @@ -976,15 +976,12 @@ void CPDF_StreamContentParser::Handle_RestoreGraphState() { } void CPDF_StreamContentParser::Handle_Rectangle() { - FX_FLOAT x = GetNumber(3), y = GetNumber(2); - FX_FLOAT w = GetNumber(1), h = GetNumber(0); + float x = GetNumber(3), y = GetNumber(2); + float w = GetNumber(1), h = GetNumber(0); AddPathRect(x, y, w, h); } -void CPDF_StreamContentParser::AddPathRect(FX_FLOAT x, - FX_FLOAT y, - FX_FLOAT w, - FX_FLOAT h) { +void CPDF_StreamContentParser::AddPathRect(float x, float y, float w, float h) { AddPathPoint(x, y, FXPT_TYPE::MoveTo, false); AddPathPoint(x + w, y, FXPT_TYPE::LineTo, false); AddPathPoint(x + w, y + h, FXPT_TYPE::LineTo, false); @@ -996,7 +993,7 @@ void CPDF_StreamContentParser::Handle_SetRGBColor_Fill() { if (m_ParamCount != 3) return; - FX_FLOAT values[3]; + float values[3]; for (int i = 0; i < 3; i++) { values[i] = GetNumber(2 - i); } @@ -1008,7 +1005,7 @@ void CPDF_StreamContentParser::Handle_SetRGBColor_Stroke() { if (m_ParamCount != 3) return; - FX_FLOAT values[3]; + float values[3]; for (int i = 0; i < 3; i++) { values[i] = GetNumber(2 - i); } @@ -1028,7 +1025,7 @@ void CPDF_StreamContentParser::Handle_StrokePath() { } void CPDF_StreamContentParser::Handle_SetColor_Fill() { - FX_FLOAT values[4]; + float values[4]; int nargs = m_ParamCount; if (nargs > 4) { nargs = 4; @@ -1040,7 +1037,7 @@ void CPDF_StreamContentParser::Handle_SetColor_Fill() { } void CPDF_StreamContentParser::Handle_SetColor_Stroke() { - FX_FLOAT values[4]; + float values[4]; int nargs = m_ParamCount; if (nargs > 4) { nargs = 4; @@ -1060,9 +1057,9 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Fill() { uint32_t nvalues = nargs; if (pLastParam->IsName()) nvalues--; - FX_FLOAT* values = nullptr; + float* values = nullptr; if (nvalues) { - values = FX_Alloc(FX_FLOAT, nvalues); + values = FX_Alloc(float, nvalues); for (uint32_t i = 0; i < nvalues; i++) { values[i] = GetNumber(nargs - i - 1); } @@ -1088,9 +1085,9 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() { if (pLastParam->IsName()) nvalues--; - FX_FLOAT* values = nullptr; + float* values = nullptr; if (nvalues) { - values = FX_Alloc(FX_FLOAT, nvalues); + values = FX_Alloc(float, nvalues); for (int i = 0; i < nvalues; i++) { values[i] = GetNumber(nargs - i - 1); } @@ -1149,7 +1146,7 @@ void CPDF_StreamContentParser::Handle_MoveTextPoint_SetLeading() { } void CPDF_StreamContentParser::Handle_SetFont() { - FX_FLOAT fs = GetNumber(0); + float fs = GetNumber(0); if (fs == 0) { fs = m_DefFontSize; } @@ -1231,8 +1228,8 @@ CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name, } void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs, - FX_FLOAT fInitKerning, - FX_FLOAT* pKerning, + float fInitKerning, + float* pKerning, int nsegs) { CPDF_Font* pFont = m_pCurStates->m_TextState.GetFont(); if (!pFont) { @@ -1260,7 +1257,7 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs, m_pLastTextObject = pText.get(); SetGraphicStates(m_pLastTextObject, true, true, true); if (TextRenderingModeIsStrokeMode(text_mode)) { - FX_FLOAT* pCTM = pText->m_TextState.GetMutableCTM(); + float* pCTM = pText->m_TextState.GetMutableCTM(); pCTM[0] = m_pCurStates->m_CTM.a; pCTM[1] = m_pCurStates->m_CTM.c; pCTM[2] = m_pCurStates->m_CTM.b; @@ -1323,9 +1320,9 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() { return; } CFX_ByteString* pStrs = new CFX_ByteString[nsegs]; - FX_FLOAT* pKerning = FX_Alloc(FX_FLOAT, nsegs); + float* pKerning = FX_Alloc(float, nsegs); size_t iSegment = 0; - FX_FLOAT fInitKerning = 0; + float fInitKerning = 0; for (size_t i = 0; i < n; i++) { CPDF_Object* pObj = pArray->GetDirectObjectAt(i); if (pObj->IsString()) { @@ -1336,7 +1333,7 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() { pStrs[iSegment] = str; pKerning[iSegment++] = 0; } else { - FX_FLOAT num = pObj ? pObj->GetNumber() : 0; + float num = pObj ? pObj->GetNumber() : 0; if (iSegment == 0) { fInitKerning += num; } else { @@ -1368,7 +1365,7 @@ void CPDF_StreamContentParser::OnChangeTextMatrix() { text_matrix.Concat(m_pCurStates->m_TextMatrix); text_matrix.Concat(m_pCurStates->m_CTM); text_matrix.Concat(m_mtContentToUser); - FX_FLOAT* pTextMatrix = m_pCurStates->m_TextState.GetMutableMatrix(); + float* pTextMatrix = m_pCurStates->m_TextState.GetMutableMatrix(); pTextMatrix[0] = text_matrix.a; pTextMatrix[1] = text_matrix.c; pTextMatrix[2] = text_matrix.b; @@ -1439,8 +1436,8 @@ void CPDF_StreamContentParser::Handle_NextLineShowText_Space() { void CPDF_StreamContentParser::Handle_Invalid() {} -void CPDF_StreamContentParser::AddPathPoint(FX_FLOAT x, - FX_FLOAT y, +void CPDF_StreamContentParser::AddPathPoint(float x, + float y, FXPT_TYPE type, bool close) { m_PathCurrentX = x; @@ -1553,7 +1550,7 @@ uint32_t CPDF_StreamContentParser::Parse(const uint8_t* pData, } void CPDF_StreamContentParser::ParsePathObject() { - FX_FLOAT params[6] = {}; + float params[6] = {}; int nParams = 0; int last_pos = m_pSyntax->GetPos(); while (1) { @@ -1624,7 +1621,7 @@ void CPDF_StreamContentParser::ParsePathObject() { int value; bool bInteger = FX_atonum(m_pSyntax->GetWord(), &value); - params[nParams++] = bInteger ? (FX_FLOAT)value : *(FX_FLOAT*)&value; + params[nParams++] = bInteger ? (float)value : *(float*)&value; break; } default: diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.h b/core/fpdfapi/page/cpdf_streamcontentparser.h index cd41990b0a..6cfc2731a9 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.h +++ b/core/fpdfapi/page/cpdf_streamcontentparser.h @@ -46,7 +46,7 @@ class CPDF_StreamContentParser { CPDF_PageObjectHolder* GetPageObjectHolder() const { return m_pObjectHolder; } CPDF_AllStates* GetCurStates() const { return m_pCurStates.get(); } bool IsColored() const { return m_bColored; } - const FX_FLOAT* GetType3Data() const { return m_Type3Data; } + const float* GetType3Data() const { return m_Type3Data; } CPDF_Font* FindFont(const CFX_ByteString& name); private: @@ -62,7 +62,7 @@ class CPDF_StreamContentParser { bool m_bInteger; union { int m_Integer; - FX_FLOAT m_Float; + float m_Float; }; } m_Number; struct { @@ -84,18 +84,18 @@ class CPDF_StreamContentParser { void ClearAllParams(); CPDF_Object* GetObject(uint32_t index); CFX_ByteString GetString(uint32_t index); - FX_FLOAT GetNumber(uint32_t index); + float GetNumber(uint32_t index); int GetInteger(uint32_t index) { return (int32_t)(GetNumber(index)); } void OnOperator(const CFX_ByteStringC& op); void AddTextObject(CFX_ByteString* pText, - FX_FLOAT fInitKerning, - FX_FLOAT* pKerning, + float fInitKerning, + float* pKerning, int count); void OnChangeTextMatrix(); void ParsePathObject(); - void AddPathPoint(FX_FLOAT x, FX_FLOAT y, FXPT_TYPE type, bool close); - void AddPathRect(FX_FLOAT x, FX_FLOAT y, FX_FLOAT w, FX_FLOAT h); + void AddPathPoint(float x, float y, FXPT_TYPE type, bool close); + void AddPathRect(float x, float y, float w, float h); void AddPathObject(int FillType, bool bStroke); CPDF_ImageObject* AddImage(std::unique_ptr<CPDF_Stream> pStream); CPDF_ImageObject* AddImage(uint32_t streamObjNum); @@ -203,19 +203,19 @@ class CPDF_StreamContentParser { CPDF_ContentMark m_CurContentMark; std::vector<std::unique_ptr<CPDF_TextObject>> m_ClipTextList; CPDF_TextObject* m_pLastTextObject; - FX_FLOAT m_DefFontSize; + float m_DefFontSize; FX_PATHPOINT* m_pPathPoints; int m_PathPointCount; int m_PathAllocSize; - FX_FLOAT m_PathStartX; - FX_FLOAT m_PathStartY; - FX_FLOAT m_PathCurrentX; - FX_FLOAT m_PathCurrentY; + float m_PathStartX; + float m_PathStartY; + float m_PathCurrentX; + float m_PathCurrentY; uint8_t m_PathClipType; CFX_ByteString m_LastImageName; CPDF_Image* m_pLastImage; bool m_bColored; - FX_FLOAT m_Type3Data[6]; + float m_Type3Data[6]; bool m_bResourceMissing; std::vector<std::unique_ptr<CPDF_AllStates>> m_StateStack; }; diff --git a/core/fpdfapi/page/cpdf_textobject.cpp b/core/fpdfapi/page/cpdf_textobject.cpp index 1c940bc057..b8f3f61073 100644 --- a/core/fpdfapi/page/cpdf_textobject.cpp +++ b/core/fpdfapi/page/cpdf_textobject.cpp @@ -44,7 +44,7 @@ void CPDF_TextObject::GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const { short vy; pFont->AsCIDFont()->GetVertOrigin(CID, vx, vy); - FX_FLOAT fontsize = m_TextState.GetFontSize(); + float fontsize = m_TextState.GetFontSize(); pInfo->m_Origin.x -= fontsize * vx / 1000; pInfo->m_Origin.y -= fontsize * vy / 1000; } @@ -60,7 +60,7 @@ int CPDF_TextObject::CountChars() const { void CPDF_TextObject::GetCharInfo(int index, uint32_t* charcode, - FX_FLOAT* kerning) const { + float* kerning) const { int count = 0; for (size_t i = 0; i < m_CharCodes.size(); ++i) { if (m_CharCodes[i] == CPDF_Font::kInvalidCharCode) @@ -108,7 +108,7 @@ void CPDF_TextObject::Transform(const CFX_Matrix& matrix) { CFX_Matrix text_matrix = GetTextMatrix(); text_matrix.Concat(matrix); - FX_FLOAT* pTextMatrix = m_TextState.GetMutableMatrix(); + float* pTextMatrix = m_TextState.GetMutableMatrix(); pTextMatrix[0] = text_matrix.a; pTextMatrix[1] = text_matrix.c; pTextMatrix[2] = text_matrix.b; @@ -130,13 +130,13 @@ const CPDF_TextObject* CPDF_TextObject::AsText() const { } CFX_Matrix CPDF_TextObject::GetTextMatrix() const { - const FX_FLOAT* pTextMatrix = m_TextState.GetMatrix(); + const float* pTextMatrix = m_TextState.GetMatrix(); return CFX_Matrix(pTextMatrix[0], pTextMatrix[2], pTextMatrix[1], pTextMatrix[3], m_Pos.x, m_Pos.y); } void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, - const FX_FLOAT* pKerning, + const float* pKerning, int nsegs) { m_CharCodes.clear(); m_CharPos.clear(); @@ -166,8 +166,8 @@ void CPDF_TextObject::SetText(const CFX_ByteString& str) { RecalcPositionData(); } -FX_FLOAT CPDF_TextObject::GetCharWidth(uint32_t charcode) const { - FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000; +float CPDF_TextObject::GetCharWidth(uint32_t charcode) const { + float fontsize = m_TextState.GetFontSize() / 1000; CPDF_Font* pFont = m_TextState.GetFont(); bool bVertWriting = false; CPDF_CIDFont* pCIDFont = pFont->AsCIDFont(); @@ -184,23 +184,23 @@ CPDF_Font* CPDF_TextObject::GetFont() const { return m_TextState.GetFont(); } -FX_FLOAT CPDF_TextObject::GetFontSize() const { +float CPDF_TextObject::GetFontSize() const { return m_TextState.GetFontSize(); } -CFX_PointF CPDF_TextObject::CalcPositionData(FX_FLOAT horz_scale) { - FX_FLOAT curpos = 0; - FX_FLOAT min_x = 10000 * 1.0f; - FX_FLOAT max_x = -10000 * 1.0f; - FX_FLOAT min_y = 10000 * 1.0f; - FX_FLOAT max_y = -10000 * 1.0f; +CFX_PointF CPDF_TextObject::CalcPositionData(float horz_scale) { + float curpos = 0; + float min_x = 10000 * 1.0f; + float max_x = -10000 * 1.0f; + float min_y = 10000 * 1.0f; + float max_y = -10000 * 1.0f; CPDF_Font* pFont = m_TextState.GetFont(); bool bVertWriting = false; CPDF_CIDFont* pCIDFont = pFont->AsCIDFont(); if (pCIDFont) bVertWriting = pCIDFont->IsVertWriting(); - FX_FLOAT fontsize = m_TextState.GetFontSize(); + float fontsize = m_TextState.GetFontSize(); for (int i = 0; i < pdfium::CollectionSize<int>(m_CharCodes); ++i) { uint32_t charcode = m_CharCodes[i]; if (i > 0) { @@ -212,14 +212,14 @@ CFX_PointF CPDF_TextObject::CalcPositionData(FX_FLOAT horz_scale) { } FX_RECT char_rect = pFont->GetCharBBox(charcode); - FX_FLOAT charwidth; + float charwidth; if (!bVertWriting) { - min_y = std::min(min_y, static_cast<FX_FLOAT>( - std::min(char_rect.top, char_rect.bottom))); - max_y = std::max(max_y, static_cast<FX_FLOAT>( - std::max(char_rect.top, char_rect.bottom))); - FX_FLOAT char_left = curpos + char_rect.left * fontsize / 1000; - FX_FLOAT char_right = curpos + char_rect.right * fontsize / 1000; + min_y = std::min( + min_y, static_cast<float>(std::min(char_rect.top, char_rect.bottom))); + max_y = std::max( + max_y, static_cast<float>(std::max(char_rect.top, char_rect.bottom))); + float char_left = curpos + char_rect.left * fontsize / 1000; + float char_right = curpos + char_rect.right * fontsize / 1000; min_x = std::min(min_x, std::min(char_left, char_right)); max_x = std::max(max_x, std::max(char_left, char_right)); charwidth = pFont->GetCharWidthF(charcode) * fontsize / 1000; @@ -232,12 +232,12 @@ CFX_PointF CPDF_TextObject::CalcPositionData(FX_FLOAT horz_scale) { char_rect.right -= vx; char_rect.top -= vy; char_rect.bottom -= vy; - min_x = std::min(min_x, static_cast<FX_FLOAT>( - std::min(char_rect.left, char_rect.right))); - max_x = std::max(max_x, static_cast<FX_FLOAT>( - std::max(char_rect.left, char_rect.right))); - FX_FLOAT char_top = curpos + char_rect.top * fontsize / 1000; - FX_FLOAT char_bottom = curpos + char_rect.bottom * fontsize / 1000; + min_x = std::min( + min_x, static_cast<float>(std::min(char_rect.left, char_rect.right))); + max_x = std::max( + max_x, static_cast<float>(std::max(char_rect.left, char_rect.right))); + float char_top = curpos + char_rect.top * fontsize / 1000; + float char_bottom = curpos + char_rect.bottom * fontsize / 1000; min_y = std::min(min_y, std::min(char_top, char_bottom)); max_y = std::max(max_y, std::max(char_top, char_bottom)); charwidth = pCIDFont->GetVertWidth(CID) * fontsize / 1000; @@ -269,7 +269,7 @@ CFX_PointF CPDF_TextObject::CalcPositionData(FX_FLOAT horz_scale) { if (!TextRenderingModeIsStrokeMode(m_TextState.GetTextMode())) return ret; - FX_FLOAT half_width = m_GraphState.GetLineWidth() / 2; + float half_width = m_GraphState.GetLineWidth() / 2; m_Left -= half_width; m_Right += half_width; m_Top += half_width; @@ -278,9 +278,9 @@ CFX_PointF CPDF_TextObject::CalcPositionData(FX_FLOAT horz_scale) { return ret; } -void CPDF_TextObject::SetPosition(FX_FLOAT x, FX_FLOAT y) { - FX_FLOAT dx = x - m_Pos.x; - FX_FLOAT dy = y - m_Pos.y; +void CPDF_TextObject::SetPosition(float x, float y) { + float dx = x - m_Pos.x; + float dy = y - m_Pos.y; m_Pos.x = x; m_Pos.y = y; m_Left += dx; diff --git a/core/fpdfapi/page/cpdf_textobject.h b/core/fpdfapi/page/cpdf_textobject.h index 59da718f62..e08b7280de 100644 --- a/core/fpdfapi/page/cpdf_textobject.h +++ b/core/fpdfapi/page/cpdf_textobject.h @@ -39,16 +39,16 @@ class CPDF_TextObject : public CPDF_PageObject { int CountItems() const; void GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const; int CountChars() const; - void GetCharInfo(int index, uint32_t* charcode, FX_FLOAT* kerning) const; + void GetCharInfo(int index, uint32_t* charcode, float* kerning) const; void GetCharInfo(int index, CPDF_TextObjectItem* pInfo) const; - FX_FLOAT GetCharWidth(uint32_t charcode) const; + float GetCharWidth(uint32_t charcode) const; CFX_PointF GetPos() const { return m_Pos; } CFX_Matrix GetTextMatrix() const; CPDF_Font* GetFont() const; - FX_FLOAT GetFontSize() const; + float GetFontSize() const; void SetText(const CFX_ByteString& text); - void SetPosition(FX_FLOAT x, FX_FLOAT y); + void SetPosition(float x, float y); void RecalcPositionData(); @@ -59,14 +59,14 @@ class CPDF_TextObject : public CPDF_PageObject { friend class CPDF_PageContentGenerator; void SetSegments(const CFX_ByteString* pStrs, - const FX_FLOAT* pKerning, + const float* pKerning, int nSegs); - CFX_PointF CalcPositionData(FX_FLOAT horz_scale); + CFX_PointF CalcPositionData(float horz_scale); CFX_PointF m_Pos; std::vector<uint32_t> m_CharCodes; - std::vector<FX_FLOAT> m_CharPos; + std::vector<float> m_CharPos; }; #endif // CORE_FPDFAPI_PAGE_CPDF_TEXTOBJECT_H_ diff --git a/core/fpdfapi/page/cpdf_textstate.cpp b/core/fpdfapi/page/cpdf_textstate.cpp index 990c9cc311..520cb7365b 100644 --- a/core/fpdfapi/page/cpdf_textstate.cpp +++ b/core/fpdfapi/page/cpdf_textstate.cpp @@ -25,51 +25,51 @@ void CPDF_TextState::SetFont(CPDF_Font* pFont) { m_Ref.GetPrivateCopy()->SetFont(pFont); } -FX_FLOAT CPDF_TextState::GetFontSize() const { +float CPDF_TextState::GetFontSize() const { return m_Ref.GetObject()->m_FontSize; } -void CPDF_TextState::SetFontSize(FX_FLOAT size) { +void CPDF_TextState::SetFontSize(float size) { m_Ref.GetPrivateCopy()->m_FontSize = size; } -const FX_FLOAT* CPDF_TextState::GetMatrix() const { +const float* CPDF_TextState::GetMatrix() const { return m_Ref.GetObject()->m_Matrix; } -FX_FLOAT* CPDF_TextState::GetMutableMatrix() { +float* CPDF_TextState::GetMutableMatrix() { return m_Ref.GetPrivateCopy()->m_Matrix; } -FX_FLOAT CPDF_TextState::GetCharSpace() const { +float CPDF_TextState::GetCharSpace() const { return m_Ref.GetObject()->m_CharSpace; } -void CPDF_TextState::SetCharSpace(FX_FLOAT sp) { +void CPDF_TextState::SetCharSpace(float sp) { m_Ref.GetPrivateCopy()->m_CharSpace = sp; } -FX_FLOAT CPDF_TextState::GetWordSpace() const { +float CPDF_TextState::GetWordSpace() const { return m_Ref.GetObject()->m_WordSpace; } -void CPDF_TextState::SetWordSpace(FX_FLOAT sp) { +void CPDF_TextState::SetWordSpace(float sp) { m_Ref.GetPrivateCopy()->m_WordSpace = sp; } -FX_FLOAT CPDF_TextState::GetFontSizeV() const { +float CPDF_TextState::GetFontSizeV() const { return m_Ref.GetObject()->GetFontSizeV(); } -FX_FLOAT CPDF_TextState::GetFontSizeH() const { +float CPDF_TextState::GetFontSizeH() const { return m_Ref.GetObject()->GetFontSizeH(); } -FX_FLOAT CPDF_TextState::GetBaselineAngle() const { +float CPDF_TextState::GetBaselineAngle() const { return m_Ref.GetObject()->GetBaselineAngle(); } -FX_FLOAT CPDF_TextState::GetShearAngle() const { +float CPDF_TextState::GetShearAngle() const { return m_Ref.GetObject()->GetShearAngle(); } @@ -81,11 +81,11 @@ void CPDF_TextState::SetTextMode(TextRenderingMode mode) { m_Ref.GetPrivateCopy()->m_TextMode = mode; } -const FX_FLOAT* CPDF_TextState::GetCTM() const { +const float* CPDF_TextState::GetCTM() const { return m_Ref.GetObject()->m_CTM; } -FX_FLOAT* CPDF_TextState::GetMutableCTM() { +float* CPDF_TextState::GetMutableCTM() { return m_Ref.GetPrivateCopy()->m_CTM; } @@ -138,19 +138,19 @@ void CPDF_TextState::TextData::SetFont(CPDF_Font* pFont) { m_pFont = pFont; } -FX_FLOAT CPDF_TextState::TextData::GetFontSizeV() const { +float CPDF_TextState::TextData::GetFontSizeV() const { return FXSYS_fabs(FXSYS_sqrt2(m_Matrix[1], m_Matrix[3]) * m_FontSize); } -FX_FLOAT CPDF_TextState::TextData::GetFontSizeH() const { +float CPDF_TextState::TextData::GetFontSizeH() const { return FXSYS_fabs(FXSYS_sqrt2(m_Matrix[0], m_Matrix[2]) * m_FontSize); } -FX_FLOAT CPDF_TextState::TextData::GetBaselineAngle() const { +float CPDF_TextState::TextData::GetBaselineAngle() const { return FXSYS_atan2(m_Matrix[2], m_Matrix[0]); } -FX_FLOAT CPDF_TextState::TextData::GetShearAngle() const { +float CPDF_TextState::TextData::GetShearAngle() const { return GetBaselineAngle() + FXSYS_atan2(m_Matrix[1], m_Matrix[3]); } diff --git a/core/fpdfapi/page/cpdf_textstate.h b/core/fpdfapi/page/cpdf_textstate.h index 4723469fd9..07bee5ed04 100644 --- a/core/fpdfapi/page/cpdf_textstate.h +++ b/core/fpdfapi/page/cpdf_textstate.h @@ -35,28 +35,28 @@ class CPDF_TextState { CPDF_Font* GetFont() const; void SetFont(CPDF_Font* pFont); - FX_FLOAT GetFontSize() const; - void SetFontSize(FX_FLOAT size); + float GetFontSize() const; + void SetFontSize(float size); - const FX_FLOAT* GetMatrix() const; - FX_FLOAT* GetMutableMatrix(); + const float* GetMatrix() const; + float* GetMutableMatrix(); - FX_FLOAT GetCharSpace() const; - void SetCharSpace(FX_FLOAT sp); + float GetCharSpace() const; + void SetCharSpace(float sp); - FX_FLOAT GetWordSpace() const; - void SetWordSpace(FX_FLOAT sp); + float GetWordSpace() const; + void SetWordSpace(float sp); - FX_FLOAT GetFontSizeV() const; - FX_FLOAT GetFontSizeH() const; - FX_FLOAT GetBaselineAngle() const; - FX_FLOAT GetShearAngle() const; + float GetFontSizeV() const; + float GetFontSizeH() const; + float GetBaselineAngle() const; + float GetShearAngle() const; TextRenderingMode GetTextMode() const; void SetTextMode(TextRenderingMode mode); - const FX_FLOAT* GetCTM() const; - FX_FLOAT* GetMutableCTM(); + const float* GetCTM() const; + float* GetMutableCTM(); private: class TextData { @@ -66,19 +66,19 @@ class CPDF_TextState { ~TextData(); void SetFont(CPDF_Font* pFont); - FX_FLOAT GetFontSizeV() const; - FX_FLOAT GetFontSizeH() const; - FX_FLOAT GetBaselineAngle() const; - FX_FLOAT GetShearAngle() const; + float GetFontSizeV() const; + float GetFontSizeH() const; + float GetBaselineAngle() const; + float GetShearAngle() const; CPDF_Font* m_pFont; CPDF_Document* m_pDocument; - FX_FLOAT m_FontSize; - FX_FLOAT m_CharSpace; - FX_FLOAT m_WordSpace; + float m_FontSize; + float m_CharSpace; + float m_WordSpace; TextRenderingMode m_TextMode; - FX_FLOAT m_Matrix[4]; - FX_FLOAT m_CTM[4]; + float m_Matrix[4]; + float m_CTM[4]; }; CFX_SharedCopyOnWrite<TextData> m_Ref; diff --git a/core/fpdfapi/page/cpdf_tilingpattern.cpp b/core/fpdfapi/page/cpdf_tilingpattern.cpp index a041f38074..fb46dd2b3e 100644 --- a/core/fpdfapi/page/cpdf_tilingpattern.cpp +++ b/core/fpdfapi/page/cpdf_tilingpattern.cpp @@ -41,8 +41,8 @@ bool CPDF_TilingPattern::Load() { return false; m_bColored = pDict->GetIntegerFor("PaintType") == 1; - m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberFor("XStep")); - m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberFor("YStep")); + m_XStep = (float)FXSYS_fabs(pDict->GetNumberFor("XStep")); + m_YStep = (float)FXSYS_fabs(pDict->GetNumberFor("YStep")); CPDF_Stream* pStream = m_pPatternObj->AsStream(); if (!pStream) diff --git a/core/fpdfapi/page/cpdf_tilingpattern.h b/core/fpdfapi/page/cpdf_tilingpattern.h index 3f0851aa7e..d9450d7c2f 100644 --- a/core/fpdfapi/page/cpdf_tilingpattern.h +++ b/core/fpdfapi/page/cpdf_tilingpattern.h @@ -31,15 +31,15 @@ class CPDF_TilingPattern : public CPDF_Pattern { bool colored() const { return m_bColored; } const CFX_FloatRect& bbox() const { return m_BBox; } - FX_FLOAT x_step() const { return m_XStep; } - FX_FLOAT y_step() const { return m_YStep; } + float x_step() const { return m_XStep; } + float y_step() const { return m_YStep; } CPDF_Form* form() const { return m_pForm.get(); } private: bool m_bColored; CFX_FloatRect m_BBox; - FX_FLOAT m_XStep; - FX_FLOAT m_YStep; + float m_XStep; + float m_YStep; std::unique_ptr<CPDF_Form> m_pForm; }; diff --git a/core/fpdfapi/page/fpdf_page_colors.cpp b/core/fpdfapi/page/fpdf_page_colors.cpp index 54b61df975..8964a18cdb 100644 --- a/core/fpdfapi/page/fpdf_page_colors.cpp +++ b/core/fpdfapi/page/fpdf_page_colors.cpp @@ -21,7 +21,7 @@ namespace { -FX_FLOAT NormalizeChannel(FX_FLOAT fVal) { +float NormalizeChannel(float fVal) { return std::min(std::max(fVal, 0.0f), 1.0f); } @@ -36,13 +36,13 @@ uint32_t ComponentsForFamily(int family) { return 4; } -void sRGB_to_AdobeCMYK(FX_FLOAT R, - FX_FLOAT G, - FX_FLOAT B, - FX_FLOAT& c, - FX_FLOAT& m, - FX_FLOAT& y, - FX_FLOAT& k) { +void sRGB_to_AdobeCMYK(float R, + float G, + float B, + float& c, + float& m, + float& y, + float& k) { c = 1.0f - R; m = 1.0f - G; y = 1.0f - B; @@ -73,10 +73,7 @@ CPDF_DeviceCS::CPDF_DeviceCS(CPDF_Document* pDoc, int family) family == PDFCS_DEVICECMYK); } -bool CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const { +bool CPDF_DeviceCS::GetRGB(float* pBuf, float& R, float& G, float& B) const { switch (m_Family) { case PDFCS_DEVICEGRAY: R = NormalizeChannel(*pBuf); @@ -90,7 +87,7 @@ bool CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf, break; case PDFCS_DEVICECMYK: if (m_dwStdConversion) { - FX_FLOAT k = pBuf[3]; + float k = pBuf[3]; R = 1.0f - std::min(1.0f, pBuf[0] + k); G = 1.0f - std::min(1.0f, pBuf[1] + k); B = 1.0f - std::min(1.0f, pBuf[2] + k); @@ -107,11 +104,11 @@ bool CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf, return true; } -bool CPDF_DeviceCS::v_GetCMYK(FX_FLOAT* pBuf, - FX_FLOAT& c, - FX_FLOAT& m, - FX_FLOAT& y, - FX_FLOAT& k) const { +bool CPDF_DeviceCS::v_GetCMYK(float* pBuf, + float& c, + float& m, + float& y, + float& k) const { if (m_Family != PDFCS_DEVICECMYK) return false; @@ -122,10 +119,7 @@ bool CPDF_DeviceCS::v_GetCMYK(FX_FLOAT* pBuf, return true; } -bool CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf, - FX_FLOAT R, - FX_FLOAT G, - FX_FLOAT B) const { +bool CPDF_DeviceCS::SetRGB(float* pBuf, float R, float G, float B) const { switch (m_Family) { case PDFCS_DEVICEGRAY: if (R != G || R != B) @@ -146,11 +140,11 @@ bool CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf, } } -bool CPDF_DeviceCS::v_SetCMYK(FX_FLOAT* pBuf, - FX_FLOAT c, - FX_FLOAT m, - FX_FLOAT y, - FX_FLOAT k) const { +bool CPDF_DeviceCS::v_SetCMYK(float* pBuf, + float c, + float m, + float y, + float k) const { switch (m_Family) { case PDFCS_DEVICEGRAY: return false; diff --git a/core/fpdfapi/page/fpdf_page_func.cpp b/core/fpdfapi/page/fpdf_page_func.cpp index 9c0cc945b3..8e918f2526 100644 --- a/core/fpdfapi/page/fpdf_page_func.cpp +++ b/core/fpdfapi/page/fpdf_page_func.cpp @@ -70,12 +70,8 @@ bool IsValidBitsPerSample(uint32_t x) { } // See PDF Reference 1.7, page 170. -FX_FLOAT PDF_Interpolate(FX_FLOAT x, - FX_FLOAT xmin, - FX_FLOAT xmax, - FX_FLOAT ymin, - FX_FLOAT ymax) { - FX_FLOAT divisor = xmax - xmin; +float PDF_Interpolate(float x, float xmin, float xmax, float ymin, float ymax) { + float divisor = xmax - xmin; return ymin + (divisor ? (x - xmin) * (ymax - ymin) / divisor : 0); } @@ -86,7 +82,7 @@ class CPDF_PSFunc : public CPDF_Function { // CPDF_Function bool v_Init(CPDF_Object* pObj) override; - bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; + bool v_Call(float* inputs, float* results) const override; private: CPDF_PSEngine m_PS; @@ -99,7 +95,7 @@ bool CPDF_PSFunc::v_Init(CPDF_Object* pObj) { acc.GetSize()); } -bool CPDF_PSFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const { +bool CPDF_PSFunc::v_Call(float* inputs, float* results) const { CPDF_PSEngine& PS = const_cast<CPDF_PSEngine&>(m_PS); PS.Reset(); for (uint32_t i = 0; i < m_nInputs; i++) @@ -120,11 +116,11 @@ class CPDF_PSOP { ASSERT(m_op != PSOP_CONST); ASSERT(m_op != PSOP_PROC); } - explicit CPDF_PSOP(FX_FLOAT value) : m_op(PSOP_CONST), m_value(value) {} + explicit CPDF_PSOP(float value) : m_op(PSOP_CONST), m_value(value) {} explicit CPDF_PSOP(std::unique_ptr<CPDF_PSProc> proc) : m_op(PSOP_PROC), m_value(0), m_proc(std::move(proc)) {} - FX_FLOAT GetFloatValue() const { + float GetFloatValue() const { if (m_op == PSOP_CONST) return m_value; @@ -142,7 +138,7 @@ class CPDF_PSOP { private: const PDF_PSOP m_op; - const FX_FLOAT m_value; + const float m_value; std::unique_ptr<CPDF_PSProc> m_proc; }; @@ -188,13 +184,13 @@ CPDF_PSEngine::CPDF_PSEngine() { m_StackCount = 0; } CPDF_PSEngine::~CPDF_PSEngine() {} -void CPDF_PSEngine::Push(FX_FLOAT v) { +void CPDF_PSEngine::Push(float v) { if (m_StackCount == PSENGINE_STACKSIZE) { return; } m_Stack[m_StackCount++] = v; } -FX_FLOAT CPDF_PSEngine::Pop() { +float CPDF_PSEngine::Pop() { if (m_StackCount == 0) { return 0; } @@ -249,8 +245,8 @@ bool CPDF_PSProc::Parse(CPDF_SimpleParser* parser, int depth) { bool CPDF_PSEngine::DoOperator(PDF_PSOP op) { int i1; int i2; - FX_FLOAT d1; - FX_FLOAT d2; + float d1; + float d2; FX_SAFE_INT32 result; switch (op) { case PSOP_ADD: @@ -301,15 +297,15 @@ bool CPDF_PSEngine::DoOperator(PDF_PSOP op) { break; case PSOP_ABS: d1 = Pop(); - Push((FX_FLOAT)FXSYS_fabs(d1)); + Push((float)FXSYS_fabs(d1)); break; case PSOP_CEILING: d1 = Pop(); - Push((FX_FLOAT)FXSYS_ceil(d1)); + Push((float)FXSYS_ceil(d1)); break; case PSOP_FLOOR: d1 = Pop(); - Push((FX_FLOAT)FXSYS_floor(d1)); + Push((float)FXSYS_floor(d1)); break; case PSOP_ROUND: d1 = Pop(); @@ -321,20 +317,20 @@ bool CPDF_PSEngine::DoOperator(PDF_PSOP op) { break; case PSOP_SQRT: d1 = Pop(); - Push((FX_FLOAT)FXSYS_sqrt(d1)); + Push((float)FXSYS_sqrt(d1)); break; case PSOP_SIN: d1 = Pop(); - Push((FX_FLOAT)FXSYS_sin(d1 * FX_PI / 180.0f)); + Push((float)FXSYS_sin(d1 * FX_PI / 180.0f)); break; case PSOP_COS: d1 = Pop(); - Push((FX_FLOAT)FXSYS_cos(d1 * FX_PI / 180.0f)); + Push((float)FXSYS_cos(d1 * FX_PI / 180.0f)); break; case PSOP_ATAN: d2 = Pop(); d1 = Pop(); - d1 = (FX_FLOAT)(FXSYS_atan2(d1, d2) * 180.0 / FX_PI); + d1 = (float)(FXSYS_atan2(d1, d2) * 180.0 / FX_PI); if (d1 < 0) { d1 += 360; } @@ -343,15 +339,15 @@ bool CPDF_PSEngine::DoOperator(PDF_PSOP op) { case PSOP_EXP: d2 = Pop(); d1 = Pop(); - Push((FX_FLOAT)FXSYS_pow(d1, d2)); + Push((float)FXSYS_pow(d1, d2)); break; case PSOP_LN: d1 = Pop(); - Push((FX_FLOAT)FXSYS_log(d1)); + Push((float)FXSYS_log(d1)); break; case PSOP_LOG: d1 = Pop(); - Push((FX_FLOAT)FXSYS_log10(d1)); + Push((float)FXSYS_log10(d1)); break; case PSOP_CVI: i1 = (int)Pop(); @@ -514,7 +510,7 @@ bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj) { } else { m_EncodeInfo[i].encode_min = 0; m_EncodeInfo[i].encode_max = - m_EncodeInfo[i].sizes == 1 ? 1 : (FX_FLOAT)m_EncodeInfo[i].sizes - 1; + m_EncodeInfo[i].sizes == 1 ? 1 : (float)m_EncodeInfo[i].sizes - 1; } } nTotalSampleBits *= m_nBitsPerSample; @@ -539,10 +535,10 @@ bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj) { return true; } -bool CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const { +bool CPDF_SampledFunc::v_Call(float* inputs, float* results) const { int pos = 0; - CFX_FixedBufGrow<FX_FLOAT, 16> encoded_input_buf(m_nInputs); - FX_FLOAT* encoded_input = encoded_input_buf; + CFX_FixedBufGrow<float, 16> encoded_input_buf(m_nInputs); + float* encoded_input = encoded_input_buf; CFX_FixedBufGrow<uint32_t, 32> int_buf(m_nInputs * 2); uint32_t* index = int_buf; uint32_t* blocksize = index + m_nInputs; @@ -580,11 +576,11 @@ bool CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const { for (uint32_t j = 0; j < m_nOutputs; j++, bitpos += m_nBitsPerSample) { uint32_t sample = GetBits32(pSampleData, bitpos.ValueOrDie(), m_nBitsPerSample); - FX_FLOAT encoded = (FX_FLOAT)sample; + float encoded = (float)sample; for (uint32_t i = 0; i < m_nInputs; i++) { if (index[i] == m_EncodeInfo[i].sizes - 1) { if (index[i] == 0) - encoded = encoded_input[i] * (FX_FLOAT)sample; + encoded = encoded_input[i] * (float)sample; } else { FX_SAFE_INT32 bitpos2 = blocksize[i]; bitpos2 += pos; @@ -595,12 +591,12 @@ bool CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const { return false; uint32_t sample1 = GetBits32(pSampleData, bitpos2.ValueOrDie(), m_nBitsPerSample); - encoded += (encoded_input[i] - index[i]) * - ((FX_FLOAT)sample1 - (FX_FLOAT)sample); + encoded += + (encoded_input[i] - index[i]) * ((float)sample1 - (float)sample); } } results[j] = - PDF_Interpolate(encoded, 0, (FX_FLOAT)m_SampleMax, + PDF_Interpolate(encoded, 0, (float)m_SampleMax, m_DecodeInfo[j].decode_min, m_DecodeInfo[j].decode_max); } return true; @@ -628,8 +624,8 @@ bool CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) { } } CPDF_Array* pArray1 = pDict->GetArrayFor("C1"); - m_pBeginValues = FX_Alloc2D(FX_FLOAT, m_nOutputs, 2); - m_pEndValues = FX_Alloc2D(FX_FLOAT, m_nOutputs, 2); + m_pBeginValues = FX_Alloc2D(float, m_nOutputs, 2); + m_pEndValues = FX_Alloc2D(float, m_nOutputs, 2); for (uint32_t i = 0; i < m_nOutputs; i++) { m_pBeginValues[i] = pArray0 ? pArray0->GetFloatAt(i) : 0.0f; m_pEndValues[i] = pArray1 ? pArray1->GetFloatAt(i) : 1.0f; @@ -642,12 +638,12 @@ bool CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) { m_nOutputs *= m_nInputs; return true; } -bool CPDF_ExpIntFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const { +bool CPDF_ExpIntFunc::v_Call(float* inputs, float* results) const { for (uint32_t i = 0; i < m_nInputs; i++) for (uint32_t j = 0; j < m_nOrigOutputs; j++) { results[i * m_nOrigOutputs + j] = m_pBeginValues[j] + - (FX_FLOAT)FXSYS_pow(inputs[i], m_Exponent) * + (float)FXSYS_pow(inputs[i], m_Exponent) * (m_pEndValues[j] - m_pBeginValues[j]); } return true; @@ -699,7 +695,7 @@ bool CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { m_pSubFunctions.push_back(std::move(pFunc)); } - m_pBounds = FX_Alloc(FX_FLOAT, nSubs + 1); + m_pBounds = FX_Alloc(float, nSubs + 1); m_pBounds[0] = m_pDomains[0]; pArray = pDict->GetArrayFor("Bounds"); if (!pArray) @@ -707,7 +703,7 @@ bool CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { for (uint32_t i = 0; i < nSubs - 1; i++) m_pBounds[i + 1] = pArray->GetFloatAt(i); m_pBounds[nSubs] = m_pDomains[1]; - m_pEncode = FX_Alloc2D(FX_FLOAT, nSubs, 2); + m_pEncode = FX_Alloc2D(float, nSubs, 2); pArray = pDict->GetArrayFor("Encode"); if (!pArray) return false; @@ -717,8 +713,8 @@ bool CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { return true; } -bool CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const { - FX_FLOAT input = inputs[0]; +bool CPDF_StitchFunc::v_Call(float* inputs, float* outputs) const { + float input = inputs[0]; size_t i; for (i = 0; i < m_pSubFunctions.size() - 1; i++) { if (input < m_pBounds[i + 1]) @@ -792,7 +788,7 @@ bool CPDF_Function::Init(CPDF_Object* pObj) { if (m_nInputs == 0) return false; - m_pDomains = FX_Alloc2D(FX_FLOAT, m_nInputs, 2); + m_pDomains = FX_Alloc2D(float, m_nInputs, 2); for (uint32_t i = 0; i < m_nInputs * 2; i++) { m_pDomains[i] = pDomains->GetFloatAt(i); } @@ -800,7 +796,7 @@ bool CPDF_Function::Init(CPDF_Object* pObj) { m_nOutputs = 0; if (pRanges) { m_nOutputs = pRanges->GetCount() / 2; - m_pRanges = FX_Alloc2D(FX_FLOAT, m_nOutputs, 2); + m_pRanges = FX_Alloc2D(float, m_nOutputs, 2); for (uint32_t i = 0; i < m_nOutputs * 2; i++) m_pRanges[i] = pRanges->GetFloatAt(i); } @@ -808,18 +804,18 @@ bool CPDF_Function::Init(CPDF_Object* pObj) { if (!v_Init(pObj)) return false; if (m_pRanges && m_nOutputs > old_outputs) { - m_pRanges = FX_Realloc(FX_FLOAT, m_pRanges, m_nOutputs * 2); + m_pRanges = FX_Realloc(float, m_pRanges, m_nOutputs * 2); if (m_pRanges) { FXSYS_memset(m_pRanges + (old_outputs * 2), 0, - sizeof(FX_FLOAT) * (m_nOutputs - old_outputs) * 2); + sizeof(float) * (m_nOutputs - old_outputs) * 2); } } return true; } -bool CPDF_Function::Call(FX_FLOAT* inputs, +bool CPDF_Function::Call(float* inputs, uint32_t ninputs, - FX_FLOAT* results, + float* results, int& nresults) const { if (m_nInputs != ninputs) { return false; diff --git a/core/fpdfapi/page/pageint.h b/core/fpdfapi/page/pageint.h index 6700633604..88e9c15ff2 100644 --- a/core/fpdfapi/page/pageint.h +++ b/core/fpdfapi/page/pageint.h @@ -33,14 +33,14 @@ class CPDF_Function { static Type IntegerToFunctionType(int iType); virtual ~CPDF_Function(); - bool Call(FX_FLOAT* inputs, + bool Call(float* inputs, uint32_t ninputs, - FX_FLOAT* results, + float* results, int& nresults) const; uint32_t CountInputs() const { return m_nInputs; } uint32_t CountOutputs() const { return m_nOutputs; } - FX_FLOAT GetDomain(int i) const { return m_pDomains[i]; } - FX_FLOAT GetRange(int i) const { return m_pRanges[i]; } + float GetDomain(int i) const { return m_pDomains[i]; } + float GetRange(int i) const { return m_pRanges[i]; } const CPDF_SampledFunc* ToSampledFunc() const; const CPDF_ExpIntFunc* ToExpIntFunc() const; @@ -51,12 +51,12 @@ class CPDF_Function { bool Init(CPDF_Object* pObj); virtual bool v_Init(CPDF_Object* pObj) = 0; - virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; + virtual bool v_Call(float* inputs, float* results) const = 0; uint32_t m_nInputs; uint32_t m_nOutputs; - FX_FLOAT* m_pDomains; - FX_FLOAT* m_pRanges; + float* m_pDomains; + float* m_pRanges; const Type m_Type; }; @@ -67,25 +67,25 @@ class CPDF_ExpIntFunc : public CPDF_Function { // CPDF_Function bool v_Init(CPDF_Object* pObj) override; - bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; + bool v_Call(float* inputs, float* results) const override; uint32_t m_nOrigOutputs; - FX_FLOAT m_Exponent; - FX_FLOAT* m_pBeginValues; - FX_FLOAT* m_pEndValues; + float m_Exponent; + float* m_pBeginValues; + float* m_pEndValues; }; class CPDF_SampledFunc : public CPDF_Function { public: struct SampleEncodeInfo { - FX_FLOAT encode_max; - FX_FLOAT encode_min; + float encode_max; + float encode_min; uint32_t sizes; }; struct SampleDecodeInfo { - FX_FLOAT decode_max; - FX_FLOAT decode_min; + float decode_max; + float decode_min; }; CPDF_SampledFunc(); @@ -93,7 +93,7 @@ class CPDF_SampledFunc : public CPDF_Function { // CPDF_Function bool v_Init(CPDF_Object* pObj) override; - bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; + bool v_Call(float* inputs, float* results) const override; const std::vector<SampleEncodeInfo>& GetEncodeInfo() const { return m_EncodeInfo; @@ -118,17 +118,17 @@ class CPDF_StitchFunc : public CPDF_Function { // CPDF_Function bool v_Init(CPDF_Object* pObj) override; - bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; + bool v_Call(float* inputs, float* results) const override; const std::vector<std::unique_ptr<CPDF_Function>>& GetSubFunctions() const { return m_pSubFunctions; } - FX_FLOAT GetBound(size_t i) const { return m_pBounds[i]; } + float GetBound(size_t i) const { return m_pBounds[i]; } private: std::vector<std::unique_ptr<CPDF_Function>> m_pSubFunctions; - FX_FLOAT* m_pBounds; - FX_FLOAT* m_pEncode; + float* m_pBounds; + float* m_pEncode; static const uint32_t kRequiredNumInputs = 1; }; @@ -149,24 +149,18 @@ class CPDF_DeviceCS : public CPDF_ColorSpace { public: CPDF_DeviceCS(CPDF_Document* pDoc, int family); - bool GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const override; - bool SetRGB(FX_FLOAT* pBuf, - FX_FLOAT R, - FX_FLOAT G, - FX_FLOAT B) const override; - bool v_GetCMYK(FX_FLOAT* pBuf, - FX_FLOAT& c, - FX_FLOAT& m, - FX_FLOAT& y, - FX_FLOAT& k) const override; - bool v_SetCMYK(FX_FLOAT* pBuf, - FX_FLOAT c, - FX_FLOAT m, - FX_FLOAT y, - FX_FLOAT k) const override; + bool GetRGB(float* pBuf, float& R, float& G, float& B) const override; + bool SetRGB(float* pBuf, float R, float G, float B) const override; + bool v_GetCMYK(float* pBuf, + float& c, + float& m, + float& y, + float& k) const override; + bool v_SetCMYK(float* pBuf, + float c, + float m, + float y, + float k) const override; void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, @@ -180,10 +174,7 @@ class CPDF_PatternCS : public CPDF_ColorSpace { explicit CPDF_PatternCS(CPDF_Document* pDoc); ~CPDF_PatternCS() override; bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; - bool GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const override; + bool GetRGB(float* pBuf, float& R, float& G, float& B) const override; CPDF_ColorSpace* GetBaseCS() const override; private: @@ -196,7 +187,7 @@ struct PatternValue { CPDF_Pattern* m_pPattern; CPDF_CountedPattern* m_pCountedPattern; int m_nComps; - FX_FLOAT m_Comps[MAX_PATTERN_COLORCOMPS]; + float m_Comps[MAX_PATTERN_COLORCOMPS]; }; CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr); diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp index 05a93702f1..bf8b51e604 100644 --- a/core/fpdfapi/parser/cpdf_array.cpp +++ b/core/fpdfapi/parser/cpdf_array.cpp @@ -108,7 +108,7 @@ int CPDF_Array::GetIntegerAt(size_t i) const { return m_Objects[i]->GetInteger(); } -FX_FLOAT CPDF_Array::GetNumberAt(size_t i) const { +float CPDF_Array::GetNumberAt(size_t i) const { if (i >= m_Objects.size()) return 0; return m_Objects[i]->GetNumber(); diff --git a/core/fpdfapi/parser/cpdf_array.h b/core/fpdfapi/parser/cpdf_array.h index 0b16f7f21b..8f8b600c7e 100644 --- a/core/fpdfapi/parser/cpdf_array.h +++ b/core/fpdfapi/parser/cpdf_array.h @@ -41,11 +41,11 @@ class CPDF_Array : public CPDF_Object { CPDF_Object* GetDirectObjectAt(size_t index) const; CFX_ByteString GetStringAt(size_t index) const; int GetIntegerAt(size_t index) const; - FX_FLOAT GetNumberAt(size_t index) const; + float GetNumberAt(size_t index) const; CPDF_Dictionary* GetDictAt(size_t index) const; CPDF_Stream* GetStreamAt(size_t index) const; CPDF_Array* GetArrayAt(size_t index) const; - FX_FLOAT GetFloatAt(size_t index) const { return GetNumberAt(index); } + float GetFloatAt(size_t index) const { return GetNumberAt(index); } CFX_Matrix GetMatrix(); CFX_FloatRect GetRect(); diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp index 40877539b5..653ef45067 100644 --- a/core/fpdfapi/parser/cpdf_dictionary.cpp +++ b/core/fpdfapi/parser/cpdf_dictionary.cpp @@ -115,7 +115,7 @@ int CPDF_Dictionary::GetIntegerFor(const CFX_ByteString& key, int def) const { return p ? p->GetInteger() : def; } -FX_FLOAT CPDF_Dictionary::GetNumberFor(const CFX_ByteString& key) const { +float CPDF_Dictionary::GetNumberFor(const CFX_ByteString& key) const { CPDF_Object* p = GetObjectFor(key); return p ? p->GetNumber() : 0; } diff --git a/core/fpdfapi/parser/cpdf_dictionary.h b/core/fpdfapi/parser/cpdf_dictionary.h index 13cbdcf7ac..b14574fd61 100644 --- a/core/fpdfapi/parser/cpdf_dictionary.h +++ b/core/fpdfapi/parser/cpdf_dictionary.h @@ -48,13 +48,13 @@ class CPDF_Dictionary : public CPDF_Object { int GetIntegerFor(const CFX_ByteString& key) const; int GetIntegerFor(const CFX_ByteString& key, int default_int) const; bool GetBooleanFor(const CFX_ByteString& key, bool bDefault = false) const; - FX_FLOAT GetNumberFor(const CFX_ByteString& key) const; + float GetNumberFor(const CFX_ByteString& key) const; CPDF_Dictionary* GetDictFor(const CFX_ByteString& key) const; CPDF_Stream* GetStreamFor(const CFX_ByteString& key) const; CPDF_Array* GetArrayFor(const CFX_ByteString& key) const; CFX_FloatRect GetRectFor(const CFX_ByteString& key) const; CFX_Matrix GetMatrixFor(const CFX_ByteString& key) const; - FX_FLOAT GetFloatFor(const CFX_ByteString& key) const { + float GetFloatFor(const CFX_ByteString& key) const { return GetNumberFor(key); } diff --git a/core/fpdfapi/parser/cpdf_number.cpp b/core/fpdfapi/parser/cpdf_number.cpp index 24feb2a2e0..c83b9dcd38 100644 --- a/core/fpdfapi/parser/cpdf_number.cpp +++ b/core/fpdfapi/parser/cpdf_number.cpp @@ -11,7 +11,7 @@ CPDF_Number::CPDF_Number() : m_bInteger(true), m_Integer(0) {} CPDF_Number::CPDF_Number(int value) : m_bInteger(true), m_Integer(value) {} -CPDF_Number::CPDF_Number(FX_FLOAT value) : m_bInteger(false), m_Float(value) {} +CPDF_Number::CPDF_Number(float value) : m_bInteger(false), m_Float(value) {} CPDF_Number::CPDF_Number(const CFX_ByteStringC& str) : m_bInteger(FX_atonum(str, &m_Integer)) {} @@ -27,8 +27,8 @@ std::unique_ptr<CPDF_Object> CPDF_Number::Clone() const { : pdfium::MakeUnique<CPDF_Number>(m_Float); } -FX_FLOAT CPDF_Number::GetNumber() const { - return m_bInteger ? static_cast<FX_FLOAT>(m_Integer) : m_Float; +float CPDF_Number::GetNumber() const { + return m_bInteger ? static_cast<float>(m_Integer) : m_Float; } int CPDF_Number::GetInteger() const { diff --git a/core/fpdfapi/parser/cpdf_number.h b/core/fpdfapi/parser/cpdf_number.h index 85a78e5f1a..6e85044d2a 100644 --- a/core/fpdfapi/parser/cpdf_number.h +++ b/core/fpdfapi/parser/cpdf_number.h @@ -17,7 +17,7 @@ class CPDF_Number : public CPDF_Object { public: CPDF_Number(); explicit CPDF_Number(int value); - explicit CPDF_Number(FX_FLOAT value); + explicit CPDF_Number(float value); explicit CPDF_Number(const CFX_ByteStringC& str); ~CPDF_Number() override; @@ -25,7 +25,7 @@ class CPDF_Number : public CPDF_Object { Type GetType() const override; std::unique_ptr<CPDF_Object> Clone() const override; CFX_ByteString GetString() const override; - FX_FLOAT GetNumber() const override; + float GetNumber() const override; int GetInteger() const override; void SetString(const CFX_ByteString& str) override; bool IsNumber() const override; @@ -38,7 +38,7 @@ class CPDF_Number : public CPDF_Object { bool m_bInteger; union { int m_Integer; - FX_FLOAT m_Float; + float m_Float; }; }; diff --git a/core/fpdfapi/parser/cpdf_object.cpp b/core/fpdfapi/parser/cpdf_object.cpp index acda334c9e..f0ff81eeed 100644 --- a/core/fpdfapi/parser/cpdf_object.cpp +++ b/core/fpdfapi/parser/cpdf_object.cpp @@ -46,7 +46,7 @@ CFX_WideString CPDF_Object::GetUnicodeText() const { return CFX_WideString(); } -FX_FLOAT CPDF_Object::GetNumber() const { +float CPDF_Object::GetNumber() const { return 0; } diff --git a/core/fpdfapi/parser/cpdf_object.h b/core/fpdfapi/parser/cpdf_object.h index f6bc5b444f..616573724b 100644 --- a/core/fpdfapi/parser/cpdf_object.h +++ b/core/fpdfapi/parser/cpdf_object.h @@ -56,7 +56,7 @@ class CPDF_Object { virtual CPDF_Object* GetDirect() const; virtual CFX_ByteString GetString() const; virtual CFX_WideString GetUnicodeText() const; - virtual FX_FLOAT GetNumber() const; + virtual float GetNumber() const; virtual int GetInteger() const; virtual CPDF_Dictionary* GetDict() const; diff --git a/core/fpdfapi/parser/cpdf_object_unittest.cpp b/core/fpdfapi/parser/cpdf_object_unittest.cpp index 927b106474..9285993c52 100644 --- a/core/fpdfapi/parser/cpdf_object_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_object_unittest.cpp @@ -218,14 +218,14 @@ TEST_F(PDFObjectsTest, GetUnicodeText) { } TEST_F(PDFObjectsTest, GetNumber) { - const FX_FLOAT direct_obj_results[] = {0, 0, 1245, 9.00345f, 0, 0, - 0, 0, 0, 0, 0}; + const float direct_obj_results[] = {0, 0, 1245, 9.00345f, 0, 0, + 0, 0, 0, 0, 0}; // Check for direct objects. for (size_t i = 0; i < m_DirectObjs.size(); ++i) EXPECT_EQ(direct_obj_results[i], m_DirectObjs[i]->GetNumber()); // Check indirect references. - const FX_FLOAT indirect_obj_results[] = {0, 1245, 0, 0, 0, 0, 0}; + const float indirect_obj_results[] = {0, 1245, 0, 0, 0, 0, 0}; for (size_t i = 0; i < m_RefObjs.size(); ++i) EXPECT_EQ(indirect_obj_results[i], m_RefObjs[i]->GetNumber()); } diff --git a/core/fpdfapi/parser/cpdf_reference.cpp b/core/fpdfapi/parser/cpdf_reference.cpp index 67b67c24dd..942bae58ba 100644 --- a/core/fpdfapi/parser/cpdf_reference.cpp +++ b/core/fpdfapi/parser/cpdf_reference.cpp @@ -24,7 +24,7 @@ CFX_ByteString CPDF_Reference::GetString() const { return obj ? obj->GetString() : CFX_ByteString(); } -FX_FLOAT CPDF_Reference::GetNumber() const { +float CPDF_Reference::GetNumber() const { CPDF_Object* obj = SafeGetDirect(); return obj ? obj->GetNumber() : 0; } diff --git a/core/fpdfapi/parser/cpdf_reference.h b/core/fpdfapi/parser/cpdf_reference.h index be7f18478e..ff8875572c 100644 --- a/core/fpdfapi/parser/cpdf_reference.h +++ b/core/fpdfapi/parser/cpdf_reference.h @@ -24,7 +24,7 @@ class CPDF_Reference : public CPDF_Object { std::unique_ptr<CPDF_Object> Clone() const override; CPDF_Object* GetDirect() const override; CFX_ByteString GetString() const override; - FX_FLOAT GetNumber() const override; + float GetNumber() const override; int GetInteger() const override; CPDF_Dictionary* GetDict() const override; bool IsReference() const override; diff --git a/core/fpdfapi/render/cpdf_charposlist.cpp b/core/fpdfapi/render/cpdf_charposlist.cpp index 639bdcf17b..6d4540e163 100644 --- a/core/fpdfapi/render/cpdf_charposlist.cpp +++ b/core/fpdfapi/render/cpdf_charposlist.cpp @@ -20,9 +20,9 @@ CPDF_CharPosList::~CPDF_CharPosList() { } void CPDF_CharPosList::Load(const std::vector<uint32_t>& charCodes, - const std::vector<FX_FLOAT>& charPos, + const std::vector<float>& charPos, CPDF_Font* pFont, - FX_FLOAT FontSize) { + float FontSize) { int nChars = pdfium::CollectionSize<int>(charCodes); m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, nChars); m_nChars = 0; diff --git a/core/fpdfapi/render/cpdf_charposlist.h b/core/fpdfapi/render/cpdf_charposlist.h index 2f5a44dfa0..c4636bca51 100644 --- a/core/fpdfapi/render/cpdf_charposlist.h +++ b/core/fpdfapi/render/cpdf_charposlist.h @@ -19,9 +19,9 @@ class CPDF_CharPosList { CPDF_CharPosList(); ~CPDF_CharPosList(); void Load(const std::vector<uint32_t>& charCodes, - const std::vector<FX_FLOAT>& charPos, + const std::vector<float>& charPos, CPDF_Font* pFont, - FX_FLOAT font_size); + float font_size); FXTEXT_CHARPOS* m_pCharPos; uint32_t m_nChars; }; diff --git a/core/fpdfapi/render/cpdf_devicebuffer.cpp b/core/fpdfapi/render/cpdf_devicebuffer.cpp index dec13433e4..b8c174d97e 100644 --- a/core/fpdfapi/render/cpdf_devicebuffer.cpp +++ b/core/fpdfapi/render/cpdf_devicebuffer.cpp @@ -38,9 +38,9 @@ bool CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, int dpiv = pDevice->GetDeviceCaps(FXDC_PIXEL_HEIGHT) * 254 / (vert_size * 10); if (dpih > max_dpi) - m_Matrix.Scale((FX_FLOAT)(max_dpi) / dpih, 1.0f); + m_Matrix.Scale((float)(max_dpi) / dpih, 1.0f); if (dpiv > max_dpi) - m_Matrix.Scale(1.0f, (FX_FLOAT)(max_dpi) / (FX_FLOAT)dpiv); + m_Matrix.Scale(1.0f, (float)(max_dpi) / (float)dpiv); } #endif CFX_Matrix ctm = m_pDevice->GetCTM(); diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp index 33a8d930a5..403866300d 100644 --- a/core/fpdfapi/render/cpdf_dibsource.cpp +++ b/core/fpdfapi/render/cpdf_dibsource.cpp @@ -452,11 +452,11 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(bool& bDefaultDecode, if (pDecode) { for (uint32_t i = 0; i < m_nComponents; i++) { pCompData[i].m_DecodeMin = pDecode->GetNumberAt(i * 2); - FX_FLOAT max = pDecode->GetNumberAt(i * 2 + 1); + float max = pDecode->GetNumberAt(i * 2 + 1); pCompData[i].m_DecodeStep = (max - pCompData[i].m_DecodeMin) / max_data; - FX_FLOAT def_value; - FX_FLOAT def_min; - FX_FLOAT def_max; + float def_value; + float def_min; + float def_max; m_pColorSpace->GetDefaultValue(i, def_value, def_min, def_max); if (m_Family == PDFCS_INDEXED) { def_max = max_data; @@ -467,7 +467,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(bool& bDefaultDecode, } } else { for (uint32_t i = 0; i < m_nComponents; i++) { - FX_FLOAT def_value; + float def_value; m_pColorSpace->GetDefaultValue(i, def_value, pCompData[i].m_DecodeMin, pCompData[i].m_DecodeStep); if (m_Family == PDFCS_INDEXED) { @@ -699,8 +699,8 @@ int CPDF_DIBSource::StratLoadMask() { CPDF_Array* pMatte = m_pMaskStream->GetDict()->GetArrayFor("Matte"); if (pMatte && m_pColorSpace && m_pColorSpace->CountComponents() <= m_nComponents) { - FX_FLOAT R, G, B; - std::vector<FX_FLOAT> colors(m_nComponents); + float R, G, B; + std::vector<float> colors(m_nComponents); for (uint32_t i = 0; i < m_nComponents; i++) { colors[i] = pMatte->GetFloatAt(i); } @@ -775,10 +775,10 @@ void CPDF_DIBSource::LoadPalette() { if (m_pColorSpace->CountComponents() > 3) { return; } - FX_FLOAT color_values[3]; + float color_values[3]; color_values[0] = m_pCompData[0].m_DecodeMin; color_values[1] = color_values[2] = color_values[0]; - FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; + float R = 0.0f, G = 0.0f, B = 0.0f; m_pColorSpace->GetRGB(color_values, R, G, B); FX_ARGB argb0 = ArgbEncode(255, FXSYS_round(R * 255), FXSYS_round(G * 255), FXSYS_round(B * 255)); @@ -798,8 +798,8 @@ void CPDF_DIBSource::LoadPalette() { m_bpc == 8 && m_bDefaultDecode) { } else { int palette_count = 1 << (m_bpc * m_nComponents); - CFX_FixedBufGrow<FX_FLOAT, 16> color_values(m_nComponents); - FX_FLOAT* color_value = color_values; + CFX_FixedBufGrow<float, 16> color_values(m_nComponents); + float* color_value = color_values; for (int i = 0; i < palette_count; i++) { int color_data = i; for (uint32_t j = 0; j < m_nComponents; j++) { @@ -808,11 +808,11 @@ void CPDF_DIBSource::LoadPalette() { color_value[j] = m_pCompData[j].m_DecodeMin + m_pCompData[j].m_DecodeStep * encoded_component; } - FX_FLOAT R = 0, G = 0, B = 0; + float R = 0, G = 0, B = 0; if (m_nComponents == 1 && m_Family == PDFCS_ICCBASED && m_pColorSpace->CountComponents() > 1) { int nComponents = m_pColorSpace->CountComponents(); - std::vector<FX_FLOAT> temp_buf(nComponents); + std::vector<float> temp_buf(nComponents); for (int k = 0; k < nComponents; k++) { temp_buf[k] = *color_value; } @@ -917,9 +917,9 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan, return; } } - CFX_FixedBufGrow<FX_FLOAT, 16> color_values1(m_nComponents); - FX_FLOAT* color_values = color_values1; - FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; + CFX_FixedBufGrow<float, 16> color_values1(m_nComponents); + float* color_values = color_values1; + float R = 0.0f, G = 0.0f, B = 0.0f; if (m_bpc == 8) { uint64_t src_byte_pos = 0; size_t dest_byte_pos = 0; @@ -930,7 +930,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan, m_pCompData[color].m_DecodeStep * data; } if (TransMask()) { - FX_FLOAT k = 1.0f - color_values[3]; + float k = 1.0f - color_values[3]; R = (1.0f - color_values[0]) * k; G = (1.0f - color_values[1]) * k; B = (1.0f - color_values[2]) * k; @@ -956,7 +956,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan, src_bit_pos += m_bpc; } if (TransMask()) { - FX_FLOAT k = 1.0f - color_values[3]; + float k = 1.0f - color_values[3]; R = (1.0f - color_values[0]) * k; G = (1.0f - color_values[1]) * k; B = (1.0f - color_values[2]) * k; @@ -1332,7 +1332,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, // in [0, src_width). Set the initial value to be an invalid src_x value. uint32_t last_src_x = src_width; FX_ARGB last_argb = FXARGB_MAKE(0xFF, 0xFF, 0xFF, 0xFF); - FX_FLOAT unit_To8Bpc = 255.0f / ((1 << m_bpc) - 1); + float unit_To8Bpc = 255.0f / ((1 << m_bpc) - 1); for (int i = 0; i < clip_width; i++) { int dest_x = clip_left + i; uint32_t src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) * @@ -1376,8 +1376,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, bTransMask); } else { for (uint32_t j = 0; j < m_nComponents; ++j) { - FX_FLOAT component_value = - static_cast<FX_FLOAT>(extracted_components[j]); + float component_value = static_cast<float>(extracted_components[j]); int color_value = static_cast<int>( (m_pCompData[j].m_DecodeMin + m_pCompData[j].m_DecodeStep * component_value) * diff --git a/core/fpdfapi/render/cpdf_dibsource.h b/core/fpdfapi/render/cpdf_dibsource.h index d5820d8bae..766025db7a 100644 --- a/core/fpdfapi/render/cpdf_dibsource.h +++ b/core/fpdfapi/render/cpdf_dibsource.h @@ -29,8 +29,8 @@ class CPDF_Document; class CPDF_Stream; typedef struct { - FX_FLOAT m_DecodeMin; - FX_FLOAT m_DecodeStep; + float m_DecodeMin; + float m_DecodeStep; int m_ColorKeyMin; int m_ColorKeyMax; } DIB_COMP_DATA; diff --git a/core/fpdfapi/render/cpdf_docrenderdata.cpp b/core/fpdfapi/render/cpdf_docrenderdata.cpp index 0e6f2d07e5..a6488c64d8 100644 --- a/core/fpdfapi/render/cpdf_docrenderdata.cpp +++ b/core/fpdfapi/render/cpdf_docrenderdata.cpp @@ -109,12 +109,12 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) { pdfium::MakeUnique<CPDF_TransferFunc>(m_pPDFDoc)); CPDF_TransferFunc* pTransfer = pTransferCounter->get(); m_TransferFuncMap[pObj] = pTransferCounter; - FX_FLOAT output[kMaxOutputs]; + float output[kMaxOutputs]; FXSYS_memset(output, 0, sizeof(output)); - FX_FLOAT input; + float input; int noutput; for (int v = 0; v < 256; ++v) { - input = (FX_FLOAT)v / 255.0f; + input = (float)v / 255.0f; if (bUniTransfer) { if (pFuncs[0] && pFuncs[0]->CountOutputs() <= kMaxOutputs) pFuncs[0]->Call(&input, 1, output, noutput); diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp index 358d13edd0..7903ad4a62 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.cpp +++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp @@ -305,7 +305,7 @@ bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { &m_pRenderStatus->m_Options, 0, m_pRenderStatus->m_bDropObjects, nullptr, true); CFX_Matrix patternDevice = *pObj2Device; - patternDevice.Translate((FX_FLOAT)-rect.left, (FX_FLOAT)-rect.top); + patternDevice.Translate((float)-rect.left, (float)-rect.top); if (CPDF_TilingPattern* pTilingPattern = m_pPattern->AsTilingPattern()) { bitmap_render.DrawTilingPattern(pTilingPattern, m_pImageObject, &patternDevice, false); diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 682e6c0c91..28c7166013 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -108,12 +108,12 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap, if (!pCoords) return; - FX_FLOAT start_x = pCoords->GetNumberAt(0); - FX_FLOAT start_y = pCoords->GetNumberAt(1); - FX_FLOAT end_x = pCoords->GetNumberAt(2); - FX_FLOAT end_y = pCoords->GetNumberAt(3); - FX_FLOAT t_min = 0; - FX_FLOAT t_max = 1.0f; + float start_x = pCoords->GetNumberAt(0); + float start_y = pCoords->GetNumberAt(1); + float end_x = pCoords->GetNumberAt(2); + float end_y = pCoords->GetNumberAt(3); + float t_min = 0; + float t_max = 1.0f; CPDF_Array* pArray = pDict->GetArrayFor("Domain"); if (pArray) { t_min = pArray->GetNumberAt(0); @@ -128,19 +128,19 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap, } int width = pBitmap->GetWidth(); int height = pBitmap->GetHeight(); - FX_FLOAT x_span = end_x - start_x; - FX_FLOAT y_span = end_y - start_y; - FX_FLOAT axis_len_square = (x_span * x_span) + (y_span * y_span); + float x_span = end_x - start_x; + float y_span = end_y - start_y; + float axis_len_square = (x_span * x_span) + (y_span * y_span); CFX_Matrix matrix; matrix.SetReverse(*pObject2Bitmap); uint32_t total_results = std::max(CountOutputs(funcs), pCS->CountComponents()); - CFX_FixedBufGrow<FX_FLOAT, 16> result_array(total_results); - FX_FLOAT* pResults = result_array; - FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT)); + CFX_FixedBufGrow<float, 16> result_array(total_results); + float* pResults = result_array; + FXSYS_memset(pResults, 0, total_results * sizeof(float)); uint32_t rgb_array[SHADING_STEPS]; for (int i = 0; i < SHADING_STEPS; i++) { - FX_FLOAT input = (t_max - t_min) * i / SHADING_STEPS + t_min; + float input = (t_max - t_min) * i / SHADING_STEPS + t_min; int offset = 0; for (const auto& func : funcs) { if (func) { @@ -149,7 +149,7 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap, offset += nresults; } } - FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; + float R = 0.0f, G = 0.0f, B = 0.0f; pCS->GetRGB(pResults, R, G, B); rgb_array[i] = FXARGB_TODIB(FXARGB_MAKE(alpha, FXSYS_round(R * 255), @@ -159,9 +159,9 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap, for (int row = 0; row < height; row++) { uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch); for (int column = 0; column < width; column++) { - CFX_PointF pos = matrix.Transform(CFX_PointF( - static_cast<FX_FLOAT>(column), static_cast<FX_FLOAT>(row))); - FX_FLOAT scale = + CFX_PointF pos = matrix.Transform( + CFX_PointF(static_cast<float>(column), static_cast<float>(row))); + float scale = (((pos.x - start_x) * x_span) + ((pos.y - start_y) * y_span)) / axis_len_square; int index = (int32_t)(scale * (SHADING_STEPS - 1)); @@ -192,16 +192,16 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap, if (!pCoords) return; - FX_FLOAT start_x = pCoords->GetNumberAt(0); - FX_FLOAT start_y = pCoords->GetNumberAt(1); - FX_FLOAT start_r = pCoords->GetNumberAt(2); - FX_FLOAT end_x = pCoords->GetNumberAt(3); - FX_FLOAT end_y = pCoords->GetNumberAt(4); - FX_FLOAT end_r = pCoords->GetNumberAt(5); + float start_x = pCoords->GetNumberAt(0); + float start_y = pCoords->GetNumberAt(1); + float start_r = pCoords->GetNumberAt(2); + float end_x = pCoords->GetNumberAt(3); + float end_y = pCoords->GetNumberAt(4); + float end_r = pCoords->GetNumberAt(5); CFX_Matrix matrix; matrix.SetReverse(*pObject2Bitmap); - FX_FLOAT t_min = 0; - FX_FLOAT t_max = 1.0f; + float t_min = 0; + float t_max = 1.0f; CPDF_Array* pArray = pDict->GetArrayFor("Domain"); if (pArray) { t_min = pArray->GetNumberAt(0); @@ -216,12 +216,12 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap, } uint32_t total_results = std::max(CountOutputs(funcs), pCS->CountComponents()); - CFX_FixedBufGrow<FX_FLOAT, 16> result_array(total_results); - FX_FLOAT* pResults = result_array; - FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT)); + CFX_FixedBufGrow<float, 16> result_array(total_results); + float* pResults = result_array; + FXSYS_memset(pResults, 0, total_results * sizeof(float)); uint32_t rgb_array[SHADING_STEPS]; for (int i = 0; i < SHADING_STEPS; i++) { - FX_FLOAT input = (t_max - t_min) * i / SHADING_STEPS + t_min; + float input = (t_max - t_min) * i / SHADING_STEPS + t_min; int offset = 0; for (const auto& func : funcs) { if (func) { @@ -230,15 +230,15 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap, offset += nresults; } } - FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; + float R = 0.0f, G = 0.0f, B = 0.0f; pCS->GetRGB(pResults, R, G, B); rgb_array[i] = FXARGB_TODIB(FXARGB_MAKE(alpha, FXSYS_round(R * 255), FXSYS_round(G * 255), FXSYS_round(B * 255))); } - FX_FLOAT a = ((start_x - end_x) * (start_x - end_x)) + - ((start_y - end_y) * (start_y - end_y)) - - ((start_r - end_r) * (start_r - end_r)); + float a = ((start_x - end_x) * (start_x - end_x)) + + ((start_y - end_y) * (start_y - end_y)) - + ((start_r - end_r) * (start_r - end_r)); int width = pBitmap->GetWidth(); int height = pBitmap->GetHeight(); int pitch = pBitmap->GetPitch(); @@ -253,24 +253,23 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap, for (int row = 0; row < height; row++) { uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch); for (int column = 0; column < width; column++) { - CFX_PointF pos = matrix.Transform(CFX_PointF( - static_cast<FX_FLOAT>(column), static_cast<FX_FLOAT>(row))); - FX_FLOAT b = -2 * (((pos.x - start_x) * (end_x - start_x)) + - ((pos.y - start_y) * (end_y - start_y)) + - (start_r * (end_r - start_r))); - FX_FLOAT c = ((pos.x - start_x) * (pos.x - start_x)) + - ((pos.y - start_y) * (pos.y - start_y)) - - (start_r * start_r); - FX_FLOAT s; + CFX_PointF pos = matrix.Transform( + CFX_PointF(static_cast<float>(column), static_cast<float>(row))); + float b = -2 * (((pos.x - start_x) * (end_x - start_x)) + + ((pos.y - start_y) * (end_y - start_y)) + + (start_r * (end_r - start_r))); + float c = ((pos.x - start_x) * (pos.x - start_x)) + + ((pos.y - start_y) * (pos.y - start_y)) - (start_r * start_r); + float s; if (a == 0) { s = -c / b; } else { - FX_FLOAT b2_4ac = (b * b) - 4 * (a * c); + float b2_4ac = (b * b) - 4 * (a * c); if (b2_4ac < 0) { continue; } - FX_FLOAT root = FXSYS_sqrt(b2_4ac); - FX_FLOAT s1, s2; + float root = FXSYS_sqrt(b2_4ac); + float s1, s2; if (a > 0) { s1 = (-b - root) / (2 * a); s2 = (-b + root) / (2 * a); @@ -321,7 +320,7 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap, int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); CPDF_Array* pDomain = pDict->GetArrayFor("Domain"); - FX_FLOAT xmin = 0, ymin = 0, xmax = 1.0f, ymax = 1.0f; + float xmin = 0, ymin = 0, xmax = 1.0f, ymax = 1.0f; if (pDomain) { xmin = pDomain->GetNumberAt(0); xmax = pDomain->GetNumberAt(1); @@ -340,18 +339,18 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap, int pitch = pBitmap->GetPitch(); uint32_t total_results = std::max(CountOutputs(funcs), pCS->CountComponents()); - CFX_FixedBufGrow<FX_FLOAT, 16> result_array(total_results); - FX_FLOAT* pResults = result_array; - FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT)); + CFX_FixedBufGrow<float, 16> result_array(total_results); + float* pResults = result_array; + FXSYS_memset(pResults, 0, total_results * sizeof(float)); for (int row = 0; row < height; row++) { uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch); for (int column = 0; column < width; column++) { - CFX_PointF pos = matrix.Transform(CFX_PointF( - static_cast<FX_FLOAT>(column), static_cast<FX_FLOAT>(row))); + CFX_PointF pos = matrix.Transform( + CFX_PointF(static_cast<float>(column), static_cast<float>(row))); if (pos.x < xmin || pos.x > xmax || pos.y < ymin || pos.y > ymax) continue; - FX_FLOAT input[] = {pos.x, pos.y}; + float input[] = {pos.x, pos.y}; int offset = 0; for (const auto& func : funcs) { if (func) { @@ -361,9 +360,9 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap, } } - FX_FLOAT R = 0.0f; - FX_FLOAT G = 0.0f; - FX_FLOAT B = 0.0f; + float R = 0.0f; + float G = 0.0f; + float B = 0.0f; pCS->GetRGB(pResults, R, G, B); dib_buf[column] = FXARGB_TODIB(FXARGB_MAKE( alpha, (int32_t)(R * 255), (int32_t)(G * 255), (int32_t)(B * 255))); @@ -374,7 +373,7 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap, bool GetScanlineIntersect(int y, const CFX_PointF& first, const CFX_PointF& second, - FX_FLOAT* x) { + float* x) { if (first.y == second.y) return false; @@ -391,8 +390,8 @@ bool GetScanlineIntersect(int y, void DrawGouraud(CFX_DIBitmap* pBitmap, int alpha, CPDF_MeshVertex triangle[3]) { - FX_FLOAT min_y = triangle[0].position.y; - FX_FLOAT max_y = triangle[0].position.y; + float min_y = triangle[0].position.y; + float max_y = triangle[0].position.y; for (int i = 1; i < 3; i++) { min_y = std::min(min_y, triangle[i].position.y); max_y = std::max(max_y, triangle[i].position.y); @@ -408,10 +407,10 @@ void DrawGouraud(CFX_DIBitmap* pBitmap, for (int y = min_yi; y <= max_yi; y++) { int nIntersects = 0; - FX_FLOAT inter_x[3]; - FX_FLOAT r[3]; - FX_FLOAT g[3]; - FX_FLOAT b[3]; + float inter_x[3]; + float r[3]; + float g[3]; + float b[3]; for (int i = 0; i < 3; i++) { CPDF_MeshVertex& vertex1 = triangle[i]; CPDF_MeshVertex& vertex2 = triangle[(i + 1) % 3]; @@ -422,7 +421,7 @@ void DrawGouraud(CFX_DIBitmap* pBitmap, if (!bIntersect) continue; - FX_FLOAT y_dist = (y - position1.y) / (position2.y - position1.y); + float y_dist = (y - position1.y) / (position2.y - position1.y); r[nIntersects] = vertex1.r + ((vertex2.r - vertex1.r) * y_dist); g[nIntersects] = vertex1.g + ((vertex2.g - vertex1.g) * y_dist); b[nIntersects] = vertex1.b + ((vertex2.b - vertex1.b) * y_dist); @@ -451,12 +450,12 @@ void DrawGouraud(CFX_DIBitmap* pBitmap, uint8_t* dib_buf = pBitmap->GetBuffer() + y * pBitmap->GetPitch() + start_x * 4; - FX_FLOAT r_unit = (r[end_index] - r[start_index]) / (max_x - min_x); - FX_FLOAT g_unit = (g[end_index] - g[start_index]) / (max_x - min_x); - FX_FLOAT b_unit = (b[end_index] - b[start_index]) / (max_x - min_x); - FX_FLOAT R = r[start_index] + (start_x - min_x) * r_unit; - FX_FLOAT G = g[start_index] + (start_x - min_x) * g_unit; - FX_FLOAT B = b[start_index] + (start_x - min_x) * b_unit; + float r_unit = (r[end_index] - r[start_index]) / (max_x - min_x); + float g_unit = (g[end_index] - g[start_index]) / (max_x - min_x); + float b_unit = (b[end_index] - b[start_index]) / (max_x - min_x); + float R = r[start_index] + (start_x - min_x) * r_unit; + float G = g[start_index] + (start_x - min_x) * g_unit; + float B = b[start_index] + (start_x - min_x) * b_unit; for (int x = start_x; x < end_x; x++) { R += r_unit; G += g_unit; @@ -862,9 +861,9 @@ void DrawCoonPatchMeshes( if (!stream.CanReadColor()) break; - FX_FLOAT r; - FX_FLOAT g; - FX_FLOAT b; + float r; + float g; + float b; std::tie(r, g, b) = stream.ReadColor(); patch.patch_colors[i].comp[0] = (int32_t)(r * 255); @@ -872,8 +871,8 @@ void DrawCoonPatchMeshes( patch.patch_colors[i].comp[2] = (int32_t)(b * 255); } CFX_FloatRect bbox = CFX_FloatRect::GetBBox(coords, point_count); - if (bbox.right <= 0 || bbox.left >= (FX_FLOAT)pBitmap->GetWidth() || - bbox.top <= 0 || bbox.bottom >= (FX_FLOAT)pBitmap->GetHeight()) { + if (bbox.right <= 0 || bbox.left >= (float)pBitmap->GetWidth() || + bbox.top <= 0 || bbox.bottom >= (float)pBitmap->GetHeight()) { continue; } Coon_Bezier C1, C2, D1, D2; @@ -908,7 +907,7 @@ std::unique_ptr<CFX_DIBitmap> DrawPatternBitmap( CFX_FloatRect cell_bbox = pPattern->bbox(); pPattern->pattern_to_form()->TransformRect(cell_bbox); pObject2Device->TransformRect(cell_bbox); - CFX_FloatRect bitmap_rect(0.0f, 0.0f, (FX_FLOAT)width, (FX_FLOAT)height); + CFX_FloatRect bitmap_rect(0.0f, 0.0f, (float)width, (float)height); CFX_Matrix mtAdjust; mtAdjust.MatchRect(bitmap_rect, cell_bbox); @@ -1128,15 +1127,15 @@ bool CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, FX_RECT rtClip = m_pDevice->GetClipBox(); if (!bLogical) { CFX_Matrix dCTM = m_pDevice->GetCTM(); - FX_FLOAT a = FXSYS_fabs(dCTM.a); - FX_FLOAT d = FXSYS_fabs(dCTM.d); + float a = FXSYS_fabs(dCTM.a); + float d = FXSYS_fabs(dCTM.d); if (a != 1.0f || d != 1.0f) { - rect.right = rect.left + (int32_t)FXSYS_ceil((FX_FLOAT)rect.Width() * a); - rect.bottom = rect.top + (int32_t)FXSYS_ceil((FX_FLOAT)rect.Height() * d); + rect.right = rect.left + (int32_t)FXSYS_ceil((float)rect.Width() * a); + rect.bottom = rect.top + (int32_t)FXSYS_ceil((float)rect.Height() * d); rtClip.right = - rtClip.left + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Width() * a); + rtClip.left + (int32_t)FXSYS_ceil((float)rtClip.Width() * a); rtClip.bottom = - rtClip.top + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Height() * d); + rtClip.top + (int32_t)FXSYS_ceil((float)rtClip.Height() * d); } } rect.Intersect(rtClip); @@ -1462,7 +1461,7 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, } } CPDF_Dictionary* pFormResource = nullptr; - FX_FLOAT group_alpha = 1.0f; + float group_alpha = 1.0f; int Transparency = m_Transparency; bool bGroupTransparent = false; if (pPageObj->IsForm()) { @@ -1532,10 +1531,10 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, return true; } CFX_Matrix deviceCTM = m_pDevice->GetCTM(); - FX_FLOAT scaleX = FXSYS_fabs(deviceCTM.a); - FX_FLOAT scaleY = FXSYS_fabs(deviceCTM.d); - int width = FXSYS_round((FX_FLOAT)rect.Width() * scaleX); - int height = FXSYS_round((FX_FLOAT)rect.Height() * scaleY); + float scaleX = FXSYS_fabs(deviceCTM.a); + float scaleY = FXSYS_fabs(deviceCTM.d); + int width = FXSYS_round((float)rect.Width() * scaleX); + int height = FXSYS_round((float)rect.Height() * scaleY); CFX_FxgeDevice bitmap_device; std::unique_ptr<CFX_DIBitmap> oriDevice; if (!isolated && (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) { @@ -1626,8 +1625,8 @@ std::unique_ptr<CFX_DIBitmap> CPDF_RenderStatus::GetBackdrop( left = bbox.left; top = bbox.top; CFX_Matrix deviceCTM = m_pDevice->GetCTM(); - FX_FLOAT scaleX = FXSYS_fabs(deviceCTM.a); - FX_FLOAT scaleY = FXSYS_fabs(deviceCTM.d); + float scaleX = FXSYS_fabs(deviceCTM.a); + float scaleY = FXSYS_fabs(deviceCTM.d); int width = FXSYS_round(bbox.Width() * scaleX); int height = FXSYS_round(bbox.Height() * scaleY); auto pBackdrop = pdfium::MakeUnique<CFX_DIBitmap>(); @@ -1753,7 +1752,7 @@ bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj, if (!IsAvailableMatrix(text_matrix)) return true; - FX_FLOAT font_size = textobj->m_TextState.GetFontSize(); + float font_size = textobj->m_TextState.GetFontSize(); if (bPattern) { DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size, &text_matrix, bFill, bStroke); @@ -1763,7 +1762,7 @@ bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj, const CFX_Matrix* pDeviceMatrix = pObj2Device; CFX_Matrix device_matrix; if (bStroke) { - const FX_FLOAT* pCTM = textobj->m_TextState.GetCTM(); + const float* pCTM = textobj->m_TextState.GetCTM(); if (pCTM[0] != 1.0f || pCTM[3] != 1.0f) { CFX_Matrix ctm(pCTM[0], pCTM[1], pCTM[2], pCTM[3], 0, 0); text_matrix.ConcatInverse(ctm); @@ -1808,11 +1807,11 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, return true; CFX_Matrix dCTM = m_pDevice->GetCTM(); - FX_FLOAT sa = FXSYS_fabs(dCTM.a); - FX_FLOAT sd = FXSYS_fabs(dCTM.d); + float sa = FXSYS_fabs(dCTM.a); + float sd = FXSYS_fabs(dCTM.d); CFX_Matrix text_matrix = textobj->GetTextMatrix(); CFX_Matrix char_matrix = pType3Font->GetFontMatrix(); - FX_FLOAT font_size = textobj->m_TextState.GetFontSize(); + float font_size = textobj->m_TextState.GetFontSize(); char_matrix.Scale(font_size, font_size); FX_ARGB fill_argb = GetFillArgb(textobj, true); int fill_alpha = FXARGB_A(fill_argb); @@ -1968,7 +1967,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj, const CFX_Matrix* pObj2Device, CPDF_Font* pFont, - FX_FLOAT font_size, + float font_size, const CFX_Matrix* pTextMatrix, bool bFill, bool bStroke) { @@ -2039,10 +2038,10 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, CPDF_Array* pBackColor = pDict->GetArrayFor("Background"); if (pBackColor && pBackColor->GetCount() >= pColorSpace->CountComponents()) { - CFX_FixedBufGrow<FX_FLOAT, 16> comps(pColorSpace->CountComponents()); + CFX_FixedBufGrow<float, 16> comps(pColorSpace->CountComponents()); for (uint32_t i = 0; i < pColorSpace->CountComponents(); i++) comps[i] = pBackColor->GetNumberAt(i); - FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; + float R = 0.0f, G = 0.0f, B = 0.0f; pColorSpace->GetRGB(comps, R, G, B); background = ArgbEncode(255, (int32_t)(R * 255), (int32_t)(G * 255), (int32_t)(B * 255)); @@ -2189,8 +2188,8 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, return; } CFX_Matrix dCTM = m_pDevice->GetCTM(); - FX_FLOAT sa = FXSYS_fabs(dCTM.a); - FX_FLOAT sd = FXSYS_fabs(dCTM.d); + float sa = FXSYS_fabs(dCTM.a); + float sd = FXSYS_fabs(dCTM.d); clip_box.right = clip_box.left + (int32_t)FXSYS_ceil(clip_box.Width() * sa); clip_box.bottom = clip_box.top + (int32_t)FXSYS_ceil(clip_box.Height() * sd); CFX_Matrix mtPattern2Device = *pPattern->pattern_to_form(); @@ -2278,8 +2277,8 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, max_row--; } } - FX_FLOAT left_offset = cell_bbox.left - mtPattern2Device.e; - FX_FLOAT top_offset = cell_bbox.bottom - mtPattern2Device.f; + float left_offset = cell_bbox.left - mtPattern2Device.e; + float top_offset = cell_bbox.bottom - mtPattern2Device.f; std::unique_ptr<CFX_DIBitmap> pPatternBitmap; if (width * height < 16) { std::unique_ptr<CFX_DIBitmap> pEnlargedBitmap = @@ -2569,15 +2568,15 @@ std::unique_ptr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask( // Store Color Space Family to use in CPDF_RenderStatus::Initialize. color_space_family = pCS->GetFamily(); - FX_FLOAT R, G, B; + float R, G, B; uint32_t comps = 8; if (pCS->CountComponents() > comps) { comps = pCS->CountComponents(); } - CFX_FixedBufGrow<FX_FLOAT, 8> float_array(comps); - FX_FLOAT* pFloats = float_array; + CFX_FixedBufGrow<float, 8> float_array(comps); + float* pFloats = float_array; FX_SAFE_UINT32 num_floats = comps; - num_floats *= sizeof(FX_FLOAT); + num_floats *= sizeof(float); if (!num_floats.IsValid()) { return nullptr; } @@ -2618,9 +2617,9 @@ std::unique_ptr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask( int src_pitch = bitmap.GetPitch(); std::vector<uint8_t> transfers(256); if (pFunc) { - CFX_FixedBufGrow<FX_FLOAT, 16> results(pFunc->CountOutputs()); + CFX_FixedBufGrow<float, 16> results(pFunc->CountOutputs()); for (int i = 0; i < 256; i++) { - FX_FLOAT input = (FX_FLOAT)i / 255.0f; + float input = (float)i / 255.0f; int nresult; pFunc->Call(&input, 1, results, nresult); transfers[i] = FXSYS_round(results[0] * 255); diff --git a/core/fpdfapi/render/cpdf_renderstatus.h b/core/fpdfapi/render/cpdf_renderstatus.h index 25ddfb06c3..6ae255271b 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.h +++ b/core/fpdfapi/render/cpdf_renderstatus.h @@ -127,7 +127,7 @@ class CPDF_RenderStatus { void DrawTextPathWithPattern(const CPDF_TextObject* textobj, const CFX_Matrix* pObj2Device, CPDF_Font* pFont, - FX_FLOAT font_size, + float font_size, const CFX_Matrix* pTextMatrix, bool bFill, bool bStroke); diff --git a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp index de60e732bb..927d23210c 100644 --- a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp +++ b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp @@ -40,9 +40,9 @@ bool CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, int dpiv = pDevice->GetDeviceCaps(FXDC_PIXEL_HEIGHT) * 254 / (vert_size * 10); if (dpih > max_dpi) - m_Matrix.Scale((FX_FLOAT)(max_dpi) / dpih, 1.0f); + m_Matrix.Scale((float)(max_dpi) / dpih, 1.0f); if (dpiv > max_dpi) - m_Matrix.Scale(1.0f, (FX_FLOAT)(max_dpi) / (FX_FLOAT)dpiv); + m_Matrix.Scale(1.0f, (float)(max_dpi) / (float)dpiv); } m_pBitmapDevice = pdfium::MakeUnique<CFX_FxgeDevice>(); FXDIB_Format dibFormat = FXDIB_Rgb; diff --git a/core/fpdfapi/render/cpdf_textrenderer.cpp b/core/fpdfapi/render/cpdf_textrenderer.cpp index 95af863f7a..c45c1ef792 100644 --- a/core/fpdfapi/render/cpdf_textrenderer.cpp +++ b/core/fpdfapi/render/cpdf_textrenderer.cpp @@ -18,9 +18,9 @@ // static bool CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice, const std::vector<uint32_t>& charCodes, - const std::vector<FX_FLOAT>& charPos, + const std::vector<float>& charPos, CPDF_Font* pFont, - FX_FLOAT font_size, + float font_size, const CFX_Matrix* pText2User, const CFX_Matrix* pUser2Device, const CFX_GraphStateData* pGraphState, @@ -65,10 +65,10 @@ bool CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice, // static void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, - FX_FLOAT origin_x, - FX_FLOAT origin_y, + float origin_x, + float origin_y, CPDF_Font* pFont, - FX_FLOAT font_size, + float font_size, const CFX_Matrix* pMatrix, const CFX_ByteString& str, FX_ARGB fill_argb, @@ -83,10 +83,10 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, int offset = 0; std::vector<uint32_t> codes; - std::vector<FX_FLOAT> positions; + std::vector<float> positions; codes.resize(nChars); positions.resize(nChars - 1); - FX_FLOAT cur_pos = 0; + float cur_pos = 0; for (int i = 0; i < nChars; i++) { codes[i] = pFont->GetNextChar(str.c_str(), str.GetLength(), offset); if (i) @@ -107,9 +107,9 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, // static bool CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice, const std::vector<uint32_t>& charCodes, - const std::vector<FX_FLOAT>& charPos, + const std::vector<float>& charPos, CPDF_Font* pFont, - FX_FLOAT font_size, + float font_size, const CFX_Matrix* pText2Device, FX_ARGB fill_argb, const CPDF_RenderOptions* pOptions) { diff --git a/core/fpdfapi/render/cpdf_textrenderer.h b/core/fpdfapi/render/cpdf_textrenderer.h index 54e9d1bd05..31c44d9599 100644 --- a/core/fpdfapi/render/cpdf_textrenderer.h +++ b/core/fpdfapi/render/cpdf_textrenderer.h @@ -23,10 +23,10 @@ class CPDF_Font; class CPDF_TextRenderer { public: static void DrawTextString(CFX_RenderDevice* pDevice, - FX_FLOAT origin_x, - FX_FLOAT origin_y, + float origin_x, + float origin_y, CPDF_Font* pFont, - FX_FLOAT font_size, + float font_size, const CFX_Matrix* matrix, const CFX_ByteString& str, FX_ARGB fill_argb, @@ -35,9 +35,9 @@ class CPDF_TextRenderer { static bool DrawTextPath(CFX_RenderDevice* pDevice, const std::vector<uint32_t>& charCodes, - const std::vector<FX_FLOAT>& charPos, + const std::vector<float>& charPos, CPDF_Font* pFont, - FX_FLOAT font_size, + float font_size, const CFX_Matrix* pText2User, const CFX_Matrix* pUser2Device, const CFX_GraphStateData* pGraphState, @@ -48,9 +48,9 @@ class CPDF_TextRenderer { static bool DrawNormalText(CFX_RenderDevice* pDevice, const std::vector<uint32_t>& charCodes, - const std::vector<FX_FLOAT>& charPos, + const std::vector<float>& charPos, CPDF_Font* pFont, - FX_FLOAT font_size, + float font_size, const CFX_Matrix* pText2Device, FX_ARGB fill_argb, const CPDF_RenderOptions* pOptions); diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp index a5de13b464..7d0cb18172 100644 --- a/core/fpdfapi/render/cpdf_type3cache.cpp +++ b/core/fpdfapi/render/cpdf_type3cache.cpp @@ -87,8 +87,8 @@ CPDF_Type3Cache::~CPDF_Type3Cache() { CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode, const CFX_Matrix* pMatrix, - FX_FLOAT retinaScaleX, - FX_FLOAT retinaScaleY) { + float retinaScaleX, + float retinaScaleY) { CPDF_UniqueKeyGen keygen; keygen.Generate( 4, FXSYS_round(pMatrix->a * 10000), FXSYS_round(pMatrix->b * 10000), @@ -115,8 +115,8 @@ CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode, CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, uint32_t charcode, const CFX_Matrix* pMatrix, - FX_FLOAT retinaScaleX, - FX_FLOAT retinaScaleY) { + float retinaScaleX, + float retinaScaleY) { const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode); if (!pChar || !pChar->m_pBitmap) return nullptr; @@ -134,11 +134,11 @@ CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, int top_line = DetectFirstLastScan(pBitmap, true); int bottom_line = DetectFirstLastScan(pBitmap, false); if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) { - FX_FLOAT top_y = image_matrix.d + image_matrix.f; - FX_FLOAT bottom_y = image_matrix.f; + float top_y = image_matrix.d + image_matrix.f; + float bottom_y = image_matrix.f; bool bFlipped = top_y > bottom_y; if (bFlipped) { - FX_FLOAT temp = top_y; + float temp = top_y; top_y = bottom_y; bottom_y = temp; } diff --git a/core/fpdfapi/render/cpdf_type3cache.h b/core/fpdfapi/render/cpdf_type3cache.h index f74a43acc5..f03578650b 100644 --- a/core/fpdfapi/render/cpdf_type3cache.h +++ b/core/fpdfapi/render/cpdf_type3cache.h @@ -23,15 +23,15 @@ class CPDF_Type3Cache { CFX_GlyphBitmap* LoadGlyph(uint32_t charcode, const CFX_Matrix* pMatrix, - FX_FLOAT retinaScaleX, - FX_FLOAT retinaScaleY); + float retinaScaleX, + float retinaScaleY); private: CFX_GlyphBitmap* RenderGlyph(CPDF_Type3Glyphs* pSize, uint32_t charcode, const CFX_Matrix* pMatrix, - FX_FLOAT retinaScaleX, - FX_FLOAT retinaScaleY); + float retinaScaleX, + float retinaScaleY); CPDF_Type3Font* const m_pFont; std::map<CFX_ByteString, CPDF_Type3Glyphs*> m_SizeMap; diff --git a/core/fpdfapi/render/cpdf_type3glyphs.cpp b/core/fpdfapi/render/cpdf_type3glyphs.cpp index 189fc2439d..33d8ef1253 100644 --- a/core/fpdfapi/render/cpdf_type3glyphs.cpp +++ b/core/fpdfapi/render/cpdf_type3glyphs.cpp @@ -18,11 +18,11 @@ CPDF_Type3Glyphs::~CPDF_Type3Glyphs() { delete pair.second; } -static int _AdjustBlue(FX_FLOAT pos, int& count, int blues[]) { - FX_FLOAT min_distance = 1000000.0f; +static int _AdjustBlue(float pos, int& count, int blues[]) { + float min_distance = 1000000.0f; int closest_pos = -1; for (int i = 0; i < count; i++) { - FX_FLOAT distance = FXSYS_fabs(pos - static_cast<FX_FLOAT>(blues[i])); + float distance = FXSYS_fabs(pos - static_cast<float>(blues[i])); if (distance < 1.0f * 80.0f / 100.0f && distance < min_distance) { min_distance = distance; closest_pos = i; @@ -37,8 +37,8 @@ static int _AdjustBlue(FX_FLOAT pos, int& count, int blues[]) { return new_pos; } -void CPDF_Type3Glyphs::AdjustBlue(FX_FLOAT top, - FX_FLOAT bottom, +void CPDF_Type3Glyphs::AdjustBlue(float top, + float bottom, int& top_line, int& bottom_line) { top_line = _AdjustBlue(top, m_TopBlueCount, m_TopBlue); diff --git a/core/fpdfapi/render/cpdf_type3glyphs.h b/core/fpdfapi/render/cpdf_type3glyphs.h index 00814d5b3b..443910dac0 100644 --- a/core/fpdfapi/render/cpdf_type3glyphs.h +++ b/core/fpdfapi/render/cpdf_type3glyphs.h @@ -20,10 +20,7 @@ class CPDF_Type3Glyphs { CPDF_Type3Glyphs(); ~CPDF_Type3Glyphs(); - void AdjustBlue(FX_FLOAT top, - FX_FLOAT bottom, - int& top_line, - int& bottom_line); + void AdjustBlue(float top, float bottom, int& top_line, int& bottom_line); std::map<uint32_t, CFX_GlyphBitmap*> m_GlyphMap; int m_TopBlue[TYPE3_MAX_BLUES]; diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp index f15d39d89b..a3ee70ab36 100644 --- a/core/fpdfdoc/cpdf_annot.cpp +++ b/core/fpdfdoc/cpdf_annot.cpp @@ -426,7 +426,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, } CPDF_Dictionary* pBS = m_pAnnotDict->GetDictFor("BS"); char style_char; - FX_FLOAT width; + float width; CPDF_Array* pDashArray = nullptr; if (!pBS) { CPDF_Array* pBorderArray = m_pAnnotDict->GetArrayFor("Border"); @@ -479,7 +479,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, if (dash_count % 2) { dash_count++; } - graph_state.m_DashArray = FX_Alloc(FX_FLOAT, dash_count); + graph_state.m_DashArray = FX_Alloc(float, dash_count); graph_state.m_DashCount = dash_count; size_t i; for (i = 0; i < pDashArray->GetCount(); ++i) { @@ -489,7 +489,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, graph_state.m_DashArray[i] = graph_state.m_DashArray[i - 1]; } } else { - graph_state.m_DashArray = FX_Alloc(FX_FLOAT, 2); + graph_state.m_DashArray = FX_Alloc(float, 2); graph_state.m_DashCount = 2; graph_state.m_DashArray[0] = graph_state.m_DashArray[1] = 3 * 1.0f; } diff --git a/core/fpdfdoc/cpdf_apsettings.cpp b/core/fpdfdoc/cpdf_apsettings.cpp index 9fc9c1aa06..4c44f5a13e 100644 --- a/core/fpdfdoc/cpdf_apsettings.cpp +++ b/core/fpdfdoc/cpdf_apsettings.cpp @@ -36,33 +36,32 @@ FX_ARGB CPDF_ApSettings::GetColor(int& iColorType, size_t dwCount = pEntry->GetCount(); if (dwCount == 1) { iColorType = COLORTYPE_GRAY; - FX_FLOAT g = pEntry->GetNumberAt(0) * 255; + float g = pEntry->GetNumberAt(0) * 255; return ArgbEncode(255, (int)g, (int)g, (int)g); } if (dwCount == 3) { iColorType = COLORTYPE_RGB; - FX_FLOAT r = pEntry->GetNumberAt(0) * 255; - FX_FLOAT g = pEntry->GetNumberAt(1) * 255; - FX_FLOAT b = pEntry->GetNumberAt(2) * 255; + float r = pEntry->GetNumberAt(0) * 255; + float g = pEntry->GetNumberAt(1) * 255; + float b = pEntry->GetNumberAt(2) * 255; return ArgbEncode(255, (int)r, (int)g, (int)b); } if (dwCount == 4) { iColorType = COLORTYPE_CMYK; - FX_FLOAT c = pEntry->GetNumberAt(0); - FX_FLOAT m = pEntry->GetNumberAt(1); - FX_FLOAT y = pEntry->GetNumberAt(2); - FX_FLOAT k = pEntry->GetNumberAt(3); - FX_FLOAT r = 1.0f - std::min(1.0f, c + k); - FX_FLOAT g = 1.0f - std::min(1.0f, m + k); - FX_FLOAT b = 1.0f - std::min(1.0f, y + k); + float c = pEntry->GetNumberAt(0); + float m = pEntry->GetNumberAt(1); + float y = pEntry->GetNumberAt(2); + float k = pEntry->GetNumberAt(3); + float r = 1.0f - std::min(1.0f, c + k); + float g = 1.0f - std::min(1.0f, m + k); + float b = 1.0f - std::min(1.0f, y + k); return ArgbEncode(255, (int)(r * 255), (int)(g * 255), (int)(b * 255)); } return color; } -FX_FLOAT CPDF_ApSettings::GetOriginalColor( - int index, - const CFX_ByteString& csEntry) const { +float CPDF_ApSettings::GetOriginalColor(int index, + const CFX_ByteString& csEntry) const { if (!m_pDict) return 0; @@ -71,7 +70,7 @@ FX_FLOAT CPDF_ApSettings::GetOriginalColor( } void CPDF_ApSettings::GetOriginalColor(int& iColorType, - FX_FLOAT fc[4], + float fc[4], const CFX_ByteString& csEntry) const { iColorType = COLORTYPE_TRANSPARENT; for (int i = 0; i < 4; i++) diff --git a/core/fpdfdoc/cpdf_apsettings.h b/core/fpdfdoc/cpdf_apsettings.h index ffddffdbe0..ba0b05bd2b 100644 --- a/core/fpdfdoc/cpdf_apsettings.h +++ b/core/fpdfdoc/cpdf_apsettings.h @@ -27,11 +27,11 @@ class CPDF_ApSettings { return GetColor(iColorType, "BC"); } - FX_FLOAT GetOriginalBorderColor(int index) const { + float GetOriginalBorderColor(int index) const { return GetOriginalColor(index, "BC"); } - void GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4]) const { + void GetOriginalBorderColor(int& iColorType, float fc[4]) const { GetOriginalColor(iColorType, fc, "BC"); } @@ -39,11 +39,11 @@ class CPDF_ApSettings { return GetColor(iColorType, "BG"); } - FX_FLOAT GetOriginalBackgroundColor(int index) const { + float GetOriginalBackgroundColor(int index) const { return GetOriginalColor(index, "BG"); } - void GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4]) const { + void GetOriginalBackgroundColor(int& iColorType, float fc[4]) const { GetOriginalColor(iColorType, fc, "BG"); } @@ -60,9 +60,9 @@ class CPDF_ApSettings { friend class CPDF_FormControl; FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry) const; - FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry) const; + float GetOriginalColor(int index, const CFX_ByteString& csEntry) const; void GetOriginalColor(int& iColorType, - FX_FLOAT fc[4], + float fc[4], const CFX_ByteString& csEntry) const; CFX_WideString GetCaption(const CFX_ByteString& csEntry) const; diff --git a/core/fpdfdoc/cpdf_defaultappearance.cpp b/core/fpdfdoc/cpdf_defaultappearance.cpp index 19767650f3..1873c1ae58 100644 --- a/core/fpdfdoc/cpdf_defaultappearance.cpp +++ b/core/fpdfdoc/cpdf_defaultappearance.cpp @@ -37,7 +37,7 @@ CFX_ByteString CPDF_DefaultAppearance::GetFontString() { } void CPDF_DefaultAppearance::GetFont(CFX_ByteString& csFontNameTag, - FX_FLOAT& fFontSize) { + float& fFontSize) { csFontNameTag = ""; fFontSize = 0; if (m_csDA.IsEmpty()) @@ -110,7 +110,7 @@ CFX_ByteString CPDF_DefaultAppearance::GetColorString( } void CPDF_DefaultAppearance::GetColor(int& iColorType, - FX_FLOAT fc[4], + float fc[4], PaintOperation nOperation) { iColorType = COLORTYPE_TRANSPARENT; for (int c = 0; c < 4; c++) @@ -156,29 +156,29 @@ void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, if (syntax.FindTagParamFromStart( (nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) { iColorType = COLORTYPE_GRAY; - FX_FLOAT g = FX_atof(syntax.GetWord()) * 255 + 0.5f; + float g = FX_atof(syntax.GetWord()) * 255 + 0.5f; color = ArgbEncode(255, (int)g, (int)g, (int)g); return; } if (syntax.FindTagParamFromStart( (nOperation == PaintOperation::STROKE ? "RG" : "rg"), 3)) { iColorType = COLORTYPE_RGB; - FX_FLOAT r = FX_atof(syntax.GetWord()) * 255 + 0.5f; - FX_FLOAT g = FX_atof(syntax.GetWord()) * 255 + 0.5f; - FX_FLOAT b = FX_atof(syntax.GetWord()) * 255 + 0.5f; + float r = FX_atof(syntax.GetWord()) * 255 + 0.5f; + float g = FX_atof(syntax.GetWord()) * 255 + 0.5f; + float b = FX_atof(syntax.GetWord()) * 255 + 0.5f; color = ArgbEncode(255, (int)r, (int)g, (int)b); return; } if (syntax.FindTagParamFromStart( (nOperation == PaintOperation::STROKE ? "K" : "k"), 4)) { iColorType = COLORTYPE_CMYK; - FX_FLOAT c = FX_atof(syntax.GetWord()); - FX_FLOAT m = FX_atof(syntax.GetWord()); - FX_FLOAT y = FX_atof(syntax.GetWord()); - FX_FLOAT k = FX_atof(syntax.GetWord()); - FX_FLOAT r = 1.0f - std::min(1.0f, c + k); - FX_FLOAT g = 1.0f - std::min(1.0f, m + k); - FX_FLOAT b = 1.0f - std::min(1.0f, y + k); + float c = FX_atof(syntax.GetWord()); + float m = FX_atof(syntax.GetWord()); + float y = FX_atof(syntax.GetWord()); + float k = FX_atof(syntax.GetWord()); + float r = 1.0f - std::min(1.0f, c + k); + float g = 1.0f - std::min(1.0f, m + k); + float b = 1.0f - std::min(1.0f, y + k); color = ArgbEncode(255, (int)(r * 255 + 0.5f), (int)(g * 255 + 0.5f), (int)(b * 255 + 0.5f)); } @@ -216,7 +216,7 @@ CFX_Matrix CPDF_DefaultAppearance::GetTextMatrix() { if (!syntax.FindTagParamFromStart("Tm", 6)) return CFX_Matrix(); - FX_FLOAT f[6]; + float f[6]; for (int i = 0; i < 6; i++) f[i] = FX_atof(syntax.GetWord()); return CFX_Matrix(f); diff --git a/core/fpdfdoc/cpdf_defaultappearance.h b/core/fpdfdoc/cpdf_defaultappearance.h index 4fd32ebd0c..0edc18c31f 100644 --- a/core/fpdfdoc/cpdf_defaultappearance.h +++ b/core/fpdfdoc/cpdf_defaultappearance.h @@ -29,13 +29,13 @@ class CPDF_DefaultAppearance { bool HasFont(); CFX_ByteString GetFontString(); - void GetFont(CFX_ByteString& csFontNameTag, FX_FLOAT& fFontSize); + void GetFont(CFX_ByteString& csFontNameTag, float& fFontSize); bool HasColor(PaintOperation nOperation = PaintOperation::FILL); CFX_ByteString GetColorString( PaintOperation nOperation = PaintOperation::FILL); void GetColor(int& iColorType, - FX_FLOAT fc[4], + float fc[4], PaintOperation nOperation = PaintOperation::FILL); void GetColor(FX_ARGB& color, int& iColorType, diff --git a/core/fpdfdoc/cpdf_dest.cpp b/core/fpdfdoc/cpdf_dest.cpp index 11264f729d..ca380be957 100644 --- a/core/fpdfdoc/cpdf_dest.cpp +++ b/core/fpdfdoc/cpdf_dest.cpp @@ -113,7 +113,7 @@ bool CPDF_Dest::GetXYZ(bool* pHasX, return true; } -FX_FLOAT CPDF_Dest::GetParam(int index) { +float CPDF_Dest::GetParam(int index) { CPDF_Array* pArray = ToArray(m_pObj); return pArray ? pArray->GetNumberAt(2 + index) : 0; } diff --git a/core/fpdfdoc/cpdf_dest.h b/core/fpdfdoc/cpdf_dest.h index 527d1dcf8b..47559495a4 100644 --- a/core/fpdfdoc/cpdf_dest.h +++ b/core/fpdfdoc/cpdf_dest.h @@ -23,7 +23,7 @@ class CPDF_Dest { int GetPageIndex(CPDF_Document* pDoc); uint32_t GetPageObjNum(); int GetZoomMode(); - FX_FLOAT GetParam(int index); + float GetParam(int index); bool GetXYZ(bool* pHasX, bool* pHasY, diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp index 0a5363ed96..b8a11cc204 100644 --- a/core/fpdfdoc/cpdf_formcontrol.cpp +++ b/core/fpdfdoc/cpdf_formcontrol.cpp @@ -216,13 +216,13 @@ FX_ARGB CPDF_FormControl::GetColor(int& iColorType, return GetMK().GetColor(iColorType, csEntry); } -FX_FLOAT CPDF_FormControl::GetOriginalColor(int index, - const CFX_ByteString& csEntry) { +float CPDF_FormControl::GetOriginalColor(int index, + const CFX_ByteString& csEntry) { return GetMK().GetOriginalColor(index, csEntry); } void CPDF_FormControl::GetOriginalColor(int& iColorType, - FX_FLOAT fc[4], + float fc[4], const CFX_ByteString& csEntry) { GetMK().GetOriginalColor(iColorType, fc, csEntry); } @@ -282,7 +282,7 @@ CPDF_DefaultAppearance CPDF_FormControl::GetDefaultAppearance() { CPDF_Font* CPDF_FormControl::GetDefaultControlFont() { CPDF_DefaultAppearance cDA = GetDefaultAppearance(); CFX_ByteString csFontNameTag; - FX_FLOAT fFontSize; + float fFontSize; cDA.GetFont(csFontNameTag, fFontSize); if (csFontNameTag.IsEmpty()) return nullptr; diff --git a/core/fpdfdoc/cpdf_formcontrol.h b/core/fpdfdoc/cpdf_formcontrol.h index c0dad39098..fff77fb32d 100644 --- a/core/fpdfdoc/cpdf_formcontrol.h +++ b/core/fpdfdoc/cpdf_formcontrol.h @@ -72,11 +72,11 @@ class CPDF_FormControl { FX_ARGB GetBorderColor(int& iColorType) { return GetColor(iColorType, "BC"); } - FX_FLOAT GetOriginalBorderColor(int index) { + float GetOriginalBorderColor(int index) { return GetOriginalColor(index, "BC"); } - void GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4]) { + void GetOriginalBorderColor(int& iColorType, float fc[4]) { GetOriginalColor(iColorType, fc, "BC"); } @@ -84,11 +84,11 @@ class CPDF_FormControl { return GetColor(iColorType, "BG"); } - FX_FLOAT GetOriginalBackgroundColor(int index) { + float GetOriginalBackgroundColor(int index) { return GetOriginalColor(index, "BG"); } - void GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4]) { + void GetOriginalBackgroundColor(int& iColorType, float fc[4]) { GetOriginalColor(iColorType, fc, "BG"); } @@ -117,9 +117,9 @@ class CPDF_FormControl { void SetOnStateName(const CFX_ByteString& csOn); void CheckControl(bool bChecked); FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry); - FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry); + float GetOriginalColor(int index, const CFX_ByteString& csEntry); void GetOriginalColor(int& iColorType, - FX_FLOAT fc[4], + float fc[4], const CFX_ByteString& csEntry); CFX_WideString GetCaption(const CFX_ByteString& csEntry); diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h index 0cb0a481c2..35eaca4866 100644 --- a/core/fpdfdoc/cpdf_formfield.h +++ b/core/fpdfdoc/cpdf_formfield.h @@ -125,7 +125,7 @@ class CPDF_FormField { bool bNotify = false); #endif // PDF_ENABLE_XFA - FX_FLOAT GetFontSize() const { return m_FontSize; } + float GetFontSize() const { return m_FontSize; } CPDF_Font* GetFont() const { return m_pFont; } private: @@ -160,7 +160,7 @@ class CPDF_FormField { CPDF_InterForm* const m_pForm; CPDF_Dictionary* m_pDict; std::vector<CPDF_FormControl*> m_ControlList; // Owned by InterForm parent. - FX_FLOAT m_FontSize; + float m_FontSize; CPDF_Font* m_pFont; }; diff --git a/core/fpdfdoc/cpdf_iconfit.cpp b/core/fpdfdoc/cpdf_iconfit.cpp index aedb785912..0f05d7de35 100644 --- a/core/fpdfdoc/cpdf_iconfit.cpp +++ b/core/fpdfdoc/cpdf_iconfit.cpp @@ -28,7 +28,7 @@ bool CPDF_IconFit::IsProportionalScale() { return m_pDict ? m_pDict->GetStringFor("S", "P") != "A" : true; } -void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { +void CPDF_IconFit::GetIconPosition(float& fLeft, float& fBottom) { fLeft = fBottom = 0.5; if (!m_pDict) return; diff --git a/core/fpdfdoc/cpdf_iconfit.h b/core/fpdfdoc/cpdf_iconfit.h index 37df48d43e..6e3b8cf50a 100644 --- a/core/fpdfdoc/cpdf_iconfit.h +++ b/core/fpdfdoc/cpdf_iconfit.h @@ -19,7 +19,7 @@ class CPDF_IconFit { ScaleMethod GetScaleMethod(); bool IsProportionalScale(); - void GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom); + void GetIconPosition(float& fLeft, float& fBottom); bool GetFittingBounds(); const CPDF_Dictionary* GetDict() const { return m_pDict; } diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp index aa393f7657..5dabf8db0c 100644 --- a/core/fpdfdoc/cpdf_variabletext.cpp +++ b/core/fpdfdoc/cpdf_variabletext.cpp @@ -773,7 +773,7 @@ const CFX_FloatRect& CPDF_VariableText::GetPlateRect() const { return m_rcPlate; } -FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo& WordInfo) { +float CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo& WordInfo) { return GetFontSize(); } @@ -781,66 +781,64 @@ int32_t CPDF_VariableText::GetWordFontIndex(const CPVT_WordInfo& WordInfo) { return WordInfo.nFontIndex; } -FX_FLOAT CPDF_VariableText::GetWordWidth(int32_t nFontIndex, - uint16_t Word, - uint16_t SubWord, - FX_FLOAT fCharSpace, - int32_t nHorzScale, - FX_FLOAT fFontSize, - FX_FLOAT fWordTail) { +float CPDF_VariableText::GetWordWidth(int32_t nFontIndex, + uint16_t Word, + uint16_t SubWord, + float fCharSpace, + int32_t nHorzScale, + float fFontSize, + float fWordTail) { return (GetCharWidth(nFontIndex, Word, SubWord) * fFontSize * kFontScale + fCharSpace) * nHorzScale * kScalePercent + fWordTail; } -FX_FLOAT CPDF_VariableText::GetWordWidth(const CPVT_WordInfo& WordInfo) { +float CPDF_VariableText::GetWordWidth(const CPVT_WordInfo& WordInfo) { return GetWordWidth(GetWordFontIndex(WordInfo), WordInfo.Word, GetSubWord(), GetCharSpace(WordInfo), GetHorzScale(WordInfo), GetWordFontSize(WordInfo), WordInfo.fWordTail); } -FX_FLOAT CPDF_VariableText::GetLineAscent(const CPVT_SectionInfo& SecInfo) { +float CPDF_VariableText::GetLineAscent(const CPVT_SectionInfo& SecInfo) { return GetFontAscent(GetDefaultFontIndex(), GetFontSize()); } -FX_FLOAT CPDF_VariableText::GetLineDescent(const CPVT_SectionInfo& SecInfo) { +float CPDF_VariableText::GetLineDescent(const CPVT_SectionInfo& SecInfo) { return GetFontDescent(GetDefaultFontIndex(), GetFontSize()); } -FX_FLOAT CPDF_VariableText::GetFontAscent(int32_t nFontIndex, - FX_FLOAT fFontSize) { - return (FX_FLOAT)GetTypeAscent(nFontIndex) * fFontSize * kFontScale; +float CPDF_VariableText::GetFontAscent(int32_t nFontIndex, float fFontSize) { + return (float)GetTypeAscent(nFontIndex) * fFontSize * kFontScale; } -FX_FLOAT CPDF_VariableText::GetFontDescent(int32_t nFontIndex, - FX_FLOAT fFontSize) { - return (FX_FLOAT)GetTypeDescent(nFontIndex) * fFontSize * kFontScale; +float CPDF_VariableText::GetFontDescent(int32_t nFontIndex, float fFontSize) { + return (float)GetTypeDescent(nFontIndex) * fFontSize * kFontScale; } -FX_FLOAT CPDF_VariableText::GetWordAscent(const CPVT_WordInfo& WordInfo, - FX_FLOAT fFontSize) { +float CPDF_VariableText::GetWordAscent(const CPVT_WordInfo& WordInfo, + float fFontSize) { return GetFontAscent(GetWordFontIndex(WordInfo), fFontSize); } -FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo& WordInfo, - FX_FLOAT fFontSize) { +float CPDF_VariableText::GetWordDescent(const CPVT_WordInfo& WordInfo, + float fFontSize) { return GetFontDescent(GetWordFontIndex(WordInfo), fFontSize); } -FX_FLOAT CPDF_VariableText::GetWordAscent(const CPVT_WordInfo& WordInfo) { +float CPDF_VariableText::GetWordAscent(const CPVT_WordInfo& WordInfo) { return GetFontAscent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo)); } -FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo& WordInfo) { +float CPDF_VariableText::GetWordDescent(const CPVT_WordInfo& WordInfo) { return GetFontDescent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo)); } -FX_FLOAT CPDF_VariableText::GetLineLeading(const CPVT_SectionInfo& SecInfo) { +float CPDF_VariableText::GetLineLeading(const CPVT_SectionInfo& SecInfo) { return m_fLineLeading; } -FX_FLOAT CPDF_VariableText::GetLineIndent(const CPVT_SectionInfo& SecInfo) { +float CPDF_VariableText::GetLineIndent(const CPVT_SectionInfo& SecInfo) { return 0.0f; } @@ -848,7 +846,7 @@ int32_t CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo) { return m_nAlignment; } -FX_FLOAT CPDF_VariableText::GetCharSpace(const CPVT_WordInfo& WordInfo) { +float CPDF_VariableText::GetCharSpace(const CPVT_WordInfo& WordInfo) { return m_fCharSpace; } @@ -979,7 +977,7 @@ CPVT_FloatRect CPDF_VariableText::Rearrange(const CPVT_WordRange& PlaceRange) { return rcRet; } -FX_FLOAT CPDF_VariableText::GetAutoFontSize() { +float CPDF_VariableText::GetAutoFontSize() { int32_t nTotal = sizeof(gFontSizeSteps) / sizeof(uint8_t); if (IsMultiLine()) nTotal /= 4; @@ -1002,10 +1000,10 @@ FX_FLOAT CPDF_VariableText::GetAutoFontSize() { continue; } } - return (FX_FLOAT)gFontSizeSteps[nMid]; + return (float)gFontSizeSteps[nMid]; } -bool CPDF_VariableText::IsBigger(FX_FLOAT fFontSize) const { +bool CPDF_VariableText::IsBigger(float fFontSize) const { CFX_SizeF szTotal; for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { if (CSection* pSection = m_SectionArray.GetAt(s)) { @@ -1024,8 +1022,8 @@ bool CPDF_VariableText::IsBigger(FX_FLOAT fFontSize) const { CPVT_FloatRect CPDF_VariableText::RearrangeSections( const CPVT_WordRange& PlaceRange) { CPVT_WordPlace place; - FX_FLOAT fPosY = 0; - FX_FLOAT fOldHeight; + float fPosY = 0; + float fOldHeight; int32_t nSSecIndex = PlaceRange.BeginPos.nSecIndex; int32_t nESecIndex = PlaceRange.EndPos.nSecIndex; CPVT_FloatRect rcRet; diff --git a/core/fpdfdoc/cpdf_variabletext.h b/core/fpdfdoc/cpdf_variabletext.h index 3bec89abec..59fe12402a 100644 --- a/core/fpdfdoc/cpdf_variabletext.h +++ b/core/fpdfdoc/cpdf_variabletext.h @@ -93,10 +93,10 @@ class CPDF_VariableText { void SetAlignment(int32_t nFormat) { m_nAlignment = nFormat; } void SetPasswordChar(uint16_t wSubWord) { m_wSubWord = wSubWord; } void SetLimitChar(int32_t nLimitChar) { m_nLimitChar = nLimitChar; } - void SetCharSpace(FX_FLOAT fCharSpace) { m_fCharSpace = fCharSpace; } + void SetCharSpace(float fCharSpace) { m_fCharSpace = fCharSpace; } void SetMultiLine(bool bMultiLine) { m_bMultiLine = bMultiLine; } void SetAutoReturn(bool bAuto) { m_bLimitWidth = bAuto; } - void SetFontSize(FX_FLOAT fFontSize) { m_fFontSize = fFontSize; } + void SetFontSize(float fFontSize) { m_fFontSize = fFontSize; } void SetCharArray(int32_t nCharArray) { m_nCharArray = nCharArray; } void SetAutoFontSize(bool bAuto) { m_bAutoFontSize = bAuto; } void Initialize(); @@ -120,14 +120,14 @@ class CPDF_VariableText { CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place); int32_t GetTotalWords() const; - FX_FLOAT GetFontSize() const { return m_fFontSize; } + float GetFontSize() const { return m_fFontSize; } int32_t GetAlignment() const { return m_nAlignment; } uint16_t GetPasswordChar() const { return GetSubWord(); } int32_t GetCharArray() const { return m_nCharArray; } int32_t GetLimitChar() const { return m_nLimitChar; } bool IsMultiLine() const { return m_bMultiLine; } int32_t GetHorzScale() const { return m_nHorzScale; } - FX_FLOAT GetCharSpace() const { return m_fCharSpace; } + float GetCharSpace() const { return m_fCharSpace; } CPVT_WordPlace GetBeginWordPlace() const; CPVT_WordPlace GetEndWordPlace() const; CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const; @@ -149,8 +149,8 @@ class CPDF_VariableText { uint16_t GetSubWord() const { return m_wSubWord; } - FX_FLOAT GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; } - FX_FLOAT GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; } + float GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; } + float GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; } CFX_SizeF GetPlateSize() const; CFX_PointF GetBTPoint() const; CFX_PointF GetETPoint() const; @@ -181,28 +181,28 @@ class CPDF_VariableText { bool SetWordInfo(const CPVT_WordPlace& place, const CPVT_WordInfo& wordinfo); bool GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo); bool GetSectionInfo(const CPVT_WordPlace& place, CPVT_SectionInfo& secinfo); - FX_FLOAT GetWordFontSize(const CPVT_WordInfo& WordInfo); - FX_FLOAT GetWordWidth(int32_t nFontIndex, - uint16_t Word, - uint16_t SubWord, - FX_FLOAT fCharSpace, - int32_t nHorzScale, - FX_FLOAT fFontSize, - FX_FLOAT fWordTail); - FX_FLOAT GetWordWidth(const CPVT_WordInfo& WordInfo); - FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize); - FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize); - FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo); - FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo); - FX_FLOAT GetLineAscent(const CPVT_SectionInfo& SecInfo); - FX_FLOAT GetLineDescent(const CPVT_SectionInfo& SecInfo); - FX_FLOAT GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize); - FX_FLOAT GetFontDescent(int32_t nFontIndex, FX_FLOAT fFontSize); + float GetWordFontSize(const CPVT_WordInfo& WordInfo); + float GetWordWidth(int32_t nFontIndex, + uint16_t Word, + uint16_t SubWord, + float fCharSpace, + int32_t nHorzScale, + float fFontSize, + float fWordTail); + float GetWordWidth(const CPVT_WordInfo& WordInfo); + float GetWordAscent(const CPVT_WordInfo& WordInfo, float fFontSize); + float GetWordDescent(const CPVT_WordInfo& WordInfo, float fFontSize); + float GetWordAscent(const CPVT_WordInfo& WordInfo); + float GetWordDescent(const CPVT_WordInfo& WordInfo); + float GetLineAscent(const CPVT_SectionInfo& SecInfo); + float GetLineDescent(const CPVT_SectionInfo& SecInfo); + float GetFontAscent(int32_t nFontIndex, float fFontSize); + float GetFontDescent(int32_t nFontIndex, float fFontSize); int32_t GetWordFontIndex(const CPVT_WordInfo& WordInfo); - FX_FLOAT GetCharSpace(const CPVT_WordInfo& WordInfo); + float GetCharSpace(const CPVT_WordInfo& WordInfo); int32_t GetHorzScale(const CPVT_WordInfo& WordInfo); - FX_FLOAT GetLineLeading(const CPVT_SectionInfo& SecInfo); - FX_FLOAT GetLineIndent(const CPVT_SectionInfo& SecInfo); + float GetLineLeading(const CPVT_SectionInfo& SecInfo); + float GetLineIndent(const CPVT_SectionInfo& SecInfo); int32_t GetAlignment(const CPVT_SectionInfo& SecInfo); void ClearSectionRightWords(const CPVT_WordPlace& place); @@ -215,8 +215,8 @@ class CPDF_VariableText { CPVT_WordPlace ClearRightWord(const CPVT_WordPlace& place); CPVT_FloatRect Rearrange(const CPVT_WordRange& PlaceRange); - FX_FLOAT GetAutoFontSize(); - bool IsBigger(FX_FLOAT fFontSize) const; + float GetAutoFontSize(); + bool IsBigger(float fFontSize) const; CPVT_FloatRect RearrangeSections(const CPVT_WordRange& PlaceRange); void ResetSectionArray(); @@ -228,11 +228,11 @@ class CPDF_VariableText { bool m_bLimitWidth; bool m_bAutoFontSize; int32_t m_nAlignment; - FX_FLOAT m_fLineLeading; - FX_FLOAT m_fCharSpace; + float m_fLineLeading; + float m_fCharSpace; int32_t m_nHorzScale; uint16_t m_wSubWord; - FX_FLOAT m_fFontSize; + float m_fFontSize; bool m_bInitial; CPDF_VariableText::Provider* m_pVTProvider; std::unique_ptr<CPDF_VariableText::Iterator> m_pVTIterator; diff --git a/core/fpdfdoc/cpvt_color.cpp b/core/fpdfdoc/cpvt_color.cpp index e0e6a26db7..584a85aaec 100644 --- a/core/fpdfdoc/cpvt_color.cpp +++ b/core/fpdfdoc/cpvt_color.cpp @@ -15,16 +15,16 @@ CPVT_Color CPVT_Color::ParseColor(const CFX_ByteString& str) { return CPVT_Color(CPVT_Color::kGray, FX_atof(syntax.GetWord())); if (syntax.FindTagParamFromStart("rg", 3)) { - FX_FLOAT f1 = FX_atof(syntax.GetWord()); - FX_FLOAT f2 = FX_atof(syntax.GetWord()); - FX_FLOAT f3 = FX_atof(syntax.GetWord()); + float f1 = FX_atof(syntax.GetWord()); + float f2 = FX_atof(syntax.GetWord()); + float f3 = FX_atof(syntax.GetWord()); return CPVT_Color(CPVT_Color::kRGB, f1, f2, f3); } if (syntax.FindTagParamFromStart("k", 4)) { - FX_FLOAT f1 = FX_atof(syntax.GetWord()); - FX_FLOAT f2 = FX_atof(syntax.GetWord()); - FX_FLOAT f3 = FX_atof(syntax.GetWord()); - FX_FLOAT f4 = FX_atof(syntax.GetWord()); + float f1 = FX_atof(syntax.GetWord()); + float f2 = FX_atof(syntax.GetWord()); + float f3 = FX_atof(syntax.GetWord()); + float f4 = FX_atof(syntax.GetWord()); return CPVT_Color(CPVT_Color::kCMYK, f1, f2, f3, f4); } return CPVT_Color(CPVT_Color::kTransparent); diff --git a/core/fpdfdoc/cpvt_color.h b/core/fpdfdoc/cpvt_color.h index 4d4942dbf9..2db3b8310e 100644 --- a/core/fpdfdoc/cpvt_color.h +++ b/core/fpdfdoc/cpvt_color.h @@ -15,10 +15,10 @@ struct CPVT_Color { enum Type { kTransparent = 0, kGray, kRGB, kCMYK }; CPVT_Color(Type type = kTransparent, - 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), @@ -26,10 +26,10 @@ struct CPVT_Color { fColor4(color4) {} Type nColorType; - FX_FLOAT fColor1; - FX_FLOAT fColor2; - FX_FLOAT fColor3; - FX_FLOAT fColor4; + float fColor1; + float fColor2; + float fColor3; + float fColor4; static CPVT_Color ParseColor(const CFX_ByteString& str); static CPVT_Color ParseColor(const CPDF_Array& array); diff --git a/core/fpdfdoc/cpvt_floatrect.h b/core/fpdfdoc/cpvt_floatrect.h index 6fc4b8ebce..a8b32dc7e5 100644 --- a/core/fpdfdoc/cpvt_floatrect.h +++ b/core/fpdfdoc/cpvt_floatrect.h @@ -13,10 +13,10 @@ class CPVT_FloatRect : public CFX_FloatRect { public: CPVT_FloatRect() { left = top = right = bottom = 0.0f; } - CPVT_FloatRect(FX_FLOAT other_left, - FX_FLOAT other_top, - FX_FLOAT other_right, - FX_FLOAT other_bottom) { + CPVT_FloatRect(float other_left, + float other_top, + float other_right, + float other_bottom) { left = other_left; top = other_top; right = other_right; @@ -32,7 +32,7 @@ class CPVT_FloatRect : public CFX_FloatRect { void Default() { left = top = right = bottom = 0.0f; } - FX_FLOAT Height() const { + float Height() const { if (top > bottom) return top - bottom; return bottom - top; diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index 15515151bc..7e895e5850 100644 --- a/core/fpdfdoc/cpvt_generateap.cpp +++ b/core/fpdfdoc/cpvt_generateap.cpp @@ -54,7 +54,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, if (sFontName.IsEmpty()) return false; - FX_FLOAT fFontSize = FX_atof(syntax.GetWord()); + float fFontSize = FX_atof(syntax.GetWord()); CPVT_Color crText = CPVT_Color::ParseColor(DA); CPDF_Dictionary* pDRDict = pFormDict->GetDictFor("DR"); if (!pDRDict) @@ -109,7 +109,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, } BorderStyle nBorderStyle = BorderStyle::SOLID; - FX_FLOAT fBorderWidth = 1; + float fBorderWidth = 1; CPVT_Dash dsBorder(3, 0, 0); CPVT_Color crLeftTop, crRightBottom; if (CPDF_Dictionary* pBSDict = pAnnotDict->GetDictFor("BS")) { @@ -353,7 +353,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, int32_t nTop = pTi ? pTi->GetInteger() : 0; CFX_ByteTextBuf sBody; if (pOpts) { - FX_FLOAT fy = rcBody.top; + float fy = rcBody.top; for (size_t i = nTop, sz = pOpts->GetCount(); i < sz; i++) { if (IsFloatSmaller(fy, rcBody.bottom)) break; @@ -384,7 +384,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, vt.Initialize(); vt.SetText(swItem); vt.RearrangeAll(); - FX_FLOAT fItemHeight = vt.GetContentRect().Height(); + float fItemHeight = vt.GetContentRect().Height(); if (bSelected) { CFX_FloatRect rcItem = CFX_FloatRect( rcBody.left, fy - fItemHeight, rcBody.right, fy); @@ -463,7 +463,7 @@ CFX_ByteString GetColorStringWithDefault(CPDF_Array* pColor, return CPVT_GenerateAP::GenerateColorAP(crDefaultColor, nOperation); } -FX_FLOAT GetBorderWidth(const CPDF_Dictionary& pAnnotDict) { +float GetBorderWidth(const CPDF_Dictionary& pAnnotDict) { if (CPDF_Dictionary* pBorderStyleDict = pAnnotDict.GetDictFor("BS")) { if (pBorderStyleDict->KeyExist("W")) return pBorderStyleDict->GetNumberFor("W"); @@ -552,7 +552,7 @@ std::unique_ptr<CPDF_Dictionary> GenerateExtGStateDict( pdfium::MakeUnique<CPDF_Dictionary>(pAnnotDict.GetByteStringPool()); pGSDict->SetNewFor<CPDF_String>("Type", "ExtGState", false); - FX_FLOAT fOpacity = + float fOpacity = pAnnotDict.KeyExist("CA") ? pAnnotDict.GetNumberFor("CA") : 1; pGSDict->SetNewFor<CPDF_Number>("CA", fOpacity); pGSDict->SetNewFor<CPDF_Number>("ca", fOpacity); @@ -630,11 +630,11 @@ CFX_ByteString GenerateTextSymbolAP(const CFX_FloatRect& rect) { sAppStream << CPVT_GenerateAP::GenerateColorAP( CPVT_Color(CPVT_Color::kRGB, 0, 0, 0), PaintOperation::STROKE); - const FX_FLOAT fBorderWidth = 1; + const float fBorderWidth = 1; sAppStream << fBorderWidth << " w\n"; - const FX_FLOAT fHalfWidth = fBorderWidth / 2; - const FX_FLOAT fTipDelta = 4; + const float fHalfWidth = fBorderWidth / 2; + const float fTipDelta = 4; CFX_FloatRect outerRect1 = rect; outerRect1.Deflate(fHalfWidth, fHalfWidth); @@ -644,7 +644,7 @@ CFX_ByteString GenerateTextSymbolAP(const CFX_FloatRect& rect) { outerRect2.left += fTipDelta; outerRect2.right = outerRect2.left + fTipDelta; outerRect2.top = outerRect2.bottom - fTipDelta; - FX_FLOAT outerRect2Middle = (outerRect2.left + outerRect2.right) / 2; + float outerRect2Middle = (outerRect2.left + outerRect2.right) / 2; // Draw outer boxes. sAppStream << outerRect1.left << " " << outerRect1.bottom << " m\n" @@ -658,8 +658,8 @@ CFX_ByteString GenerateTextSymbolAP(const CFX_FloatRect& rect) { // Draw inner lines. CFX_FloatRect lineRect = outerRect1; - const FX_FLOAT fXDelta = 2; - const FX_FLOAT fYDelta = (lineRect.top - lineRect.bottom) / 4; + const float fXDelta = 2; + const float fYDelta = (lineRect.top - lineRect.bottom) / 4; lineRect.left += fXDelta; lineRect.right -= fXDelta; @@ -744,7 +744,7 @@ bool CPVT_GenerateAP::GenerateCircleAP(CPDF_Document* pDoc, CPVT_Color(CPVT_Color::kRGB, 0, 0, 0), PaintOperation::STROKE); - FX_FLOAT fBorderWidth = GetBorderWidth(*pAnnotDict); + float fBorderWidth = GetBorderWidth(*pAnnotDict); bool bIsStrokeRect = fBorderWidth > 0; if (bIsStrokeRect) { @@ -762,15 +762,15 @@ bool CPVT_GenerateAP::GenerateCircleAP(CPDF_Document* pDoc, rect.Deflate(fBorderWidth / 2, fBorderWidth / 2); } - const FX_FLOAT fMiddleX = (rect.left + rect.right) / 2; - const FX_FLOAT fMiddleY = (rect.top + rect.bottom) / 2; + const float fMiddleX = (rect.left + rect.right) / 2; + const float fMiddleY = (rect.top + rect.bottom) / 2; // |fL| is precalculated approximate value of 4 * tan((3.14 / 2) / 4) / 3, // where |fL| * radius is a good approximation of control points for // arc with 90 degrees. - const FX_FLOAT fL = 0.5523f; - const FX_FLOAT fDeltaX = fL * rect.Width() / 2.0; - const FX_FLOAT fDeltaY = fL * rect.Height() / 2.0; + const float fL = 0.5523f; + const float fDeltaX = fL * rect.Width() / 2.0; + const float fDeltaY = fL * rect.Height() / 2.0; // Starting point sAppStream << fMiddleX << " " << rect.top << " m\n"; @@ -833,7 +833,7 @@ bool CPVT_GenerateAP::GenerateHighlightAP(CPDF_Document* pDoc, bool CPVT_GenerateAP::GenerateInkAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { - FX_FLOAT fBorderWidth = GetBorderWidth(*pAnnotDict); + float fBorderWidth = GetBorderWidth(*pAnnotDict); bool bIsStroke = fBorderWidth > 0; if (!bIsStroke) @@ -892,7 +892,7 @@ bool CPVT_GenerateAP::GenerateTextAP(CPDF_Document* pDoc, sAppStream << "/" << sExtGSDictName << " gs "; CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect"); - const FX_FLOAT fNoteLength = 20; + const float fNoteLength = 20; CFX_FloatRect noteRect(rect.left, rect.bottom, rect.left + fNoteLength, rect.bottom + fNoteLength); pAnnotDict->SetRectFor("Rect", noteRect); @@ -921,7 +921,7 @@ bool CPVT_GenerateAP::GenerateUnderlineAP(CPDF_Document* pDoc, CFX_FloatRect rect = CPDF_Annot::RectFromQuadPoints(pAnnotDict); rect.Normalize(); - FX_FLOAT fLineWidth = 1.0; + float fLineWidth = 1.0; sAppStream << fLineWidth << " w " << rect.left << " " << rect.bottom + fLineWidth << " m " << rect.right << " " << rect.bottom + fLineWidth << " l S\n"; @@ -946,7 +946,7 @@ bool CPVT_GenerateAP::GeneratePopupAP(CPDF_Document* pDoc, sAppStream << GenerateColorAP(CPVT_Color(CPVT_Color::kRGB, 0, 0, 0), PaintOperation::STROKE); - const FX_FLOAT fBorderWidth = 1; + const float fBorderWidth = 1; sAppStream << fBorderWidth << " w\n"; CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect"); @@ -988,7 +988,7 @@ bool CPVT_GenerateAP::GenerateSquareAP(CPDF_Document* pDoc, CPVT_Color(CPVT_Color::kRGB, 0, 0, 0), PaintOperation::STROKE); - FX_FLOAT fBorderWidth = GetBorderWidth(*pAnnotDict); + float fBorderWidth = GetBorderWidth(*pAnnotDict); bool bIsStrokeRect = fBorderWidth > 0; if (bIsStrokeRect) { @@ -1034,16 +1034,16 @@ bool CPVT_GenerateAP::GenerateSquigglyAP(CPDF_Document* pDoc, CFX_FloatRect rect = CPDF_Annot::RectFromQuadPoints(pAnnotDict); rect.Normalize(); - FX_FLOAT fLineWidth = 1.0; + float fLineWidth = 1.0; sAppStream << fLineWidth << " w "; - const FX_FLOAT fDelta = 2.0; - const FX_FLOAT fTop = rect.bottom + fDelta; - const FX_FLOAT fBottom = rect.bottom; + const float fDelta = 2.0; + const float fTop = rect.bottom + fDelta; + const float fBottom = rect.bottom; sAppStream << rect.left << " " << fTop << " m "; - FX_FLOAT fX = rect.left + fDelta; + float fX = rect.left + fDelta; bool isUpwards = false; while (fX < rect.right) { @@ -1053,7 +1053,7 @@ bool CPVT_GenerateAP::GenerateSquigglyAP(CPDF_Document* pDoc, isUpwards = !isUpwards; } - FX_FLOAT fRemainder = rect.right - (fX - fDelta); + float fRemainder = rect.right - (fX - fDelta); if (isUpwards) sAppStream << rect.right << " " << fBottom + fRemainder << " l "; else @@ -1083,8 +1083,8 @@ bool CPVT_GenerateAP::GenerateStrikeOutAP(CPDF_Document* pDoc, CFX_FloatRect rect = CPDF_Annot::RectFromQuadPoints(pAnnotDict); rect.Normalize(); - FX_FLOAT fLineWidth = 1.0; - FX_FLOAT fY = (rect.top + rect.bottom) / 2; + float fLineWidth = 1.0; + float fY = (rect.top + rect.bottom) / 2; sAppStream << fLineWidth << " w " << rect.left << " " << fY << " m " << rect.right << " " << fY << " l S\n"; @@ -1184,7 +1184,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP( // Static. CFX_ByteString CPVT_GenerateAP::GenerateBorderAP( const CFX_FloatRect& rect, - FX_FLOAT fWidth, + float fWidth, const CPVT_Color& color, const CPVT_Color& crLeftTop, const CPVT_Color& crRightBottom, @@ -1192,12 +1192,12 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP( const CPVT_Dash& dash) { 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; switch (nStyle) { default: case BorderStyle::SOLID: @@ -1355,7 +1355,7 @@ CFX_ByteString CPVT_GenerateAP::GetWordRenderString( // Static. CFX_ByteString CPVT_GenerateAP::GetFontSetString(IPVT_FontMap* pFontMap, int32_t nFontIndex, - FX_FLOAT fFontSize) { + float fFontSize) { CFX_ByteTextBuf sRet; if (pFontMap) { CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex); diff --git a/core/fpdfdoc/cpvt_generateap.h b/core/fpdfdoc/cpvt_generateap.h index 62a84531ee..c558636255 100644 --- a/core/fpdfdoc/cpvt_generateap.h +++ b/core/fpdfdoc/cpvt_generateap.h @@ -52,7 +52,7 @@ class CPVT_GenerateAP { bool bContinuous, uint16_t SubWord); static CFX_ByteString GenerateBorderAP(const CFX_FloatRect& rect, - FX_FLOAT fWidth, + float fWidth, const CPVT_Color& color, const CPVT_Color& crLeftTop, const CPVT_Color& crRightBottom, @@ -68,7 +68,7 @@ class CPVT_GenerateAP { static CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords); static CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap, int32_t nFontIndex, - FX_FLOAT fFontSize); + float fFontSize); }; #endif // CORE_FPDFDOC_CPVT_GENERATEAP_H_ diff --git a/core/fpdfdoc/cpvt_line.h b/core/fpdfdoc/cpvt_line.h index 47c3e84d6a..087034d3d5 100644 --- a/core/fpdfdoc/cpvt_line.h +++ b/core/fpdfdoc/cpvt_line.h @@ -18,9 +18,9 @@ class CPVT_Line { CPVT_WordPlace lineplace; CPVT_WordPlace lineEnd; CFX_PointF ptLine; - FX_FLOAT fLineWidth; - FX_FLOAT fLineAscent; - FX_FLOAT fLineDescent; + float fLineWidth; + float fLineAscent; + float fLineDescent; }; inline CPVT_Line::CPVT_Line() diff --git a/core/fpdfdoc/cpvt_lineinfo.h b/core/fpdfdoc/cpvt_lineinfo.h index 8fb10de250..96a3234380 100644 --- a/core/fpdfdoc/cpvt_lineinfo.h +++ b/core/fpdfdoc/cpvt_lineinfo.h @@ -16,11 +16,11 @@ class CPVT_LineInfo { int32_t nTotalWord; int32_t nBeginWordIndex; int32_t nEndWordIndex; - FX_FLOAT fLineX; - FX_FLOAT fLineY; - FX_FLOAT fLineWidth; - FX_FLOAT fLineAscent; - FX_FLOAT fLineDescent; + float fLineX; + float fLineY; + float fLineWidth; + float fLineAscent; + float fLineDescent; }; inline CPVT_LineInfo::CPVT_LineInfo() diff --git a/core/fpdfdoc/cpvt_secprops.h b/core/fpdfdoc/cpvt_secprops.h index d1c4b589f1..93829f9b00 100644 --- a/core/fpdfdoc/cpvt_secprops.h +++ b/core/fpdfdoc/cpvt_secprops.h @@ -12,7 +12,7 @@ struct CPVT_SecProps { CPVT_SecProps() : fLineLeading(0.0f), fLineIndent(0.0f), nAlignment(0) {} - CPVT_SecProps(FX_FLOAT lineLeading, FX_FLOAT lineIndent, int32_t alignment) + CPVT_SecProps(float lineLeading, float lineIndent, int32_t alignment) : fLineLeading(lineLeading), fLineIndent(lineIndent), nAlignment(alignment) {} @@ -22,8 +22,8 @@ struct CPVT_SecProps { fLineIndent(other.fLineIndent), nAlignment(other.nAlignment) {} - FX_FLOAT fLineLeading; - FX_FLOAT fLineIndent; + float fLineLeading; + float fLineIndent; int32_t nAlignment; }; diff --git a/core/fpdfdoc/cpvt_word.h b/core/fpdfdoc/cpvt_word.h index 540f0416ad..28e192467b 100644 --- a/core/fpdfdoc/cpvt_word.h +++ b/core/fpdfdoc/cpvt_word.h @@ -19,11 +19,11 @@ class CPVT_Word { int32_t nCharset; CPVT_WordPlace WordPlace; CFX_PointF ptWord; - FX_FLOAT fAscent; - FX_FLOAT fDescent; - FX_FLOAT fWidth; + float fAscent; + float fDescent; + float fWidth; int32_t nFontIndex; - FX_FLOAT fFontSize; + float fFontSize; CPVT_WordProps WordProps; }; diff --git a/core/fpdfdoc/cpvt_wordinfo.h b/core/fpdfdoc/cpvt_wordinfo.h index 861534b0a5..00f5a45e70 100644 --- a/core/fpdfdoc/cpvt_wordinfo.h +++ b/core/fpdfdoc/cpvt_wordinfo.h @@ -25,9 +25,9 @@ struct CPVT_WordInfo { uint16_t Word; int32_t nCharset; - FX_FLOAT fWordX; - FX_FLOAT fWordY; - FX_FLOAT fWordTail; + float fWordX; + float fWordY; + float fWordTail; int32_t nFontIndex; std::unique_ptr<CPVT_WordProps> pWordProps; }; diff --git a/core/fpdfdoc/cpvt_wordprops.h b/core/fpdfdoc/cpvt_wordprops.h index 2b7084116a..2d0e5d51b3 100644 --- a/core/fpdfdoc/cpvt_wordprops.h +++ b/core/fpdfdoc/cpvt_wordprops.h @@ -22,12 +22,12 @@ struct CPVT_WordProps { nHorzScale(0) {} CPVT_WordProps(int32_t fontIndex, - FX_FLOAT fontSize, + float fontSize, FX_COLORREF wordColor = 0, CPDF_VariableText::ScriptType scriptType = CPDF_VariableText::ScriptType::Normal, int32_t wordStyle = 0, - FX_FLOAT charSpace = 0, + float charSpace = 0, int32_t horzScale = 100) : nFontIndex(fontIndex), fFontSize(fontSize), @@ -47,11 +47,11 @@ struct CPVT_WordProps { nHorzScale(other.nHorzScale) {} int32_t nFontIndex; - FX_FLOAT fFontSize; + float fFontSize; FX_COLORREF dwWordColor; CPDF_VariableText::ScriptType nScriptType; int32_t nWordStyle; - FX_FLOAT fCharSpace; + float fCharSpace; int32_t nHorzScale; }; diff --git a/core/fpdfdoc/csection.cpp b/core/fpdfdoc/csection.cpp index 490ef1b230..ce78418dc5 100644 --- a/core/fpdfdoc/csection.cpp +++ b/core/fpdfdoc/csection.cpp @@ -65,7 +65,7 @@ CPVT_FloatRect CSection::Rearrange() { return CTypeset(this).Typeset(); } -CFX_SizeF CSection::GetSectionSize(FX_FLOAT fFontSize) { +CFX_SizeF CSection::GetSectionSize(float fFontSize) { return CTypeset(this).GetEditSize(fFontSize); } @@ -154,8 +154,8 @@ CPVT_WordPlace CSection::SearchWordPlace(const CFX_PointF& point) const { int32_t nLeft = 0; int32_t nRight = m_LineArray.GetSize() - 1; int32_t nMid = m_LineArray.GetSize() / 2; - FX_FLOAT fTop = 0; - FX_FLOAT fBottom = 0; + float fTop = 0; + float fBottom = 0; while (nLeft <= nRight) { if (CLine* pLine = m_LineArray.GetAt(nMid)) { fTop = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineAscent - @@ -195,7 +195,7 @@ CPVT_WordPlace CSection::SearchWordPlace(const CFX_PointF& point) const { } CPVT_WordPlace CSection::SearchWordPlace( - FX_FLOAT fx, + float fx, const CPVT_WordPlace& lineplace) const { if (CLine* pLine = m_LineArray.GetAt(lineplace.nLineIndex)) { return SearchWordPlace( @@ -206,7 +206,7 @@ CPVT_WordPlace CSection::SearchWordPlace( return GetBeginWordPlace(); } -CPVT_WordPlace CSection::SearchWordPlace(FX_FLOAT fx, +CPVT_WordPlace CSection::SearchWordPlace(float fx, const CPVT_WordRange& range) const { CPVT_WordPlace wordplace = range.BeginPos; wordplace.nWordIndex = -1; diff --git a/core/fpdfdoc/csection.h b/core/fpdfdoc/csection.h index a2ac43b102..b82409dc6f 100644 --- a/core/fpdfdoc/csection.h +++ b/core/fpdfdoc/csection.h @@ -33,17 +33,16 @@ class CSection final { void ClearWords(const CPVT_WordRange& PlaceRange); void ClearWord(const CPVT_WordPlace& place); CPVT_FloatRect Rearrange(); - CFX_SizeF GetSectionSize(FX_FLOAT fFontSize); + CFX_SizeF GetSectionSize(float fFontSize); CPVT_WordPlace GetBeginWordPlace() const; CPVT_WordPlace GetEndWordPlace() const; CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const; CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const; void UpdateWordPlace(CPVT_WordPlace& place) const; CPVT_WordPlace SearchWordPlace(const CFX_PointF& point) const; - CPVT_WordPlace SearchWordPlace(FX_FLOAT fx, + CPVT_WordPlace SearchWordPlace(float fx, const CPVT_WordPlace& lineplace) const; - CPVT_WordPlace SearchWordPlace(FX_FLOAT fx, - const CPVT_WordRange& range) const; + CPVT_WordPlace SearchWordPlace(float fx, const CPVT_WordRange& range) const; CPVT_WordPlace SecPlace; CPVT_SectionInfo m_SecInfo; diff --git a/core/fpdfdoc/ctypeset.cpp b/core/fpdfdoc/ctypeset.cpp index 452143e682..6cfaff5cc8 100644 --- a/core/fpdfdoc/ctypeset.cpp +++ b/core/fpdfdoc/ctypeset.cpp @@ -180,16 +180,16 @@ CTypeset::~CTypeset() {} CPVT_FloatRect CTypeset::CharArray() { ASSERT(m_pSection); - FX_FLOAT fLineAscent = + float fLineAscent = m_pVT->GetFontAscent(m_pVT->GetDefaultFontIndex(), m_pVT->GetFontSize()); - FX_FLOAT fLineDescent = + float fLineDescent = m_pVT->GetFontDescent(m_pVT->GetDefaultFontIndex(), m_pVT->GetFontSize()); m_rcRet.Default(); - FX_FLOAT x = 0.0f, y = 0.0f; - FX_FLOAT fNextWidth; + float x = 0.0f, y = 0.0f; + float fNextWidth; int32_t nStart = 0; - FX_FLOAT fNodeWidth = m_pVT->GetPlateWidth() / - (m_pVT->m_nCharArray <= 0 ? 1 : m_pVT->m_nCharArray); + float fNodeWidth = m_pVT->GetPlateWidth() / + (m_pVT->m_nCharArray <= 0 ? 1 : m_pVT->m_nCharArray); if (CLine* pLine = m_pSection->m_LineArray.GetAt(0)) { x = 0.0f; y += m_pVT->GetLineLeading(m_pSection->m_SecInfo); @@ -221,11 +221,11 @@ CPVT_FloatRect CTypeset::CharArray() { } if (CPVT_WordInfo* pWord = m_pSection->m_WordArray.GetAt(w)) { pWord->fWordTail = 0; - FX_FLOAT fWordWidth = m_pVT->GetWordWidth(*pWord); - FX_FLOAT fWordAscent = m_pVT->GetWordAscent(*pWord); - FX_FLOAT fWordDescent = m_pVT->GetWordDescent(*pWord); - x = (FX_FLOAT)(fNodeWidth * (w + nStart + 0.5) - - fWordWidth * VARIABLETEXT_HALF); + float fWordWidth = m_pVT->GetWordWidth(*pWord); + float fWordAscent = m_pVT->GetWordAscent(*pWord); + float fWordDescent = m_pVT->GetWordDescent(*pWord); + x = (float)(fNodeWidth * (w + nStart + 0.5) - + fWordWidth * VARIABLETEXT_HALF); pWord->fWordX = x; pWord->fWordY = y; if (w == 0) { @@ -255,7 +255,7 @@ CPVT_FloatRect CTypeset::CharArray() { return m_rcRet = CPVT_FloatRect(0, 0, x, y); } -CFX_SizeF CTypeset::GetEditSize(FX_FLOAT fFontSize) { +CFX_SizeF CTypeset::GetEditSize(float fFontSize) { ASSERT(m_pSection); ASSERT(m_pVT); SplitLines(false, fFontSize); @@ -271,22 +271,22 @@ CPVT_FloatRect CTypeset::Typeset() { return m_rcRet; } -void CTypeset::SplitLines(bool bTypeset, FX_FLOAT fFontSize) { +void CTypeset::SplitLines(bool bTypeset, float fFontSize) { ASSERT(m_pVT); ASSERT(m_pSection); int32_t nLineHead = 0; int32_t nLineTail = 0; - FX_FLOAT fMaxX = 0.0f, fMaxY = 0.0f; - FX_FLOAT fLineWidth = 0.0f, fBackupLineWidth = 0.0f; - FX_FLOAT fLineAscent = 0.0f, fBackupLineAscent = 0.0f; - FX_FLOAT fLineDescent = 0.0f, fBackupLineDescent = 0.0f; + float fMaxX = 0.0f, fMaxY = 0.0f; + float fLineWidth = 0.0f, fBackupLineWidth = 0.0f; + float fLineAscent = 0.0f, fBackupLineAscent = 0.0f; + float fLineDescent = 0.0f, fBackupLineDescent = 0.0f; int32_t nWordStartPos = 0; bool bFullWord = false; int32_t nLineFullWordIndex = 0; int32_t nCharIndex = 0; CPVT_LineInfo line; - FX_FLOAT fWordWidth = 0; - FX_FLOAT fTypesetWidth = std::max( + float fWordWidth = 0; + float fTypesetWidth = std::max( m_pVT->GetPlateWidth() - m_pVT->GetLineIndent(m_pSection->m_SecInfo), 0.0f); int32_t nTotalWords = m_pSection->m_WordArray.GetSize(); @@ -420,10 +420,10 @@ void CTypeset::SplitLines(bool bTypeset, FX_FLOAT fFontSize) { void CTypeset::OutputLines() { ASSERT(m_pVT); ASSERT(m_pSection); - FX_FLOAT fMinX = 0.0f, fMinY = 0.0f, fMaxX = 0.0f, fMaxY = 0.0f; - FX_FLOAT fPosX = 0.0f, fPosY = 0.0f; - FX_FLOAT fLineIndent = m_pVT->GetLineIndent(m_pSection->m_SecInfo); - FX_FLOAT fTypesetWidth = std::max(m_pVT->GetPlateWidth() - fLineIndent, 0.0f); + float fMinX = 0.0f, fMinY = 0.0f, fMaxX = 0.0f, fMaxY = 0.0f; + float fPosX = 0.0f, fPosY = 0.0f; + float fLineIndent = m_pVT->GetLineIndent(m_pSection->m_SecInfo); + float fTypesetWidth = std::max(m_pVT->GetPlateWidth() - fLineIndent, 0.0f); switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) { default: case 0: diff --git a/core/fpdfdoc/ctypeset.h b/core/fpdfdoc/ctypeset.h index 4161c03b42..f769fe1311 100644 --- a/core/fpdfdoc/ctypeset.h +++ b/core/fpdfdoc/ctypeset.h @@ -18,12 +18,12 @@ class CTypeset final { explicit CTypeset(CSection* pSection); ~CTypeset(); - CFX_SizeF GetEditSize(FX_FLOAT fFontSize); + CFX_SizeF GetEditSize(float fFontSize); CPVT_FloatRect Typeset(); CPVT_FloatRect CharArray(); private: - void SplitLines(bool bTypeset, FX_FLOAT fFontSize); + void SplitLines(bool bTypeset, float fFontSize); void OutputLines(); CPVT_FloatRect m_rcRet; diff --git a/core/fpdfdoc/doc_tagged.cpp b/core/fpdfdoc/doc_tagged.cpp index af5cf85938..418fab411a 100644 --- a/core/fpdfdoc/doc_tagged.cpp +++ b/core/fpdfdoc/doc_tagged.cpp @@ -291,7 +291,7 @@ void CPDF_StructElement::LoadKid(uint32_t PageObjNum, } static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs, const CFX_ByteStringC& owner, - FX_FLOAT nLevel = 0.0F) { + float nLevel = 0.0F) { if (nLevel > nMaxRecursion) return nullptr; if (!pAttrs) @@ -317,7 +317,7 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs, CPDF_Object* CPDF_StructElement::GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, bool bInheritable, - FX_FLOAT fLevel) { + float fLevel) { if (fLevel > nMaxRecursion) { return nullptr; } @@ -400,11 +400,11 @@ FX_ARGB CPDF_StructElement::GetColor(const CFX_ByteStringC& owner, ((int)(pArray->GetNumberAt(1) * 255) << 8) | (int)(pArray->GetNumberAt(2) * 255); } -FX_FLOAT CPDF_StructElement::GetNumber(const CFX_ByteStringC& owner, - const CFX_ByteStringC& name, - FX_FLOAT default_value, - bool bInheritable, - int subindex) { +float CPDF_StructElement::GetNumber(const CFX_ByteStringC& owner, + const CFX_ByteStringC& name, + float default_value, + bool bInheritable, + int subindex) { CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); return ToNumber(pAttr) ? pAttr->GetNumber() : default_value; } diff --git a/core/fpdfdoc/fpdf_tagged.h b/core/fpdfdoc/fpdf_tagged.h index fbbb49f856..5e7b1827c5 100644 --- a/core/fpdfdoc/fpdf_tagged.h +++ b/core/fpdfdoc/fpdf_tagged.h @@ -42,7 +42,7 @@ class IPDF_StructElement { virtual CPDF_Object* GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, bool bInheritable = false, - FX_FLOAT fLevel = 0.0F) = 0; + float fLevel = 0.0F) = 0; virtual CFX_ByteString GetName(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, @@ -56,11 +56,11 @@ class IPDF_StructElement { bool bInheritable = false, int subindex = -1) = 0; - virtual FX_FLOAT GetNumber(const CFX_ByteStringC& owner, - const CFX_ByteStringC& name, - FX_FLOAT default_value, - bool bInheritable = false, - int subindex = -1) = 0; + virtual float GetNumber(const CFX_ByteStringC& owner, + const CFX_ByteStringC& name, + float default_value, + bool bInheritable = false, + int subindex = -1) = 0; virtual int GetInteger(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, diff --git a/core/fpdfdoc/tagged_int.h b/core/fpdfdoc/tagged_int.h index ce246023df..cafcbd42aa 100644 --- a/core/fpdfdoc/tagged_int.h +++ b/core/fpdfdoc/tagged_int.h @@ -73,7 +73,7 @@ class CPDF_StructElement final : public CFX_Retainable, CPDF_Object* GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, bool bInheritable = false, - FX_FLOAT fLevel = 0.0F) override; + float fLevel = 0.0F) override; CFX_ByteString GetName(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, const CFX_ByteStringC& default_value, @@ -84,11 +84,11 @@ class CPDF_StructElement final : public CFX_Retainable, FX_ARGB default_value, bool bInheritable = false, int subindex = -1) override; - FX_FLOAT GetNumber(const CFX_ByteStringC& owner, - const CFX_ByteStringC& name, - FX_FLOAT default_value, - bool bInheritable = false, - int subindex = -1) override; + float GetNumber(const CFX_ByteStringC& owner, + const CFX_ByteStringC& name, + float default_value, + bool bInheritable = false, + int subindex = -1) override; int GetInteger(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, int default_value, diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index 1a1edcb0ff..7a89b24171 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -26,12 +26,12 @@ namespace { -const FX_FLOAT kDefaultFontSize = 1.0f; +const float kDefaultFontSize = 1.0f; const uint16_t* const g_UnicodeData_Normalization_Maps[5] = { nullptr, g_UnicodeData_Normalization_Map1, g_UnicodeData_Normalization_Map2, g_UnicodeData_Normalization_Map3, g_UnicodeData_Normalization_Map4}; -FX_FLOAT NormalizeThreshold(FX_FLOAT threshold) { +float NormalizeThreshold(float threshold) { if (threshold < 300) return threshold / 2.0f; if (threshold < 500) @@ -41,21 +41,21 @@ FX_FLOAT NormalizeThreshold(FX_FLOAT threshold) { return threshold / 6.0f; } -FX_FLOAT CalculateBaseSpace(const CPDF_TextObject* pTextObj, - const CFX_Matrix& matrix) { - FX_FLOAT baseSpace = 0.0; +float CalculateBaseSpace(const CPDF_TextObject* pTextObj, + const CFX_Matrix& matrix) { + float baseSpace = 0.0; const int nItems = pTextObj->CountItems(); if (pTextObj->m_TextState.GetCharSpace() && nItems >= 3) { bool bAllChar = true; - FX_FLOAT spacing = + float spacing = matrix.TransformDistance(pTextObj->m_TextState.GetCharSpace()); baseSpace = spacing; for (int i = 0; i < nItems; i++) { CPDF_TextObjectItem item; pTextObj->GetItemInfo(i, &item); if (item.m_CharCode == static_cast<uint32_t>(-1)) { - FX_FLOAT fontsize_h = pTextObj->m_TextState.GetFontSizeH(); - FX_FLOAT kerning = -fontsize_h * item.m_Origin.x / 1000; + float fontsize_h = pTextObj->m_TextState.GetFontSizeH(); + float kerning = -fontsize_h * item.m_Origin.x / 1000; baseSpace = std::min(baseSpace, kerning + spacing); bAllChar = false; } @@ -277,7 +277,7 @@ std::vector<CFX_FloatRect> CPDF_TextPage::GetRectArray(int start, rect.top = origin.y + pCurObj->GetFont()->GetTypeAscent() * pCurObj->GetFontSize() / 1000; - FX_FLOAT xPosTemp = + float xPosTemp = origin.x + GetCharWidth(info_curchar.m_CharCode, pCurObj->GetFont()) * pCurObj->GetFontSize() / 1000; @@ -347,7 +347,7 @@ CFX_WideString CPDF_TextPage::GetTextByRect(const CFX_FloatRect& rect) const { if (!m_bIsParsed) return CFX_WideString(); - FX_FLOAT posy = 0; + float posy = 0; bool IsContainPreChar = false; bool IsAddLineFeed = false; CFX_WideString strText; @@ -492,10 +492,10 @@ int CPDF_TextPage::CountRects(int start, int nCount) { } void CPDF_TextPage::GetRect(int rectIndex, - FX_FLOAT& left, - FX_FLOAT& top, - FX_FLOAT& right, - FX_FLOAT& bottom) const { + float& left, + float& top, + float& right, + float& bottom) const { if (!m_bIsParsed) return; @@ -520,7 +520,7 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::FindTextlineFlowOrientation() std::vector<bool> nHorizontalMask(nPageWidth); std::vector<bool> nVerticalMask(nPageHeight); - FX_FLOAT fLineHeight = 0.0f; + float fLineHeight = 0.0f; int32_t nStartH = nPageWidth; int32_t nEndH = 0; int32_t nStartV = nPageHeight; @@ -556,11 +556,11 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::FindTextlineFlowOrientation() if ((nEndH - nStartH) < nDoubleLineHeight) return TextOrientation::Vertical; - const FX_FLOAT nSumH = MaskPercentFilled(nHorizontalMask, nStartH, nEndH); + const float nSumH = MaskPercentFilled(nHorizontalMask, nStartH, nEndH); if (nSumH > 0.8f) return TextOrientation::Horizontal; - const FX_FLOAT nSumV = MaskPercentFilled(nVerticalMask, nStartV, nEndV); + const float nSumV = MaskPercentFilled(nVerticalMask, nStartV, nEndV); if (nSumH > nSumV) return TextOrientation::Horizontal; if (nSumH < nSumV) @@ -762,7 +762,7 @@ void CPDF_TextPage::ProcessTextObject( CPDF_TextObjectItem item; int nItem = prev_Obj.m_pTextObj->CountItems(); prev_Obj.m_pTextObj->GetItemInfo(nItem - 1, &item); - FX_FLOAT prev_width = + float prev_width = GetCharWidth(item.m_CharCode, prev_Obj.m_pTextObj->GetFont()) * prev_Obj.m_pTextObj->GetFontSize() / 1000; @@ -771,8 +771,8 @@ void CPDF_TextPage::ProcessTextObject( prev_matrix.Concat(prev_Obj.m_formMatrix); prev_width = prev_matrix.TransformDistance(prev_width); pTextObj->GetItemInfo(0, &item); - FX_FLOAT this_width = GetCharWidth(item.m_CharCode, pTextObj->GetFont()) * - pTextObj->GetFontSize() / 1000; + float this_width = GetCharWidth(item.m_CharCode, pTextObj->GetFont()) * + pTextObj->GetFontSize() / 1000; this_width = FXSYS_fabs(this_width); CFX_Matrix this_matrix = pTextObj->GetTextMatrix(); @@ -780,8 +780,7 @@ void CPDF_TextPage::ProcessTextObject( this_matrix.Concat(formMatrix); this_width = this_matrix.TransformDistance(this_width); - FX_FLOAT threshold = - prev_width > this_width ? prev_width / 4 : this_width / 4; + float threshold = prev_width > this_width ? prev_width / 4 : this_width / 4; CFX_PointF prev_pos = m_DisplayMatrix.Transform( prev_Obj.m_formMatrix.Transform(prev_Obj.m_pTextObj->GetPos())); CFX_PointF this_pos = @@ -1041,7 +1040,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { m_pPreTextObj = pTextObj; m_perMatrix = formMatrix; int nItems = pTextObj->CountItems(); - FX_FLOAT baseSpace = CalculateBaseSpace(pTextObj, matrix); + float baseSpace = CalculateBaseSpace(pTextObj, matrix); const bool bR2L = IsRightToLeft(pTextObj, pFont, nItems); const bool bIsBidiAndMirrorInverse = @@ -1050,7 +1049,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { int32_t iCharListStartAppend = pdfium::CollectionSize<int32_t>(m_TempCharList); - FX_FLOAT spacing = 0; + float spacing = 0; for (int i = 0; i < nItems; i++) { CPDF_TextObjectItem item; PAGECHAR_INFO charinfo; @@ -1062,11 +1061,11 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { if (str.IsEmpty() || str.GetAt(str.GetLength() - 1) == TEXT_SPACE_CHAR) continue; - FX_FLOAT fontsize_h = pTextObj->m_TextState.GetFontSizeH(); + float fontsize_h = pTextObj->m_TextState.GetFontSizeH(); spacing = -fontsize_h * item.m_Origin.x / 1000; continue; } - FX_FLOAT charSpace = pTextObj->m_TextState.GetCharSpace(); + float charSpace = pTextObj->m_TextState.GetCharSpace(); if (charSpace > 0.001) spacing += matrix.TransformDistance(charSpace); else if (charSpace < -0.001) @@ -1074,9 +1073,9 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { spacing -= baseSpace; if (spacing && i > 0) { int last_width = 0; - FX_FLOAT fontsize_h = pTextObj->m_TextState.GetFontSizeH(); + float fontsize_h = pTextObj->m_TextState.GetFontSizeH(); uint32_t space_charcode = pFont->CharCodeFromUnicode(' '); - FX_FLOAT threshold = 0; + float threshold = 0; if (space_charcode != CPDF_Font::kInvalidCharCode) threshold = fontsize_h * pFont->GetCharWidthF(space_charcode) / 1000; if (threshold > fontsize_h / 3) @@ -1086,8 +1085,8 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { if (threshold == 0) { threshold = fontsize_h; int this_width = FXSYS_abs(GetCharWidth(item.m_CharCode, pFont)); - threshold = this_width > last_width ? (FX_FLOAT)this_width - : (FX_FLOAT)last_width; + threshold = + this_width > last_width ? (float)this_width : (float)last_width; threshold = NormalizeThreshold(threshold); threshold = fontsize_h * threshold / 1000; } @@ -1155,8 +1154,8 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { bool bDel = false; const int count = std::min(pdfium::CollectionSize<int>(m_TempCharList), 7); - FX_FLOAT threshold = charinfo.m_Matrix.TransformXDistance( - (FX_FLOAT)TEXT_CHARRATIO_GAPDELTA * pTextObj->GetFontSize()); + float threshold = charinfo.m_Matrix.TransformXDistance( + (float)TEXT_CHARRATIO_GAPDELTA * pTextObj->GetFontSize()); for (int n = pdfium::CollectionSize<int>(m_TempCharList); n > pdfium::CollectionSize<int>(m_TempCharList) - count; n--) { const PAGECHAR_INFO& charinfo1 = m_TempCharList[n - 1]; @@ -1207,8 +1206,8 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::GetTextObjectWritingMode( first.m_Origin = textMatrix.Transform(first.m_Origin); last.m_Origin = textMatrix.Transform(last.m_Origin); - FX_FLOAT dX = FXSYS_fabs(last.m_Origin.x - first.m_Origin.x); - FX_FLOAT dY = FXSYS_fabs(last.m_Origin.y - first.m_Origin.y); + float dX = FXSYS_fabs(last.m_Origin.x - first.m_Origin.x); + float dY = FXSYS_fabs(last.m_Origin.y - first.m_Origin.y); if (dX <= 0.0001f && dY <= 0.0001f) return TextOrientation::Unknown; @@ -1279,10 +1278,9 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject( wchar_t curChar = wstrItem.GetAt(0); if (WritingMode == TextOrientation::Horizontal) { if (this_rect.Height() > 4.5 && prev_rect.Height() > 4.5) { - FX_FLOAT top = - this_rect.top < prev_rect.top ? this_rect.top : prev_rect.top; - FX_FLOAT bottom = this_rect.bottom > prev_rect.bottom ? this_rect.bottom - : prev_rect.bottom; + float top = this_rect.top < prev_rect.top ? this_rect.top : prev_rect.top; + float bottom = this_rect.bottom > prev_rect.bottom ? this_rect.bottom + : prev_rect.bottom; if (bottom >= top) { return IsHyphen(curChar) ? GenerateCharacter::Hyphen : GenerateCharacter::LineBreak; @@ -1291,11 +1289,10 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject( } else if (WritingMode == TextOrientation::Vertical) { if (this_rect.Width() > pObj->GetFontSize() * 0.1f && prev_rect.Width() > m_pPreTextObj->GetFontSize() * 0.1f) { - FX_FLOAT left = this_rect.left > m_CurlineRect.left ? this_rect.left - : m_CurlineRect.left; - FX_FLOAT right = this_rect.right < m_CurlineRect.right - ? this_rect.right - : m_CurlineRect.right; + float left = this_rect.left > m_CurlineRect.left ? this_rect.left + : m_CurlineRect.left; + float right = this_rect.right < m_CurlineRect.right ? this_rect.right + : m_CurlineRect.right; if (right <= left) { return IsHyphen(curChar) ? GenerateCharacter::Hyphen : GenerateCharacter::LineBreak; @@ -1303,15 +1300,14 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject( } } - FX_FLOAT last_pos = PrevItem.m_Origin.x; + float last_pos = PrevItem.m_Origin.x; int nLastWidth = GetCharWidth(PrevItem.m_CharCode, m_pPreTextObj->GetFont()); - FX_FLOAT last_width = nLastWidth * m_pPreTextObj->GetFontSize() / 1000; + float last_width = nLastWidth * m_pPreTextObj->GetFontSize() / 1000; last_width = FXSYS_fabs(last_width); int nThisWidth = GetCharWidth(item.m_CharCode, pObj->GetFont()); - FX_FLOAT this_width = nThisWidth * pObj->GetFontSize() / 1000; + float this_width = nThisWidth * pObj->GetFontSize() / 1000; this_width = FXSYS_fabs(this_width); - FX_FLOAT threshold = - last_width > this_width ? last_width / 4 : this_width / 4; + float threshold = last_width > this_width ? last_width / 4 : this_width / 4; CFX_Matrix prev_matrix = m_pPreTextObj->GetTextMatrix(); prev_matrix.Concat(m_perMatrix); @@ -1372,7 +1368,7 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject( CFX_Matrix matrix = pObj->GetTextMatrix(); matrix.Concat(formMatrix); - threshold = (FX_FLOAT)(nLastWidth > nThisWidth ? nLastWidth : nThisWidth); + threshold = (float)(nLastWidth > nThisWidth ? nLastWidth : nThisWidth); threshold = threshold > 400 ? (threshold < 700 ? threshold / 4 @@ -1416,11 +1412,11 @@ bool CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1, CFX_FloatRect rcPreObj = pTextObj2->GetRect(); CFX_FloatRect rcCurObj = pTextObj1->GetRect(); if (rcPreObj.IsEmpty() && rcCurObj.IsEmpty()) { - FX_FLOAT dbXdif = FXSYS_fabs(rcPreObj.left - rcCurObj.left); + float dbXdif = FXSYS_fabs(rcPreObj.left - rcCurObj.left); size_t nCount = m_CharList.size(); if (nCount >= 2) { PAGECHAR_INFO perCharTemp = m_CharList[nCount - 2]; - FX_FLOAT dbSpace = perCharTemp.m_CharBox.Width(); + float dbSpace = perCharTemp.m_CharBox.Width(); if (dbXdif > dbSpace) return false; } @@ -1454,9 +1450,9 @@ bool CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1, } CFX_PointF diff = pTextObj1->GetPos() - pTextObj2->GetPos(); - FX_FLOAT font_size = pTextObj2->GetFontSize(); - FX_FLOAT char_size = GetCharWidth(itemPer.m_CharCode, pTextObj2->GetFont()); - FX_FLOAT max_pre_size = + float font_size = pTextObj2->GetFontSize(); + float char_size = GetCharWidth(itemPer.m_CharCode, pTextObj2->GetFont()); + float max_pre_size = std::max(std::max(rcPreObj.Height(), rcPreObj.Width()), font_size); if (FXSYS_fabs(diff.x) > char_size * font_size / 1000 * 0.9 || FXSYS_fabs(diff.y) > max_pre_size / 8) { @@ -1503,8 +1499,8 @@ bool CPDF_TextPage::GenerateCharInfo(wchar_t unicode, PAGECHAR_INFO& info) { GetCharWidth(preChar->m_CharCode, preChar->m_pTextObj->GetFont()); } - FX_FLOAT fFontSize = preChar->m_pTextObj ? preChar->m_pTextObj->GetFontSize() - : preChar->m_CharBox.Height(); + float fFontSize = preChar->m_pTextObj ? preChar->m_pTextObj->GetFontSize() + : preChar->m_CharBox.Height(); if (!fFontSize) fFontSize = kDefaultFontSize; diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h index e8de6205a2..ebe58eb7ff 100644 --- a/core/fpdftext/cpdf_textpage.h +++ b/core/fpdftext/cpdf_textpage.h @@ -52,7 +52,7 @@ class FPDF_CHAR_INFO { wchar_t m_Unicode; wchar_t m_Charcode; int32_t m_Flag; - FX_FLOAT m_FontSize; + float m_FontSize; CFX_PointF m_Origin; CFX_FloatRect m_CharBox; CPDF_TextObject* m_pTextObj; @@ -103,10 +103,10 @@ class CPDF_TextPage { CFX_WideString GetPageText(int start = 0, int nCount = -1) const; int CountRects(int start, int nCount); void GetRect(int rectIndex, - FX_FLOAT& left, - FX_FLOAT& top, - FX_FLOAT& right, - FX_FLOAT& bottom) const; + float& left, + float& top, + float& right, + float& bottom) const; static bool IsRectIntersect(const CFX_FloatRect& rect1, const CFX_FloatRect& rect2); diff --git a/core/fxcodec/codec/ccodec_iccmodule.h b/core/fxcodec/codec/ccodec_iccmodule.h index 1f856faa04..c568a9b3c2 100644 --- a/core/fxcodec/codec/ccodec_iccmodule.h +++ b/core/fxcodec/codec/ccodec_iccmodule.h @@ -22,7 +22,7 @@ class CCodec_IccModule { int32_t intent = 0, uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT); void DestroyTransform(void* pTransform); - void Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues); + void Translate(void* pTransform, float* pSrcValues, float* pDestValues); void TranslateScanline(void* pTransform, uint8_t* pDest, const uint8_t* pSrc, diff --git a/core/fxcodec/codec/ccodec_tiffmodule.cpp b/core/fxcodec/codec/ccodec_tiffmodule.cpp index 3d7db88b18..3807ec75aa 100644 --- a/core/fxcodec/codec/ccodec_tiffmodule.cpp +++ b/core/fxcodec/codec/ccodec_tiffmodule.cpp @@ -257,16 +257,14 @@ bool CCodec_TiffContext::LoadFrameInfo(int32_t frame, pAttribute->m_wDPIUnit--; } Tiff_Exif_GetInfo<uint16_t>(m_tif_ctx, TIFFTAG_ORIENTATION, pAttribute); - if (Tiff_Exif_GetInfo<FX_FLOAT>(m_tif_ctx, TIFFTAG_XRESOLUTION, - pAttribute)) { + if (Tiff_Exif_GetInfo<float>(m_tif_ctx, TIFFTAG_XRESOLUTION, pAttribute)) { void* val = pAttribute->m_Exif[TIFFTAG_XRESOLUTION]; - FX_FLOAT fDpi = val ? *reinterpret_cast<FX_FLOAT*>(val) : 0; + float fDpi = val ? *reinterpret_cast<float*>(val) : 0; pAttribute->m_nXDPI = (int32_t)(fDpi + 0.5f); } - if (Tiff_Exif_GetInfo<FX_FLOAT>(m_tif_ctx, TIFFTAG_YRESOLUTION, - pAttribute)) { + if (Tiff_Exif_GetInfo<float>(m_tif_ctx, TIFFTAG_YRESOLUTION, pAttribute)) { void* val = pAttribute->m_Exif[TIFFTAG_YRESOLUTION]; - FX_FLOAT fDpi = val ? *reinterpret_cast<FX_FLOAT*>(val) : 0; + float fDpi = val ? *reinterpret_cast<float*>(val) : 0; pAttribute->m_nYDPI = (int32_t)(fDpi + 0.5f); } Tiff_Exif_GetStringInfo(m_tif_ctx, TIFFTAG_IMAGEDESCRIPTION, pAttribute); diff --git a/core/fxcodec/codec/fx_codec_icc.cpp b/core/fxcodec/codec/fx_codec_icc.cpp index f77c8507bf..4f701aaed3 100644 --- a/core/fxcodec/codec/fx_codec_icc.cpp +++ b/core/fxcodec/codec/fx_codec_icc.cpp @@ -156,8 +156,8 @@ void IccLib_DestroyTransform(void* pTransform) { } void IccLib_Translate(void* pTransform, uint32_t nSrcComponents, - FX_FLOAT* pSrcValues, - FX_FLOAT* pDestValues) { + float* pSrcValues, + float* pDestValues) { if (!pTransform) { return; } @@ -226,8 +226,8 @@ void CCodec_IccModule::DestroyTransform(void* pTransform) { IccLib_DestroyTransform(pTransform); } void CCodec_IccModule::Translate(void* pTransform, - FX_FLOAT* pSrcValues, - FX_FLOAT* pDestValues) { + float* pSrcValues, + float* pDestValues) { IccLib_Translate(pTransform, m_nComponents, pSrcValues, pDestValues); } void CCodec_IccModule::TranslateScanline(void* pTransform, @@ -1631,13 +1631,13 @@ void AdobeCMYK_to_sRGB1(uint8_t c, G = fix_g >> 8; B = fix_b >> 8; } -void AdobeCMYK_to_sRGB(FX_FLOAT c, - FX_FLOAT m, - FX_FLOAT y, - FX_FLOAT k, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) { +void AdobeCMYK_to_sRGB(float c, + float m, + float y, + float k, + float& R, + float& G, + float& B) { // Convert to uint8_t with round-to-nearest. Avoid using FXSYS_round because // it is incredibly expensive with VC++ (tested on VC++ 2015) because round() // is very expensive. diff --git a/core/fxcodec/codec/fx_codec_jpx_unittest.cpp b/core/fxcodec/codec/fx_codec_jpx_unittest.cpp index 4d0564af67..2acb76c355 100644 --- a/core/fxcodec/codec/fx_codec_jpx_unittest.cpp +++ b/core/fxcodec/codec/fx_codec_jpx_unittest.cpp @@ -22,16 +22,16 @@ union Float_t { Float_t(float num = 0.0f) : f(num) {} int32_t i; - FX_FLOAT f; + float f; }; TEST(fxcodec, CMYK_Rounding) { // Testing all floats from 0.0 to 1.0 takes about 35 seconds in release // builds and much longer in debug builds, so just test the known-dangerous // range. - const FX_FLOAT startValue = 0.001f; - const FX_FLOAT endValue = 0.003f; - FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; + const float startValue = 0.001f; + const float endValue = 0.003f; + float R = 0.0f, G = 0.0f, B = 0.0f; // Iterate through floats by incrementing the representation, as discussed in // https://randomascii.wordpress.com/2012/01/23/stupid-float-tricks-2/ for (Float_t f = startValue; f.f < endValue; f.i++) { diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp index 1f2f50c29e..af7f24e4fe 100644 --- a/core/fxcodec/codec/fx_codec_progress.cpp +++ b/core/fxcodec/codec/fx_codec_progress.cpp @@ -51,25 +51,23 @@ void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len, int src_max, bool bInterpol) { double scale, base; - scale = (FX_FLOAT)src_len / (FX_FLOAT)dest_len; + scale = (float)src_len / (float)dest_len; if (dest_len < 0) { - base = (FX_FLOAT)(src_len); + base = (float)(src_len); } else { base = 0.0f; } - m_ItemSize = - (int)(sizeof(int) * 2 + - sizeof(int) * (FXSYS_ceil(FXSYS_fabs((FX_FLOAT)scale)) + 1)); + m_ItemSize = (int)(sizeof(int) * 2 + + sizeof(int) * (FXSYS_ceil(FXSYS_fabs((float)scale)) + 1)); m_DestMin = dest_min; m_pWeightTables.resize((dest_max - dest_min) * m_ItemSize + 4); - if (FXSYS_fabs((FX_FLOAT)scale) < 1.0f) { + if (FXSYS_fabs((float)scale) < 1.0f) { for (int dest_pixel = dest_min; dest_pixel < dest_max; dest_pixel++) { PixelWeight& pixel_weights = *GetPixelWeight(dest_pixel); double src_pos = dest_pixel * scale + scale / 2 + base; if (bInterpol) { - pixel_weights.m_SrcStart = - (int)FXSYS_floor((FX_FLOAT)src_pos - 1.0f / 2); - pixel_weights.m_SrcEnd = (int)FXSYS_floor((FX_FLOAT)src_pos + 1.0f / 2); + pixel_weights.m_SrcStart = (int)FXSYS_floor((float)src_pos - 1.0f / 2); + pixel_weights.m_SrcEnd = (int)FXSYS_floor((float)src_pos + 1.0f / 2); if (pixel_weights.m_SrcStart < src_min) { pixel_weights.m_SrcStart = src_min; } @@ -80,13 +78,12 @@ void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len, pixel_weights.m_Weights[0] = 65536; } else { pixel_weights.m_Weights[1] = FXSYS_round( - (FX_FLOAT)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) * - 65536); + (float)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) * 65536); pixel_weights.m_Weights[0] = 65536 - pixel_weights.m_Weights[1]; } } else { pixel_weights.m_SrcStart = pixel_weights.m_SrcEnd = - (int)FXSYS_floor((FX_FLOAT)src_pos); + (int)FXSYS_floor((float)src_pos); pixel_weights.m_Weights[0] = 65536; } } @@ -98,11 +95,11 @@ void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len, double src_end = src_start + scale; int start_i, end_i; if (src_start < src_end) { - start_i = (int)FXSYS_floor((FX_FLOAT)src_start); - end_i = (int)FXSYS_ceil((FX_FLOAT)src_end); + start_i = (int)FXSYS_floor((float)src_start); + end_i = (int)FXSYS_ceil((float)src_end); } else { - start_i = (int)FXSYS_floor((FX_FLOAT)src_end); - end_i = (int)FXSYS_ceil((FX_FLOAT)src_start); + start_i = (int)FXSYS_floor((float)src_end); + end_i = (int)FXSYS_ceil((float)src_start); } if (start_i < src_min) { start_i = src_min; @@ -118,18 +115,17 @@ void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len, pixel_weights.m_SrcStart = start_i; pixel_weights.m_SrcEnd = end_i; for (int j = start_i; j <= end_i; j++) { - double dest_start = ((FX_FLOAT)j - base) / scale; - double dest_end = ((FX_FLOAT)(j + 1) - base) / scale; + double dest_start = ((float)j - base) / scale; + double dest_end = ((float)(j + 1) - base) / scale; if (dest_start > dest_end) { double temp = dest_start; dest_start = dest_end; dest_end = temp; } - double area_start = dest_start > (FX_FLOAT)(dest_pixel) - ? dest_start - : (FX_FLOAT)(dest_pixel); - double area_end = dest_end > (FX_FLOAT)(dest_pixel + 1) - ? (FX_FLOAT)(dest_pixel + 1) + double area_start = + dest_start > (float)(dest_pixel) ? dest_start : (float)(dest_pixel); + double area_end = dest_end > (float)(dest_pixel + 1) + ? (float)(dest_pixel + 1) : dest_end; double weight = area_start >= area_end ? 0.0f : area_end - area_start; if (weight == 0 && j == end_i) { @@ -137,7 +133,7 @@ void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len, break; } pixel_weights.m_Weights[j - start_i] = - FXSYS_round((FX_FLOAT)(weight * 65536)); + FXSYS_round((float)(weight * 65536)); } } } @@ -157,7 +153,7 @@ void CCodec_ProgressiveDecoder::CFXCODEC_HorzTable::Calc(int dest_len, int pre_des_col = 0; for (int src_col = 0; src_col < src_len; src_col++) { double des_col_f = src_col * scale; - int des_col = FXSYS_round((FX_FLOAT)des_col_f); + int des_col = FXSYS_round((float)des_col_f); PixelWeight* pWeight = GetPixelWeight(des_col); pWeight->m_SrcStart = pWeight->m_SrcEnd = src_col; pWeight->m_Weights[0] = 65536; @@ -179,10 +175,10 @@ void CCodec_ProgressiveDecoder::CFXCODEC_HorzTable::Calc(int dest_len, pWeight->m_SrcStart = src_col - 1; pWeight->m_SrcEnd = src_col; pWeight->m_Weights[0] = - bInterpol ? FXSYS_round((FX_FLOAT)( - ((FX_FLOAT)des_col - (FX_FLOAT)des_col_index) / - (FX_FLOAT)des_col_len * 65536)) - : 65536; + bInterpol + ? FXSYS_round((float)(((float)des_col - (float)des_col_index) / + (float)des_col_len * 65536)) + : 65536; pWeight->m_Weights[1] = 65536 - pWeight->m_Weights[0]; } pre_des_col = des_col; @@ -191,7 +187,7 @@ void CCodec_ProgressiveDecoder::CFXCODEC_HorzTable::Calc(int dest_len, } for (int des_col = 0; des_col < dest_len; des_col++) { double src_col_f = des_col / scale; - int src_col = FXSYS_round((FX_FLOAT)src_col_f); + int src_col = FXSYS_round((float)src_col_f); PixelWeight* pWeight = GetPixelWeight(des_col); pWeight->m_SrcStart = pWeight->m_SrcEnd = src_col; pWeight->m_Weights[0] = 65536; @@ -249,8 +245,8 @@ void CCodec_ProgressiveDecoder::CFXCODEC_VertTable::Calc(int dest_len, PixelWeight* pWeight = GetPixelWeight(des_row); pWeight->m_SrcStart = start_step; pWeight->m_SrcEnd = end_step; - pWeight->m_Weights[0] = FXSYS_round((FX_FLOAT)(end_step - des_row) / - (FX_FLOAT)length * 65536); + pWeight->m_Weights[0] = + FXSYS_round((float)(end_step - des_row) / (float)length * 65536); pWeight->m_Weights[1] = 65536 - pWeight->m_Weights[0]; } } @@ -1745,7 +1741,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, } return; } - int multiple = (int)FXSYS_ceil((FX_FLOAT)scale_y - 1); + int multiple = (int)FXSYS_ceil((float)scale_y - 1); if (multiple > 0) { uint8_t* scan_src = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet; @@ -1871,21 +1867,21 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap, m_bInterpol = bInterpol; m_FrameCur = 0; if (start_x < 0 || out_range_x > 0) { - FX_FLOAT scaleX = (FX_FLOAT)m_clipBox.Width() / (FX_FLOAT)size_x; + float scaleX = (float)m_clipBox.Width() / (float)size_x; if (start_x < 0) { - m_clipBox.left -= (int32_t)FXSYS_ceil((FX_FLOAT)start_x * scaleX); + m_clipBox.left -= (int32_t)FXSYS_ceil((float)start_x * scaleX); } if (out_range_x > 0) { - m_clipBox.right -= (int32_t)FXSYS_floor((FX_FLOAT)out_range_x * scaleX); + m_clipBox.right -= (int32_t)FXSYS_floor((float)out_range_x * scaleX); } } if (start_y < 0 || out_range_y > 0) { - FX_FLOAT scaleY = (FX_FLOAT)m_clipBox.Height() / (FX_FLOAT)size_y; + float scaleY = (float)m_clipBox.Height() / (float)size_y; if (start_y < 0) { - m_clipBox.top -= (int32_t)FXSYS_ceil((FX_FLOAT)start_y * scaleY); + m_clipBox.top -= (int32_t)FXSYS_ceil((float)start_y * scaleY); } if (out_range_y > 0) { - m_clipBox.bottom -= (int32_t)FXSYS_floor((FX_FLOAT)out_range_y * scaleY); + m_clipBox.bottom -= (int32_t)FXSYS_floor((float)out_range_y * scaleY); } } if (m_clipBox.IsEmpty()) { diff --git a/core/fxcodec/fx_codec.h b/core/fxcodec/fx_codec.h index b0b9fa1821..fa4956c095 100644 --- a/core/fxcodec/fx_codec.h +++ b/core/fxcodec/fx_codec.h @@ -46,7 +46,7 @@ class CFX_DIBAttribute { int32_t m_nXDPI; int32_t m_nYDPI; - FX_FLOAT m_fAspectRatio; + float m_fAspectRatio; uint16_t m_wDPIUnit; CFX_ByteString m_strAuthor; uint8_t m_strTime[20]; @@ -112,20 +112,20 @@ class CCodec_ModuleMgr { void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels); uint32_t ComponentsForFamily(int family); -void sRGB_to_AdobeCMYK(FX_FLOAT R, - FX_FLOAT G, - FX_FLOAT B, - FX_FLOAT& c, - FX_FLOAT& m, - FX_FLOAT& y, - FX_FLOAT& k); -void AdobeCMYK_to_sRGB(FX_FLOAT c, - FX_FLOAT m, - FX_FLOAT y, - FX_FLOAT k, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B); +void sRGB_to_AdobeCMYK(float R, + float G, + float B, + float& c, + float& m, + float& y, + float& k); +void AdobeCMYK_to_sRGB(float c, + float m, + float y, + float k, + float& R, + float& G, + float& B); void AdobeCMYK_to_sRGB1(uint8_t c, uint8_t m, uint8_t y, diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h index 007c362ad6..a4069fddbd 100644 --- a/core/fxcrt/fx_basic.h +++ b/core/fxcrt/fx_basic.h @@ -506,12 +506,11 @@ class CFX_Vector_3by1 { public: CFX_Vector_3by1() : a(0.0f), b(0.0f), c(0.0f) {} - CFX_Vector_3by1(FX_FLOAT a1, FX_FLOAT b1, FX_FLOAT c1) - : a(a1), b(b1), c(c1) {} + CFX_Vector_3by1(float a1, float b1, float c1) : a(a1), b(b1), c(c1) {} - FX_FLOAT a; - FX_FLOAT b; - FX_FLOAT c; + float a; + float b; + float c; }; class CFX_Matrix_3by3 { public: @@ -526,15 +525,15 @@ class CFX_Matrix_3by3 { h(0.0f), i(0.0f) {} - CFX_Matrix_3by3(FX_FLOAT a1, - FX_FLOAT b1, - FX_FLOAT c1, - FX_FLOAT d1, - FX_FLOAT e1, - FX_FLOAT f1, - FX_FLOAT g1, - FX_FLOAT h1, - FX_FLOAT i1) + CFX_Matrix_3by3(float a1, + float b1, + float c1, + float d1, + float e1, + float f1, + float g1, + float h1, + float i1) : a(a1), b(b1), c(c1), d(d1), e(e1), f(f1), g(g1), h(h1), i(i1) {} CFX_Matrix_3by3 Inverse(); @@ -543,15 +542,15 @@ class CFX_Matrix_3by3 { CFX_Vector_3by1 TransformVector(const CFX_Vector_3by1& v); - FX_FLOAT a; - FX_FLOAT b; - FX_FLOAT c; - FX_FLOAT d; - FX_FLOAT e; - FX_FLOAT f; - FX_FLOAT g; - FX_FLOAT h; - FX_FLOAT i; + float a; + float b; + float c; + float d; + float e; + float f; + float g; + float h; + float i; }; uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits); diff --git a/core/fxcrt/fx_basic_bstring.cpp b/core/fxcrt/fx_basic_bstring.cpp index cbd8b379b9..b4eb4a75e0 100644 --- a/core/fxcrt/fx_basic_bstring.cpp +++ b/core/fxcrt/fx_basic_bstring.cpp @@ -958,7 +958,7 @@ void CFX_ByteString::TrimLeft() { uint32_t CFX_ByteString::GetID(FX_STRSIZE start_pos) const { return AsStringC().GetID(start_pos); } -FX_STRSIZE FX_ftoa(FX_FLOAT d, char* buf) { +FX_STRSIZE FX_ftoa(float d, char* buf) { buf[0] = '0'; buf[1] = '\0'; if (d == 0.0f) { @@ -1004,7 +1004,7 @@ FX_STRSIZE FX_ftoa(FX_FLOAT d, char* buf) { } return buf_size; } -CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { +CFX_ByteString CFX_ByteString::FormatFloat(float d, int precision) { char buf[32]; FX_STRSIZE len = FX_ftoa(d, buf); return CFX_ByteString(buf, len); diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp index eaa79c9af1..341d9013ae 100644 --- a/core/fxcrt/fx_basic_buffer.cpp +++ b/core/fxcrt/fx_basic_buffer.cpp @@ -117,7 +117,7 @@ CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(uint32_t i) { CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(double f) { char buf[32]; - FX_STRSIZE len = FX_ftoa((FX_FLOAT)f, buf); + FX_STRSIZE len = FX_ftoa((float)f, buf); AppendBlock(buf, len); return *this; } @@ -158,7 +158,7 @@ CFX_WideTextBuf& CFX_WideTextBuf::operator<<(int i) { CFX_WideTextBuf& CFX_WideTextBuf::operator<<(double f) { char buf[32]; - FX_STRSIZE len = FX_ftoa((FX_FLOAT)f, buf); + FX_STRSIZE len = FX_ftoa((float)f, buf); ExpandBuf(len * sizeof(wchar_t)); wchar_t* str = (wchar_t*)(m_pBuffer.get() + m_DataSize); for (FX_STRSIZE i = 0; i < len; i++) { diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp index cb5a010427..460f700f03 100644 --- a/core/fxcrt/fx_basic_coords.cpp +++ b/core/fxcrt/fx_basic_coords.cpp @@ -13,12 +13,12 @@ namespace { -void MatchFloatRange(FX_FLOAT f1, FX_FLOAT f2, int* i1, int* i2) { +void MatchFloatRange(float f1, float f2, int* i1, int* i2) { int length = static_cast<int>(FXSYS_ceil(f2 - f1)); int i1_1 = static_cast<int>(FXSYS_floor(f1)); int i1_2 = static_cast<int>(FXSYS_ceil(f1)); - FX_FLOAT error1 = f1 - i1_1 + (FX_FLOAT)FXSYS_fabs(f2 - i1_1 - length); - FX_FLOAT error2 = i1_2 - f1 + (FX_FLOAT)FXSYS_fabs(f2 - i1_2 - length); + float error1 = f1 - i1_1 + (float)FXSYS_fabs(f2 - i1_1 - length); + float error2 = i1_2 - f1 + (float)FXSYS_fabs(f2 - i1_2 - length); *i1 = (error1 > error2) ? i1_2 : i1_1; *i2 = *i1 + length; @@ -51,12 +51,12 @@ void FX_RECT::Intersect(const FX_RECT& src) { } } -bool GetIntersection(FX_FLOAT low1, - FX_FLOAT high1, - FX_FLOAT low2, - FX_FLOAT high2, - FX_FLOAT& interlow, - FX_FLOAT& interhigh) { +bool GetIntersection(float low1, + float high1, + float low2, + float high2, + float& interlow, + float& interhigh) { if (low1 >= high2 || low2 >= high1) { return false; } @@ -64,24 +64,24 @@ bool GetIntersection(FX_FLOAT low1, interhigh = high1 > high2 ? high2 : high1; return true; } -extern "C" int FXSYS_round(FX_FLOAT d) { - if (d < (FX_FLOAT)INT_MIN) { +extern "C" int FXSYS_round(float d) { + if (d < (float)INT_MIN) { return INT_MIN; } - if (d > (FX_FLOAT)INT_MAX) { + if (d > (float)INT_MAX) { return INT_MAX; } return (int)round(d); } CFX_FloatRect::CFX_FloatRect(const FX_RECT& rect) { - left = (FX_FLOAT)(rect.left); - right = (FX_FLOAT)(rect.right); - bottom = (FX_FLOAT)(rect.top); - top = (FX_FLOAT)(rect.bottom); + left = (float)(rect.left); + right = (float)(rect.right); + bottom = (float)(rect.top); + top = (float)(rect.bottom); } void CFX_FloatRect::Normalize() { - FX_FLOAT temp; + float temp; if (left > right) { temp = left; left = right; @@ -205,7 +205,7 @@ bool CFX_FloatRect::Contains(const CFX_FloatRect& other_rect) const { n2.top <= n1.top; } -void CFX_FloatRect::UpdateRect(FX_FLOAT x, FX_FLOAT y) { +void CFX_FloatRect::UpdateRect(float x, float y) { left = std::min(left, x); right = std::max(right, x); bottom = std::min(bottom, y); @@ -216,10 +216,10 @@ CFX_FloatRect CFX_FloatRect::GetBBox(const CFX_PointF* pPoints, int nPoints) { if (nPoints == 0) return CFX_FloatRect(); - FX_FLOAT min_x = pPoints->x; - FX_FLOAT max_x = pPoints->x; - FX_FLOAT min_y = pPoints->y; - FX_FLOAT max_y = pPoints->y; + float min_x = pPoints->x; + float max_x = pPoints->x; + float min_y = pPoints->y; + float max_y = pPoints->y; for (int i = 1; i < nPoints; i++) { min_x = std::min(min_x, pPoints[i].x); max_x = std::max(max_x, pPoints[i].x); @@ -230,11 +230,11 @@ CFX_FloatRect CFX_FloatRect::GetBBox(const CFX_PointF* pPoints, int nPoints) { } void CFX_Matrix::SetReverse(const CFX_Matrix& m) { - FX_FLOAT i = m.a * m.d - m.b * m.c; + float i = m.a * m.d - m.b * m.c; if (FXSYS_fabs(i) == 0) return; - FX_FLOAT j = -i; + float j = -i; a = m.d / i; b = m.b / j; c = m.c / j; @@ -263,7 +263,7 @@ bool CFX_Matrix::IsScaled() const { FXSYS_fabs(c * 1000) < FXSYS_fabs(d); } -void CFX_Matrix::Translate(FX_FLOAT x, FX_FLOAT y, bool bPrepended) { +void CFX_Matrix::Translate(float x, float y, bool bPrepended) { if (bPrepended) { e += x * a + y * c; f += y * d + x * b; @@ -273,7 +273,7 @@ void CFX_Matrix::Translate(FX_FLOAT x, FX_FLOAT y, bool bPrepended) { f += y; } -void CFX_Matrix::Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended) { +void CFX_Matrix::Scale(float sx, float sy, bool bPrepended) { a *= sx; d *= sy; if (bPrepended) { @@ -288,25 +288,20 @@ void CFX_Matrix::Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended) { f *= sy; } -void CFX_Matrix::Rotate(FX_FLOAT fRadian, bool bPrepended) { - FX_FLOAT cosValue = FXSYS_cos(fRadian); - FX_FLOAT sinValue = FXSYS_sin(fRadian); +void CFX_Matrix::Rotate(float fRadian, bool bPrepended) { + float cosValue = FXSYS_cos(fRadian); + float sinValue = FXSYS_sin(fRadian); ConcatInternal(CFX_Matrix(cosValue, sinValue, -sinValue, cosValue, 0, 0), bPrepended); } -void CFX_Matrix::RotateAt(FX_FLOAT fRadian, - FX_FLOAT dx, - FX_FLOAT dy, - bool bPrepended) { +void CFX_Matrix::RotateAt(float fRadian, float dx, float dy, bool bPrepended) { Translate(dx, dy, bPrepended); Rotate(fRadian, bPrepended); Translate(-dx, -dy, bPrepended); } -void CFX_Matrix::Shear(FX_FLOAT fAlphaRadian, - FX_FLOAT fBetaRadian, - bool bPrepended) { +void CFX_Matrix::Shear(float fAlphaRadian, float fBetaRadian, bool bPrepended) { ConcatInternal( CFX_Matrix(1, FXSYS_tan(fAlphaRadian), FXSYS_tan(fBetaRadian), 1, 0, 0), bPrepended); @@ -314,7 +309,7 @@ void CFX_Matrix::Shear(FX_FLOAT fAlphaRadian, void CFX_Matrix::MatchRect(const CFX_FloatRect& dest, const CFX_FloatRect& src) { - FX_FLOAT fDiff = src.left - src.right; + float fDiff = src.left - src.right; a = FXSYS_fabs(fDiff) < 0.001f ? 1 : (dest.left - dest.right) / fDiff; fDiff = src.bottom - src.top; @@ -325,7 +320,7 @@ void CFX_Matrix::MatchRect(const CFX_FloatRect& dest, c = 0; } -FX_FLOAT CFX_Matrix::GetXUnit() const { +float CFX_Matrix::GetXUnit() const { if (b == 0) return (a > 0 ? a : -a); if (a == 0) @@ -333,7 +328,7 @@ FX_FLOAT CFX_Matrix::GetXUnit() const { return FXSYS_sqrt(a * a + b * b); } -FX_FLOAT CFX_Matrix::GetYUnit() const { +float CFX_Matrix::GetYUnit() const { if (c == 0) return (d > 0 ? d : -d); if (d == 0) @@ -347,19 +342,19 @@ CFX_FloatRect CFX_Matrix::GetUnitRect() const { return rect; } -FX_FLOAT CFX_Matrix::TransformXDistance(FX_FLOAT dx) const { - FX_FLOAT fx = a * dx; - FX_FLOAT fy = b * dx; +float CFX_Matrix::TransformXDistance(float dx) const { + float fx = a * dx; + float fy = b * dx; return FXSYS_sqrt(fx * fx + fy * fy); } -FX_FLOAT CFX_Matrix::TransformDistance(FX_FLOAT dx, FX_FLOAT dy) const { - FX_FLOAT fx = a * dx + c * dy; - FX_FLOAT fy = b * dx + d * dy; +float CFX_Matrix::TransformDistance(float dx, float dy) const { + float fx = a * dx + c * dy; + float fy = b * dx + d * dy; return FXSYS_sqrt(fx * fx + fy * fy); } -FX_FLOAT CFX_Matrix::TransformDistance(FX_FLOAT distance) const { +float CFX_Matrix::TransformDistance(float distance) const { return distance * (GetXUnit() + GetYUnit()) / 2; } @@ -369,16 +364,16 @@ CFX_PointF CFX_Matrix::Transform(const CFX_PointF& point) const { } void CFX_Matrix::TransformRect(CFX_RectF& rect) const { - FX_FLOAT right = rect.right(), bottom = rect.bottom(); + float right = rect.right(), bottom = rect.bottom(); TransformRect(rect.left, right, bottom, rect.top); rect.width = right - rect.left; rect.height = bottom - rect.top; } -void CFX_Matrix::TransformRect(FX_FLOAT& left, - FX_FLOAT& right, - FX_FLOAT& top, - FX_FLOAT& bottom) const { +void CFX_Matrix::TransformRect(float& left, + float& right, + float& top, + float& bottom) const { CFX_PointF points[] = { {left, top}, {left, bottom}, {right, top}, {right, bottom}}; for (int i = 0; i < 4; i++) diff --git a/core/fxcrt/fx_basic_util.cpp b/core/fxcrt/fx_basic_util.cpp index 45543dc317..b3c5829fc9 100644 --- a/core/fxcrt/fx_basic_util.cpp +++ b/core/fxcrt/fx_basic_util.cpp @@ -14,7 +14,7 @@ bool FX_atonum(const CFX_ByteStringC& strc, void* pData) { if (strc.Find('.') != -1) { - FX_FLOAT* pFloat = static_cast<FX_FLOAT*>(pData); + float* pFloat = static_cast<float*>(pData); *pFloat = FX_atof(strc); return false; } @@ -69,7 +69,7 @@ bool FX_atonum(const CFX_ByteStringC& strc, void* pData) { return true; } -static const FX_FLOAT fraction_scales[] = { +static const float fraction_scales[] = { 0.1f, 0.01f, 0.001f, 0.0001f, 0.00001f, 0.000001f, 0.0000001f, 0.00000001f, 0.000000001f, 0.0000000001f, 0.00000000001f}; @@ -78,11 +78,11 @@ int FXSYS_FractionalScaleCount() { return FX_ArraySize(fraction_scales); } -FX_FLOAT FXSYS_FractionalScale(size_t scale_factor, int value) { +float FXSYS_FractionalScale(size_t scale_factor, int value) { return fraction_scales[scale_factor] * value; } -FX_FLOAT FX_atof(const CFX_ByteStringC& strc) { +float FX_atof(const CFX_ByteStringC& strc) { if (strc.IsEmpty()) return 0.0; @@ -100,7 +100,7 @@ FX_FLOAT FX_atof(const CFX_ByteStringC& strc) { break; cc++; } - FX_FLOAT value = 0; + float value = 0; while (cc < len) { if (strc[cc] == '.') break; @@ -206,8 +206,7 @@ wchar_t FX_GetFolderSeparator() { } CFX_Matrix_3by3 CFX_Matrix_3by3::Inverse() { - FX_FLOAT det = - a * (e * i - f * h) - b * (i * d - f * g) + c * (d * h - e * g); + float det = a * (e * i - f * h) - b * (i * d - f * g) + c * (d * h - e * g); if (FXSYS_fabs(det) < 0.0000001) return CFX_Matrix_3by3(); diff --git a/core/fxcrt/fx_basic_wstring.cpp b/core/fxcrt/fx_basic_wstring.cpp index 3b9fa2435c..8522d42a38 100644 --- a/core/fxcrt/fx_basic_wstring.cpp +++ b/core/fxcrt/fx_basic_wstring.cpp @@ -945,7 +945,7 @@ void CFX_WideString::TrimLeft(wchar_t chTarget) { void CFX_WideString::TrimLeft() { TrimLeft(L"\x09\x0a\x0b\x0c\x0d\x20"); } -FX_FLOAT FX_wtof(const wchar_t* str, int len) { +float FX_wtof(const wchar_t* str, int len) { if (len == 0) { return 0.0; } @@ -965,17 +965,17 @@ FX_FLOAT FX_wtof(const wchar_t* str, int len) { integer = integer * 10 + FXSYS_toDecimalDigit(str[cc]); cc++; } - FX_FLOAT fraction = 0; + float fraction = 0; if (str[cc] == '.') { cc++; - FX_FLOAT scale = 0.1f; + float scale = 0.1f; while (cc < len) { fraction += scale * FXSYS_toDecimalDigit(str[cc]); scale *= 0.1f; cc++; } } - fraction += (FX_FLOAT)integer; + fraction += (float)integer; return bNegative ? -fraction : fraction; } @@ -983,7 +983,7 @@ int CFX_WideString::GetInteger() const { return m_pData ? FXSYS_wtoi(m_pData->m_String) : 0; } -FX_FLOAT CFX_WideString::GetFloat() const { +float CFX_WideString::GetFloat() const { return m_pData ? FX_wtof(m_pData->m_String, m_pData->m_nDataLength) : 0.0f; } diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index 2c84d0776c..5ccaf3d229 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -71,7 +71,7 @@ class CFX_PTemplate { BaseType y; }; using CFX_Point = CFX_PTemplate<int32_t>; -using CFX_PointF = CFX_PTemplate<FX_FLOAT>; +using CFX_PointF = CFX_PTemplate<float>; template <class BaseType> class CFX_STemplate { @@ -144,7 +144,7 @@ class CFX_STemplate { BaseType height; }; using CFX_Size = CFX_STemplate<int32_t>; -using CFX_SizeF = CFX_STemplate<FX_FLOAT>; +using CFX_SizeF = CFX_STemplate<float>; template <class BaseType> class CFX_VTemplate : public CFX_PTemplate<BaseType> { @@ -162,9 +162,9 @@ class CFX_VTemplate : public CFX_PTemplate<BaseType> { const CFX_PTemplate<BaseType>& point2) : CFX_PTemplate<BaseType>(point2.x - point1.x, point2.y - point1.y) {} - FX_FLOAT Length() const { return FXSYS_sqrt(x * x + y * y); } + float Length() const { return FXSYS_sqrt(x * x + y * y); } void Normalize() { - FX_FLOAT fLen = Length(); + float fLen = Length(); if (fLen < 0.0001f) return; @@ -179,15 +179,15 @@ class CFX_VTemplate : public CFX_PTemplate<BaseType> { x *= sx; y *= sy; } - void Rotate(FX_FLOAT fRadian) { - FX_FLOAT cosValue = FXSYS_cos(fRadian); - FX_FLOAT sinValue = FXSYS_sin(fRadian); + void Rotate(float fRadian) { + float cosValue = FXSYS_cos(fRadian); + float sinValue = FXSYS_sin(fRadian); x = x * cosValue - y * sinValue; y = x * sinValue + y * cosValue; } }; using CFX_Vector = CFX_VTemplate<int32_t>; -using CFX_VectorF = CFX_VTemplate<FX_FLOAT>; +using CFX_VectorF = CFX_VTemplate<float>; // Rectangles. // TODO(tsepez): Consolidate all these different rectangle classes. @@ -313,7 +313,7 @@ class CFX_RTemplate { Deflate(rt.left, rt.top, rt.top + rt.width, rt.top + rt.height); } bool IsEmpty() const { return width <= 0 || height <= 0; } - bool IsEmpty(FX_FLOAT fEpsilon) const { + bool IsEmpty(float fEpsilon) const { return width <= fEpsilon || height <= fEpsilon; } void Empty() { width = height = 0; } @@ -385,7 +385,7 @@ class CFX_RTemplate { rect.Intersect(*this); return !rect.IsEmpty(); } - bool IntersectWith(const RectType& rt, FX_FLOAT fEpsilon) const { + bool IntersectWith(const RectType& rt, float fEpsilon) const { RectType rect = rt; rect.Intersect(*this); return !rect.IsEmpty(fEpsilon); @@ -404,7 +404,7 @@ class CFX_RTemplate { BaseType height; }; using CFX_Rect = CFX_RTemplate<int32_t>; -using CFX_RectF = CFX_RTemplate<FX_FLOAT>; +using CFX_RectF = CFX_RTemplate<float>; // LTRB rectangles (y-axis runs downwards). struct FX_RECT { @@ -454,10 +454,10 @@ struct FX_RECT { class CFX_FloatRect { public: CFX_FloatRect() : CFX_FloatRect(0.0f, 0.0f, 0.0f, 0.0f) {} - CFX_FloatRect(FX_FLOAT l, FX_FLOAT b, FX_FLOAT r, FX_FLOAT t) + CFX_FloatRect(float l, float b, float r, float t) : left(l), bottom(b), right(r), top(t) {} - explicit CFX_FloatRect(const FX_FLOAT* pArray) + explicit CFX_FloatRect(const float* pArray) : CFX_FloatRect(pArray[0], pArray[1], pArray[2], pArray[3]) {} explicit CFX_FloatRect(const FX_RECT& rect); @@ -485,18 +485,18 @@ class CFX_FloatRect { int Substract4(CFX_FloatRect& substract_rect, CFX_FloatRect* pRects); - void InitRect(FX_FLOAT x, FX_FLOAT y) { + void InitRect(float x, float y) { left = x; right = x; bottom = y; top = y; } - void UpdateRect(FX_FLOAT x, FX_FLOAT y); + void UpdateRect(float x, float y); - FX_FLOAT Width() const { return right - left; } - FX_FLOAT Height() const { return top - bottom; } + float Width() const { return right - left; } + float Height() const { return top - bottom; } - void Inflate(FX_FLOAT x, FX_FLOAT y) { + void Inflate(float x, float y) { Normalize(); left -= x; right += x; @@ -504,10 +504,10 @@ class CFX_FloatRect { top += y; } - void Inflate(FX_FLOAT other_left, - FX_FLOAT other_bottom, - FX_FLOAT other_right, - FX_FLOAT other_top) { + void Inflate(float other_left, + float other_bottom, + float other_right, + float other_top) { Normalize(); left -= other_left; bottom -= other_bottom; @@ -519,7 +519,7 @@ class CFX_FloatRect { Inflate(rt.left, rt.bottom, rt.right, rt.top); } - void Deflate(FX_FLOAT x, FX_FLOAT y) { + void Deflate(float x, float y) { Normalize(); left += x; right -= x; @@ -527,10 +527,10 @@ class CFX_FloatRect { top -= y; } - void Deflate(FX_FLOAT other_left, - FX_FLOAT other_bottom, - FX_FLOAT other_right, - FX_FLOAT other_top) { + void Deflate(float other_left, + float other_bottom, + float other_right, + float other_top) { Normalize(); left += other_left; bottom += other_bottom; @@ -542,7 +542,7 @@ class CFX_FloatRect { Deflate(rt.left, rt.bottom, rt.right, rt.top); } - void Translate(FX_FLOAT e, FX_FLOAT f) { + void Translate(float e, float f) { left += e; right += e; top += f; @@ -560,17 +560,17 @@ class CFX_FloatRect { return CFX_FloatRect(rect.left, rect.top, rect.right(), rect.bottom()); } - FX_FLOAT left; - FX_FLOAT bottom; - FX_FLOAT right; - FX_FLOAT top; + float left; + float bottom; + float right; + float top; }; class CFX_Matrix { public: CFX_Matrix() { SetIdentity(); } - explicit CFX_Matrix(const FX_FLOAT n[6]) + explicit CFX_Matrix(const float n[6]) : a(n[0]), b(n[1]), c(n[2]), d(n[3]), e(n[4]), f(n[5]) {} CFX_Matrix(const CFX_Matrix& other) @@ -581,12 +581,7 @@ class CFX_Matrix { e(other.e), f(other.f) {} - CFX_Matrix(FX_FLOAT a1, - FX_FLOAT b1, - FX_FLOAT c1, - FX_FLOAT d1, - FX_FLOAT e1, - FX_FLOAT f1) + CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1) : a(a1), b(b1), c(c1), d(d1), e(e1), f(f1) {} void operator=(const CFX_Matrix& other) { @@ -620,49 +615,44 @@ class CFX_Matrix { bool IsScaled() const; bool WillScale() const { return a != 1.0f || b != 0 || c != 0 || d != 1.0f; } - void Translate(FX_FLOAT x, FX_FLOAT y, bool bPrepended = false); + void Translate(float x, float y, bool bPrepended = false); void Translate(int32_t x, int32_t y, bool bPrepended = false) { - Translate(static_cast<FX_FLOAT>(x), static_cast<FX_FLOAT>(y), bPrepended); + Translate(static_cast<float>(x), static_cast<float>(y), bPrepended); } - void Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended = false); - void Rotate(FX_FLOAT fRadian, bool bPrepended = false); - void RotateAt(FX_FLOAT fRadian, - FX_FLOAT x, - FX_FLOAT y, - bool bPrepended = false); + void Scale(float sx, float sy, bool bPrepended = false); + void Rotate(float fRadian, bool bPrepended = false); + void RotateAt(float fRadian, float x, float y, bool bPrepended = false); - void Shear(FX_FLOAT fAlphaRadian, - FX_FLOAT fBetaRadian, - bool bPrepended = false); + void Shear(float fAlphaRadian, float fBetaRadian, bool bPrepended = false); void MatchRect(const CFX_FloatRect& dest, const CFX_FloatRect& src); - FX_FLOAT GetXUnit() const; - FX_FLOAT GetYUnit() const; + float GetXUnit() const; + float GetYUnit() const; CFX_FloatRect GetUnitRect() const; - FX_FLOAT TransformXDistance(FX_FLOAT dx) const; - FX_FLOAT TransformDistance(FX_FLOAT dx, FX_FLOAT dy) const; - FX_FLOAT TransformDistance(FX_FLOAT distance) const; + float TransformXDistance(float dx) const; + float TransformDistance(float dx, float dy) const; + float TransformDistance(float distance) const; CFX_PointF Transform(const CFX_PointF& point) const; void TransformRect(CFX_RectF& rect) const; - void TransformRect(FX_FLOAT& left, - FX_FLOAT& right, - FX_FLOAT& top, - FX_FLOAT& bottom) const; + void TransformRect(float& left, + float& right, + float& top, + float& bottom) const; void TransformRect(CFX_FloatRect& rect) const { TransformRect(rect.left, rect.right, rect.top, rect.bottom); } - FX_FLOAT a; - FX_FLOAT b; - FX_FLOAT c; - FX_FLOAT d; - FX_FLOAT e; - FX_FLOAT f; + float a; + float b; + float c; + float d; + float e; + float f; private: void ConcatInternal(const CFX_Matrix& other, bool prepend); diff --git a/core/fxcrt/fx_ext.h b/core/fxcrt/fx_ext.h index 3ee5a4f91f..e605d04077 100644 --- a/core/fxcrt/fx_ext.h +++ b/core/fxcrt/fx_ext.h @@ -15,14 +15,14 @@ #define FX_INVALID_OFFSET static_cast<uint32_t>(-1) -FX_FLOAT FXSYS_tan(FX_FLOAT a); -FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); -FX_FLOAT FXSYS_strtof(const char* pcsStr, - int32_t iLength = -1, - int32_t* pUsedLen = nullptr); -FX_FLOAT FXSYS_wcstof(const wchar_t* pwsStr, - int32_t iLength = -1, - int32_t* pUsedLen = nullptr); +float FXSYS_tan(float a); +float FXSYS_logb(float b, float x); +float FXSYS_strtof(const char* pcsStr, + int32_t iLength = -1, + int32_t* pUsedLen = nullptr); +float FXSYS_wcstof(const wchar_t* pwsStr, + int32_t iLength = -1, + int32_t* pUsedLen = nullptr); wchar_t* FXSYS_wcsncpy(wchar_t* dstStr, const wchar_t* srcStr, size_t count); int32_t FXSYS_wcsnicmp(const wchar_t* s1, const wchar_t* s2, size_t count); int32_t FXSYS_strnicmp(const char* s1, const char* s2, size_t count); @@ -75,7 +75,7 @@ inline int FXSYS_toDecimalDigit(const wchar_t c) { return std::iswdigit(c) ? c - L'0' : 0; } -FX_FLOAT FXSYS_FractionalScale(size_t scale_factor, int value); +float FXSYS_FractionalScale(size_t scale_factor, int value); int FXSYS_FractionalScaleCount(); void* FX_Random_MT_Start(uint32_t dwSeed); diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp index 0b7197ec7c..28c46c93f6 100644 --- a/core/fxcrt/fx_extension.cpp +++ b/core/fxcrt/fx_extension.cpp @@ -423,13 +423,13 @@ CFX_RetainPtr<IFX_MemoryStream> IFX_MemoryStream::Create(bool bConsecutive) { return pdfium::MakeRetain<CFX_MemoryStream>(bConsecutive); } -FX_FLOAT FXSYS_tan(FX_FLOAT a) { - return (FX_FLOAT)tan(a); +float FXSYS_tan(float a) { + return (float)tan(a); } -FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x) { +float FXSYS_logb(float b, float x) { return FXSYS_log(x) / FXSYS_log(b); } -FX_FLOAT FXSYS_strtof(const char* pcsStr, int32_t iLength, int32_t* pUsedLen) { +float FXSYS_strtof(const char* pcsStr, int32_t iLength, int32_t* pUsedLen) { ASSERT(pcsStr); if (iLength < 0) { iLength = (int32_t)FXSYS_strlen(pcsStr); @@ -438,9 +438,7 @@ FX_FLOAT FXSYS_strtof(const char* pcsStr, int32_t iLength, int32_t* pUsedLen) { CFX_WideString::FromLocal(CFX_ByteStringC(pcsStr, iLength)); return FXSYS_wcstof(ws.c_str(), iLength, pUsedLen); } -FX_FLOAT FXSYS_wcstof(const wchar_t* pwsStr, - int32_t iLength, - int32_t* pUsedLen) { +float FXSYS_wcstof(const wchar_t* pwsStr, int32_t iLength, int32_t* pUsedLen) { ASSERT(pwsStr); if (iLength < 0) { iLength = (int32_t)FXSYS_wcslen(pwsStr); @@ -457,7 +455,7 @@ FX_FLOAT FXSYS_wcstof(const wchar_t* pwsStr, iUsedLen++; break; } - FX_FLOAT fValue = 0.0f; + float fValue = 0.0f; while (iUsedLen < iLength) { wchar_t wch = pwsStr[iUsedLen]; if (wch >= L'0' && wch <= L'9') { @@ -468,7 +466,7 @@ FX_FLOAT FXSYS_wcstof(const wchar_t* pwsStr, iUsedLen++; } if (iUsedLen < iLength && pwsStr[iUsedLen] == L'.') { - FX_FLOAT fPrecise = 0.1f; + float fPrecise = 0.1f; while (++iUsedLen < iLength) { wchar_t wch = pwsStr[iUsedLen]; if (wch >= L'0' && wch <= L'9') { diff --git a/core/fxcrt/fx_string.h b/core/fxcrt/fx_string.h index 01be6a1901..12304eb452 100644 --- a/core/fxcrt/fx_string.h +++ b/core/fxcrt/fx_string.h @@ -154,7 +154,7 @@ class CFX_ByteString { #define FXFORMAT_CAPITAL 4 static CFX_ByteString FormatInteger(int i, uint32_t flags = 0); - static CFX_ByteString FormatFloat(FX_FLOAT f, int precision = 0); + static CFX_ByteString FormatFloat(float f, int precision = 0); protected: using StringData = CFX_StringDataTemplate<char>; @@ -336,7 +336,7 @@ class CFX_WideString { void ReleaseBuffer(FX_STRSIZE len = -1); int GetInteger() const; - FX_FLOAT GetFloat() const; + float GetFloat() const; FX_STRSIZE Find(const CFX_WideStringC& pSub, FX_STRSIZE start = 0) const; FX_STRSIZE Find(wchar_t ch, FX_STRSIZE start = 0) const; @@ -421,12 +421,12 @@ inline bool operator!=(const CFX_WideStringC& lhs, const CFX_WideString& rhs) { } CFX_ByteString FX_UTF8Encode(const CFX_WideStringC& wsStr); -FX_FLOAT FX_atof(const CFX_ByteStringC& str); -inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { +float FX_atof(const CFX_ByteStringC& str); +inline float FX_atof(const CFX_WideStringC& wsStr) { return FX_atof(FX_UTF8Encode(wsStr).c_str()); } bool FX_atonum(const CFX_ByteStringC& str, void* pData); -FX_STRSIZE FX_ftoa(FX_FLOAT f, char* buf); +FX_STRSIZE FX_ftoa(float f, char* buf); uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase); uint32_t FX_HashCode_GetW(const CFX_WideStringC& str, bool bIgnoreCase); diff --git a/core/fxcrt/fx_system.h b/core/fxcrt/fx_system.h index 4c938d9b27..321a8e272e 100644 --- a/core/fxcrt/fx_system.h +++ b/core/fxcrt/fx_system.h @@ -68,7 +68,6 @@ extern "C" { #endif // __cplusplus typedef void* FX_POSITION; // Keep until fxcrt containers gone -typedef float FX_FLOAT; // Keep, allow upgrade to doubles. #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) @@ -247,21 +246,21 @@ wchar_t* FXSYS_wcsupr(wchar_t* str); #endif // _FXM_PLATFORM == _FXM_PLATFORM_WINDOWS_ #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -#define FXSYS_pow(a, b) (FX_FLOAT) powf(a, b) +#define FXSYS_pow(a, b) (float)powf(a, b) #else -#define FXSYS_pow(a, b) (FX_FLOAT) pow(a, b) +#define FXSYS_pow(a, b) (float)pow(a, b) #endif -#define FXSYS_sqrt(a) (FX_FLOAT) sqrt(a) -#define FXSYS_fabs(a) (FX_FLOAT) fabs(a) -#define FXSYS_atan2(a, b) (FX_FLOAT) atan2(a, b) -#define FXSYS_ceil(a) (FX_FLOAT) ceil(a) -#define FXSYS_floor(a) (FX_FLOAT) floor(a) -#define FXSYS_cos(a) (FX_FLOAT) cos(a) -#define FXSYS_acos(a) (FX_FLOAT) acos(a) -#define FXSYS_sin(a) (FX_FLOAT) sin(a) -#define FXSYS_log(a) (FX_FLOAT) log(a) -#define FXSYS_log10(a) (FX_FLOAT) log10(a) -#define FXSYS_fmod(a, b) (FX_FLOAT) fmod(a, b) +#define FXSYS_sqrt(a) (float)sqrt(a) +#define FXSYS_fabs(a) (float)fabs(a) +#define FXSYS_atan2(a, b) (float)atan2(a, b) +#define FXSYS_ceil(a) (float)ceil(a) +#define FXSYS_floor(a) (float)floor(a) +#define FXSYS_cos(a) (float)cos(a) +#define FXSYS_acos(a) (float)acos(a) +#define FXSYS_sin(a) (float)sin(a) +#define FXSYS_log(a) (float)log(a) +#define FXSYS_log10(a) (float)log10(a) +#define FXSYS_fmod(a, b) (float)fmod(a, b) #define FXSYS_abs abs #define FXDWORD_GET_LSBFIRST(p) \ ((static_cast<uint32_t>(p[3]) << 24) | (static_cast<uint32_t>(p[2]) << 16) | \ @@ -279,8 +278,8 @@ int32_t FXSYS_wtoi(const wchar_t* str); int64_t FXSYS_atoi64(const char* str); int64_t FXSYS_wtoi64(const wchar_t* str); const char* FXSYS_i64toa(int64_t value, char* str, int radix); -int FXSYS_round(FX_FLOAT f); -#define FXSYS_sqrt2(a, b) (FX_FLOAT) FXSYS_sqrt((a) * (a) + (b) * (b)) +int FXSYS_round(float f); +#define FXSYS_sqrt2(a, b) (float)FXSYS_sqrt((a) * (a) + (b) * (b)) #ifdef __cplusplus }; #endif diff --git a/core/fxcrt/fx_xml.h b/core/fxcrt/fx_xml.h index 87f1915cb1..0b0de23d67 100644 --- a/core/fxcrt/fx_xml.h +++ b/core/fxcrt/fx_xml.h @@ -107,19 +107,19 @@ class CXML_Element { return attr; } - bool GetAttrFloat(const CFX_ByteStringC& name, FX_FLOAT& attribute) const; - FX_FLOAT GetAttrFloat(const CFX_ByteStringC& name) const { - FX_FLOAT attr = 0; + bool GetAttrFloat(const CFX_ByteStringC& name, float& attribute) const; + float GetAttrFloat(const CFX_ByteStringC& name) const { + float attr = 0; GetAttrFloat(name, attr); return attr; } bool GetAttrFloat(const CFX_ByteStringC& space, const CFX_ByteStringC& name, - FX_FLOAT& attribute) const; - FX_FLOAT GetAttrFloat(const CFX_ByteStringC& space, - const CFX_ByteStringC& name) const { - FX_FLOAT attr = 0; + float& attribute) const; + float GetAttrFloat(const CFX_ByteStringC& space, + const CFX_ByteStringC& name) const { + float attr = 0; GetAttrFloat(space, name, attr); return attr; } diff --git a/core/fxcrt/fx_xml_parser.cpp b/core/fxcrt/fx_xml_parser.cpp index b81ae4e0d9..25024a1b2d 100644 --- a/core/fxcrt/fx_xml_parser.cpp +++ b/core/fxcrt/fx_xml_parser.cpp @@ -785,7 +785,7 @@ bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& space, } bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& name, - FX_FLOAT& attribute) const { + float& attribute) const { CFX_ByteStringC bsSpace; CFX_ByteStringC bsName; FX_XML_SplitQualifiedName(name, bsSpace, bsName); @@ -794,7 +794,7 @@ bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& name, bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& space, const CFX_ByteStringC& name, - FX_FLOAT& attribute) const { + float& attribute) const { const CFX_WideString* pValue = m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name)); if (!pValue) diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 8c7277752e..a3429a5b64 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -358,7 +358,7 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, agg::path_storage& path_data, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_FLOAT scale = 1.0f, + float scale = 1.0f, bool bStrokeAdjust = false, bool bTextMode = false) { agg::line_cap_e cap; @@ -385,8 +385,8 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, join = agg::miter_join_revert; break; } - FX_FLOAT width = pGraphState->m_LineWidth * scale; - FX_FLOAT unit = 1.f; + float width = pGraphState->m_LineWidth * scale; + float unit = 1.f; if (pObject2Device) { unit = 1.0f / ((pObject2Device->GetXUnit() + pObject2Device->GetYUnit()) / 2); @@ -398,13 +398,13 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, typedef agg::conv_dash<agg::path_storage> dash_converter; dash_converter dash(path_data); for (int i = 0; i < (pGraphState->m_DashCount + 1) / 2; i++) { - FX_FLOAT on = pGraphState->m_DashArray[i * 2]; + float on = pGraphState->m_DashArray[i * 2]; if (on <= 0.000001f) { on = 1.0f / 10; } - FX_FLOAT off = i * 2 + 1 == pGraphState->m_DashCount - ? on - : pGraphState->m_DashArray[i * 2 + 1]; + float off = i * 2 + 1 == pGraphState->m_DashCount + ? on + : pGraphState->m_DashArray[i * 2 + 1]; if (off < 0) { off = 0; } @@ -460,7 +460,7 @@ bool CFX_AggDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, + float font_size, uint32_t color) { return false; } @@ -556,9 +556,9 @@ bool CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, if (size == 5 || size == 4) { CFX_FloatRect rectf; if (pPathData->IsRect(pObject2Device, &rectf)) { - rectf.Intersect( - CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH), - (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); + rectf.Intersect(CFX_FloatRect(0, 0, + (float)GetDeviceCaps(FXDC_PIXEL_WIDTH), + (float)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); FX_RECT rect = rectf.GetOuterRect(); m_pClipRgn->IntersectRect(rect); return true; @@ -568,8 +568,8 @@ bool CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, path_data.BuildPath(pPathData, pObject2Device); path_data.m_PathData.end_poly(); agg::rasterizer_scanline_aa rasterizer; - rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), - (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); + rasterizer.clip_box(0.0f, 0.0f, (float)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), + (float)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); rasterizer.add_path(path_data.m_PathData); rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING ? agg::fill_non_zero @@ -589,8 +589,8 @@ bool CFX_AggDeviceDriver::SetClip_PathStroke( CAgg_PathData path_data; path_data.BuildPath(pPathData, nullptr); agg::rasterizer_scanline_aa rasterizer; - rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), - (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); + rasterizer.clip_box(0.0f, 0.0f, (float)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), + (float)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); RasterizeStroke(rasterizer, path_data.m_PathData, pObject2Device, pGraphState); rasterizer.filling_rule(agg::fill_non_zero); @@ -1467,8 +1467,8 @@ bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, CAgg_PathData path_data; path_data.BuildPath(pPathData, pObject2Device); agg::rasterizer_scanline_aa rasterizer; - rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), - (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); + rasterizer.clip_box(0.0f, 0.0f, (float)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), + (float)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); rasterizer.add_path(path_data.m_PathData); rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING ? agg::fill_non_zero @@ -1487,8 +1487,8 @@ bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, CAgg_PathData path_data; path_data.BuildPath(pPathData, pObject2Device); agg::rasterizer_scanline_aa rasterizer; - rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), - (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); + rasterizer.clip_box(0.0f, 0.0f, (float)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), + (float)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); RasterizeStroke(rasterizer, path_data.m_PathData, nullptr, pGraphState, 1, false, !!(fill_mode & FX_STROKE_TEXT_MODE)); return RenderRasterizer(rasterizer, stroke_color, @@ -1514,8 +1514,8 @@ bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, CAgg_PathData path_data; path_data.BuildPath(pPathData, &matrix1); agg::rasterizer_scanline_aa rasterizer; - rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), - (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); + rasterizer.clip_box(0.0f, 0.0f, (float)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), + (float)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); RasterizeStroke(rasterizer, path_data.m_PathData, &matrix2, pGraphState, matrix1.a, false, !!(fill_mode & FX_STROKE_TEXT_MODE)); return RenderRasterizer(rasterizer, stroke_color, diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h index 8da63394a4..7b4c7209e8 100644 --- a/core/fxge/agg/fx_agg_driver.h +++ b/core/fxge/agg/fx_agg_driver.h @@ -93,7 +93,7 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, + float font_size, uint32_t color) override; int GetDriverType() const override; diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h index fed6abcfb0..2a4029bd38 100644 --- a/core/fxge/apple/apple_int.h +++ b/core/fxge/apple/apple_int.h @@ -27,7 +27,7 @@ class CQuartz2D { void setGraphicsTextMatrix(void* graphics, CFX_Matrix* matrix); bool drawGraphicsString(void* graphics, void* font, - FX_FLOAT fontSize, + float fontSize, uint16_t* glyphIndices, CGPoint* glyphPositions, int32_t chars, diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp index f576eb0ba2..20e86ed483 100644 --- a/core/fxge/apple/fx_apple_platform.cpp +++ b/core/fxge/apple/fx_apple_platform.cpp @@ -30,7 +30,7 @@ bool CGDrawGlyphRun(CGContextRef pContext, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, + float font_size, uint32_t argb) { if (nChars == 0) return true; @@ -102,7 +102,7 @@ bool CFX_AggDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, + float font_size, uint32_t argb) { if (!pFont) return false; diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp index 0cd5b6b93a..dbb121065d 100644 --- a/core/fxge/apple/fx_quartz_device.cpp +++ b/core/fxge/apple/fx_quartz_device.cpp @@ -77,7 +77,7 @@ void CQuartz2D::setGraphicsTextMatrix(void* graphics, CFX_Matrix* matrix) { bool CQuartz2D::drawGraphicsString(void* graphics, void* font, - FX_FLOAT fontSize, + float fontSize, uint16_t* glyphIndices, CGPoint* glyphPositions, int32_t charsCount, diff --git a/core/fxge/cfx_gemodule.h b/core/fxge/cfx_gemodule.h index c5bd841002..587ec89e59 100644 --- a/core/fxge/cfx_gemodule.h +++ b/core/fxge/cfx_gemodule.h @@ -24,7 +24,7 @@ class CFX_GEModule { void Init(const char** pUserFontPaths, CCodec_ModuleMgr* pCodecModule); CFX_FontCache* GetFontCache(); CFX_FontMgr* GetFontMgr() { return m_pFontMgr.get(); } - void SetTextGamma(FX_FLOAT gammaValue); + void SetTextGamma(float gammaValue); const uint8_t* GetTextGammaTable() const; CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; } diff --git a/core/fxge/cfx_graphstate.h b/core/fxge/cfx_graphstate.h index a838dfc17c..b023ce790d 100644 --- a/core/fxge/cfx_graphstate.h +++ b/core/fxge/cfx_graphstate.h @@ -20,10 +20,10 @@ class CFX_GraphState { void Emplace(); - void SetLineDash(CPDF_Array* pArray, FX_FLOAT phase, FX_FLOAT scale); + void SetLineDash(CPDF_Array* pArray, float phase, float scale); - FX_FLOAT GetLineWidth() const; - void SetLineWidth(FX_FLOAT width); + float GetLineWidth() const; + void SetLineWidth(float width); CFX_GraphStateData::LineCap GetLineCap() const; void SetLineCap(CFX_GraphStateData::LineCap cap); @@ -31,8 +31,8 @@ class CFX_GraphState { CFX_GraphStateData::LineJoin GetLineJoin() const; void SetLineJoin(CFX_GraphStateData::LineJoin join); - FX_FLOAT GetMiterLimit() const; - void SetMiterLimit(FX_FLOAT limit); + float GetMiterLimit() const; + void SetMiterLimit(float limit); // FIXME(tsepez): remove when all GraphStateData usage gone. const CFX_GraphStateData* GetObject() const { return m_Ref.GetObject(); } diff --git a/core/fxge/cfx_graphstatedata.h b/core/fxge/cfx_graphstatedata.h index 03e4a8f51a..dc0098be3e 100644 --- a/core/fxge/cfx_graphstatedata.h +++ b/core/fxge/cfx_graphstatedata.h @@ -22,8 +22,8 @@ class CFX_GraphStateData { LineCap m_LineCap; int m_DashCount; - FX_FLOAT* m_DashArray; - FX_FLOAT m_DashPhase; + float* m_DashArray; + float m_DashPhase; enum LineJoin { LineJoinMiter = 0, @@ -31,8 +31,8 @@ class CFX_GraphStateData { LineJoinBevel = 2, }; LineJoin m_LineJoin; - FX_FLOAT m_MiterLimit; - FX_FLOAT m_LineWidth; + float m_MiterLimit; + float m_LineWidth; }; #endif // CORE_FXGE_CFX_GRAPHSTATEDATA_H_ diff --git a/core/fxge/cfx_pathdata.h b/core/fxge/cfx_pathdata.h index b0e30e32ad..bcb2b7aadf 100644 --- a/core/fxge/cfx_pathdata.h +++ b/core/fxge/cfx_pathdata.h @@ -47,7 +47,7 @@ class CFX_PathData { std::vector<FX_PATHPOINT>& GetPoints() { return m_Points; } CFX_FloatRect GetBoundingBox() const; - CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const; + CFX_FloatRect GetBoundingBox(float line_width, float miter_limit) const; void Transform(const CFX_Matrix* pMatrix); bool IsRect() const; @@ -59,7 +59,7 @@ class CFX_PathData { bool IsRect(const CFX_Matrix* pMatrix, CFX_FloatRect* rect) const; void Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix); - void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top); + void AppendRect(float left, float bottom, float right, float top); void AppendPoint(const CFX_PointF& pos, FXPT_TYPE type, bool closeFigure); void ClosePath(); diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h index 2e9abf9963..41f8e4c690 100644 --- a/core/fxge/cfx_renderdevice.h +++ b/core/fxge/cfx_renderdevice.h @@ -68,7 +68,7 @@ class FXTEXT_CHARPOS { FXTEXT_CHARPOS(const FXTEXT_CHARPOS&); ~FXTEXT_CHARPOS(); - FX_FLOAT m_AdjustMatrix[4]; + float m_AdjustMatrix[4]; CFX_PointF m_Origin; uint32_t m_GlyphIndex; int32_t m_FontCharWidth; @@ -132,10 +132,10 @@ class CFX_RenderDevice { return FillRectWithBlend(pRect, color, FXDIB_BLEND_NORMAL); } bool FillRectWithBlend(const FX_RECT* pRect, uint32_t color, int blend_type); - bool DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, + bool DrawCosmeticLine(float x1, + float y1, + float x2, + float y2, uint32_t color, int fill_mode, int blend_type); @@ -203,14 +203,14 @@ class CFX_RenderDevice { bool DrawNormalText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, - FX_FLOAT font_size, + float font_size, const CFX_Matrix* pText2Device, uint32_t fill_color, uint32_t text_flags); bool DrawTextPath(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, - FX_FLOAT font_size, + float font_size, const CFX_Matrix* pText2User, const CFX_Matrix* pUser2Device, const CFX_GraphStateData* pGraphState, diff --git a/core/fxge/dib/fx_dib_engine.cpp b/core/fxge/dib/fx_dib_engine.cpp index c004aac538..8d90a72401 100644 --- a/core/fxge/dib/fx_dib_engine.cpp +++ b/core/fxge/dib/fx_dib_engine.cpp @@ -56,12 +56,12 @@ bool CWeightTable::Calc(int dest_len, FX_Free(m_pWeightTables); m_pWeightTables = nullptr; m_dwWeightTablesSize = 0; - const double scale = (FX_FLOAT)src_len / (FX_FLOAT)dest_len; - const double base = dest_len < 0 ? (FX_FLOAT)(src_len) : 0; + const double scale = (float)src_len / (float)dest_len; + const double base = dest_len < 0 ? (float)(src_len) : 0; const int ext_size = flags & FXDIB_BICUBIC_INTERPOL ? 3 : 1; m_ItemSize = sizeof(int) * 2 + - (int)(sizeof(int) * (FXSYS_ceil(FXSYS_fabs((FX_FLOAT)scale)) + ext_size)); + (int)(sizeof(int) * (FXSYS_ceil(FXSYS_fabs((float)scale)) + ext_size)); m_DestMin = dest_min; if ((dest_max - dest_min) > (int)((1U << 30) - 4) / m_ItemSize) return false; @@ -71,14 +71,13 @@ bool CWeightTable::Calc(int dest_len, if (!m_pWeightTables) return false; - if ((flags & FXDIB_NOSMOOTH) != 0 || FXSYS_fabs((FX_FLOAT)scale) < 1.0f) { + if ((flags & FXDIB_NOSMOOTH) != 0 || FXSYS_fabs((float)scale) < 1.0f) { for (int dest_pixel = dest_min; dest_pixel < dest_max; dest_pixel++) { PixelWeight& pixel_weights = *GetPixelWeight(dest_pixel); double src_pos = dest_pixel * scale + scale / 2 + base; if (flags & FXDIB_INTERPOL) { - pixel_weights.m_SrcStart = - (int)FXSYS_floor((FX_FLOAT)src_pos - 1.0f / 2); - pixel_weights.m_SrcEnd = (int)FXSYS_floor((FX_FLOAT)src_pos + 1.0f / 2); + pixel_weights.m_SrcStart = (int)FXSYS_floor((float)src_pos - 1.0f / 2); + pixel_weights.m_SrcEnd = (int)FXSYS_floor((float)src_pos + 1.0f / 2); if (pixel_weights.m_SrcStart < src_min) { pixel_weights.m_SrcStart = src_min; } @@ -89,14 +88,12 @@ bool CWeightTable::Calc(int dest_len, pixel_weights.m_Weights[0] = 65536; } else { pixel_weights.m_Weights[1] = FXSYS_round( - (FX_FLOAT)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) * - 65536); + (float)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) * 65536); pixel_weights.m_Weights[0] = 65536 - pixel_weights.m_Weights[1]; } } else if (flags & FXDIB_BICUBIC_INTERPOL) { - pixel_weights.m_SrcStart = - (int)FXSYS_floor((FX_FLOAT)src_pos - 1.0f / 2); - pixel_weights.m_SrcEnd = (int)FXSYS_floor((FX_FLOAT)src_pos + 1.0f / 2); + pixel_weights.m_SrcStart = (int)FXSYS_floor((float)src_pos - 1.0f / 2); + pixel_weights.m_SrcEnd = (int)FXSYS_floor((float)src_pos + 1.0f / 2); int start = pixel_weights.m_SrcStart - 1; int end = pixel_weights.m_SrcEnd + 1; if (start < src_min) { @@ -114,7 +111,7 @@ bool CWeightTable::Calc(int dest_len, } int weight; weight = FXSYS_round( - (FX_FLOAT)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) * 256); + (float)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) * 256); if (start == end) { pixel_weights.m_Weights[0] = (SDP_Table[256 + weight] + SDP_Table[weight] + @@ -179,7 +176,7 @@ bool CWeightTable::Calc(int dest_len, } } else { pixel_weights.m_SrcStart = pixel_weights.m_SrcEnd = - (int)FXSYS_floor((FX_FLOAT)src_pos); + (int)FXSYS_floor((float)src_pos); if (pixel_weights.m_SrcStart < src_min) { pixel_weights.m_SrcStart = src_min; } @@ -198,11 +195,11 @@ bool CWeightTable::Calc(int dest_len, double src_end = src_start + scale; int start_i, end_i; if (src_start < src_end) { - start_i = (int)FXSYS_floor((FX_FLOAT)src_start); - end_i = (int)FXSYS_ceil((FX_FLOAT)src_end); + start_i = (int)FXSYS_floor((float)src_start); + end_i = (int)FXSYS_ceil((float)src_end); } else { - start_i = (int)FXSYS_floor((FX_FLOAT)src_end); - end_i = (int)FXSYS_ceil((FX_FLOAT)src_start); + start_i = (int)FXSYS_floor((float)src_end); + end_i = (int)FXSYS_ceil((float)src_start); } if (start_i < src_min) { start_i = src_min; @@ -221,18 +218,17 @@ bool CWeightTable::Calc(int dest_len, pixel_weights.m_SrcStart = start_i; pixel_weights.m_SrcEnd = end_i; for (int j = start_i; j <= end_i; j++) { - double dest_start = ((FX_FLOAT)j - base) / scale; - double dest_end = ((FX_FLOAT)(j + 1) - base) / scale; + double dest_start = ((float)j - base) / scale; + double dest_end = ((float)(j + 1) - base) / scale; if (dest_start > dest_end) { double temp = dest_start; dest_start = dest_end; dest_end = temp; } - double area_start = dest_start > (FX_FLOAT)(dest_pixel) - ? dest_start - : (FX_FLOAT)(dest_pixel); - double area_end = dest_end > (FX_FLOAT)(dest_pixel + 1) - ? (FX_FLOAT)(dest_pixel + 1) + double area_start = + dest_start > (float)(dest_pixel) ? dest_start : (float)(dest_pixel); + double area_end = dest_end > (float)(dest_pixel + 1) + ? (float)(dest_pixel + 1) : dest_end; double weight = area_start >= area_end ? 0.0f : area_end - area_start; if (weight == 0 && j == end_i) { @@ -242,7 +238,7 @@ bool CWeightTable::Calc(int dest_len, size_t idx = j - start_i; if (idx >= GetPixelWeightSize()) return false; - pixel_weights.m_Weights[idx] = FXSYS_round((FX_FLOAT)(weight * 65536)); + pixel_weights.m_Weights[idx] = FXSYS_round((float)(weight * 65536)); } } return true; @@ -321,14 +317,14 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, m_Flags |= FXDIB_DOWNSAMPLE; } } - double scale_x = (FX_FLOAT)m_SrcWidth / (FX_FLOAT)m_DestWidth; - double scale_y = (FX_FLOAT)m_SrcHeight / (FX_FLOAT)m_DestHeight; - double base_x = m_DestWidth > 0 ? 0.0f : (FX_FLOAT)(m_DestWidth); - double base_y = m_DestHeight > 0 ? 0.0f : (FX_FLOAT)(m_DestHeight); - double src_left = scale_x * ((FX_FLOAT)(clip_rect.left) + base_x); - double src_right = scale_x * ((FX_FLOAT)(clip_rect.right) + base_x); - double src_top = scale_y * ((FX_FLOAT)(clip_rect.top) + base_y); - double src_bottom = scale_y * ((FX_FLOAT)(clip_rect.bottom) + base_y); + double scale_x = (float)m_SrcWidth / (float)m_DestWidth; + double scale_y = (float)m_SrcHeight / (float)m_DestHeight; + double base_x = m_DestWidth > 0 ? 0.0f : (float)(m_DestWidth); + double base_y = m_DestHeight > 0 ? 0.0f : (float)(m_DestHeight); + double src_left = scale_x * ((float)(clip_rect.left) + base_x); + double src_right = scale_x * ((float)(clip_rect.right) + base_x); + double src_top = scale_y * ((float)(clip_rect.top) + base_y); + double src_bottom = scale_y * ((float)(clip_rect.bottom) + base_y); if (src_left > src_right) { double temp = src_left; src_left = src_right; @@ -339,10 +335,10 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, src_top = src_bottom; src_bottom = temp; } - m_SrcClip.left = (int)FXSYS_floor((FX_FLOAT)src_left); - m_SrcClip.right = (int)FXSYS_ceil((FX_FLOAT)src_right); - m_SrcClip.top = (int)FXSYS_floor((FX_FLOAT)src_top); - m_SrcClip.bottom = (int)FXSYS_ceil((FX_FLOAT)src_bottom); + m_SrcClip.left = (int)FXSYS_floor((float)src_left); + m_SrcClip.right = (int)FXSYS_ceil((float)src_right); + m_SrcClip.top = (int)FXSYS_floor((float)src_top); + m_SrcClip.bottom = (int)FXSYS_ceil((float)src_bottom); FX_RECT src_rect(0, 0, m_SrcWidth, m_SrcHeight); m_SrcClip.Intersect(src_rect); if (m_SrcBpp == 1) { diff --git a/core/fxge/dib/fx_dib_transform.cpp b/core/fxge/dib/fx_dib_transform.cpp index bd88272941..4a1c3ee050 100644 --- a/core/fxge/dib/fx_dib_transform.cpp +++ b/core/fxge/dib/fx_dib_transform.cpp @@ -394,7 +394,7 @@ bool CFX_ImageTransformer::Start() { int stretch_width = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b)); int stretch_height = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d)); CFX_Matrix stretch2dest(1.0f, 0.0f, 0.0f, -1.0f, 0.0f, - (FX_FLOAT)(stretch_height)); + (float)(stretch_height)); stretch2dest.Concat( CFX_Matrix(m_pMatrix->a / stretch_width, m_pMatrix->b / stretch_width, m_pMatrix->c / stretch_height, m_pMatrix->d / stretch_height, @@ -453,8 +453,8 @@ bool CFX_ImageTransformer::Continue(IFX_Pause* pPause) { if (pTransformed->m_pAlphaMask) pTransformed->m_pAlphaMask->Clear(0); - CFX_Matrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, (FX_FLOAT)(m_result.left), - (FX_FLOAT)(m_result.top)); + CFX_Matrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, (float)(m_result.left), + (float)(m_result.top)); result2stretch.Concat(m_dest2stretch); result2stretch.Translate(-m_StretchClip.left, -m_StretchClip.top); if (!stretch_buf_mask && pTransformed->m_pAlphaMask) { diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h index 07392fa07f..79957ef506 100644 --- a/core/fxge/fx_font.h +++ b/core/fxge/fx_font.h @@ -240,8 +240,8 @@ class FXTEXT_GLYPHPOS { FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, int anti_alias, - FX_FLOAT retinaScaleX = 1.0f, - FX_FLOAT retinaScaleY = 1.0f); + float retinaScaleX = 1.0f, + float retinaScaleY = 1.0f); CFX_ByteString GetNameFromTT(const uint8_t* name_table, uint32_t name_table_size, diff --git a/core/fxge/ge/cfx_facecache.cpp b/core/fxge/ge/cfx_facecache.cpp index 314c95b8b2..3cdff44f8b 100644 --- a/core/fxge/ge/cfx_facecache.cpp +++ b/core/fxge/ge/cfx_facecache.cpp @@ -44,7 +44,7 @@ void ContrastAdjust(uint8_t* pDataIn, int nDstRowBytes) { int col, row, temp; int max = 0, min = 255; - FX_FLOAT rate; + float rate; for (row = 0; row < nHeight; row++) { uint8_t* pRow = pDataIn + row * nSrcRowBytes; for (col = 0; col < nWidth; col++) { diff --git a/core/fxge/ge/cfx_font.cpp b/core/fxge/ge/cfx_font.cpp index 87157b0101..068f0b032c 100644 --- a/core/fxge/ge/cfx_font.cpp +++ b/core/fxge/ge/cfx_font.cpp @@ -31,7 +31,7 @@ typedef struct { CFX_PathData* m_pPath; int m_CurX; int m_CurY; - FX_FLOAT m_CoordUnit; + float m_CoordUnit; } OUTLINE_PARAMS; #ifdef PDF_ENABLE_XFA diff --git a/core/fxge/ge/cfx_gemodule.cpp b/core/fxge/ge/cfx_gemodule.cpp index ed6d6cb32e..790b670e4f 100644 --- a/core/fxge/ge/cfx_gemodule.cpp +++ b/core/fxge/ge/cfx_gemodule.cpp @@ -59,11 +59,11 @@ CFX_FontCache* CFX_GEModule::GetFontCache() { return m_pFontCache; } -void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) { +void CFX_GEModule::SetTextGamma(float gammaValue) { gammaValue /= 2.2f; for (int i = 0; i < 256; ++i) { m_GammaValue[i] = static_cast<uint8_t>( - FXSYS_pow(static_cast<FX_FLOAT>(i) / 255, gammaValue) * 255.0f + 0.5f); + FXSYS_pow(static_cast<float>(i) / 255, gammaValue) * 255.0f + 0.5f); } } diff --git a/core/fxge/ge/cfx_graphstate.cpp b/core/fxge/ge/cfx_graphstate.cpp index 6357aa51a4..54443b9636 100644 --- a/core/fxge/ge/cfx_graphstate.cpp +++ b/core/fxge/ge/cfx_graphstate.cpp @@ -19,9 +19,7 @@ void CFX_GraphState::Emplace() { m_Ref.Emplace(); } -void CFX_GraphState::SetLineDash(CPDF_Array* pArray, - FX_FLOAT phase, - FX_FLOAT scale) { +void CFX_GraphState::SetLineDash(CPDF_Array* pArray, float phase, float scale) { CFX_GraphStateData* pData = m_Ref.GetPrivateCopy(); pData->m_DashPhase = phase * scale; pData->SetDashCount(static_cast<int>(pArray->GetCount())); @@ -29,11 +27,11 @@ void CFX_GraphState::SetLineDash(CPDF_Array* pArray, pData->m_DashArray[i] = pArray->GetNumberAt(i) * scale; } -FX_FLOAT CFX_GraphState::GetLineWidth() const { +float CFX_GraphState::GetLineWidth() const { return m_Ref.GetObject() ? m_Ref.GetObject()->m_LineWidth : 1.f; } -void CFX_GraphState::SetLineWidth(FX_FLOAT width) { +void CFX_GraphState::SetLineWidth(float width) { m_Ref.GetPrivateCopy()->m_LineWidth = width; } @@ -52,10 +50,10 @@ void CFX_GraphState::SetLineJoin(CFX_GraphStateData::LineJoin join) { m_Ref.GetPrivateCopy()->m_LineJoin = join; } -FX_FLOAT CFX_GraphState::GetMiterLimit() const { +float CFX_GraphState::GetMiterLimit() const { return m_Ref.GetObject() ? m_Ref.GetObject()->m_MiterLimit : 10.f; } -void CFX_GraphState::SetMiterLimit(FX_FLOAT limit) { +void CFX_GraphState::SetMiterLimit(float limit) { m_Ref.GetPrivateCopy()->m_MiterLimit = limit; } diff --git a/core/fxge/ge/cfx_graphstatedata.cpp b/core/fxge/ge/cfx_graphstatedata.cpp index 03798a6320..8c5508f2f2 100644 --- a/core/fxge/ge/cfx_graphstatedata.cpp +++ b/core/fxge/ge/cfx_graphstatedata.cpp @@ -33,8 +33,8 @@ void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) { m_MiterLimit = src.m_MiterLimit; m_LineWidth = src.m_LineWidth; if (m_DashCount) { - m_DashArray = FX_Alloc(FX_FLOAT, m_DashCount); - FXSYS_memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(FX_FLOAT)); + m_DashArray = FX_Alloc(float, m_DashCount); + FXSYS_memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(float)); } } @@ -48,5 +48,5 @@ void CFX_GraphStateData::SetDashCount(int count) { m_DashCount = count; if (count == 0) return; - m_DashArray = FX_Alloc(FX_FLOAT, count); + m_DashArray = FX_Alloc(float, count); } diff --git a/core/fxge/ge/cfx_pathdata.cpp b/core/fxge/ge/cfx_pathdata.cpp index 9fa2cd2aac..d4c657c3a4 100644 --- a/core/fxge/ge/cfx_pathdata.cpp +++ b/core/fxge/ge/cfx_pathdata.cpp @@ -14,7 +14,7 @@ namespace { void UpdateLineEndPoints(CFX_FloatRect* rect, const CFX_PointF& start_pos, const CFX_PointF& end_pos, - FX_FLOAT hw) { + float hw) { if (start_pos.x == end_pos.x) { if (start_pos.y == end_pos.y) { rect->UpdateRect(end_pos.x + hw, end_pos.y + hw); @@ -22,7 +22,7 @@ void UpdateLineEndPoints(CFX_FloatRect* rect, return; } - FX_FLOAT point_y; + float point_y; if (end_pos.y < start_pos.y) point_y = end_pos.y - hw; else @@ -34,7 +34,7 @@ void UpdateLineEndPoints(CFX_FloatRect* rect, } if (start_pos.y == end_pos.y) { - FX_FLOAT point_x; + float point_x; if (end_pos.x < start_pos.x) point_x = end_pos.x - hw; else @@ -46,11 +46,11 @@ void UpdateLineEndPoints(CFX_FloatRect* rect, } CFX_PointF diff = end_pos - start_pos; - FX_FLOAT ll = FXSYS_sqrt2(diff.x, diff.y); - FX_FLOAT mx = end_pos.x + hw * diff.x / ll; - FX_FLOAT my = end_pos.y + hw * diff.y / ll; - FX_FLOAT dx1 = hw * diff.y / ll; - FX_FLOAT dy1 = hw * diff.x / ll; + float ll = FXSYS_sqrt2(diff.x, diff.y); + float mx = end_pos.x + hw * diff.x / ll; + float my = end_pos.y + hw * diff.y / ll; + float dx1 = hw * diff.y / ll; + float dy1 = hw * diff.x / ll; rect->UpdateRect(mx - dx1, my + dy1); rect->UpdateRect(mx + dx1, my - dy1); } @@ -59,23 +59,23 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, const CFX_PointF& start_pos, const CFX_PointF& mid_pos, const CFX_PointF& end_pos, - FX_FLOAT half_width, - FX_FLOAT miter_limit) { - FX_FLOAT start_k = 0; - FX_FLOAT start_c = 0; - FX_FLOAT end_k = 0; - FX_FLOAT end_c = 0; - FX_FLOAT start_len = 0; - FX_FLOAT start_dc = 0; - FX_FLOAT end_len = 0; - FX_FLOAT end_dc = 0; - FX_FLOAT one_twentieth = 1.0f / 20; + float half_width, + float miter_limit) { + float start_k = 0; + float start_c = 0; + float end_k = 0; + float end_c = 0; + float start_len = 0; + float start_dc = 0; + float end_len = 0; + float end_dc = 0; + float one_twentieth = 1.0f / 20; bool bStartVert = FXSYS_fabs(start_pos.x - mid_pos.x) < one_twentieth; bool bEndVert = FXSYS_fabs(mid_pos.x - end_pos.x) < one_twentieth; if (bStartVert && bEndVert) { int start_dir = mid_pos.y > start_pos.y ? 1 : -1; - FX_FLOAT point_y = mid_pos.y + half_width * start_dir; + float point_y = mid_pos.y + half_width * start_dir; rect->UpdateRect(mid_pos.x + half_width, point_y); rect->UpdateRect(mid_pos.x - half_width, point_y); return; @@ -86,8 +86,8 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, start_k = (mid_pos.y - start_pos.y) / (mid_pos.x - start_pos.x); start_c = mid_pos.y - (start_k * mid_pos.x); start_len = FXSYS_sqrt2(start_to_mid.x, start_to_mid.y); - start_dc = static_cast<FX_FLOAT>( - FXSYS_fabs(half_width * start_len / start_to_mid.x)); + start_dc = + static_cast<float>(FXSYS_fabs(half_width * start_len / start_to_mid.x)); } if (!bEndVert) { CFX_PointF end_to_mid = end_pos - mid_pos; @@ -95,7 +95,7 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, end_c = mid_pos.y - (end_k * mid_pos.x); end_len = FXSYS_sqrt2(end_to_mid.x, end_to_mid.y); end_dc = - static_cast<FX_FLOAT>(FXSYS_fabs(half_width * end_len / end_to_mid.x)); + static_cast<float>(FXSYS_fabs(half_width * end_len / end_to_mid.x)); } if (bStartVert) { CFX_PointF outside(start_pos.x, 0); @@ -139,20 +139,20 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, return; } - FX_FLOAT start_outside_c = start_c; + float start_outside_c = start_c; if (end_pos.y < (start_k * end_pos.x) + start_c) start_outside_c += start_dc; else start_outside_c -= start_dc; - FX_FLOAT end_outside_c = end_c; + float end_outside_c = end_c; if (start_pos.y < (end_k * start_pos.x) + end_c) end_outside_c += end_dc; else end_outside_c -= end_dc; - FX_FLOAT join_x = (end_outside_c - start_outside_c) / (start_k - end_k); - FX_FLOAT join_y = start_k * join_x + start_outside_c; + float join_x = (end_outside_c - start_outside_c) / (start_k - end_k); + float join_y = start_k * join_x + start_outside_c; rect->UpdateRect(join_x, join_y); } @@ -203,10 +203,10 @@ void CFX_PathData::AppendPoint(const CFX_PointF& point, m_Points.push_back(FX_PATHPOINT(point, type, closeFigure)); } -void CFX_PathData::AppendRect(FX_FLOAT left, - FX_FLOAT bottom, - FX_FLOAT right, - FX_FLOAT top) { +void CFX_PathData::AppendRect(float left, + float bottom, + float right, + float top) { m_Points.push_back( FX_PATHPOINT(CFX_PointF(left, bottom), FXPT_TYPE::MoveTo, false)); m_Points.push_back( @@ -230,11 +230,11 @@ CFX_FloatRect CFX_PathData::GetBoundingBox() const { return rect; } -CFX_FloatRect CFX_PathData::GetBoundingBox(FX_FLOAT line_width, - FX_FLOAT miter_limit) const { +CFX_FloatRect CFX_PathData::GetBoundingBox(float line_width, + float miter_limit) const { CFX_FloatRect rect(100000.0f, 100000.0f, -100000.0f, -100000.0f); size_t iPoint = 0; - FX_FLOAT half_width = line_width; + float half_width = line_width; int iStartPoint = 0; int iEndPoint = 0; int iMiddlePoint = 0; diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp index daa67ccc91..fab318373a 100644 --- a/core/fxge/ge/cfx_renderdevice.cpp +++ b/core/fxge/ge/cfx_renderdevice.cpp @@ -34,17 +34,16 @@ void AdjustGlyphSpace(std::vector<FXTEXT_GLYPHPOS>* pGlyphAndPos) { for (size_t i = glyphs.size() - 1; i > 1; --i) { FXTEXT_GLYPHPOS& next = glyphs[i]; int next_origin = bVertical ? next.m_Origin.y : next.m_Origin.x; - FX_FLOAT next_origin_f = bVertical ? next.m_fOrigin.y : next.m_fOrigin.x; + float next_origin_f = bVertical ? next.m_fOrigin.y : next.m_fOrigin.x; FXTEXT_GLYPHPOS& current = glyphs[i - 1]; int& current_origin = bVertical ? current.m_Origin.y : current.m_Origin.x; - FX_FLOAT current_origin_f = + float current_origin_f = bVertical ? current.m_fOrigin.y : current.m_fOrigin.x; int space = next_origin - current_origin; - FX_FLOAT space_f = next_origin_f - current_origin_f; - FX_FLOAT error = - FXSYS_fabs(space_f) - FXSYS_fabs(static_cast<FX_FLOAT>(space)); + float space_f = next_origin_f - current_origin_f; + float error = FXSYS_fabs(space_f) - FXSYS_fabs(static_cast<float>(space)); if (error > 0.5f) current_origin += space > 0 ? -1 : 1; } @@ -526,16 +525,16 @@ bool CFX_RenderDevice::DrawPathWithBlend(const CFX_PathData* pPathData, rect_i.bottom++; } if (rect_i.Width() >= width + 1) { - if (rect_f.left - (FX_FLOAT)(rect_i.left) > - (FX_FLOAT)(rect_i.right) - rect_f.right) { + if (rect_f.left - (float)(rect_i.left) > + (float)(rect_i.right) - rect_f.right) { rect_i.left++; } else { rect_i.right--; } } if (rect_i.Height() >= height + 1) { - if (rect_f.top - (FX_FLOAT)(rect_i.top) > - (FX_FLOAT)(rect_i.bottom) - rect_f.bottom) { + if (rect_f.top - (float)(rect_i.top) > + (float)(rect_i.bottom) - rect_f.bottom) { rect_i.top++; } else { rect_i.bottom--; @@ -608,8 +607,8 @@ bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData, pObject2Device->TransformRect(bbox); CFX_Matrix ctm = GetCTM(); - FX_FLOAT fScaleX = FXSYS_fabs(ctm.a); - FX_FLOAT fScaleY = FXSYS_fabs(ctm.d); + float fScaleX = FXSYS_fabs(ctm.a); + float fScaleY = FXSYS_fabs(ctm.d); FX_RECT rect = bbox.GetOuterRect(); CFX_DIBitmap bitmap, Backdrop; if (!CreateCompatibleBitmap(&bitmap, FXSYS_round(rect.Width() * fScaleX), @@ -679,10 +678,10 @@ bool CFX_RenderDevice::FillRectWithBlend(const FX_RECT* pRect, return true; } -bool CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, +bool CFX_RenderDevice::DrawCosmeticLine(float x1, + float y1, + float x2, + float y2, uint32_t color, int fill_mode, int blend_type) { @@ -714,8 +713,8 @@ bool CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap, int blend_mode) { ASSERT(!pBitmap->IsAlphaMask()); CFX_Matrix ctm = GetCTM(); - FX_FLOAT fScaleX = FXSYS_fabs(ctm.a); - FX_FLOAT fScaleY = FXSYS_fabs(ctm.d); + float fScaleX = FXSYS_fabs(ctm.a); + float fScaleY = FXSYS_fabs(ctm.d); FX_RECT dest_rect(left, top, FXSYS_round(left + pBitmap->GetWidth() / fScaleX), FXSYS_round(top + pBitmap->GetHeight() / fScaleY)); @@ -848,7 +847,7 @@ bool CFX_RenderDevice::SetBitsWithMask(const CFX_DIBSource* pBitmap, bool CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, - FX_FLOAT font_size, + float font_size, const CFX_Matrix* pText2Device, uint32_t fill_color, uint32_t text_flags) { @@ -916,8 +915,8 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, } std::vector<FXTEXT_GLYPHPOS> glyphs(nChars); CFX_Matrix matrixCTM = GetCTM(); - FX_FLOAT scale_x = FXSYS_fabs(matrixCTM.a); - FX_FLOAT scale_y = FXSYS_fabs(matrixCTM.d); + float scale_x = FXSYS_fabs(matrixCTM.a); + float scale_y = FXSYS_fabs(matrixCTM.d); CFX_Matrix deviceCtm = char2device; CFX_Matrix m(scale_x, 0, 0, scale_y, 0, 0); deviceCtm.Concat(m); @@ -958,10 +957,10 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, bmp_rect1.right++; bmp_rect1.bottom++; } - FX_RECT bmp_rect(FXSYS_round((FX_FLOAT)(bmp_rect1.left) / scale_x), - FXSYS_round((FX_FLOAT)(bmp_rect1.top) / scale_y), - FXSYS_round((FX_FLOAT)bmp_rect1.right / scale_x), - FXSYS_round((FX_FLOAT)bmp_rect1.bottom / scale_y)); + FX_RECT bmp_rect(FXSYS_round((float)(bmp_rect1.left) / scale_x), + FXSYS_round((float)(bmp_rect1.top) / scale_y), + FXSYS_round((float)bmp_rect1.right / scale_x), + FXSYS_round((float)bmp_rect1.bottom / scale_y)); bmp_rect.Intersect(m_ClipBox); if (bmp_rect.IsEmpty()) return true; @@ -1067,7 +1066,7 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, bool CFX_RenderDevice::DrawTextPath(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, - FX_FLOAT font_size, + float font_size, const CFX_Matrix* pText2User, const CFX_Matrix* pUser2Device, const CFX_GraphStateData* pGraphState, diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp index 669969db0b..f3dea9178d 100644 --- a/core/fxge/ge/fx_ge_text.cpp +++ b/core/fxge/ge/fx_ge_text.cpp @@ -45,8 +45,8 @@ ScopedFontTransform::~ScopedFontTransform() { FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, int anti_alias, - FX_FLOAT retinaScaleX, - FX_FLOAT retinaScaleY) { + float retinaScaleX, + float retinaScaleY) { FX_RECT rect(0, 0, 0, 0); bool bStarted = false; for (const FXTEXT_GLYPHPOS& glyph : glyphs) { diff --git a/core/fxge/ifx_renderdevicedriver.cpp b/core/fxge/ifx_renderdevicedriver.cpp index 77af00f430..44ce833d99 100644 --- a/core/fxge/ifx_renderdevicedriver.cpp +++ b/core/fxge/ifx_renderdevicedriver.cpp @@ -39,10 +39,10 @@ bool IFX_RenderDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, return false; } -bool IFX_RenderDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, +bool IFX_RenderDeviceDriver::DrawCosmeticLine(float x1, + float y1, + float x2, + float y2, uint32_t color, int blend_type) { return false; @@ -68,7 +68,7 @@ bool IFX_RenderDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, + float font_size, uint32_t color) { return false; } diff --git a/core/fxge/ifx_renderdevicedriver.h b/core/fxge/ifx_renderdevicedriver.h index fd35149e42..3dd4730f9b 100644 --- a/core/fxge/ifx_renderdevicedriver.h +++ b/core/fxge/ifx_renderdevicedriver.h @@ -49,10 +49,10 @@ class IFX_RenderDeviceDriver { virtual bool FillRectWithBlend(const FX_RECT* pRect, uint32_t fill_color, int blend_type); - virtual bool DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, + virtual bool DrawCosmeticLine(float x1, + float y1, + float x2, + float y2, uint32_t color, int blend_type); @@ -87,7 +87,7 @@ class IFX_RenderDeviceDriver { const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, + float font_size, uint32_t color); virtual void* GetPlatformSurface() const; virtual int GetDriverType() const; diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 7e23f97287..949ffb8031 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -368,7 +368,7 @@ bool AddColors(const CPDF_ExpIntFunc* pFunc, SkTDArray<SkColor>* skColors) { return true; } -uint8_t FloatToByte(FX_FLOAT f) { +uint8_t FloatToByte(float f) { ASSERT(0 <= f && f <= 1); return (uint8_t)(f * 255.99f); } @@ -395,25 +395,25 @@ bool AddSamples(const CPDF_SampledFunc* pFunc, if (pFunc->GetSampleStream()->GetSize() < sampleCount * 3 * sampleSize / 8) return false; - FX_FLOAT colorsMin[3]; - FX_FLOAT colorsMax[3]; + float colorsMin[3]; + float colorsMax[3]; for (int i = 0; i < 3; ++i) { colorsMin[i] = pFunc->GetRange(i * 2); colorsMax[i] = pFunc->GetRange(i * 2 + 1); } const uint8_t* pSampleData = pFunc->GetSampleStream()->GetData(); for (uint32_t i = 0; i < sampleCount; ++i) { - FX_FLOAT floatColors[3]; + float floatColors[3]; for (uint32_t j = 0; j < 3; ++j) { int sample = GetBits32(pSampleData, (i * 3 + j) * sampleSize, sampleSize); - FX_FLOAT interp = (FX_FLOAT)sample / (sampleCount - 1); + float interp = (float)sample / (sampleCount - 1); floatColors[j] = colorsMin[j] + (colorsMax[j] - colorsMin[j]) * interp; } SkColor color = SkPackARGB32(0xFF, FloatToByte(floatColors[0]), FloatToByte(floatColors[1]), FloatToByte(floatColors[2])); skColors->push(color); - skPos->push((FX_FLOAT)i / (sampleCount - 1)); + skPos->push((float)i / (sampleCount - 1)); } return true; } @@ -421,7 +421,7 @@ bool AddSamples(const CPDF_SampledFunc* pFunc, bool AddStitching(const CPDF_StitchFunc* pFunc, SkTDArray<SkColor>* skColors, SkTDArray<SkScalar>* skPos) { - FX_FLOAT boundsStart = pFunc->GetDomain(0); + float boundsStart = pFunc->GetDomain(0); const auto& subFunctions = pFunc->GetSubFunctions(); int subFunctionCount = subFunctions.size(); @@ -431,7 +431,7 @@ bool AddStitching(const CPDF_StitchFunc* pFunc, return false; if (!AddColors(pSubFunc, skColors)) return false; - FX_FLOAT boundsEnd = + float boundsEnd = i < subFunctionCount - 1 ? pFunc->GetBound(i + 1) : pFunc->GetDomain(1); skPos->push(boundsStart); skPos->push(boundsEnd); @@ -771,7 +771,7 @@ class SkiaState { const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pMatrix, - FX_FLOAT font_size, + float font_size, uint32_t color) { if (m_debugDisable) return false; @@ -973,7 +973,7 @@ class SkiaState { bool FontChanged(CFX_Font* pFont, const CFX_Matrix* pMatrix, - FX_FLOAT font_size, + float font_size, uint32_t color) const { return pFont != m_pFont || MatrixChanged(pMatrix, m_drawMatrix) || font_size != m_fontSize || color != m_fillColor; @@ -1118,7 +1118,7 @@ class SkiaState { CFX_Matrix m_clipMatrix; CFX_SkiaDeviceDriver* m_pDriver; CFX_Font* m_pFont; - FX_FLOAT m_fontSize; + float m_fontSize; uint32_t m_fillColor; uint32_t m_strokeColor; int m_blendType; @@ -1170,7 +1170,7 @@ void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint, inverse.set(SkMatrix::kMTransY, 0); SkVector deviceUnits[2] = {{0, 1}, {1, 0}}; inverse.mapPoints(deviceUnits, SK_ARRAY_COUNT(deviceUnits)); - FX_FLOAT width = + float width = SkTMax(pGraphState->m_LineWidth, SkTMin(deviceUnits[0].length(), deviceUnits[1].length())); if (pGraphState->m_DashArray) { @@ -1178,12 +1178,12 @@ void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint, SkScalar* intervals = FX_Alloc2D(SkScalar, count, sizeof(SkScalar)); // Set dash pattern for (int i = 0; i < count; i++) { - FX_FLOAT on = pGraphState->m_DashArray[i * 2]; + float on = pGraphState->m_DashArray[i * 2]; if (on <= 0.000001f) on = 1.f / 10; - FX_FLOAT off = i * 2 + 1 == pGraphState->m_DashCount - ? on - : pGraphState->m_DashArray[i * 2 + 1]; + float off = i * 2 + 1 == pGraphState->m_DashCount + ? on + : pGraphState->m_DashArray[i * 2 + 1]; if (off < 0) off = 0; intervals[i * 2] = on; @@ -1261,7 +1261,7 @@ bool CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, + float font_size, uint32_t color) { if (m_pCache->DrawText(nChars, pCharPos, pFont, pObject2Device, font_size, color)) { @@ -1435,9 +1435,9 @@ bool CFX_SkiaDeviceDriver::SetClip_PathFill( pPathData->GetPoints().size() == 4) { CFX_FloatRect rectf; if (pPathData->IsRect(deviceMatrix, &rectf)) { - rectf.Intersect( - CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH), - (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); + rectf.Intersect(CFX_FloatRect(0, 0, + (float)GetDeviceCaps(FXDC_PIXEL_WIDTH), + (float)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); // note that PDF's y-axis goes up; Skia's y-axis goes down if (!cached) { SkRect skClipRect = @@ -1573,10 +1573,10 @@ bool CFX_SkiaDeviceDriver::DrawPath( return true; } -bool CFX_SkiaDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, +bool CFX_SkiaDeviceDriver::DrawCosmeticLine(float x1, + float y1, + float x2, + float y2, uint32_t color, int blend_type) { return false; @@ -1661,10 +1661,10 @@ bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, SkPath skClip; SkPath skPath; if (kAxialShading == shadingType) { - FX_FLOAT start_x = pCoords->GetNumberAt(0); - FX_FLOAT start_y = pCoords->GetNumberAt(1); - FX_FLOAT end_x = pCoords->GetNumberAt(2); - FX_FLOAT end_y = pCoords->GetNumberAt(3); + float start_x = pCoords->GetNumberAt(0); + float start_y = pCoords->GetNumberAt(1); + float end_x = pCoords->GetNumberAt(2); + float end_y = pCoords->GetNumberAt(3); SkPoint pts[] = {{start_x, start_y}, {end_x, end_y}}; skMatrix.mapPoints(pts, SK_ARRAY_COUNT(pts)); paint.setShader(SkGradientShader::MakeLinear( @@ -1701,12 +1701,12 @@ bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, skPath.addRect(skRect); skMatrix.setIdentity(); } else if (kRadialShading == shadingType) { - FX_FLOAT start_x = pCoords->GetNumberAt(0); - FX_FLOAT start_y = pCoords->GetNumberAt(1); - FX_FLOAT start_r = pCoords->GetNumberAt(2); - FX_FLOAT end_x = pCoords->GetNumberAt(3); - FX_FLOAT end_y = pCoords->GetNumberAt(4); - FX_FLOAT end_r = pCoords->GetNumberAt(5); + float start_x = pCoords->GetNumberAt(0); + float start_y = pCoords->GetNumberAt(1); + float start_r = pCoords->GetNumberAt(2); + float end_x = pCoords->GetNumberAt(3); + float end_y = pCoords->GetNumberAt(4); + float end_r = pCoords->GetNumberAt(5); SkPoint pts[] = {{start_x, start_y}, {end_x, end_y}}; paint.setShader(SkGradientShader::MakeTwoPointConical( @@ -1761,9 +1761,9 @@ bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, cubics[i].fY = point.y; } for (int i = iStartColor; i < (int)SK_ARRAY_COUNT(colors); i++) { - FX_FLOAT r; - FX_FLOAT g; - FX_FLOAT b; + float r; + float g; + float b; std::tie(r, g, b) = stream.ReadColor(); colors[i] = SkColorSetARGBInline(0xFF, (U8CPU)(r * 255), (U8CPU)(g * 255), (U8CPU)(b * 255)); diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h index ecb1104518..b26ebdd724 100644 --- a/core/fxge/skia/fx_skia_device.h +++ b/core/fxge/skia/fx_skia_device.h @@ -69,10 +69,10 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { int blend_type) override; /** Draw a single pixel (device dependant) line */ - bool DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, + bool DrawCosmeticLine(float x1, + float y1, + float x2, + float y2, uint32_t color, int blend_type) override; @@ -134,7 +134,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, + float font_size, uint32_t color) override; bool DrawShading(const CPDF_ShadingPattern* pPattern, diff --git a/core/fxge/skia/fx_skia_device_unittest.cpp b/core/fxge/skia/fx_skia_device_unittest.cpp index afd47780d7..d612840b4c 100644 --- a/core/fxge/skia/fx_skia_device_unittest.cpp +++ b/core/fxge/skia/fx_skia_device_unittest.cpp @@ -41,7 +41,7 @@ void CommonTest(CFX_SkiaDeviceDriver* driver, const State& state) { charPos[0].m_FontCharWidth = 4; CFX_Font font; - FX_FLOAT fontSize = 1; + float fontSize = 1; CFX_PathData clipPath, clipPath2; clipPath.AppendRect(0, 0, 3, 1); clipPath2.AppendRect(0, 0, 2, 1); diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index c3d2c66d9d..391af83630 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -22,7 +22,7 @@ struct PSGlyph { CFX_Font* m_pFont; uint32_t m_GlyphIndex; bool m_bGlyphAdjust; - FX_FLOAT m_AdjustMatrix[4]; + float m_AdjustMatrix[4]; }; class CPSFont { @@ -260,7 +260,7 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) { if (!m_bGraphStateSet || m_CurGraphState.m_DashCount != pGraphState->m_DashCount || FXSYS_memcmp(m_CurGraphState.m_DashArray, pGraphState->m_DashArray, - sizeof(FX_FLOAT) * m_CurGraphState.m_DashCount)) { + sizeof(float) * m_CurGraphState.m_DashCount)) { buf << "["; for (int i = 0; i < pGraphState->m_DashCount; ++i) { buf << pGraphState->m_DashArray[i] << " "; @@ -343,9 +343,9 @@ bool CFX_PSRenderer::SetDIBits(const CFX_DIBSource* pSource, int left, int top) { StartRendering(); - CFX_Matrix matrix((FX_FLOAT)(pSource->GetWidth()), 0.0f, 0.0f, - -(FX_FLOAT)(pSource->GetHeight()), (FX_FLOAT)(left), - (FX_FLOAT)(top + pSource->GetHeight())); + CFX_Matrix matrix((float)(pSource->GetWidth()), 0.0f, 0.0f, + -(float)(pSource->GetHeight()), (float)(left), + (float)(top + pSource->GetHeight())); return DrawDIBits(pSource, color, &matrix, 0); } @@ -357,9 +357,8 @@ bool CFX_PSRenderer::StretchDIBits(const CFX_DIBSource* pSource, int dest_height, uint32_t flags) { StartRendering(); - CFX_Matrix matrix((FX_FLOAT)(dest_width), 0.0f, 0.0f, - (FX_FLOAT)(-dest_height), (FX_FLOAT)(dest_left), - (FX_FLOAT)(dest_top + dest_height)); + CFX_Matrix matrix((float)(dest_width), 0.0f, 0.0f, (float)(-dest_height), + (float)(dest_left), (float)(dest_top + dest_height)); return DrawDIBits(pSource, color, &matrix, flags); } @@ -632,7 +631,7 @@ bool CFX_PSRenderer::DrawText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, + float font_size, uint32_t color) { StartRendering(); int alpha = FXARGB_A(color); diff --git a/core/fxge/win32/cfx_psrenderer.h b/core/fxge/win32/cfx_psrenderer.h index 163c6180af..133d7b9d72 100644 --- a/core/fxge/win32/cfx_psrenderer.h +++ b/core/fxge/win32/cfx_psrenderer.h @@ -70,7 +70,7 @@ class CFX_PSRenderer { const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, + float font_size, uint32_t color); private: diff --git a/core/fxge/win32/dwrite_int.h b/core/fxge/win32/dwrite_int.h index 86ead89947..105c34998c 100644 --- a/core/fxge/win32/dwrite_int.h +++ b/core/fxge/win32/dwrite_int.h @@ -46,14 +46,14 @@ class CDWriteExt { FX_RECT& stringRect, CFX_Matrix* pMatrix, void* font, - FX_FLOAT font_size, + float font_size, FX_ARGB text_color, int glyph_count, unsigned short* glyph_indices, - FX_FLOAT baselineOriginX, - FX_FLOAT baselineOriginY, + float baselineOriginX, + float baselineOriginY, void* glyph_offsets, - FX_FLOAT* glyph_advances); + float* glyph_advances); void DwDeleteFont(void* pFont); protected: diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index d1d81b18e4..b2ee4549ea 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -91,8 +91,8 @@ bool IsGDIEnabled() { HPEN CreatePen(const CFX_GraphStateData* pGraphState, const CFX_Matrix* pMatrix, uint32_t argb) { - FX_FLOAT width; - FX_FLOAT scale = 1.f; + float width; + float scale = 1.f; if (pMatrix) scale = FXSYS_fabs(pMatrix->a) > FXSYS_fabs(pMatrix->b) ? FXSYS_fabs(pMatrix->a) @@ -215,26 +215,26 @@ void SetPathToDC(HDC hDC, // altogether and replace by Skia code. struct rect_base { - FX_FLOAT x1; - FX_FLOAT y1; - FX_FLOAT x2; - FX_FLOAT y2; + float x1; + float y1; + float x2; + float y2; }; -unsigned clip_liang_barsky(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, +unsigned clip_liang_barsky(float x1, + float y1, + float x2, + float y2, const rect_base& clip_box, - FX_FLOAT* x, - FX_FLOAT* y) { - const FX_FLOAT nearzero = 1e-30f; - FX_FLOAT deltax = x2 - x1; - FX_FLOAT deltay = y2 - y1; + float* x, + float* y) { + const float nearzero = 1e-30f; + float deltax = x2 - x1; + float deltay = y2 - y1; unsigned np = 0; if (deltax == 0) deltax = (x1 > clip_box.x1) ? -nearzero : nearzero; - FX_FLOAT xin, xout; + float xin, xout; if (deltax > 0) { xin = clip_box.x1; xout = clip_box.x2; @@ -242,10 +242,10 @@ unsigned clip_liang_barsky(FX_FLOAT x1, xin = clip_box.x2; xout = clip_box.x1; } - FX_FLOAT tinx = (xin - x1) / deltax; + float tinx = (xin - x1) / deltax; if (deltay == 0) deltay = (y1 > clip_box.y1) ? -nearzero : nearzero; - FX_FLOAT yin, yout; + float yin, yout; if (deltay > 0) { yin = clip_box.y1; yout = clip_box.y2; @@ -253,8 +253,8 @@ unsigned clip_liang_barsky(FX_FLOAT x1, yin = clip_box.y2; yout = clip_box.y1; } - FX_FLOAT tiny = (yin - y1) / deltay; - FX_FLOAT tin1, tin2; + float tiny = (yin - y1) / deltay; + float tin1, tin2; if (tinx < tiny) { tin1 = tinx; tin2 = tiny; @@ -269,9 +269,9 @@ unsigned clip_liang_barsky(FX_FLOAT x1, ++np; } if (tin2 <= 1.0f) { - FX_FLOAT toutx = (xout - x1) / deltax; - FX_FLOAT touty = (yout - y1) / deltay; - FX_FLOAT tout1 = (toutx < touty) ? toutx : touty; + float toutx = (xout - x1) / deltax; + float touty = (yout - y1) / deltay; + float tout1 = (toutx < touty) ? toutx : touty; if (tin2 > 0 || tout1 > 0) { if (tin2 <= tout1) { if (tin2 > 0) { @@ -928,10 +928,7 @@ void* CGdiDeviceDriver::GetPlatformSurface() const { return (void*)m_hDC; } -void CGdiDeviceDriver::DrawLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2) { +void CGdiDeviceDriver::DrawLine(float x1, float y1, float x2, float y2) { if (!m_bMetafileDCType) { // EMF drawing is not bound to the DC. int startOutOfBoundsFlag = (x1 < 0) | ((x1 > m_Width) << 1) | ((y1 < 0) << 2) | ((y1 > m_Height) << 3); @@ -941,18 +938,18 @@ void CGdiDeviceDriver::DrawLine(FX_FLOAT x1, return; if (startOutOfBoundsFlag || endOutOfBoundsFlag) { - FX_FLOAT x[2]; - FX_FLOAT y[2]; + float x[2]; + float y[2]; int np; #ifdef _SKIA_SUPPORT_ // TODO(caryclark) temporary replacement of antigrain in line function // to permit removing antigrain altogether - rect_base rect = {0.0f, 0.0f, (FX_FLOAT)(m_Width), (FX_FLOAT)(m_Height)}; + rect_base rect = {0.0f, 0.0f, (float)(m_Width), (float)(m_Height)}; np = clip_liang_barsky(x1, y1, x2, y2, rect, x, y); #else - agg::rect_base<FX_FLOAT> rect(0.0f, 0.0f, (FX_FLOAT)(m_Width), - (FX_FLOAT)(m_Height)); - np = agg::clip_liang_barsky<FX_FLOAT>(x1, y1, x2, y2, rect, x, y); + agg::rect_base<float> rect(0.0f, 0.0f, (float)(m_Width), + (float)(m_Height)); + np = agg::clip_liang_barsky<float>(x1, y1, x2, y2, rect, x, y); #endif if (np == 0) return; @@ -994,13 +991,13 @@ bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, FX_RECT bbox = bbox_f.GetInnerRect(); if (bbox.Width() <= 0) { - return DrawCosmeticLine( - (FX_FLOAT)(bbox.left), (FX_FLOAT)(bbox.top), (FX_FLOAT)(bbox.left), - (FX_FLOAT)(bbox.bottom + 1), fill_color, FXDIB_BLEND_NORMAL); + return DrawCosmeticLine((float)(bbox.left), (float)(bbox.top), + (float)(bbox.left), (float)(bbox.bottom + 1), + fill_color, FXDIB_BLEND_NORMAL); } if (bbox.Height() <= 0) { - return DrawCosmeticLine((FX_FLOAT)(bbox.left), (FX_FLOAT)(bbox.top), - (FX_FLOAT)(bbox.right + 1), (FX_FLOAT)(bbox.top), + return DrawCosmeticLine((float)(bbox.left), (float)(bbox.top), + (float)(bbox.right + 1), (float)(bbox.top), fill_color, FXDIB_BLEND_NORMAL); } } @@ -1133,10 +1130,10 @@ bool CGdiDeviceDriver::SetClip_PathStroke( return ret; } -bool CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, +bool CGdiDeviceDriver::DrawCosmeticLine(float x1, + float y1, + float x2, + float y2, uint32_t color, int blend_type) { if (blend_type != FXDIB_BLEND_NORMAL) diff --git a/core/fxge/win32/fx_win32_dwrite.cpp b/core/fxge/win32/fx_win32_dwrite.cpp index dc0f5ed745..e088e832bc 100644 --- a/core/fxge/win32/fx_win32_dwrite.cpp +++ b/core/fxge/win32/fx_win32_dwrite.cpp @@ -227,14 +227,14 @@ bool CDWriteExt::DwRendingString(void* renderTarget, FX_RECT& stringRect, CFX_Matrix* pMatrix, void* font, - FX_FLOAT font_size, + float font_size, FX_ARGB text_color, int glyph_count, unsigned short* glyph_indices, - FX_FLOAT baselineOriginX, - FX_FLOAT baselineOriginY, + float baselineOriginX, + float baselineOriginY, void* glyph_offsets, - FX_FLOAT* glyph_advances) { + float* glyph_advances) { if (!renderTarget) { return true; } diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index 1e51bba2b3..8a7f55e0cb 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -779,7 +779,7 @@ bool CGdiplusExt::GdipCreateFontFamilyFromName(const wchar_t* name, return false; } bool CGdiplusExt::GdipCreateFontFromFamily(void* pFamily, - FX_FLOAT font_size, + float font_size, int fontstyle, int flag, void** pFont) { @@ -793,13 +793,13 @@ bool CGdiplusExt::GdipCreateFontFromFamily(void* pFamily, } return false; } -void CGdiplusExt::GdipGetFontSize(void* pFont, FX_FLOAT* size) { +void CGdiplusExt::GdipGetFontSize(void* pFont, float* size) { REAL get_size; CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; GpStatus status = CallFunc(GdipGetFontSize)((GpFont*)pFont, (REAL*)&get_size); if (status == Ok) { - *size = (FX_FLOAT)get_size; + *size = (float)get_size; } else { *size = 0; } @@ -845,7 +845,7 @@ void CGdiplusExt::GdipDeleteBrush(void* pBrush) { CallFunc(GdipDeleteBrush)((GpSolidFill*)pBrush); } void* CGdiplusExt::GdipCreateFontFromCollection(void* pFontCollection, - FX_FLOAT font_size, + float font_size, int fontstyle) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; @@ -869,12 +869,12 @@ void* CGdiplusExt::GdipCreateFontFromCollection(void* pFontCollection, } return pFont; } -void CGdiplusExt::GdipCreateMatrix(FX_FLOAT a, - FX_FLOAT b, - FX_FLOAT c, - FX_FLOAT d, - FX_FLOAT e, - FX_FLOAT f, +void CGdiplusExt::GdipCreateMatrix(float a, + float b, + float c, + float d, + float e, + float f, void** matrix) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; @@ -972,11 +972,11 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, bool bTextMode = false) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; - FX_FLOAT width = pGraphState ? pGraphState->m_LineWidth : 1.0f; + float width = pGraphState ? pGraphState->m_LineWidth : 1.0f; if (!bTextMode) { - FX_FLOAT unit = - pMatrix ? 1.0f / ((pMatrix->GetXUnit() + pMatrix->GetYUnit()) / 2) - : 1.0f; + float unit = pMatrix + ? 1.0f / ((pMatrix->GetXUnit() + pMatrix->GetYUnit()) / 2) + : 1.0f; if (width < unit) { width = unit; } @@ -1015,13 +1015,13 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, } CallFunc(GdipSetPenLineJoin)(pPen, lineJoin); if (pGraphState->m_DashCount) { - FX_FLOAT* pDashArray = FX_Alloc( - FX_FLOAT, pGraphState->m_DashCount + pGraphState->m_DashCount % 2); + float* pDashArray = FX_Alloc( + float, pGraphState->m_DashCount + pGraphState->m_DashCount % 2); int nCount = 0; - FX_FLOAT on_leftover = 0, off_leftover = 0; + float on_leftover = 0, off_leftover = 0; for (int i = 0; i < pGraphState->m_DashCount; i += 2) { - FX_FLOAT on_phase = pGraphState->m_DashArray[i]; - FX_FLOAT off_phase; + float on_phase = pGraphState->m_DashArray[i]; + float off_phase; if (i == pGraphState->m_DashCount - 1) { off_phase = on_phase; } else { @@ -1057,7 +1057,7 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, } } CallFunc(GdipSetPenDashArray)(pPen, pDashArray, nCount); - FX_FLOAT phase = pGraphState->m_DashPhase; + float phase = pGraphState->m_DashPhase; if (bDashExtend) { if (phase < 0.5f) { phase = 0; @@ -1089,7 +1089,7 @@ static bool IsSmallTriangle(PointF* points, } CFX_PointF diff = p1 - p2; - FX_FLOAT distance_square = (diff.x * diff.x) + (diff.y * diff.y); + float distance_square = (diff.x * diff.x) + (diff.y * diff.y); if (distance_square < (1.0f * 2 + 1.0f / 4)) { v1 = i; v2 = pair1; diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp index cda83ebc95..061896f09b 100644 --- a/core/fxge/win32/fx_win32_print.cpp +++ b/core/fxge/win32/fx_win32_print.cpp @@ -199,7 +199,7 @@ bool CGdiPrinterDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, + float font_size, uint32_t color) { #if defined(PDFIUM_PRINT_TEXT_WITH_GDI) if (!g_pdfium_print_text_with_gdi) @@ -287,7 +287,7 @@ bool CGdiPrinterDriver::DrawDeviceText(int nChars, // Text CFX_WideString wsText; std::vector<INT> spacing(nChars); - FX_FLOAT fPreviousOriginX = 0; + float fPreviousOriginX = 0; for (int i = 0; i < nChars; ++i) { // Only works with PDFs from Skia's PDF generator. Cannot handle arbitrary // values from PDFs. @@ -300,8 +300,8 @@ bool CGdiPrinterDriver::DrawDeviceText(int nChars, // Round the spacing to the nearest integer, but keep track of the rounding // error for calculating the next spacing value. - FX_FLOAT fOriginX = charpos.m_Origin.x * kScaleFactor; - FX_FLOAT fPixelSpacing = fOriginX - fPreviousOriginX; + float fOriginX = charpos.m_Origin.x * kScaleFactor; + float fPixelSpacing = fOriginX - fPreviousOriginX; spacing[i] = FXSYS_round(fPixelSpacing); fPreviousOriginX = fOriginX - (fPixelSpacing - spacing[i]); @@ -349,10 +349,10 @@ CPSPrinterDriver::CPSPrinterDriver(HDC hDC, int pslevel, bool bCmykOutput) for (uint32_t i = 0; i < pData->rdh.nCount; i++) { RECT* pRect = reinterpret_cast<RECT*>(pData->Buffer + pData->rdh.nRgnSize * i); - path.AppendRect(static_cast<FX_FLOAT>(pRect->left), - static_cast<FX_FLOAT>(pRect->bottom), - static_cast<FX_FLOAT>(pRect->right), - static_cast<FX_FLOAT>(pRect->top)); + path.AppendRect(static_cast<float>(pRect->left), + static_cast<float>(pRect->bottom), + static_cast<float>(pRect->right), + static_cast<float>(pRect->top)); } m_PSRenderer.SetClip_PathFill(&path, nullptr, FXFILL_WINDING); } @@ -483,7 +483,7 @@ bool CPSPrinterDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, + float font_size, uint32_t color) { return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pObject2Device, font_size, color); diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h index 08a8224db6..54ea3716e1 100644 --- a/core/fxge/win32/win32_int.h +++ b/core/fxge/win32/win32_int.h @@ -75,12 +75,12 @@ class CGdiplusExt { const void* matrix); void GdipCreateBrush(uint32_t fill_argb, void** pBrush); void GdipDeleteBrush(void* pBrush); - void GdipCreateMatrix(FX_FLOAT a, - FX_FLOAT b, - FX_FLOAT c, - FX_FLOAT d, - FX_FLOAT e, - FX_FLOAT f, + void GdipCreateMatrix(float a, + float b, + float c, + float d, + float e, + float f, void** matrix); void GdipDeleteMatrix(void* matrix); bool GdipCreateFontFamilyFromName(const wchar_t* name, @@ -88,17 +88,17 @@ class CGdiplusExt { void** pFamily); void GdipDeleteFontFamily(void* pFamily); bool GdipCreateFontFromFamily(void* pFamily, - FX_FLOAT font_size, + float font_size, int fontstyle, int flag, void** pFont); void* GdipCreateFontFromCollection(void* pFontCollection, - FX_FLOAT font_size, + float font_size, int fontstyle); void GdipDeleteFont(void* pFont); bool GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap); void GdipDisposeImage(void* bitmap); - void GdipGetFontSize(void* pFont, FX_FLOAT* size); + void GdipGetFontSize(void* pFont, float* size); void* GdiAddFontMemResourceEx(void* pFontdata, uint32_t size, void* pdv, @@ -147,16 +147,16 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver { bool FillRectWithBlend(const FX_RECT* pRect, uint32_t fill_color, int blend_type) override; - bool DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, + bool DrawCosmeticLine(float x1, + float y1, + float x2, + float y2, uint32_t color, int blend_type) override; bool GetClipBox(FX_RECT* pRect) override; void* GetPlatformSurface() const override; - void DrawLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2); + void DrawLine(float x1, float y1, float x2, float y2); bool GDI_SetDIBits(CFX_DIBitmap* pBitmap, const FX_RECT* pSrcRect, @@ -257,7 +257,7 @@ class CGdiPrinterDriver : public CGdiDeviceDriver { const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, + float font_size, uint32_t color) override; const int m_HorzSize; @@ -316,7 +316,7 @@ class CPSPrinterDriver : public IFX_RenderDeviceDriver { const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, + float font_size, uint32_t color) override; void* GetPlatformSurface() const override; diff --git a/fpdfsdk/cba_annotiterator.cpp b/fpdfsdk/cba_annotiterator.cpp index 409a9282d1..3e35ff8294 100644 --- a/fpdfsdk/cba_annotiterator.cpp +++ b/fpdfsdk/cba_annotiterator.cpp @@ -113,7 +113,7 @@ void CBA_AnnotIterator::GenerateResults() { while (!sa.empty()) { int nLeftTopIndex = -1; - FX_FLOAT fTop = 0.0f; + float fTop = 0.0f; for (int i = sa.size() - 1; i >= 0; i--) { CFX_FloatRect rcAnnot = GetAnnotRect(sa[i]); if (rcAnnot.top > fTop) { @@ -129,7 +129,7 @@ void CBA_AnnotIterator::GenerateResults() { std::vector<size_t> aSelect; for (size_t i = 0; i < sa.size(); ++i) { CFX_FloatRect rcAnnot = GetAnnotRect(sa[i]); - FX_FLOAT fCenterY = (rcAnnot.top + rcAnnot.bottom) / 2.0f; + float fCenterY = (rcAnnot.top + rcAnnot.bottom) / 2.0f; if (fCenterY > rcLeftTop.bottom && fCenterY < rcLeftTop.top) aSelect.push_back(i); } @@ -145,7 +145,7 @@ void CBA_AnnotIterator::GenerateResults() { while (!sa.empty()) { int nLeftTopIndex = -1; - FX_FLOAT fLeft = -1.0f; + float fLeft = -1.0f; for (int i = sa.size() - 1; i >= 0; --i) { CFX_FloatRect rcAnnot = GetAnnotRect(sa[i]); if (fLeft < 0) { @@ -164,7 +164,7 @@ void CBA_AnnotIterator::GenerateResults() { std::vector<size_t> aSelect; for (size_t i = 0; i < sa.size(); ++i) { CFX_FloatRect rcAnnot = GetAnnotRect(sa[i]); - FX_FLOAT fCenterX = (rcAnnot.left + rcAnnot.right) / 2.0f; + float fCenterX = (rcAnnot.left + rcAnnot.right) / 2.0f; if (fCenterX > rcLeftTop.left && fCenterX < rcLeftTop.right) aSelect.push_back(i); } diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp index b6dc19d48f..ea64412d4c 100644 --- a/fpdfsdk/cfx_systemhandler.cpp +++ b/fpdfsdk/cfx_systemhandler.cpp @@ -46,10 +46,10 @@ void CFX_SystemHandler::InvalidateRect(CPDFSDK_Widget* widget, FX_RECT rect) { CFX_Matrix device2page; device2page.SetReverse(page2device); - CFX_PointF left_top = device2page.Transform(CFX_PointF( - static_cast<FX_FLOAT>(rect.left), static_cast<FX_FLOAT>(rect.top))); + CFX_PointF left_top = device2page.Transform( + CFX_PointF(static_cast<float>(rect.left), static_cast<float>(rect.top))); CFX_PointF right_bottom = device2page.Transform(CFX_PointF( - static_cast<FX_FLOAT>(rect.right), static_cast<FX_FLOAT>(rect.bottom))); + static_cast<float>(rect.right), static_cast<float>(rect.bottom))); CFX_FloatRect rcPDF(left_top.x, right_bottom.y, right_bottom.x, left_top.y); rcPDF.Normalize(); diff --git a/fpdfsdk/cpdfsdk_annot.cpp b/fpdfsdk/cpdfsdk_annot.cpp index 4dcce48465..dcfcac92fc 100644 --- a/fpdfsdk/cpdfsdk_annot.cpp +++ b/fpdfsdk/cpdfsdk_annot.cpp @@ -43,11 +43,11 @@ CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { #endif // PDF_ENABLE_XFA -FX_FLOAT CPDFSDK_Annot::GetMinWidth() const { +float CPDFSDK_Annot::GetMinWidth() const { return kMinWidth; } -FX_FLOAT CPDFSDK_Annot::GetMinHeight() const { +float CPDFSDK_Annot::GetMinHeight() const { return kMinHeight; } diff --git a/fpdfsdk/cpdfsdk_annot.h b/fpdfsdk/cpdfsdk_annot.h index 36e7b56612..1053c00c13 100644 --- a/fpdfsdk/cpdfsdk_annot.h +++ b/fpdfsdk/cpdfsdk_annot.h @@ -32,8 +32,8 @@ class CPDFSDK_Annot : public CFX_Observable<CPDFSDK_Annot> { virtual CXFA_FFWidget* GetXFAWidget() const; #endif // PDF_ENABLE_XFA - virtual FX_FLOAT GetMinWidth() const; - virtual FX_FLOAT GetMinHeight() const; + virtual float GetMinWidth() const; + virtual float GetMinHeight() const; virtual int GetLayoutOrder() const; virtual CPDF_Annot* GetPDFAnnot() const; virtual CPDF_Annot::Subtype GetAnnotSubtype() const; diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp index 3c96550a42..129491c210 100644 --- a/fpdfsdk/cpdfsdk_baannot.cpp +++ b/fpdfsdk/cpdfsdk_baannot.cpp @@ -245,11 +245,11 @@ BorderStyle CPDFSDK_BAAnnot::GetBorderStyle() const { void CPDFSDK_BAAnnot::SetColor(FX_COLORREF color) { CPDF_Array* pArray = m_pAnnot->GetAnnotDict()->SetNewFor<CPDF_Array>("C"); - pArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(FXSYS_GetRValue(color)) / + pArray->AddNew<CPDF_Number>(static_cast<float>(FXSYS_GetRValue(color)) / 255.0f); - pArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(FXSYS_GetGValue(color)) / + pArray->AddNew<CPDF_Number>(static_cast<float>(FXSYS_GetGValue(color)) / 255.0f); - pArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(FXSYS_GetBValue(color)) / + pArray->AddNew<CPDF_Number>(static_cast<float>(FXSYS_GetBValue(color)) / 255.0f); } @@ -261,28 +261,28 @@ bool CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const { if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArrayFor("C")) { size_t nCount = pEntry->GetCount(); if (nCount == 1) { - FX_FLOAT g = pEntry->GetNumberAt(0) * 255; + float g = pEntry->GetNumberAt(0) * 255; color = FXSYS_RGB((int)g, (int)g, (int)g); return true; } else if (nCount == 3) { - FX_FLOAT r = pEntry->GetNumberAt(0) * 255; - FX_FLOAT g = pEntry->GetNumberAt(1) * 255; - FX_FLOAT b = pEntry->GetNumberAt(2) * 255; + float r = pEntry->GetNumberAt(0) * 255; + float g = pEntry->GetNumberAt(1) * 255; + float b = pEntry->GetNumberAt(2) * 255; color = FXSYS_RGB((int)r, (int)g, (int)b); return true; } else if (nCount == 4) { - FX_FLOAT c = pEntry->GetNumberAt(0); - FX_FLOAT m = pEntry->GetNumberAt(1); - FX_FLOAT y = pEntry->GetNumberAt(2); - FX_FLOAT k = pEntry->GetNumberAt(3); - - FX_FLOAT r = 1.0f - std::min(1.0f, c + k); - FX_FLOAT g = 1.0f - std::min(1.0f, m + k); - FX_FLOAT b = 1.0f - std::min(1.0f, y + k); + float c = pEntry->GetNumberAt(0); + float m = pEntry->GetNumberAt(1); + float y = pEntry->GetNumberAt(2); + float k = pEntry->GetNumberAt(3); + + float r = 1.0f - std::min(1.0f, c + k); + float g = 1.0f - std::min(1.0f, m + k); + float b = 1.0f - std::min(1.0f, y + k); color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)(b * 255)); diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index c67948da90..d5a04fef3e 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -96,10 +96,9 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, if (pPage->GetContext()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { CFX_Graphics gs(pDevice); - CFX_RectF rectClip(static_cast<FX_FLOAT>(pClip.left), - static_cast<FX_FLOAT>(pClip.top), - static_cast<FX_FLOAT>(pClip.Width()), - static_cast<FX_FLOAT>(pClip.Height())); + CFX_RectF rectClip( + static_cast<float>(pClip.left), static_cast<float>(pClip.top), + static_cast<float>(pClip.Width()), static_cast<float>(pClip.Height())); gs.SetClipRect(rectClip); std::unique_ptr<CXFA_RenderContext> pRenderContext(new CXFA_RenderContext); CXFA_RenderOptions renderOptions; diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index e5df453d90..75c34b38b4 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -584,11 +584,11 @@ bool CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const { return iColorType != COLORTYPE_TRANSPARENT; } -FX_FLOAT CPDFSDK_Widget::GetFontSize() const { +float CPDFSDK_Widget::GetFontSize() const { CPDF_FormControl* pFormCtrl = GetFormControl(); CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance(); CFX_ByteString csFont = ""; - FX_FLOAT fFontSize = 0.0f; + float fFontSize = 0.0f; pDa.GetFont(csFont, fFontSize); return fFontSize; @@ -892,7 +892,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() { CPWL_Color crBackground; CPWL_Color crBorder; int iColorType; - FX_FLOAT fc[4]; + float fc[4]; pControl->GetOriginalBackgroundColor(iColorType, fc); if (iColorType > 0) crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); @@ -901,7 +901,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() { if (iColorType > 0) crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); - FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); + float fBorderWidth = (float)GetBorderWidth(); CPWL_Dash dsBorder(3, 0, 0); CPWL_Color crLeftTop; CPWL_Color crRightBottom; @@ -929,7 +929,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() { CPWL_Color crText(COLORTYPE_GRAY, 0); - FX_FLOAT fFontSize = 12.0f; + float fFontSize = 12.0f; CFX_ByteString csNameTag; CPDF_DefaultAppearance da = pControl->GetDefaultAppearance(); @@ -1071,7 +1071,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() { CPDF_FormControl* pControl = GetFormControl(); CPWL_Color crBackground, crBorder, crText; int iColorType; - FX_FLOAT fc[4]; + float fc[4]; pControl->GetOriginalBackgroundColor(iColorType, fc); if (iColorType > 0) @@ -1081,7 +1081,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() { if (iColorType > 0) crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); - FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); + float fBorderWidth = (float)GetBorderWidth(); CPWL_Dash dsBorder(3, 0, 0); CPWL_Color crLeftTop, crRightBottom; @@ -1191,7 +1191,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() { CPDF_FormControl* pControl = GetFormControl(); CPWL_Color crBackground, crBorder, crText; int iColorType; - FX_FLOAT fc[4]; + float fc[4]; pControl->GetOriginalBackgroundColor(iColorType, fc); if (iColorType > 0) @@ -1201,7 +1201,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() { if (iColorType > 0) crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); - FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); + float fBorderWidth = (float)GetBorderWidth(); CPWL_Dash dsBorder(3, 0, 0); CPWL_Color crLeftTop; CPWL_Color crRightBottom; @@ -1369,7 +1369,7 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const CFX_WideString* sValue) { pEdit->SetPlateRect(rcEdit); pEdit->SetAlignmentV(1, true); - FX_FLOAT fFontSize = GetFontSize(); + float fFontSize = GetFontSize(); if (IsFloatZero(fFontSize)) pEdit->SetAutoFontSize(true, true); else @@ -1428,14 +1428,14 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() { pEdit->SetPlateRect(CFX_FloatRect(rcClient.left, 0.0f, rcClient.right, 0.0f)); - FX_FLOAT fFontSize = GetFontSize(); + float fFontSize = GetFontSize(); pEdit->SetFontSize(IsFloatZero(fFontSize) ? 12.0f : fFontSize); pEdit->Initialize(); CFX_ByteTextBuf sList; - FX_FLOAT fy = rcClient.top; + float fy = rcClient.top; int32_t nTop = pField->GetTopVisibleIndex(); int32_t nCount = pField->CountOptions(); @@ -1453,7 +1453,7 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() { pEdit->SetText(pField->GetOptionLabel(i)); CFX_FloatRect rcContent = pEdit->GetContentRect(); - FX_FLOAT fItemHeight = rcContent.Height(); + float fItemHeight = rcContent.Height(); if (bSelected) { CFX_FloatRect rcItem = @@ -1530,7 +1530,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) { int nMaxLen = pField->GetMaxLen(); bool bCharArray = (dwFieldFlags >> 24) & 1; - FX_FLOAT fFontSize = GetFontSize(); + float fFontSize = GetFontSize(); #ifdef PDF_ENABLE_XFA CFX_WideString sValueTmp; @@ -1642,7 +1642,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) { CFX_FloatRect CPDFSDK_Widget::GetClientRect() const { CFX_FloatRect rcWindow = GetRotatedRect(); - FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); + float fBorderWidth = (float)GetBorderWidth(); switch (GetBorderStyle()) { case BorderStyle::BEVELED: case BorderStyle::INSET: @@ -1657,8 +1657,8 @@ CFX_FloatRect CPDFSDK_Widget::GetClientRect() const { CFX_FloatRect CPDFSDK_Widget::GetRotatedRect() const { CFX_FloatRect rectAnnot = GetRect(); - FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; - FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; + float fWidth = rectAnnot.right - rectAnnot.left; + float fHeight = rectAnnot.top - rectAnnot.bottom; CPDF_FormControl* pControl = GetFormControl(); CFX_FloatRect rcPDFWindow; @@ -1691,7 +1691,7 @@ CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const { CPWL_Color crBackground = GetFillPWLColor(); CPWL_Color crLeftTop, crRightBottom; - FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); + float fBorderWidth = (float)GetBorderWidth(); CPWL_Dash dsBorder(3, 0, 0); BorderStyle nBorderStyle = GetBorderStyle(); @@ -1722,8 +1722,8 @@ CFX_Matrix CPDFSDK_Widget::GetMatrix() const { CFX_Matrix mt; CPDF_FormControl* pControl = GetFormControl(); CFX_FloatRect rcAnnot = GetRect(); - FX_FLOAT fWidth = rcAnnot.right - rcAnnot.left; - FX_FLOAT fHeight = rcAnnot.top - rcAnnot.bottom; + float fWidth = rcAnnot.right - rcAnnot.left; + float fHeight = rcAnnot.top - rcAnnot.bottom; switch (abs(pControl->GetRotation() % 360)) { case 0: @@ -1751,7 +1751,7 @@ CPWL_Color CPDFSDK_Widget::GetTextPWLColor() const { CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); if (da.HasColor()) { int32_t iColorType; - FX_FLOAT fc[4]; + float fc[4]; da.GetColor(iColorType, fc); crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); } @@ -1764,7 +1764,7 @@ CPWL_Color CPDFSDK_Widget::GetBorderPWLColor() const { CPDF_FormControl* pFormCtrl = GetFormControl(); int32_t iColorType; - FX_FLOAT fc[4]; + float fc[4]; pFormCtrl->GetOriginalBorderColor(iColorType, fc); if (iColorType > 0) crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); @@ -1777,7 +1777,7 @@ CPWL_Color CPDFSDK_Widget::GetFillPWLColor() const { CPDF_FormControl* pFormCtrl = GetFormControl(); int32_t iColorType; - FX_FLOAT fc[4]; + float fc[4]; pFormCtrl->GetOriginalBackgroundColor(iColorType, fc); if (iColorType > 0) crFill = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); diff --git a/fpdfsdk/cpdfsdk_widget.h b/fpdfsdk/cpdfsdk_widget.h index 21e5169706..9f58cc1d61 100644 --- a/fpdfsdk/cpdfsdk_widget.h +++ b/fpdfsdk/cpdfsdk_widget.h @@ -77,7 +77,7 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { bool GetFillColor(FX_COLORREF& color) const; bool GetBorderColor(FX_COLORREF& color) const; bool GetTextColor(FX_COLORREF& color) const; - FX_FLOAT GetFontSize() const; + float GetFontSize() const; int GetSelectedIndex(int nIndex) const; #ifndef PDF_ENABLE_XFA diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index da6f9208e0..947c495f19 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -438,8 +438,8 @@ CFX_WideString CFFL_FormFiller::LoadPopupMenuString(int nIndex) { CFX_FloatRect CFFL_FormFiller::GetPDFWindowRect() const { CFX_FloatRect rectAnnot = m_pWidget->GetPDFAnnot()->GetRect(); - FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; - FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; + float fWidth = rectAnnot.right - rectAnnot.left; + float fHeight = rectAnnot.top - rectAnnot.bottom; if ((m_pWidget->GetRotate() / 90) & 0x01) return CFX_FloatRect(0, 0, fHeight, fWidth); diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index a830d529cb..4cebc83fc4 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -527,10 +527,10 @@ void CFFL_InteractiveFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) { } void CFFL_InteractiveFormFiller::QueryWherePopup(void* pPrivateData, - FX_FLOAT fPopupMin, - FX_FLOAT fPopupMax, + float fPopupMin, + float fPopupMax, int32_t& nRet, - FX_FLOAT& fPopupRet) { + float& fPopupRet) { CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; CFX_FloatRect rcPageView(0, 0, 0, 0); @@ -540,8 +540,8 @@ void CFFL_InteractiveFormFiller::QueryWherePopup(void* pPrivateData, CFX_FloatRect rcAnnot = pData->pWidget->GetRect(); - FX_FLOAT fTop = 0.0f; - FX_FLOAT fBottom = 0.0f; + float fTop = 0.0f; + float fBottom = 0.0f; CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pData->pWidget; switch (pWidget->GetRotate() / 90) { @@ -564,9 +564,9 @@ void CFFL_InteractiveFormFiller::QueryWherePopup(void* pPrivateData, break; } - FX_FLOAT fFactHeight = 0; + float fFactHeight = 0; bool bBottom = true; - FX_FLOAT fMaxListBoxHeight = 0; + float fMaxListBoxHeight = 0; if (fPopupMax > FFL_MAXLISTBOXHEIGHT) { if (fPopupMin > FFL_MAXLISTBOXHEIGHT) { fMaxListBoxHeight = fPopupMin; diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index 90fd98c0e8..3c23a6e2f8 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h @@ -139,10 +139,10 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { // IPWL_Filler_Notify: void QueryWherePopup(void* pPrivateData, - FX_FLOAT fPopupMin, - FX_FLOAT fPopupMax, + float fPopupMin, + float fPopupMax, int32_t& nRet, - FX_FLOAT& fPopupRet) override; + float& fPopupRet) override; void OnBeforeKeyStroke(void* pPrivateData, CFX_WideString& strChange, const CFX_WideString& strChangeEx, diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index 06ea939b72..c43412cfc7 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -123,14 +123,14 @@ int ParserAnnots(CPDF_Document* pSourceDoc, return FLATTEN_SUCCESS; } -FX_FLOAT GetMinMaxValue(const std::vector<CFX_FloatRect>& array, - FPDF_TYPE type, - FPDF_VALUE value) { +float GetMinMaxValue(const std::vector<CFX_FloatRect>& array, + FPDF_TYPE type, + FPDF_VALUE value) { size_t nRects = array.size(); if (nRects <= 0) return 0.0f; - std::vector<FX_FLOAT> pArray(nRects); + std::vector<float> pArray(nRects); switch (value) { case LEFT: for (size_t i = 0; i < nRects; i++) @@ -153,7 +153,7 @@ FX_FLOAT GetMinMaxValue(const std::vector<CFX_FloatRect>& array, return 0.0f; } - FX_FLOAT fRet = pArray[0]; + float fRet = pArray[0]; if (type == MAX) { for (size_t i = 1; i < nRects; i++) fRet = std::max(fRet, pArray[i]); @@ -231,11 +231,11 @@ CFX_Matrix GetMatrix(CFX_FloatRect rcAnnot, matrix.TransformRect(rcStream); rcStream.Normalize(); - FX_FLOAT a = rcAnnot.Width() / rcStream.Width(); - FX_FLOAT d = rcAnnot.Height() / rcStream.Height(); + float a = rcAnnot.Width() / rcStream.Width(); + float d = rcAnnot.Height() / rcStream.Height(); - FX_FLOAT e = rcAnnot.left - rcStream.left * a; - FX_FLOAT f = rcAnnot.bottom - rcStream.bottom * d; + float e = rcAnnot.left - rcStream.left * a; + float f = rcAnnot.bottom - rcStream.bottom * d; return CFX_Matrix(a, 0, 0, d, e, f); } diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp index 3427f4ea58..32ba3a7525 100644 --- a/fpdfsdk/fpdf_transformpage.cpp +++ b/fpdfsdk/fpdf_transformpage.cpp @@ -206,8 +206,7 @@ FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object, CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_object; if (!pPageObj) return; - CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, - (FX_FLOAT)e, (FX_FLOAT)f); + CFX_Matrix matrix((float)a, (float)b, (float)c, (float)d, (float)e, (float)f); // Special treatment to shading object, because the ClipPath for shading // object is already transformed. diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp index f7d94c2f97..39c7602565 100644 --- a/fpdfsdk/fpdfdoc.cpp +++ b/fpdfsdk/fpdfdoc.cpp @@ -258,9 +258,9 @@ DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, return nullptr; return pLinkList - ->GetLinkAtPoint( - pPage, CFX_PointF(static_cast<FX_FLOAT>(x), static_cast<FX_FLOAT>(y)), - nullptr) + ->GetLinkAtPoint(pPage, + CFX_PointF(static_cast<float>(x), static_cast<float>(y)), + nullptr) .GetDict(); } @@ -277,7 +277,7 @@ DLLEXPORT int STDCALL FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, int z_order = -1; pLinkList->GetLinkAtPoint( - pPage, CFX_PointF(static_cast<FX_FLOAT>(x), static_cast<FX_FLOAT>(y)), + pPage, CFX_PointF(static_cast<float>(x), static_cast<float>(y)), &z_order); return z_order; } diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp index 56875e233e..ad5605011c 100644 --- a/fpdfsdk/fpdfeditimg.cpp +++ b/fpdfsdk/fpdfeditimg.cpp @@ -78,10 +78,9 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, return false; CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object); - pImgObj->set_matrix( - CFX_Matrix(static_cast<FX_FLOAT>(a), static_cast<FX_FLOAT>(b), - static_cast<FX_FLOAT>(c), static_cast<FX_FLOAT>(d), - static_cast<FX_FLOAT>(e), static_cast<FX_FLOAT>(f))); + pImgObj->set_matrix(CFX_Matrix(static_cast<float>(a), static_cast<float>(b), + static_cast<float>(c), static_cast<float>(d), + static_cast<float>(e), static_cast<float>(f))); pImgObj->CalcBoundingBox(); return true; } diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index 63740ba083..cff339c8f8 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -112,8 +112,8 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, CPDF_Array* pMediaBoxArray = pPageDict->SetNewFor<CPDF_Array>("MediaBox"); pMediaBoxArray->AddNew<CPDF_Number>(0); pMediaBoxArray->AddNew<CPDF_Number>(0); - pMediaBoxArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(width)); - pMediaBoxArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(height)); + pMediaBoxArray->AddNew<CPDF_Number>(static_cast<float>(width)); + pMediaBoxArray->AddNew<CPDF_Number>(static_cast<float>(height)); pPageDict->SetNewFor<CPDF_Number>("Rotate", 0); pPageDict->SetNewFor<CPDF_Dictionary>("Resources"); @@ -267,8 +267,7 @@ DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, if (!pPageObj) return; - CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, - (FX_FLOAT)e, (FX_FLOAT)f); + CFX_Matrix matrix((float)a, (float)b, (float)c, (float)d, (float)e, (float)f); pPageObj->Transform(matrix); } @@ -287,8 +286,8 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page, for (size_t i = 0; i < AnnotList.Count(); ++i) { CPDF_Annot* pAnnot = AnnotList.GetAt(i); CFX_FloatRect rect = pAnnot->GetRect(); // transformAnnots Rectangle - CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, - (FX_FLOAT)e, (FX_FLOAT)f); + CFX_Matrix matrix((float)a, (float)b, (float)c, (float)d, (float)e, + (float)f); matrix.TransformRect(rect); CPDF_Array* pRectArray = pAnnot->GetAnnotDict()->GetArrayFor("Rect"); diff --git a/fpdfsdk/fpdfeditpath.cpp b/fpdfsdk/fpdfeditpath.cpp index d7ffd8b1f2..f085ed3481 100644 --- a/fpdfsdk/fpdfeditpath.cpp +++ b/fpdfsdk/fpdfeditpath.cpp @@ -35,7 +35,7 @@ DLLEXPORT FPDF_BOOL FPDFPath_SetStrokeColor(FPDF_PAGEOBJECT path, auto* pPathObj = reinterpret_cast<CPDF_PathObject*>(path); pPathObj->m_GeneralState.SetStrokeAlpha(A / 255.f); - FX_FLOAT rgb[3] = {R / 255.f, G / 255.f, B / 255.f}; + float rgb[3] = {R / 255.f, G / 255.f, B / 255.f}; pPathObj->m_ColorState.SetStrokeColor( CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); return true; @@ -60,7 +60,7 @@ DLLEXPORT FPDF_BOOL FPDFPath_SetFillColor(FPDF_PAGEOBJECT path, auto* pPathObj = reinterpret_cast<CPDF_PathObject*>(path); pPathObj->m_GeneralState.SetFillAlpha(A / 255.f); - FX_FLOAT rgb[3] = {R / 255.f, G / 255.f, B / 255.f}; + float rgb[3] = {R / 255.f, G / 255.f, B / 255.f}; pPathObj->m_ColorState.SetFillColor( CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); return true; diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp index 57ff6b669c..3c866a91a3 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -156,8 +156,8 @@ DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, if (pPage) { CPDF_InterForm interform(pPage->m_pDocument); CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint( - pPage, CFX_PointF(static_cast<FX_FLOAT>(page_x), - static_cast<FX_FLOAT>(page_y)), + pPage, + CFX_PointF(static_cast<float>(page_x), static_cast<float>(page_y)), nullptr); if (!pFormCtrl) return -1; @@ -198,8 +198,8 @@ DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, rcWidget.bottom -= 1.0f; rcWidget.top += 1.0f; - if (rcWidget.Contains(CFX_PointF(static_cast<FX_FLOAT>(page_x), - static_cast<FX_FLOAT>(page_y)))) { + if (rcWidget.Contains(CFX_PointF(static_cast<float>(page_x), + static_cast<float>(page_y)))) { return FPDF_FORMFIELD_XFA; } pXFAAnnot = pWidgetIterator->MoveToNext(); @@ -227,8 +227,7 @@ DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, CPDF_InterForm interform(pPage->m_pDocument); int z_order = -1; (void)interform.GetControlAtPoint( - pPage, - CFX_PointF(static_cast<FX_FLOAT>(page_x), static_cast<FX_FLOAT>(page_y)), + pPage, CFX_PointF(static_cast<float>(page_x), static_cast<float>(page_y)), &z_order); return z_order; } @@ -318,7 +317,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle, if (!pPageView) return false; - CFX_PointF pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); + CFX_PointF pt((float)page_x, (float)page_y); return pPageView->OnLButtonUp(pt, modifier); } @@ -343,7 +342,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, if (!pPageView) return false; - CFX_PointF pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); + CFX_PointF pt((float)page_x, (float)page_y); return pPageView->OnRButtonUp(pt, modifier); } #endif // PDF_ENABLE_XFA diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp index 0432afd707..cbb682d85a 100644 --- a/fpdfsdk/fpdftext.cpp +++ b/fpdfsdk/fpdftext.cpp @@ -134,9 +134,9 @@ DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(text_page); return textpage->GetIndexAtPos( - CFX_PointF(static_cast<FX_FLOAT>(x), static_cast<FX_FLOAT>(y)), - CFX_SizeF(static_cast<FX_FLOAT>(xTolerance), - static_cast<FX_FLOAT>(yTolerance))); + CFX_PointF(static_cast<float>(x), static_cast<float>(y)), + CFX_SizeF(static_cast<float>(xTolerance), + static_cast<float>(yTolerance))); } DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, @@ -201,8 +201,7 @@ DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page, return 0; CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(text_page); - CFX_FloatRect rect((FX_FLOAT)left, (FX_FLOAT)bottom, (FX_FLOAT)right, - (FX_FLOAT)top); + CFX_FloatRect rect((float)left, (float)bottom, (float)right, (float)top); CFX_WideString str = textpage->GetTextByRect(rect); if (buflen <= 0 || !buffer) diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 9100017bea..4c3631fc88 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -891,8 +891,8 @@ DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, CFX_Matrix device2page; device2page.SetReverse(page2device); - CFX_PointF pos = device2page.Transform(CFX_PointF( - static_cast<FX_FLOAT>(device_x), static_cast<FX_FLOAT>(device_y))); + CFX_PointF pos = device2page.Transform( + CFX_PointF(static_cast<float>(device_x), static_cast<float>(device_y))); *page_x = pos.x; *page_y = pos.y; @@ -921,7 +921,7 @@ DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, CFX_Matrix page2device = pPage->GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate); CFX_PointF pos = page2device.Transform( - CFX_PointF(static_cast<FX_FLOAT>(page_x), static_cast<FX_FLOAT>(page_y))); + CFX_PointF(static_cast<float>(page_x), static_cast<float>(page_y))); *device_x = FXSYS_round(pos.x); *device_y = FXSYS_round(pos.y); diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index 731b0cc296..743b68b27f 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -108,8 +108,8 @@ void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget, } bool CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget, - FX_FLOAT fMinPopup, - FX_FLOAT fMaxPopup, + float fMinPopup, + float fMaxPopup, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) { if (!hWidget) @@ -185,13 +185,13 @@ bool CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget, dwPos = 1; } - FX_FLOAT fPopupHeight; + float fPopupHeight; if (t < fMinPopup) fPopupHeight = fMinPopup; else if (t > fMaxPopup) fPopupHeight = fMaxPopup; else - fPopupHeight = static_cast<FX_FLOAT>(t); + fPopupHeight = static_cast<float>(t); switch (nRotate) { case 0: diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h index dc18d9a0c6..4624d8008c 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h @@ -31,8 +31,8 @@ class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment { const CFX_RectF* pRtAnchor) override; // dwPos: (0:bottom 1:top) bool GetPopupPos(CXFA_FFWidget* hWidget, - FX_FLOAT fMinPopup, - FX_FLOAT fMaxPopup, + float fMinPopup, + float fMaxPopup, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) override; bool PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup) override; diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp index 8b5bb3d279..d3910ae263 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp @@ -94,7 +94,7 @@ bool CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) { return true; } -FX_FLOAT CPDFXFA_Page::GetPageWidth() const { +float CPDFXFA_Page::GetPageWidth() const { if (!m_pPDFPage && !m_pXFAPageView) return 0.0f; @@ -118,7 +118,7 @@ FX_FLOAT CPDFXFA_Page::GetPageWidth() const { return 0.0f; } -FX_FLOAT CPDFXFA_Page::GetPageHeight() const { +float CPDFXFA_Page::GetPageHeight() const { if (!m_pPDFPage && !m_pXFAPageView) return 0.0f; @@ -158,8 +158,8 @@ void CPDFXFA_Page::DeviceToPage(int start_x, device2page.SetReverse( GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate)); - CFX_PointF pos = device2page.Transform(CFX_PointF( - static_cast<FX_FLOAT>(device_x), static_cast<FX_FLOAT>(device_y))); + CFX_PointF pos = device2page.Transform( + CFX_PointF(static_cast<float>(device_x), static_cast<float>(device_y))); *page_x = pos.x; *page_y = pos.y; @@ -181,7 +181,7 @@ void CPDFXFA_Page::PageToDevice(int start_x, GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate); CFX_PointF pos = page2device.Transform( - CFX_PointF(static_cast<FX_FLOAT>(page_x), static_cast<FX_FLOAT>(page_y))); + CFX_PointF(static_cast<float>(page_x), static_cast<float>(page_y))); *device_x = FXSYS_round(pos.x); *device_y = FXSYS_round(pos.y); diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.h b/fpdfsdk/fpdfxfa/cpdfxfa_page.h index 993885d59e..05b9238eb7 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_page.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.h @@ -38,8 +38,8 @@ class CPDFXFA_Page { m_pXFAPageView = pPageView; } - FX_FLOAT GetPageWidth() const; - FX_FLOAT GetPageHeight() const; + float GetPageWidth() const; + float GetPageHeight() const; void DeviceToPage(int start_x, int start_y, diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index 1acc57795a..0a5c3d940f 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -43,7 +43,7 @@ CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords) { CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap, int32_t nFontIndex, - FX_FLOAT fFontSize) { + float fFontSize) { if (!pFontMap) return CFX_ByteString(); @@ -59,7 +59,7 @@ CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap, void DrawTextString(CFX_RenderDevice* pDevice, const CFX_PointF& pt, CPDF_Font* pFont, - FX_FLOAT fFontSize, + float fFontSize, CFX_Matrix* pUser2Device, const CFX_ByteString& str, FX_ARGB crTextFill, @@ -673,7 +673,7 @@ CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, sAppStream << nHorzScale << " Tz\n"; } - FX_FLOAT fCharSpace = pEdit->GetCharSpace(); + float fCharSpace = pEdit->GetCharSpace(); if (!IsFloatZero(fCharSpace)) { sAppStream << fCharSpace << " Tc\n"; } @@ -726,7 +726,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, const bool bContinuous = pEdit->GetCharArray() == 0 && pEdit->GetCharSpace() <= 0.0f; uint16_t SubWord = pEdit->GetPasswordChar(); - FX_FLOAT fFontSize = pEdit->GetFontSize(); + float fFontSize = pEdit->GetFontSize(); CPVT_WordRange wrSelect = pEdit->GetSelectWordRange(); int32_t nHorzScale = pEdit->GetHorzScale(); @@ -921,7 +921,7 @@ void CFX_Edit::SetCharArray(int32_t nCharArray) { Paint(); } -void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace) { +void CFX_Edit::SetCharSpace(float fCharSpace) { m_pVT->SetCharSpace(fCharSpace); Paint(); } @@ -944,7 +944,7 @@ void CFX_Edit::SetAutoFontSize(bool bAuto, bool bPaint) { Paint(); } -void CFX_Edit::SetFontSize(FX_FLOAT fFontSize) { +void CFX_Edit::SetFontSize(float fFontSize) { m_pVT->SetFontSize(fFontSize); Paint(); } @@ -1139,7 +1139,7 @@ bool CFX_Edit::InsertText(const CFX_WideString& sText, int32_t charset) { return InsertText(sText, charset, true, true); } -FX_FLOAT CFX_Edit::GetFontSize() const { +float CFX_Edit::GetFontSize() const { return m_pVT->GetFontSize(); } @@ -1159,7 +1159,7 @@ int32_t CFX_Edit::GetHorzScale() const { return m_pVT->GetHorzScale(); } -FX_FLOAT CFX_Edit::GetCharSpace() const { +float CFX_Edit::GetCharSpace() const { return m_pVT->GetCharSpace(); } @@ -1269,7 +1269,7 @@ CFX_PointF CFX_Edit::VTToEdit(const CFX_PointF& point) const { CFX_FloatRect rcContent = m_pVT->GetContentRect(); CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); - FX_FLOAT fPadding = 0.0f; + float fPadding = 0.0f; switch (m_nAlignment) { case 0: @@ -1291,7 +1291,7 @@ CFX_PointF CFX_Edit::EditToVT(const CFX_PointF& point) const { CFX_FloatRect rcContent = m_pVT->GetContentRect(); CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); - FX_FLOAT fPadding = 0.0f; + float fPadding = 0.0f; switch (m_nAlignment) { case 0: @@ -1332,7 +1332,7 @@ void CFX_Edit::SetScrollInfo() { } } -void CFX_Edit::SetScrollPosX(FX_FLOAT fx) { +void CFX_Edit::SetScrollPosX(float fx) { if (!m_bEnableScroll) return; @@ -1344,7 +1344,7 @@ void CFX_Edit::SetScrollPosX(FX_FLOAT fx) { } } -void CFX_Edit::SetScrollPosY(FX_FLOAT fy) { +void CFX_Edit::SetScrollPosY(float fy) { if (!m_bEnableScroll) return; diff --git a/fpdfsdk/fxedit/fxet_edit.h b/fpdfsdk/fxedit/fxet_edit.h index ab83af2e3b..4fcb5569c3 100644 --- a/fpdfsdk/fxedit/fxet_edit.h +++ b/fpdfsdk/fxedit/fxet_edit.h @@ -357,12 +357,12 @@ class CFX_Edit { // Set the maximum number of words in the text. void SetLimitChar(int32_t nLimitChar); void SetCharArray(int32_t nCharArray); - void SetCharSpace(FX_FLOAT fCharSpace); + void SetCharSpace(float fCharSpace); void SetMultiLine(bool bMultiLine, bool bPaint); void SetAutoReturn(bool bAuto, bool bPaint); void SetAutoFontSize(bool bAuto, bool bPaint); void SetAutoScroll(bool bAuto, bool bPaint); - void SetFontSize(FX_FLOAT fFontSize); + void SetFontSize(float fFontSize); void SetTextOverflow(bool bAllowed, bool bPaint); void OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl); void OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl); @@ -388,14 +388,14 @@ class CFX_Edit { CPVT_WordPlace GetCaretWordPlace() const; CFX_WideString GetSelText() const; CFX_WideString GetText() const; - FX_FLOAT GetFontSize() const; + float GetFontSize() const; uint16_t GetPasswordChar() const; CFX_PointF GetScrollPos() const; int32_t GetCharArray() const; CFX_FloatRect GetContentRect() const; CFX_WideString GetRangeText(const CPVT_WordRange& range) const; int32_t GetHorzScale() const; - FX_FLOAT GetCharSpace() const; + float GetCharSpace() const; int32_t GetTotalWords() const; void SetSel(int32_t nStartChar, int32_t nEndChar); void GetSel(int32_t& nStartChar, int32_t& nEndChar) const; @@ -440,8 +440,8 @@ class CFX_Edit { void RearrangePart(const CPVT_WordRange& range); void ScrollToCaret(); void SetScrollInfo(); - void SetScrollPosX(FX_FLOAT fx); - void SetScrollPosY(FX_FLOAT fy); + void SetScrollPosX(float fx); + void SetScrollPosY(float fy); void SetScrollLimit(); void SetContentChanged(); diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp index 3782cf0a33..d79503556d 100644 --- a/fpdfsdk/fxedit/fxet_list.cpp +++ b/fpdfsdk/fxedit/fxet_list.cpp @@ -53,11 +53,11 @@ void CFX_ListItem::SetText(const CFX_WideString& text) { m_pEdit->SetText(text); } -void CFX_ListItem::SetFontSize(FX_FLOAT fFontSize) { +void CFX_ListItem::SetFontSize(float fFontSize) { m_pEdit->SetFontSize(fFontSize); } -FX_FLOAT CFX_ListItem::GetItemHeight() const { +float CFX_ListItem::GetItemHeight() const { return m_pEdit->GetContentRect().Height(); } @@ -542,7 +542,7 @@ void CFX_ListCtrl::SetScrollPos(const CFX_PointF& point) { SetScrollPosY(point.y); } -void CFX_ListCtrl::SetScrollPosY(FX_FLOAT fy) { +void CFX_ListCtrl::SetScrollPosY(float fy) { if (!IsFloatEqual(m_ptScrollPos.y, fy)) { CFX_FloatRect rcPlate = GetPlateRect(); CFX_FloatRect rcContent = GetContentRectInternal(); @@ -579,14 +579,14 @@ CFX_FloatRect CFX_ListCtrl::GetContentRect() const { } void CFX_ListCtrl::ReArrange(int32_t nItemIndex) { - FX_FLOAT fPosY = 0.0f; + float fPosY = 0.0f; if (CFX_ListItem* pPrevItem = m_aListItems.GetAt(nItemIndex - 1)) fPosY = pPrevItem->GetRect().bottom; for (int32_t i = nItemIndex, sz = m_aListItems.GetSize(); i < sz; i++) { if (CFX_ListItem* pListItem = m_aListItems.GetAt(i)) { - FX_FLOAT fListItemHeight = pListItem->GetItemHeight(); + float fListItemHeight = pListItem->GetItemHeight(); pListItem->SetRect(CLST_Rect(0.0f, fPosY, 0.0f, fPosY + fListItemHeight)); fPosY += fListItemHeight; } @@ -668,7 +668,7 @@ void CFX_ListCtrl::SetFontMap(IPVT_FontMap* pFontMap) { m_pFontMap = pFontMap; } -void CFX_ListCtrl::SetFontSize(FX_FLOAT fFontSize) { +void CFX_ListCtrl::SetFontSize(float fFontSize) { m_fFontSize = fFontSize; } @@ -696,11 +696,11 @@ CFX_FloatRect CFX_ListCtrl::GetPlateRect() const { return CFX_ListContainer::GetPlateRect(); } -FX_FLOAT CFX_ListCtrl::GetFontSize() const { +float CFX_ListCtrl::GetFontSize() const { return m_fFontSize; } -FX_FLOAT CFX_ListCtrl::GetFirstHeight() const { +float CFX_ListCtrl::GetFirstHeight() const { if (CFX_ListItem* pListItem = m_aListItems.GetAt(0)) { return pListItem->GetItemHeight(); } diff --git a/fpdfsdk/fxedit/fxet_list.h b/fpdfsdk/fxedit/fxet_list.h index 9d07187560..00e03d8213 100644 --- a/fpdfsdk/fxedit/fxet_list.h +++ b/fpdfsdk/fxedit/fxet_list.h @@ -20,10 +20,10 @@ class CLST_Rect : public CFX_FloatRect { public: CLST_Rect() { left = top = right = bottom = 0.0f; } - CLST_Rect(FX_FLOAT other_left, - FX_FLOAT other_top, - FX_FLOAT other_right, - FX_FLOAT other_bottom) { + CLST_Rect(float other_left, + float other_top, + float other_right, + float other_bottom) { left = other_left; top = other_top; right = other_right; @@ -56,9 +56,9 @@ class CLST_Rect : public CFX_FloatRect { bool operator!=(const CLST_Rect& rect) const { return !(*this == rect); } - FX_FLOAT Width() const { return right - left; } + float Width() const { return right - left; } - FX_FLOAT Height() const { + float Height() const { if (top > bottom) return top - bottom; return bottom - top; @@ -108,12 +108,12 @@ class CFX_ListItem final { void SetRect(const CLST_Rect& rect); void SetSelect(bool bSelected); void SetText(const CFX_WideString& text); - void SetFontSize(FX_FLOAT fFontSize); + void SetFontSize(float fFontSize); CFX_WideString GetText() const; CLST_Rect GetRect() const; bool IsSelected() const; - FX_FLOAT GetItemHeight() const; + float GetItemHeight() const; uint16_t GetFirstChar() const; private: @@ -252,13 +252,13 @@ class CFX_ListCtrl : protected CFX_ListContainer { CFX_WideString GetText() const; void SetFontMap(IPVT_FontMap* pFontMap); - void SetFontSize(FX_FLOAT fFontSize); + void SetFontSize(float fFontSize); CFX_FloatRect GetPlateRect() const; - FX_FLOAT GetFontSize() const; + float GetFontSize() const; CFX_Edit* GetItemEdit(int32_t nIndex) const; int32_t GetCount() const; bool IsItemSelected(int32_t nIndex) const; - FX_FLOAT GetFirstHeight() const; + float GetFirstHeight() const; void SetMultipleSel(bool bMultiple); bool IsMultipleSel() const; bool IsValid(int32_t nItemIndex) const; @@ -280,7 +280,7 @@ class CFX_ListCtrl : protected CFX_ListContainer { void SelectItems(); bool IsItemVisible(int32_t nItemIndex) const; void SetScrollInfo(); - void SetScrollPosY(FX_FLOAT fy); + void SetScrollPosY(float fy); void AddItem(const CFX_WideString& str); CFX_WideString GetItemText(int32_t nIndex) const; void SetItemSelect(int32_t nItemIndex, bool bSelected); @@ -296,7 +296,7 @@ class CFX_ListCtrl : protected CFX_ListContainer { bool m_bCtrlSel; // for multiple int32_t m_nCaretIndex; // for multiple CLST_ArrayTemplate<CFX_ListItem*> m_aListItems; - FX_FLOAT m_fFontSize; + float m_fFontSize; IPVT_FontMap* m_pFontMap; bool m_bMultiple; }; diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index a45b8b9ea7..45c22b106c 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -1468,7 +1468,7 @@ int Document::CountWords(CPDF_TextObject* pTextObj) { for (int i = 0, sz = pTextObj->CountChars(); i < sz; i++) { uint32_t charcode = CPDF_Font::kInvalidCharCode; - FX_FLOAT kerning; + float kerning; pTextObj->GetCharInfo(i, &charcode, &kerning); CFX_WideString swUnicode = pFont->UnicodeFromCharCode(charcode); @@ -1501,7 +1501,7 @@ CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj, for (int i = 0, sz = pTextObj->CountChars(); i < sz; i++) { uint32_t charcode = CPDF_Font::kInvalidCharCode; - FX_FLOAT kerning; + float kerning; pTextObj->GetCharInfo(i, &charcode, &kerning); CFX_WideString swUnicode = pFont->UnicodeFromCharCode(charcode); diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index 61a2538df7..12c3508597 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -575,7 +575,7 @@ bool Field::buttonAlignX(CJS_Runtime* pRuntime, CPDF_IconFit IconFit = pFormControl->GetIconFit(); - FX_FLOAT fLeft, fBottom; + float fLeft, fBottom; IconFit.GetIconPosition(fLeft, fBottom); vp << (int32_t)fLeft; @@ -624,7 +624,7 @@ bool Field::buttonAlignY(CJS_Runtime* pRuntime, CPDF_IconFit IconFit = pFormControl->GetIconFit(); - FX_FLOAT fLeft, fBottom; + float fLeft, fBottom; IconFit.GetIconPosition(fLeft, fBottom); vp << (int32_t)fBottom; @@ -2003,11 +2003,11 @@ bool Field::rect(CJS_Runtime* pRuntime, rcArray.GetElement(pRuntime, 2, Lower_Rightx); rcArray.GetElement(pRuntime, 3, Lower_Righty); - FX_FLOAT pArray[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - pArray[0] = static_cast<FX_FLOAT>(Upper_Leftx.ToInt(pRuntime)); - pArray[1] = static_cast<FX_FLOAT>(Lower_Righty.ToInt(pRuntime)); - pArray[2] = static_cast<FX_FLOAT>(Lower_Rightx.ToInt(pRuntime)); - pArray[3] = static_cast<FX_FLOAT>(Upper_Lefty.ToInt(pRuntime)); + float pArray[4] = {0.0f, 0.0f, 0.0f, 0.0f}; + pArray[0] = static_cast<float>(Upper_Leftx.ToInt(pRuntime)); + pArray[1] = static_cast<float>(Lower_Righty.ToInt(pRuntime)); + pArray[2] = static_cast<float>(Lower_Rightx.ToInt(pRuntime)); + pArray[3] = static_cast<float>(Upper_Lefty.ToInt(pRuntime)); CFX_FloatRect crRect(pArray); if (m_bDelay) { @@ -2485,7 +2485,7 @@ bool Field::textSize(CJS_Runtime* pRuntime, CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaultAppearance(); CFX_ByteString csFontNameTag; - FX_FLOAT fFontSize; + float fFontSize; FieldAppearance.GetFont(csFontNameTag, fFontSize); vp << (int)fFontSize; return true; diff --git a/fpdfsdk/javascript/color.cpp b/fpdfsdk/javascript/color.cpp index b5ccbadabf..376eefa248 100644 --- a/fpdfsdk/javascript/color.cpp +++ b/fpdfsdk/javascript/color.cpp @@ -121,13 +121,12 @@ void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime, if (sSpace == "T") { *color = CPWL_Color(COLORTYPE_TRANSPARENT); } else if (sSpace == "G") { - *color = CPWL_Color(COLORTYPE_GRAY, (FX_FLOAT)d1); + *color = CPWL_Color(COLORTYPE_GRAY, (float)d1); } else if (sSpace == "RGB") { - *color = - CPWL_Color(COLORTYPE_RGB, (FX_FLOAT)d1, (FX_FLOAT)d2, (FX_FLOAT)d3); + *color = CPWL_Color(COLORTYPE_RGB, (float)d1, (float)d2, (float)d3); } else if (sSpace == "CMYK") { - *color = CPWL_Color(COLORTYPE_CMYK, (FX_FLOAT)d1, (FX_FLOAT)d2, - (FX_FLOAT)d3, (FX_FLOAT)d4); + *color = + CPWL_Color(COLORTYPE_CMYK, (float)d1, (float)d2, (float)d3, (float)d4); } } 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<PWL_SCROLL_INFO*>(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<CFX_Edit> 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<int32_t>(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_ diff --git a/fxjs/cfxjse_arguments.cpp b/fxjs/cfxjse_arguments.cpp index 75904cbbea..323134dcf5 100644 --- a/fxjs/cfxjse_arguments.cpp +++ b/fxjs/cfxjse_arguments.cpp @@ -32,8 +32,8 @@ int32_t CFXJSE_Arguments::GetInt32(int32_t index) const { return static_cast<int32_t>((*m_pInfo)[index]->NumberValue()); } -FX_FLOAT CFXJSE_Arguments::GetFloat(int32_t index) const { - return static_cast<FX_FLOAT>((*m_pInfo)[index]->NumberValue()); +float CFXJSE_Arguments::GetFloat(int32_t index) const { + return static_cast<float>((*m_pInfo)[index]->NumberValue()); } CFX_ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const { diff --git a/fxjs/cfxjse_arguments.h b/fxjs/cfxjse_arguments.h index 51e1981d03..4f18082f84 100644 --- a/fxjs/cfxjse_arguments.h +++ b/fxjs/cfxjse_arguments.h @@ -24,7 +24,7 @@ class CFXJSE_Arguments { std::unique_ptr<CFXJSE_Value> GetValue(int32_t index) const; bool GetBoolean(int32_t index) const; int32_t GetInt32(int32_t index) const; - FX_FLOAT GetFloat(int32_t index) const; + float GetFloat(int32_t index) const; CFX_ByteString GetUTF8String(int32_t index) const; CFXJSE_HostObject* GetObject(int32_t index, CFXJSE_Class* pClass = nullptr) const; diff --git a/fxjs/cfxjse_value.cpp b/fxjs/cfxjse_value.cpp index 68c82e5deb..fb7fe20e21 100644 --- a/fxjs/cfxjse_value.cpp +++ b/fxjs/cfxjse_value.cpp @@ -13,8 +13,8 @@ namespace { -double ftod(FX_FLOAT fNumber) { - static_assert(sizeof(FX_FLOAT) == 4, "FX_FLOAT of incorrect size"); +double ftod(float fNumber) { + static_assert(sizeof(float) == 4, "float of incorrect size"); uint32_t nFloatBits = (uint32_t&)fNumber; uint8_t nExponent = (uint8_t)(nFloatBits >> 23); @@ -120,7 +120,7 @@ void CFXJSE_Value::SetDate(double dDouble) { m_hValue.Reset(m_pIsolate, hDate); } -void CFXJSE_Value::SetFloat(FX_FLOAT fFloat) { +void CFXJSE_Value::SetFloat(float fFloat) { CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); v8::Local<v8::Value> pValue = v8::Number::New(m_pIsolate, ftod(fFloat)); m_hValue.Reset(m_pIsolate, pValue); @@ -442,11 +442,11 @@ bool CFXJSE_Value::ToBoolean() const { return static_cast<bool>(hValue->BooleanValue()); } -FX_FLOAT CFXJSE_Value::ToFloat() const { +float CFXJSE_Value::ToFloat() const { ASSERT(!m_hValue.IsEmpty()); CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(m_pIsolate, m_hValue); - return static_cast<FX_FLOAT>(hValue->NumberValue()); + return static_cast<float>(hValue->NumberValue()); } double CFXJSE_Value::ToDouble() const { diff --git a/fxjs/cfxjse_value.h b/fxjs/cfxjse_value.h index f2ebdc1c25..31b751da1e 100644 --- a/fxjs/cfxjse_value.h +++ b/fxjs/cfxjse_value.h @@ -35,7 +35,7 @@ class CFXJSE_Value { bool IsFunction() const; bool IsDate() const; bool ToBoolean() const; - FX_FLOAT ToFloat() const; + float ToFloat() const; double ToDouble() const; int32_t ToInteger() const; CFX_ByteString ToString() const; @@ -50,7 +50,7 @@ class CFXJSE_Value { void SetInteger(int32_t nInteger); void SetDouble(double dDouble); void SetString(const CFX_ByteStringC& szString); - void SetFloat(FX_FLOAT fFloat); + void SetFloat(float fFloat); void SetJSObject(); void SetObject(CFXJSE_HostObject* lpObject, CFXJSE_Class* pClass); diff --git a/testing/libfuzzer/pdf_codec_icc_fuzzer.cc b/testing/libfuzzer/pdf_codec_icc_fuzzer.cc index d7bfdba0cf..c7abdd69a4 100644 --- a/testing/libfuzzer/pdf_codec_icc_fuzzer.cc +++ b/testing/libfuzzer/pdf_codec_icc_fuzzer.cc @@ -12,8 +12,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { void* transform = icc_module.CreateTransform_sRGB(data, size, nComponent); if (transform) { - FX_FLOAT src[4]; - FX_FLOAT dst[4]; + float src[4]; + float dst[4]; for (int i = 0; i < 4; i++) src[i] = 0.5f; icc_module.SetComponents(nComponent); diff --git a/third_party/agg23/0001-gcc-warning.patch b/third_party/agg23/0001-gcc-warning.patch index 759696ef03..3bdce6578e 100644 --- a/third_party/agg23/0001-gcc-warning.patch +++ b/third_party/agg23/0001-gcc-warning.patch @@ -4,7 +4,7 @@ index dc13851..7f21bac 100644 +++ b/third_party/agg23/agg_path_storage.h @@ -38,9 +38,9 @@ public: } - unsigned vertex(FX_FLOAT* x, FX_FLOAT* y) + unsigned vertex(float* x, float* y) { - return (m_vertex_idx < m_path->total_vertices()) ? - m_path->vertex(m_vertex_idx++, x, y) : diff --git a/third_party/agg23/0002-ubsan-error-fixes.patch b/third_party/agg23/0002-ubsan-error-fixes.patch index 00ced0071c..58b17dc19c 100644 --- a/third_party/agg23/0002-ubsan-error-fixes.patch +++ b/third_party/agg23/0002-ubsan-error-fixes.patch @@ -13,21 +13,21 @@ index db6ca97..5b1261f 100644 @@ -36,8 +37,18 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2, T* x, T* y) { - const FX_FLOAT nearzero = 1e-30f; -- FX_FLOAT deltax = (FX_FLOAT)(x2 - x1); -- FX_FLOAT deltay = (FX_FLOAT)(y2 - y1); + const float nearzero = 1e-30f; +- float deltax = (float)(x2 - x1); +- float deltay = (float)(y2 - y1); + -+ pdfium::base::CheckedNumeric<FX_FLOAT> width = x2; ++ pdfium::base::CheckedNumeric<float> width = x2; + width -= x1; + if (!width.IsValid()) + return 0; -+ pdfium::base::CheckedNumeric<FX_FLOAT> height = y2; ++ pdfium::base::CheckedNumeric<float> height = y2; + height -= y1; + if (!height.IsValid()) + return 0; + -+ FX_FLOAT deltax = width.ValueOrDefault(0); -+ FX_FLOAT deltay = height.ValueOrDefault(0); ++ float deltax = width.ValueOrDefault(0); ++ float deltay = height.ValueOrDefault(0); unsigned np = 0; if(deltax == 0) { deltax = (x1 > clip_box.x1) ? -nearzero : nearzero; diff --git a/third_party/agg23/agg_basics.h b/third_party/agg23/agg_basics.h index 52a658ec96..fc155561e0 100644 --- a/third_party/agg23/agg_basics.h +++ b/third_party/agg23/agg_basics.h @@ -41,7 +41,7 @@ #endif #define AGG_INLINE inline -#include "core/fxcrt/fx_system.h" // For FX_FLOAT +#include "core/fxcrt/fx_system.h" namespace agg { @@ -143,7 +143,7 @@ inline Rect unite_rectangles(const Rect& r1, const Rect& r2) return r; } typedef rect_base<int> rect; -typedef rect_base<FX_FLOAT> rect_d; +typedef rect_base<float> rect_d; enum path_commands_e { path_cmd_stop = 0, path_cmd_move_to = 1, @@ -261,10 +261,10 @@ inline unsigned set_orientation(unsigned c, unsigned o) return clear_orientation(c) | o; } struct point_type { - FX_FLOAT x, y; + float x, y; unsigned flag; point_type() {} - point_type(FX_FLOAT x_, FX_FLOAT y_, unsigned flag_ = 0) : x(x_), y(y_), flag(flag_) {} + point_type(float x_, float y_, unsigned flag_ = 0) : x(x_), y(y_), flag(flag_) {} }; struct point_type_flag : public point_type { unsigned flag; @@ -272,13 +272,13 @@ struct point_type_flag : public point_type { { flag = 0; } - point_type_flag(FX_FLOAT x_, FX_FLOAT y_, unsigned flag_ = 0) : point_type(x_, y_), flag(flag_) {} + point_type_flag(float x_, float y_, unsigned flag_ = 0) : point_type(x_, y_), flag(flag_) {} }; struct vertex_type { - FX_FLOAT x, y; + float x, y; unsigned cmd; vertex_type() {} - vertex_type(FX_FLOAT x_, FX_FLOAT y_, unsigned cmd_) : + vertex_type(float x_, float y_, unsigned cmd_) : x(x_), y(y_), cmd(cmd_) {} }; } diff --git a/third_party/agg23/agg_clip_liang_barsky.h b/third_party/agg23/agg_clip_liang_barsky.h index 5b1261f004..31b35fe96e 100644 --- a/third_party/agg23/agg_clip_liang_barsky.h +++ b/third_party/agg23/agg_clip_liang_barsky.h @@ -36,45 +36,45 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2, const rect_base<T>& clip_box, T* x, T* y) { - const FX_FLOAT nearzero = 1e-30f; + const float nearzero = 1e-30f; - pdfium::base::CheckedNumeric<FX_FLOAT> width = x2; + pdfium::base::CheckedNumeric<float> width = x2; width -= x1; if (!width.IsValid()) return 0; - pdfium::base::CheckedNumeric<FX_FLOAT> height = y2; + pdfium::base::CheckedNumeric<float> height = y2; height -= y1; if (!height.IsValid()) return 0; - FX_FLOAT deltax = width.ValueOrDefault(0); - FX_FLOAT deltay = height.ValueOrDefault(0); + float deltax = width.ValueOrDefault(0); + float deltay = height.ValueOrDefault(0); unsigned np = 0; if(deltax == 0) { deltax = (x1 > clip_box.x1) ? -nearzero : nearzero; } - FX_FLOAT xin, xout; + float xin, xout; if(deltax > 0) { - xin = (FX_FLOAT)clip_box.x1; - xout = (FX_FLOAT)clip_box.x2; + xin = (float)clip_box.x1; + xout = (float)clip_box.x2; } else { - xin = (FX_FLOAT)clip_box.x2; - xout = (FX_FLOAT)clip_box.x1; + xin = (float)clip_box.x2; + xout = (float)clip_box.x1; } - FX_FLOAT tinx = (xin - x1) / deltax; + float tinx = (xin - x1) / deltax; if(deltay == 0) { deltay = (y1 > clip_box.y1) ? -nearzero : nearzero; } - FX_FLOAT yin, yout; + float yin, yout; if(deltay > 0) { - yin = (FX_FLOAT)clip_box.y1; - yout = (FX_FLOAT)clip_box.y2; + yin = (float)clip_box.y1; + yout = (float)clip_box.y2; } else { - yin = (FX_FLOAT)clip_box.y2; - yout = (FX_FLOAT)clip_box.y1; + yin = (float)clip_box.y2; + yout = (float)clip_box.y1; } - FX_FLOAT tiny = (yin - y1) / deltay; - FX_FLOAT tin1, tin2; + float tiny = (yin - y1) / deltay; + float tin1, tin2; if (tinx < tiny) { tin1 = tinx; tin2 = tiny; @@ -89,9 +89,9 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2, ++np; } if(tin2 <= 1.0f) { - FX_FLOAT toutx = (xout - x1) / deltax; - FX_FLOAT touty = (yout - y1) / deltay; - FX_FLOAT tout1 = (toutx < touty) ? toutx : touty; + float toutx = (xout - x1) / deltax; + float touty = (yout - y1) / deltay; + float tout1 = (toutx < touty) ? toutx : touty; if (tin2 > 0 || tout1 > 0) { if(tin2 <= tout1) { if(tin2 > 0) { diff --git a/third_party/agg23/agg_conv_adaptor_vcgen.h b/third_party/agg23/agg_conv_adaptor_vcgen.h index 0d8d6ff99e..be4dc2d609 100644 --- a/third_party/agg23/agg_conv_adaptor_vcgen.h +++ b/third_party/agg23/agg_conv_adaptor_vcgen.h @@ -20,10 +20,10 @@ namespace agg { struct null_markers { void remove_all() {} - void add_vertex(FX_FLOAT, FX_FLOAT, unsigned) {} + void add_vertex(float, float, unsigned) {} void prepare_src() {} void rewind(unsigned) {} - unsigned vertex(FX_FLOAT*, FX_FLOAT*) + unsigned vertex(float*, float*) { return path_cmd_stop; } @@ -67,7 +67,7 @@ public: m_source->rewind(path_id); m_status = initial; } - unsigned vertex(FX_FLOAT* x, FX_FLOAT* y); + unsigned vertex(float* x, float* y); private: conv_adaptor_vcgen(const conv_adaptor_vcgen<VertexSource, Generator, Markers>&); const conv_adaptor_vcgen<VertexSource, Generator, Markers>& @@ -77,11 +77,11 @@ private: Markers m_markers; status m_status; unsigned m_last_cmd; - FX_FLOAT m_start_x; - FX_FLOAT m_start_y; + float m_start_x; + float m_start_y; }; template<class VertexSource, class Generator, class Markers> -unsigned conv_adaptor_vcgen<VertexSource, Generator, Markers>::vertex(FX_FLOAT* x, FX_FLOAT* y) +unsigned conv_adaptor_vcgen<VertexSource, Generator, Markers>::vertex(float* x, float* y) { unsigned cmd = path_cmd_stop; bool done = false; diff --git a/third_party/agg23/agg_conv_dash.h b/third_party/agg23/agg_conv_dash.h index 63b2019dde..f87eccc3b1 100644 --- a/third_party/agg23/agg_conv_dash.h +++ b/third_party/agg23/agg_conv_dash.h @@ -36,15 +36,15 @@ struct conv_dash : public conv_adaptor_vcgen<VertexSource, vcgen_dash, Markers> { base_type::generator().remove_all_dashes(); } - void add_dash(FX_FLOAT dash_len, FX_FLOAT gap_len) + void add_dash(float dash_len, float gap_len) { base_type::generator().add_dash(dash_len, gap_len); } - void dash_start(FX_FLOAT ds) + void dash_start(float ds) { base_type::generator().dash_start(ds); } - void shorten(FX_FLOAT s) + void shorten(float s) { base_type::generator().shorten(s); } diff --git a/third_party/agg23/agg_conv_stroke.h b/third_party/agg23/agg_conv_stroke.h index 5a36bd73bb..82268ddec6 100644 --- a/third_party/agg23/agg_conv_stroke.h +++ b/third_party/agg23/agg_conv_stroke.h @@ -57,47 +57,47 @@ struct conv_stroke : { return base_type::generator().inner_join(); } - void width(FX_FLOAT w) + void width(float w) { base_type::generator().width(w); } - void miter_limit(FX_FLOAT ml) + void miter_limit(float ml) { base_type::generator().miter_limit(ml); } - void miter_limit_theta(FX_FLOAT t) + void miter_limit_theta(float t) { base_type::generator().miter_limit_theta(t); } - void inner_miter_limit(FX_FLOAT ml) + void inner_miter_limit(float ml) { base_type::generator().inner_miter_limit(ml); } - void approximation_scale(FX_FLOAT as) + void approximation_scale(float as) { base_type::generator().approximation_scale(as); } - FX_FLOAT width() const + float width() const { return base_type::generator().width(); } - FX_FLOAT miter_limit() const + float miter_limit() const { return base_type::generator().miter_limit(); } - FX_FLOAT inner_miter_limit() const + float inner_miter_limit() const { return base_type::generator().inner_miter_limit(); } - FX_FLOAT approximation_scale() const + float approximation_scale() const { return base_type::generator().approximation_scale(); } - void shorten(FX_FLOAT s) + void shorten(float s) { base_type::generator().shorten(s); } - FX_FLOAT shorten() const + float shorten() const { return base_type::generator().shorten(); } diff --git a/third_party/agg23/agg_curves.cpp b/third_party/agg23/agg_curves.cpp index b86cf630c3..4bfe457817 100644 --- a/third_party/agg23/agg_curves.cpp +++ b/third_party/agg23/agg_curves.cpp @@ -25,12 +25,12 @@ namespace agg { -const FX_FLOAT curve_collinearity_epsilon = 1e-30f; +const float curve_collinearity_epsilon = 1e-30f; enum curve_recursion_limit_e { curve_recursion_limit = 16 }; -void curve4_div::init(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x3, FX_FLOAT y3, - FX_FLOAT x4, FX_FLOAT y4) +void curve4_div::init(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { m_points.remove_all(); m_distance_tolerance_square = 1.0f / 4; @@ -38,31 +38,31 @@ void curve4_div::init(FX_FLOAT x1, FX_FLOAT y1, bezier(x1, y1, x2, y2, x3, y3, x4, y4); m_count = 0; } -void curve4_div::recursive_bezier(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x3, FX_FLOAT y3, - FX_FLOAT x4, FX_FLOAT y4, +void curve4_div::recursive_bezier(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4, unsigned level) { if(level > curve_recursion_limit) { return; } - FX_FLOAT x12 = (x1 + x2) / 2; - FX_FLOAT y12 = (y1 + y2) / 2; - FX_FLOAT x23 = (x2 + x3) / 2; - FX_FLOAT y23 = (y2 + y3) / 2; - FX_FLOAT x34 = (x3 + x4) / 2; - FX_FLOAT y34 = (y3 + y4) / 2; - FX_FLOAT x123 = (x12 + x23) / 2; - FX_FLOAT y123 = (y12 + y23) / 2; - FX_FLOAT x234 = (x23 + x34) / 2; - FX_FLOAT y234 = (y23 + y34) / 2; - FX_FLOAT x1234 = (x123 + x234) / 2; - FX_FLOAT y1234 = (y123 + y234) / 2; - FX_FLOAT dx = x4 - x1; - FX_FLOAT dy = y4 - y1; - FX_FLOAT d2 = FXSYS_fabs(((x2 - x4) * dy) - ((y2 - y4) * dx)); - FX_FLOAT d3 = FXSYS_fabs(((x3 - x4) * dy) - ((y3 - y4) * dx)); + float x12 = (x1 + x2) / 2; + float y12 = (y1 + y2) / 2; + float x23 = (x2 + x3) / 2; + float y23 = (y2 + y3) / 2; + float x34 = (x3 + x4) / 2; + float y34 = (y3 + y4) / 2; + float x123 = (x12 + x23) / 2; + float y123 = (y12 + y23) / 2; + float x234 = (x23 + x34) / 2; + float y234 = (y23 + y34) / 2; + float x1234 = (x123 + x234) / 2; + float y1234 = (y123 + y234) / 2; + float dx = x4 - x1; + float dy = y4 - y1; + float d2 = FXSYS_fabs(((x2 - x4) * dy) - ((y2 - y4) * dx)); + float d3 = FXSYS_fabs(((x3 - x4) * dy) - ((y3 - y4) * dx)); switch((int(d2 > curve_collinearity_epsilon) << 1) + int(d3 > curve_collinearity_epsilon)) { case 0: @@ -99,10 +99,10 @@ void curve4_div::recursive_bezier(FX_FLOAT x1, FX_FLOAT y1, recursive_bezier(x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1); recursive_bezier(x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1); } -void curve4_div::bezier(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x3, FX_FLOAT y3, - FX_FLOAT x4, FX_FLOAT y4) +void curve4_div::bezier(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { m_points.add(point_type(x1, y1)); recursive_bezier(x1, y1, x2, y2, x3, y3, x4, y4, 0); diff --git a/third_party/agg23/agg_curves.h b/third_party/agg23/agg_curves.h index 495f7a6a8f..488db4a1ff 100644 --- a/third_party/agg23/agg_curves.h +++ b/third_party/agg23/agg_curves.h @@ -20,12 +20,12 @@ namespace agg { struct curve4_points { - FX_FLOAT cp[8]; + float cp[8]; curve4_points() {} - curve4_points(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x3, FX_FLOAT y3, - FX_FLOAT x4, FX_FLOAT y4) + curve4_points(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { cp[0] = x1; cp[1] = y1; @@ -36,10 +36,10 @@ struct curve4_points { cp[6] = x4; cp[7] = y4; } - void init(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x3, FX_FLOAT y3, - FX_FLOAT x4, FX_FLOAT y4) + void init(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { cp[0] = x1; cp[1] = y1; @@ -50,11 +50,11 @@ struct curve4_points { cp[6] = x4; cp[7] = y4; } - FX_FLOAT operator [] (unsigned i) const + float operator [] (unsigned i) const { return cp[i]; } - FX_FLOAT& operator [] (unsigned i) + float& operator [] (unsigned i) { return cp[i]; } @@ -65,10 +65,10 @@ public: curve4_div() : m_count(0) {} - curve4_div(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x3, FX_FLOAT y3, - FX_FLOAT x4, FX_FLOAT y4) : + curve4_div(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) : m_count(0) { init(x1, y1, x2, y2, x3, y3, x4, y4); @@ -83,10 +83,10 @@ public: m_points.remove_all(); m_count = 0; } - void init(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x3, FX_FLOAT y3, - FX_FLOAT x4, FX_FLOAT y4); + void init(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4); void init(const curve4_points& cp) { init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); @@ -95,7 +95,7 @@ public: { m_count = 0; } - unsigned vertex(FX_FLOAT* x, FX_FLOAT* y) + unsigned vertex(float* x, float* y) { if(m_count >= m_points.size()) { return path_cmd_stop; @@ -105,7 +105,7 @@ public: *y = p.y; return (m_count == 1) ? path_cmd_move_to : path_cmd_line_to; } - unsigned vertex_flag(FX_FLOAT* x, FX_FLOAT* y, int& flag) + unsigned vertex_flag(float* x, float* y, int& flag) { if(m_count >= m_points.size()) { return path_cmd_stop; @@ -121,17 +121,17 @@ public: return m_points.size(); } private: - void bezier(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x3, FX_FLOAT y3, - FX_FLOAT x4, FX_FLOAT y4); - void recursive_bezier(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x3, FX_FLOAT y3, - FX_FLOAT x4, FX_FLOAT y4, + void bezier(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4); + void recursive_bezier(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4, unsigned level); - FX_FLOAT m_distance_tolerance_square; - FX_FLOAT m_distance_tolerance_manhattan; + float m_distance_tolerance_square; + float m_distance_tolerance_manhattan; unsigned m_count; pod_deque<point_type> m_points; }; @@ -139,10 +139,10 @@ class curve4 { public: curve4() {} - curve4(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x3, FX_FLOAT y3, - FX_FLOAT x4, FX_FLOAT y4) + curve4(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { init(x1, y1, x2, y2, x3, y3, x4, y4); } @@ -154,10 +154,10 @@ public: { m_curve_div.reset(); } - void init(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x3, FX_FLOAT y3, - FX_FLOAT x4, FX_FLOAT y4) + void init(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { m_curve_div.init(x1, y1, x2, y2, x3, y3, x4, y4); } @@ -169,11 +169,11 @@ public: { m_curve_div.rewind(path_id); } - unsigned vertex(FX_FLOAT* x, FX_FLOAT* y) + unsigned vertex(float* x, float* y) { return m_curve_div.vertex(x, y); } - unsigned vertex_curve_flag(FX_FLOAT* x, FX_FLOAT* y, int& flag) + unsigned vertex_curve_flag(float* x, float* y, int& flag) { return m_curve_div.vertex_flag(x, y, flag); } diff --git a/third_party/agg23/agg_math.h b/third_party/agg23/agg_math.h index e003297dff..6c03bab929 100644 --- a/third_party/agg23/agg_math.h +++ b/third_party/agg23/agg_math.h @@ -21,37 +21,37 @@ #include "agg_basics.h" namespace agg { -const FX_FLOAT intersection_epsilon = 1.0e-30f; -AGG_INLINE FX_FLOAT calc_point_location(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x, FX_FLOAT y) +const float intersection_epsilon = 1.0e-30f; +AGG_INLINE float calc_point_location(float x1, float y1, + float x2, float y2, + float x, float y) { return ((x - x2) * (y2 - y1)) - ((y - y2) * (x2 - x1)); } -AGG_INLINE FX_FLOAT calc_distance(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2) +AGG_INLINE float calc_distance(float x1, float y1, float x2, float y2) { - FX_FLOAT dx = x2 - x1; - FX_FLOAT dy = y2 - y1; + float dx = x2 - x1; + float dy = y2 - y1; return FXSYS_sqrt2(dx, dy); } -AGG_INLINE FX_FLOAT calc_line_point_distance(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x, FX_FLOAT y) +AGG_INLINE float calc_line_point_distance(float x1, float y1, + float x2, float y2, + float x, float y) { - FX_FLOAT dx = x2 - x1; - FX_FLOAT dy = y2 - y1; - FX_FLOAT d = FXSYS_sqrt2(dx, dy); + float dx = x2 - x1; + float dy = y2 - y1; + float d = FXSYS_sqrt2(dx, dy); if(d < intersection_epsilon) { return calc_distance(x1, y1, x, y); } return ((x - x2) * dy / d) - ((y - y2) * dx / d); } -AGG_INLINE bool calc_intersection(FX_FLOAT ax, FX_FLOAT ay, FX_FLOAT bx, FX_FLOAT by, - FX_FLOAT cx, FX_FLOAT cy, FX_FLOAT dx, FX_FLOAT dy, - FX_FLOAT* x, FX_FLOAT* y) +AGG_INLINE bool calc_intersection(float ax, float ay, float bx, float by, + float cx, float cy, float dx, float dy, + float* x, float* y) { - FX_FLOAT num = ((ay - cy) * (dx - cx)) - ((ax - cx) * (dy - cy)); - FX_FLOAT den = ((bx - ax) * (dy - cy)) - ((by - ay) * (dx - cx)); + float num = ((ay - cy) * (dx - cx)) - ((ax - cx) * (dy - cy)); + float den = ((bx - ax) * (dy - cy)) - ((by - ay) * (dx - cx)); if (FXSYS_fabs(den) < intersection_epsilon) { return false; } diff --git a/third_party/agg23/agg_math_stroke.h b/third_party/agg23/agg_math_stroke.h index 2b06b1bfda..90c1153cc5 100644 --- a/third_party/agg23/agg_math_stroke.h +++ b/third_party/agg23/agg_math_stroke.h @@ -41,19 +41,19 @@ enum inner_join_e { inner_jag, inner_round }; -const FX_FLOAT stroke_theta = 1.0f / 1000.0f; +const float stroke_theta = 1.0f / 1000.0f; template<class VertexConsumer> void stroke_calc_arc(VertexConsumer& out_vertices, - FX_FLOAT x, FX_FLOAT y, - FX_FLOAT dx1, FX_FLOAT dy1, - FX_FLOAT dx2, FX_FLOAT dy2, - FX_FLOAT width, - FX_FLOAT approximation_scale) + float x, float y, + float dx1, float dy1, + float dx2, float dy2, + float width, + float approximation_scale) { typedef typename VertexConsumer::value_type coord_type; - FX_FLOAT a1 = FXSYS_atan2(dy1, dx1); - FX_FLOAT a2 = FXSYS_atan2(dy2, dx2); - FX_FLOAT da = a1 - a2; + float a1 = FXSYS_atan2(dy1, dx1); + float a2 = FXSYS_atan2(dy2, dx2); + float da = a1 - a2; bool ccw = da > 0 && da < FX_PI; if(width < 0) { width = -width; @@ -92,31 +92,31 @@ void stroke_calc_miter(VertexConsumer& out_vertices, const vertex_dist& v0, const vertex_dist& v1, const vertex_dist& v2, - FX_FLOAT dx1, FX_FLOAT dy1, - FX_FLOAT dx2, FX_FLOAT dy2, - FX_FLOAT width, + float dx1, float dy1, + float dx2, float dy2, + float width, line_join_e line_join, - FX_FLOAT miter_limit, - FX_FLOAT approximation_scale) + float miter_limit, + float approximation_scale) { typedef typename VertexConsumer::value_type coord_type; - FX_FLOAT xi = v1.x; - FX_FLOAT yi = v1.y; + float xi = v1.x; + float yi = v1.y; bool miter_limit_exceeded = true; if(calc_intersection(v0.x + dx1, v0.y - dy1, v1.x + dx1, v1.y - dy1, v1.x + dx2, v1.y - dy2, v2.x + dx2, v2.y - dy2, &xi, &yi)) { - FX_FLOAT d1 = calc_distance(v1.x, v1.y, xi, yi); - FX_FLOAT lim = width * miter_limit; + float d1 = calc_distance(v1.x, v1.y, xi, yi); + float lim = width * miter_limit; if(d1 <= lim) { out_vertices.add(coord_type(xi, yi)); miter_limit_exceeded = false; } } else { - FX_FLOAT x2 = v1.x + dx1; - FX_FLOAT y2 = v1.y - dy1; + float x2 = v1.x + dx1; + float y2 = v1.y - dy1; if ((((x2 - v0.x) * dy1) - ((v0.y - y2) * dx1) < 0) != (((x2 - v2.x) * dy1) - ((v2.y - y2) * dx1) < 0)) { out_vertices.add(coord_type(v1.x + dx1, v1.y - dy1)); @@ -147,17 +147,17 @@ template<class VertexConsumer> void stroke_calc_cap(VertexConsumer& out_vertices, const vertex_dist& v0, const vertex_dist& v1, - FX_FLOAT len, + float len, line_cap_e line_cap, - FX_FLOAT width, - FX_FLOAT approximation_scale) + float width, + float approximation_scale) { typedef typename VertexConsumer::value_type coord_type; out_vertices.remove_all(); - FX_FLOAT dx1 = (v1.y - v0.y) / len; - FX_FLOAT dy1 = (v1.x - v0.x) / len; - FX_FLOAT dx2 = 0; - FX_FLOAT dy2 = 0; + float dx1 = (v1.y - v0.y) / len; + float dy1 = (v1.x - v0.x) / len; + float dx2 = 0; + float dy2 = 0; dx1 = dx1 * width; dy1 = dy1 * width; if(line_cap != round_cap) { @@ -168,9 +168,9 @@ void stroke_calc_cap(VertexConsumer& out_vertices, out_vertices.add(coord_type(v0.x - dx1 - dx2, v0.y + dy1 - dy2)); out_vertices.add(coord_type(v0.x + dx1 - dx2, v0.y - dy1 - dy2)); } else { - FX_FLOAT a1 = FXSYS_atan2(dy1, -dx1); - FX_FLOAT a2 = a1 + FX_PI; - FX_FLOAT da = + float a1 = FXSYS_atan2(dy1, -dx1); + float a2 = a1 + FX_PI; + float da = FXSYS_acos(width / (width + ((1.0f / 8) / approximation_scale))) * 2; out_vertices.add(coord_type(v0.x - dx1, v0.y + dy1)); @@ -189,17 +189,17 @@ void stroke_calc_join(VertexConsumer& out_vertices, const vertex_dist& v0, const vertex_dist& v1, const vertex_dist& v2, - FX_FLOAT len1, - FX_FLOAT len2, - FX_FLOAT width, + float len1, + float len2, + float width, line_join_e line_join, inner_join_e inner_join, - FX_FLOAT miter_limit, - FX_FLOAT inner_miter_limit, - FX_FLOAT approximation_scale) + float miter_limit, + float inner_miter_limit, + float approximation_scale) { typedef typename VertexConsumer::value_type coord_type; - FX_FLOAT dx1, dy1, dx2, dy2; + float dx1, dy1, dx2, dy2; dx1 = width * (v1.y - v0.y) / len1; dy1 = width * (v1.x - v0.x) / len1; dx2 = width * (v2.y - v1.y) / len2; @@ -221,7 +221,7 @@ void stroke_calc_join(VertexConsumer& out_vertices, break; case inner_jag: case inner_round: { - FX_FLOAT d = (dx1 - dx2) * (dx1 - dx2) + (dy1 - dy2) * (dy1 - dy2); + float d = (dx1 - dx2) * (dx1 - dx2) + (dy1 - dy2) * (dy1 - dy2); if(d < len1 * len1 && d < len2 * len2) { stroke_calc_miter(out_vertices, v0, v1, v2, dx1, dy1, dx2, dy2, diff --git a/third_party/agg23/agg_path_storage.cpp b/third_party/agg23/agg_path_storage.cpp index 968746738a..747777d28e 100644 --- a/third_party/agg23/agg_path_storage.cpp +++ b/third_party/agg23/agg_path_storage.cpp @@ -32,7 +32,7 @@ namespace agg path_storage::~path_storage() { if(m_total_blocks) { - FX_FLOAT** coord_blk = m_coord_blocks + m_total_blocks - 1; + float** coord_blk = m_coord_blocks + m_total_blocks - 1; while(m_total_blocks--) { FX_Free(*coord_blk); --coord_blk; @@ -52,14 +52,14 @@ path_storage::path_storage() : void path_storage::allocate_block(unsigned nb) { if(nb >= m_max_blocks) { - FX_FLOAT** new_coords = - FX_Alloc2D(FX_FLOAT*, m_max_blocks + block_pool, 2); + float** new_coords = + FX_Alloc2D(float*, m_max_blocks + block_pool, 2); unsigned char** new_cmds = (unsigned char**)(new_coords + m_max_blocks + block_pool); if(m_coord_blocks) { FXSYS_memcpy(new_coords, m_coord_blocks, - m_max_blocks * sizeof(FX_FLOAT*)); + m_max_blocks * sizeof(float*)); FXSYS_memcpy(new_cmds, m_cmd_blocks, m_max_blocks * sizeof(unsigned char*)); @@ -70,9 +70,9 @@ void path_storage::allocate_block(unsigned nb) m_max_blocks += block_pool; } m_coord_blocks[nb] = - FX_Alloc( FX_FLOAT, block_size * 2 + + FX_Alloc( float, block_size * 2 + block_size / - (sizeof(FX_FLOAT) / sizeof(unsigned char))); + (sizeof(float) / sizeof(unsigned char))); m_cmd_blocks[nb] = (unsigned char*)(m_coord_blocks[nb] + block_size * 2); m_total_blocks++; @@ -81,9 +81,9 @@ void path_storage::rewind(unsigned path_id) { m_iterator = path_id; } -void path_storage::curve4(FX_FLOAT x_ctrl1, FX_FLOAT y_ctrl1, - FX_FLOAT x_ctrl2, FX_FLOAT y_ctrl2, - FX_FLOAT x_to, FX_FLOAT y_to) +void path_storage::curve4(float x_ctrl1, float y_ctrl1, + float x_ctrl2, float y_ctrl2, + float x_to, float y_to) { add_vertex(x_ctrl1, y_ctrl1, path_cmd_curve4); add_vertex(x_ctrl2, y_ctrl2, path_cmd_curve4); diff --git a/third_party/agg23/agg_path_storage.h b/third_party/agg23/agg_path_storage.h index 7f21bacd09..17e82d73e4 100644 --- a/third_party/agg23/agg_path_storage.h +++ b/third_party/agg23/agg_path_storage.h @@ -36,7 +36,7 @@ public: { m_vertex_idx = path_id; } - unsigned vertex(FX_FLOAT* x, FX_FLOAT* y) + unsigned vertex(float* x, float* y) { return (m_vertex_idx < m_path->total_vertices()) ? m_path->vertex(m_vertex_idx++, x, y) @@ -48,19 +48,19 @@ public: }; ~path_storage(); path_storage(); - unsigned last_vertex(FX_FLOAT* x, FX_FLOAT* y) const; - unsigned prev_vertex(FX_FLOAT* x, FX_FLOAT* y) const; - void move_to(FX_FLOAT x, FX_FLOAT y); - void line_to(FX_FLOAT x, FX_FLOAT y); - void curve4(FX_FLOAT x_ctrl1, FX_FLOAT y_ctrl1, - FX_FLOAT x_ctrl2, FX_FLOAT y_ctrl2, - FX_FLOAT x_to, FX_FLOAT y_to); + unsigned last_vertex(float* x, float* y) const; + unsigned prev_vertex(float* x, float* y) const; + void move_to(float x, float y); + void line_to(float x, float y); + void curve4(float x_ctrl1, float y_ctrl1, + float x_ctrl2, float y_ctrl2, + float x_to, float y_to); template<class VertexSource> void add_path(VertexSource& vs, unsigned path_id = 0, bool solid_path = true) { - FX_FLOAT x, y; + float x, y; unsigned cmd; vs.rewind(path_id); while(!is_stop(cmd = vs.vertex(&x, &y))) { @@ -75,7 +75,7 @@ public: unsigned path_id = 0, bool solid_path = true) { - FX_FLOAT x, y; + float x, y; unsigned cmd; int flag; vs.rewind(path_id); @@ -90,10 +90,10 @@ public: { return m_total_vertices; } - unsigned vertex(unsigned idx, FX_FLOAT* x, FX_FLOAT* y) const + unsigned vertex(unsigned idx, float* x, float* y) const { unsigned nb = idx >> block_shift; - const FX_FLOAT* pv = m_coord_blocks[nb] + ((idx & block_mask) << 1); + const float* pv = m_coord_blocks[nb] + ((idx & block_mask) << 1); *x = *pv++; *y = *pv; return m_cmd_blocks[nb][idx & block_mask]; @@ -107,42 +107,42 @@ public: return m_cmd_blocks[idx >> block_shift][idx & block_mask] & path_flags_jr; } void rewind(unsigned path_id); - unsigned vertex(FX_FLOAT* x, FX_FLOAT* y); - void add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd); + unsigned vertex(float* x, float* y); + void add_vertex(float x, float y, unsigned cmd); void end_poly(); private: void allocate_block(unsigned nb); - unsigned char* storage_ptrs(FX_FLOAT** xy_ptr); + unsigned char* storage_ptrs(float** xy_ptr); private: unsigned m_total_vertices; unsigned m_total_blocks; unsigned m_max_blocks; - FX_FLOAT** m_coord_blocks; + float** m_coord_blocks; unsigned char** m_cmd_blocks; unsigned m_iterator; }; -inline unsigned path_storage::vertex(FX_FLOAT* x, FX_FLOAT* y) +inline unsigned path_storage::vertex(float* x, float* y) { if(m_iterator >= m_total_vertices) { return path_cmd_stop; } return vertex(m_iterator++, x, y); } -inline unsigned path_storage::prev_vertex(FX_FLOAT* x, FX_FLOAT* y) const +inline unsigned path_storage::prev_vertex(float* x, float* y) const { if(m_total_vertices > 1) { return vertex(m_total_vertices - 2, x, y); } return path_cmd_stop; } -inline unsigned path_storage::last_vertex(FX_FLOAT* x, FX_FLOAT* y) const +inline unsigned path_storage::last_vertex(float* x, float* y) const { if(m_total_vertices) { return vertex(m_total_vertices - 1, x, y); } return path_cmd_stop; } -inline unsigned char* path_storage::storage_ptrs(FX_FLOAT** xy_ptr) +inline unsigned char* path_storage::storage_ptrs(float** xy_ptr) { unsigned nb = m_total_vertices >> block_shift; if(nb >= m_total_blocks) { @@ -151,20 +151,20 @@ inline unsigned char* path_storage::storage_ptrs(FX_FLOAT** xy_ptr) *xy_ptr = m_coord_blocks[nb] + ((m_total_vertices & block_mask) << 1); return m_cmd_blocks[nb] + (m_total_vertices & block_mask); } -inline void path_storage::add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd) +inline void path_storage::add_vertex(float x, float y, unsigned cmd) { - FX_FLOAT* coord_ptr = 0; + float* coord_ptr = 0; unsigned char* cmd_ptr = storage_ptrs(&coord_ptr); *cmd_ptr = (unsigned char)cmd; *coord_ptr++ = x; *coord_ptr = y; m_total_vertices++; } -inline void path_storage::move_to(FX_FLOAT x, FX_FLOAT y) +inline void path_storage::move_to(float x, float y) { add_vertex(x, y, path_cmd_move_to); } -inline void path_storage::line_to(FX_FLOAT x, FX_FLOAT y) +inline void path_storage::line_to(float x, float y) { add_vertex(x, y, path_cmd_line_to); } diff --git a/third_party/agg23/agg_rasterizer_scanline_aa.h b/third_party/agg23/agg_rasterizer_scanline_aa.h index fc28290f54..c747ee379e 100644 --- a/third_party/agg23/agg_rasterizer_scanline_aa.h +++ b/third_party/agg23/agg_rasterizer_scanline_aa.h @@ -45,7 +45,7 @@ enum poly_base_scale_e { poly_base_size = 1 << poly_base_shift, poly_base_mask = poly_base_size - 1 }; -inline int poly_coord(FX_FLOAT c) +inline int poly_coord(float c) { return int(c * poly_base_size); } @@ -219,14 +219,14 @@ public: m_outline.reset(); m_status = status_initial; } - void clip_box(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2) + void clip_box(float x1, float y1, float x2, float y2) { m_clip_box = rect(poly_coord(x1), poly_coord(y1), poly_coord(x2), poly_coord(y2)); m_clip_box.normalize(); m_clipping = true; } - void add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd) + void add_vertex(float x, float y, unsigned cmd) { if(is_close(cmd)) { close_polygon(); @@ -374,8 +374,8 @@ public: template<class VertexSource> void add_path(VertexSource& vs, unsigned path_id = 0) { - FX_FLOAT x; - FX_FLOAT y; + float x; + float y; unsigned cmd; vs.rewind(path_id); while(!is_stop(cmd = vs.vertex(&x, &y))) { @@ -385,8 +385,8 @@ public: template<class VertexSource> void add_path_transformed(VertexSource& vs, const CFX_Matrix* pMatrix, unsigned path_id = 0) { - FX_FLOAT x; - FX_FLOAT y; + float x; + float y; unsigned cmd; vs.rewind(path_id); while(!is_stop(cmd = vs.vertex(&x, &y))) { diff --git a/third_party/agg23/agg_shorten_path.h b/third_party/agg23/agg_shorten_path.h index d7eb4be018..2f62ec52d2 100644 --- a/third_party/agg23/agg_shorten_path.h +++ b/third_party/agg23/agg_shorten_path.h @@ -20,11 +20,11 @@ namespace agg { template<class VertexSequence> -void shorten_path(VertexSequence& vs, FX_FLOAT s, unsigned closed = 0) +void shorten_path(VertexSequence& vs, float s, unsigned closed = 0) { typedef typename VertexSequence::value_type vertex_type; if(s > 0 && vs.size() > 1) { - FX_FLOAT d; + float d; int n = int(vs.size() - 2); while(n) { d = vs[n].dist; @@ -42,8 +42,8 @@ void shorten_path(VertexSequence& vs, FX_FLOAT s, unsigned closed = 0) vertex_type& prev = vs[n - 1]; vertex_type& last = vs[n]; d = (prev.dist - s) / prev.dist; - FX_FLOAT x = prev.x + (last.x - prev.x) * d; - FX_FLOAT y = prev.y + (last.y - prev.y) * d; + float x = prev.x + (last.x - prev.x) * d; + float y = prev.y + (last.y - prev.y) * d; last.x = x; last.y = y; if(!prev(last)) { diff --git a/third_party/agg23/agg_vcgen_dash.cpp b/third_party/agg23/agg_vcgen_dash.cpp index bd5a2122a2..cfeab0764e 100644 --- a/third_party/agg23/agg_vcgen_dash.cpp +++ b/third_party/agg23/agg_vcgen_dash.cpp @@ -44,7 +44,7 @@ void vcgen_dash::remove_all_dashes() m_curr_dash_start = 0; m_curr_dash = 0; } -void vcgen_dash::add_dash(FX_FLOAT dash_len, FX_FLOAT gap_len) +void vcgen_dash::add_dash(float dash_len, float gap_len) { if(m_num_dashes < max_dashes) { m_total_dash_len += dash_len + gap_len; @@ -52,12 +52,12 @@ void vcgen_dash::add_dash(FX_FLOAT dash_len, FX_FLOAT gap_len) m_dashes[m_num_dashes++] = gap_len; } } -void vcgen_dash::dash_start(FX_FLOAT ds) +void vcgen_dash::dash_start(float ds) { m_dash_start = ds; calc_dash_start(FXSYS_fabs(ds)); } -void vcgen_dash::calc_dash_start(FX_FLOAT ds) +void vcgen_dash::calc_dash_start(float ds) { m_curr_dash = 0; m_curr_dash_start = 0; @@ -81,7 +81,7 @@ void vcgen_dash::remove_all() m_src_vertices.remove_all(); m_closed = 0; } -void vcgen_dash::add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd) +void vcgen_dash::add_vertex(float x, float y, unsigned cmd) { m_status = initial; if(is_move_to(cmd)) { @@ -103,7 +103,7 @@ void vcgen_dash::rewind(unsigned) m_status = ready; m_src_vertex = 0; } -unsigned vcgen_dash::vertex(FX_FLOAT* x, FX_FLOAT* y) +unsigned vcgen_dash::vertex(float* x, float* y) { unsigned cmd = path_cmd_move_to; while(!is_stop(cmd)) { @@ -127,7 +127,7 @@ unsigned vcgen_dash::vertex(FX_FLOAT* x, FX_FLOAT* y) } return path_cmd_move_to; case polyline: { - FX_FLOAT dash_rest = m_dashes[m_curr_dash] - m_curr_dash_start; + float dash_rest = m_dashes[m_curr_dash] - m_curr_dash_start; unsigned cmd = (m_curr_dash & 1) ? path_cmd_move_to : path_cmd_line_to; diff --git a/third_party/agg23/agg_vcgen_dash.h b/third_party/agg23/agg_vcgen_dash.h index 9c3aa630c2..7702fa7adc 100644 --- a/third_party/agg23/agg_vcgen_dash.h +++ b/third_party/agg23/agg_vcgen_dash.h @@ -38,9 +38,9 @@ public: typedef vertex_sequence<vertex_dist, 6> vertex_storage; vcgen_dash(); void remove_all_dashes(); - void add_dash(FX_FLOAT dash_len, FX_FLOAT gap_len); - void dash_start(FX_FLOAT ds); - void shorten(FX_FLOAT s) + void add_dash(float dash_len, float gap_len); + void dash_start(float ds); + void shorten(float s) { m_shorten = s; } @@ -49,21 +49,21 @@ public: return m_shorten; } void remove_all(); - void add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd); + void add_vertex(float x, float y, unsigned cmd); void rewind(unsigned path_id); - unsigned vertex(FX_FLOAT* x, FX_FLOAT* y); + unsigned vertex(float* x, float* y); private: vcgen_dash(const vcgen_dash&); const vcgen_dash& operator = (const vcgen_dash&); - void calc_dash_start(FX_FLOAT ds); - FX_FLOAT m_dashes[max_dashes]; - FX_FLOAT m_total_dash_len; + void calc_dash_start(float ds); + float m_dashes[max_dashes]; + float m_total_dash_len; unsigned m_num_dashes; - FX_FLOAT m_dash_start; - FX_FLOAT m_shorten; - FX_FLOAT m_curr_dash_start; + float m_dash_start; + float m_shorten; + float m_curr_dash_start; unsigned m_curr_dash; - FX_FLOAT m_curr_rest; + float m_curr_rest; const vertex_dist* m_v1; const vertex_dist* m_v2; vertex_storage m_src_vertices; diff --git a/third_party/agg23/agg_vcgen_stroke.cpp b/third_party/agg23/agg_vcgen_stroke.cpp index 03225b1649..a59abf0022 100644 --- a/third_party/agg23/agg_vcgen_stroke.cpp +++ b/third_party/agg23/agg_vcgen_stroke.cpp @@ -51,7 +51,7 @@ void vcgen_stroke::remove_all() m_closed = 0; m_status = initial; } -void vcgen_stroke::add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd) +void vcgen_stroke::add_vertex(float x, float y, unsigned cmd) { m_status = initial; if(is_move_to(cmd)) { @@ -64,13 +64,13 @@ void vcgen_stroke::add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd) } } } -static inline void calc_butt_cap(FX_FLOAT* cap, +static inline void calc_butt_cap(float* cap, const vertex_dist& v0, const vertex_dist& v1, - FX_FLOAT len, - FX_FLOAT width) { - FX_FLOAT dx = (v1.y - v0.y) * width / len; - FX_FLOAT dy = (v1.x - v0.x) * width / len; + float len, + float width) { + float dx = (v1.y - v0.y) * width / len; + float dy = (v1.x - v0.x) * width / len; cap[0] = v0.x - dx; cap[1] = v0.y + dy; cap[2] = v0.x + dx; @@ -88,7 +88,7 @@ void vcgen_stroke::rewind(unsigned) m_src_vertex = 0; m_out_vertex = 0; } -unsigned vcgen_stroke::vertex(FX_FLOAT* x, FX_FLOAT* y) +unsigned vcgen_stroke::vertex(float* x, float* y) { unsigned cmd = path_cmd_line_to; line_join_e curj; diff --git a/third_party/agg23/agg_vcgen_stroke.h b/third_party/agg23/agg_vcgen_stroke.h index 84fadd6ed8..23142d37f6 100644 --- a/third_party/agg23/agg_vcgen_stroke.h +++ b/third_party/agg23/agg_vcgen_stroke.h @@ -61,52 +61,52 @@ public: { return m_inner_join; } - void width(FX_FLOAT w) + void width(float w) { m_width = w / 2; } - void miter_limit(FX_FLOAT ml) + void miter_limit(float ml) { m_miter_limit = ml; } - void miter_limit_theta(FX_FLOAT t); - void inner_miter_limit(FX_FLOAT ml) + void miter_limit_theta(float t); + void inner_miter_limit(float ml) { m_inner_miter_limit = ml; } - void approximation_scale(FX_FLOAT as) + void approximation_scale(float as) { m_approx_scale = as; } - FX_FLOAT width() const + float width() const { return m_width * 2; } - FX_FLOAT miter_limit() const + float miter_limit() const { return m_miter_limit; } - FX_FLOAT inner_miter_limit() const + float inner_miter_limit() const { return m_inner_miter_limit; } - FX_FLOAT approximation_scale() const + float approximation_scale() const { return m_approx_scale; } void remove_all(); - void add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd); + void add_vertex(float x, float y, unsigned cmd); void rewind(unsigned path_id); - unsigned vertex(FX_FLOAT* x, FX_FLOAT* y); + unsigned vertex(float* x, float* y); private: vcgen_stroke(const vcgen_stroke&); const vcgen_stroke& operator = (const vcgen_stroke&); vertex_storage m_src_vertices; coord_storage m_out_vertices; - FX_FLOAT m_width; - FX_FLOAT m_miter_limit; - FX_FLOAT m_inner_miter_limit; - FX_FLOAT m_approx_scale; + float m_width; + float m_miter_limit; + float m_inner_miter_limit; + float m_approx_scale; line_cap_e m_line_cap; line_join_e m_line_join; inner_join_e m_inner_join; diff --git a/third_party/agg23/agg_vertex_sequence.h b/third_party/agg23/agg_vertex_sequence.h index 6600bf2085..448e57b04d 100644 --- a/third_party/agg23/agg_vertex_sequence.h +++ b/third_party/agg23/agg_vertex_sequence.h @@ -69,13 +69,13 @@ void vertex_sequence<T, S>::close(bool closed) } } } -const FX_FLOAT vertex_dist_epsilon = 1e-14f; +const float vertex_dist_epsilon = 1e-14f; struct vertex_dist { - FX_FLOAT x; - FX_FLOAT y; - FX_FLOAT dist; + float x; + float y; + float dist; vertex_dist() {} - vertex_dist(FX_FLOAT x_, FX_FLOAT y_) : + vertex_dist(float x_, float y_) : x(x_), y(y_), dist(0) @@ -90,7 +90,7 @@ struct vertex_dist { struct vertex_dist_cmd : public vertex_dist { unsigned cmd; vertex_dist_cmd() {} - vertex_dist_cmd(FX_FLOAT x_, FX_FLOAT y_, unsigned cmd_) : + vertex_dist_cmd(float x_, float y_, unsigned cmd_) : vertex_dist(x_, y_), cmd(cmd_) { 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); diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp index 1e0cc9c25e..37822140c3 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.cpp +++ b/xfa/fgas/layout/fgas_rtfbreak.cpp @@ -43,7 +43,7 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwLayoutStyles) CFX_RTFBreak::~CFX_RTFBreak() {} -void CFX_RTFBreak::SetLineBoundary(FX_FLOAT fLineStart, FX_FLOAT fLineEnd) { +void CFX_RTFBreak::SetLineBoundary(float fLineStart, float fLineEnd) { if (fLineStart > fLineEnd) return; @@ -53,7 +53,7 @@ void CFX_RTFBreak::SetLineBoundary(FX_FLOAT fLineStart, FX_FLOAT fLineEnd) { m_pCurLine->m_iStart = std::max(m_pCurLine->m_iStart, m_iBoundaryStart); } -void CFX_RTFBreak::SetLineStartPos(FX_FLOAT fLinePos) { +void CFX_RTFBreak::SetLineStartPos(float fLinePos) { int32_t iLinePos = FXSYS_round(fLinePos * 20000.0f); iLinePos = std::min(iLinePos, m_iBoundaryEnd); iLinePos = std::max(iLinePos, m_iBoundaryStart); @@ -69,7 +69,7 @@ void CFX_RTFBreak::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont) { FontChanged(); } -void CFX_RTFBreak::SetFontSize(FX_FLOAT fFontSize) { +void CFX_RTFBreak::SetFontSize(float fFontSize) { int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); if (m_iFontSize == iFontSize) return; @@ -92,11 +92,11 @@ void CFX_RTFBreak::FontChanged() { m_iDefChar *= m_iFontSize; } -void CFX_RTFBreak::SetTabWidth(FX_FLOAT fTabWidth) { +void CFX_RTFBreak::SetTabWidth(float fTabWidth) { m_iTabWidth = FXSYS_round(fTabWidth * 20000.0f); } -void CFX_RTFBreak::AddPositionedTab(FX_FLOAT fTabPos) { +void CFX_RTFBreak::AddPositionedTab(float fTabPos) { int32_t iTabPos = std::min(FXSYS_round(fTabPos * 20000.0f) + m_iBoundaryStart, m_iBoundaryEnd); auto it = std::lower_bound(m_PositionedTabs.begin(), m_PositionedTabs.end(), @@ -106,7 +106,7 @@ void CFX_RTFBreak::AddPositionedTab(FX_FLOAT fTabPos) { m_PositionedTabs.insert(it, iTabPos); } -void CFX_RTFBreak::SetLineBreakTolerance(FX_FLOAT fTolerance) { +void CFX_RTFBreak::SetLineBreakTolerance(float fTolerance) { m_iTolerance = FXSYS_round(fTolerance * 20000.0f); } @@ -130,7 +130,7 @@ void CFX_RTFBreak::SetVerticalScale(int32_t iScale) { m_iVerticalScale = iScale; } -void CFX_RTFBreak::SetCharSpace(FX_FLOAT fCharSpace) { +void CFX_RTFBreak::SetCharSpace(float fCharSpace) { m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f); } @@ -834,23 +834,23 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, CFX_RetainPtr<CFGAS_GEFont> pFont = pText->pFont; CFX_RectF rtText(*pText->pRect); bool bRTLPiece = FX_IsOdd(pText->iBidiLevel); - FX_FLOAT fFontSize = pText->fFontSize; + float fFontSize = pText->fFontSize; int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); int32_t iAscent = pFont->GetAscent(); int32_t iDescent = pFont->GetDescent(); int32_t iMaxHeight = iAscent - iDescent; - FX_FLOAT fFontHeight = fFontSize; - FX_FLOAT fAscent = fFontHeight * static_cast<FX_FLOAT>(iAscent) / - static_cast<FX_FLOAT>(iMaxHeight); + float fFontHeight = fFontSize; + float fAscent = fFontHeight * static_cast<float>(iAscent) / + static_cast<float>(iMaxHeight); wchar_t wPrev = 0xFEFF; wchar_t wNext; - FX_FLOAT fX = rtText.left; + float fX = rtText.left; int32_t iHorScale = pText->iHorizontalScale; int32_t iVerScale = pText->iVerticalScale; if (bRTLPiece) fX = rtText.right(); - FX_FLOAT fY = rtText.top + fAscent; + float fY = rtText.top + fAscent; int32_t iCount = 0; for (int32_t i = 0; i < pText->iLength; ++i) { wchar_t wch = pText->pStr[i]; @@ -900,7 +900,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, pCharPos->m_FontCharWidth = iCharWidth; } - FX_FLOAT fCharWidth = fFontSize * iCharWidth / 1000.0f; + float fCharWidth = fFontSize * iCharWidth / 1000.0f; if (bRTLPiece && dwCharType != FX_CHARTYPE_Combination) fX -= fCharWidth; diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h index 339d2f4bcd..978634d1c8 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.h +++ b/xfa/fgas/layout/fgas_rtfbreak.h @@ -37,7 +37,7 @@ struct FX_RTFTEXTOBJ { CFX_RetainPtr<CFGAS_GEFont> pFont; const CFX_RectF* pRect; wchar_t wLineBreakChar; - FX_FLOAT fFontSize; + float fFontSize; int32_t iLength; int32_t iBidiLevel; int32_t iHorizontalScale; @@ -49,19 +49,19 @@ class CFX_RTFBreak { explicit CFX_RTFBreak(uint32_t dwLayoutStyles); ~CFX_RTFBreak(); - void SetLineBoundary(FX_FLOAT fLineStart, FX_FLOAT fLineEnd); - void SetLineStartPos(FX_FLOAT fLinePos); + void SetLineBoundary(float fLineStart, float fLineEnd); + void SetLineStartPos(float fLinePos); void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont); - void SetFontSize(FX_FLOAT fFontSize); - void SetTabWidth(FX_FLOAT fTabWidth); - void SetLineBreakTolerance(FX_FLOAT fTolerance); + void SetFontSize(float fFontSize); + void SetTabWidth(float fTabWidth); + void SetLineBreakTolerance(float fTolerance); void SetHorizontalScale(int32_t iScale); void SetVerticalScale(int32_t iScale); - void SetCharSpace(FX_FLOAT fCharSpace); + void SetCharSpace(float fCharSpace); void SetAlignment(CFX_RTFLineAlignment align) { m_iAlignment = align; } void SetUserData(const CFX_RetainPtr<CFX_Retainable>& pUserData); - void AddPositionedTab(FX_FLOAT fTabPos); + void AddPositionedTab(float fTabPos); CFX_BreakType EndBreak(CFX_BreakType dwStatus); int32_t CountBreakPieces() const; diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp index eabe381621..8bba780382 100644 --- a/xfa/fgas/layout/fgas_textbreak.cpp +++ b/xfa/fgas/layout/fgas_textbreak.cpp @@ -67,7 +67,7 @@ CFX_TxtBreak::CFX_TxtBreak() CFX_TxtBreak::~CFX_TxtBreak() {} -void CFX_TxtBreak::SetLineWidth(FX_FLOAT fLineWidth) { +void CFX_TxtBreak::SetLineWidth(float fLineWidth) { m_iLineWidth = FXSYS_round(fLineWidth * 20000.0f); ASSERT(m_iLineWidth >= 20000); } @@ -88,7 +88,7 @@ void CFX_TxtBreak::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont) { FontChanged(); } -void CFX_TxtBreak::SetFontSize(FX_FLOAT fFontSize) { +void CFX_TxtBreak::SetFontSize(float fFontSize) { int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); if (m_iFontSize == iFontSize) return; @@ -107,7 +107,7 @@ void CFX_TxtBreak::FontChanged() { m_iDefChar *= m_iFontSize; } -void CFX_TxtBreak::SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant) { +void CFX_TxtBreak::SetTabWidth(float fTabWidth, bool bEquidistant) { m_iTabWidth = std::max(FXSYS_round(fTabWidth * 20000.0f), kMinimumTabWidth); m_bEquidistant = bEquidistant; } @@ -131,7 +131,7 @@ void CFX_TxtBreak::SetParagraphBreakChar(wchar_t wch) { m_wParagBreakChar = wch; } -void CFX_TxtBreak::SetLineBreakTolerance(FX_FLOAT fTolerance) { +void CFX_TxtBreak::SetLineBreakTolerance(float fTolerance) { m_iTolerance = FXSYS_round(fTolerance * 20000.0f); } @@ -147,7 +147,7 @@ void CFX_TxtBreak::ResetContextCharStyles() { m_dwContextCharStyles |= (m_iArabicContext << 8); } -void CFX_TxtBreak::SetCombWidth(FX_FLOAT fCombWidth) { +void CFX_TxtBreak::SetCombWidth(float fCombWidth) { m_iCombWidth = FXSYS_round(fCombWidth * 20000.0f); } @@ -171,7 +171,7 @@ void CFX_TxtBreak::SetHorizontalScale(int32_t iScale) { m_iHorScale = iScale; } -void CFX_TxtBreak::SetCharSpace(FX_FLOAT fCharSpace) { +void CFX_TxtBreak::SetCharSpace(float fCharSpace) { m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f); } @@ -841,22 +841,22 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, uint32_t dwStyles = pTxtRun->dwStyles; CFX_RectF rtText(*pTxtRun->pRect); bool bRTLPiece = (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0; - FX_FLOAT fFontSize = pTxtRun->fFontSize; + float fFontSize = pTxtRun->fFontSize; int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); int32_t iAscent = pFont->GetAscent(); int32_t iDescent = pFont->GetDescent(); int32_t iMaxHeight = iAscent - iDescent; - FX_FLOAT fFontHeight = fFontSize; - FX_FLOAT fAscent = fFontHeight * (FX_FLOAT)iAscent / (FX_FLOAT)iMaxHeight; - FX_FLOAT fX = rtText.left; - FX_FLOAT fY; - FX_FLOAT fCharWidth; - FX_FLOAT fCharHeight; + float fFontHeight = fFontSize; + float fAscent = fFontHeight * (float)iAscent / (float)iMaxHeight; + float fX = rtText.left; + float fY; + float fCharWidth; + float fCharHeight; int32_t iHorScale = pTxtRun->iHorizontalScale; int32_t iVerScale = pTxtRun->iVerticalScale; bool bSkipSpace = pTxtRun->bSkipSpace; FX_FORMCHAR formChars[3]; - FX_FLOAT fYBase; + float fYBase; if (bRTLPiece) fX = rtText.right(); @@ -1036,7 +1036,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, if ((dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0) { int32_t iFormWidth = iCharWidth; pFont->GetCharWidth(wForm, iFormWidth, false); - FX_FLOAT fOffset = fFontSize * (iCharWidth - iFormWidth) / 2000.0f; + float fOffset = fFontSize * (iCharWidth - iFormWidth) / 2000.0f; pCharPos->m_Origin.x += fOffset; } @@ -1045,7 +1045,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, if (pFont->GetCharBBox(wForm, &rtBBox, false)) { pCharPos->m_Origin.y = fYBase + fFontSize - - fFontSize * (FX_FLOAT)rtBBox.height / (FX_FLOAT)iMaxHeight; + fFontSize * (float)rtBBox.height / (float)iMaxHeight; } if (wForm == wch && wLast != 0xFEFF) { uint32_t dwLastProps = FX_GetUnicodeProperties(wLast); @@ -1102,9 +1102,9 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, int32_t* pWidths = pTxtRun->pWidths; int32_t iLength = pTxtRun->iLength; CFX_RectF rect(*pTxtRun->pRect); - FX_FLOAT fFontSize = pTxtRun->fFontSize; + float fFontSize = pTxtRun->fFontSize; int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); - FX_FLOAT fScale = fFontSize / 1000.0f; + float fScale = fFontSize / 1000.0f; CFX_RetainPtr<CFGAS_GEFont> pFont = pTxtRun->pFont; if (!pFont) bCharBBox = false; @@ -1113,16 +1113,16 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, if (bCharBBox) bCharBBox = pFont->GetBBox(&bbox); - FX_FLOAT fLeft = std::max(0.0f, bbox.left * fScale); - FX_FLOAT fHeight = FXSYS_fabs(bbox.height * fScale); + float fLeft = std::max(0.0f, bbox.left * fScale); + float fHeight = FXSYS_fabs(bbox.height * fScale); bool bRTLPiece = !!(pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel); bool bSingleLine = !!(pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_SingleLine); bool bCombText = !!(pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_CombText); wchar_t wch; wchar_t wLineBreakChar = pTxtRun->wLineBreakChar; int32_t iCharSize; - FX_FLOAT fCharSize; - FX_FLOAT fStart = bRTLPiece ? rect.right() : rect.left; + float fCharSize; + float fStart = bRTLPiece ? rect.right() : rect.left; std::vector<CFX_RectF> rtArray(iLength); for (int32_t i = 0; i < iLength; i++) { @@ -1133,7 +1133,7 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, wch = *pStr++; iCharSize = *pWidths++; } - fCharSize = static_cast<FX_FLOAT>(iCharSize) / 20000.0f; + fCharSize = static_cast<float>(iCharSize) / 20000.0f; bool bRet = (!bSingleLine && IsCtrlCode(wch)); if (!(wch == L'\v' || wch == L'\f' || wch == 0x2028 || wch == 0x2029 || (wLineBreakChar != 0xFEFF && wch == wLineBreakChar))) { @@ -1155,7 +1155,7 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, if (bCharBBox && !bRet) { int32_t iCharWidth = 1000; pFont->GetCharWidth(wch, iCharWidth, false); - FX_FLOAT fRTLeft = 0, fCharWidth = 0; + float fRTLeft = 0, fCharWidth = 0; if (iCharWidth > 0) { fCharWidth = iCharWidth * fScale; fRTLeft = fLeft; diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h index fd864f1296..d4aa1418e7 100644 --- a/xfa/fgas/layout/fgas_textbreak.h +++ b/xfa/fgas/layout/fgas_textbreak.h @@ -55,7 +55,7 @@ struct FX_TXTRUN { int32_t* pWidths; int32_t iLength; CFX_RetainPtr<CFGAS_GEFont> pFont; - FX_FLOAT fFontSize; + float fFontSize; uint32_t dwStyles; int32_t iHorizontalScale; int32_t iVerticalScale; @@ -70,19 +70,19 @@ class CFX_TxtBreak { CFX_TxtBreak(); ~CFX_TxtBreak(); - void SetLineWidth(FX_FLOAT fLineWidth); + void SetLineWidth(float fLineWidth); uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; } void SetLayoutStyles(uint32_t dwLayoutStyles); void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont); - void SetFontSize(FX_FLOAT fFontSize); - void SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant); + void SetFontSize(float fFontSize); + void SetTabWidth(float fTabWidth, bool bEquidistant); void SetDefaultChar(wchar_t wch); void SetParagraphBreakChar(wchar_t wch); - void SetLineBreakTolerance(FX_FLOAT fTolerance); + void SetLineBreakTolerance(float fTolerance); void SetHorizontalScale(int32_t iScale); - void SetCharSpace(FX_FLOAT fCharSpace); + void SetCharSpace(float fCharSpace); void SetAlignment(int32_t iAlignment); - void SetCombWidth(FX_FLOAT fCombWidth); + void SetCombWidth(float fCombWidth); CFX_BreakType EndBreak(CFX_BreakType dwStatus); int32_t CountBreakPieces() const; const CFX_BreakPiece* GetBreakPiece(int32_t index) const; diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp index 430215662e..b2c848fed9 100644 --- a/xfa/fgas/localization/fgas_locale.cpp +++ b/xfa/fgas/localization/fgas_locale.cpp @@ -95,11 +95,11 @@ class CFX_LCNumeric { CFX_LCNumeric(int64_t integral, uint32_t fractional = 0, int32_t exponent = 0); - explicit CFX_LCNumeric(FX_FLOAT dbRetValue); + explicit CFX_LCNumeric(float dbRetValue); explicit CFX_LCNumeric(double dbvalue); explicit CFX_LCNumeric(CFX_WideString& wsNumeric); - FX_FLOAT GetFloat() const; + float GetFloat() const; double GetDouble() const; CFX_WideString ToString() const; CFX_WideString ToString(int32_t nTreading, bool bTrimTailZeros) const; @@ -210,7 +210,7 @@ CFX_LCNumeric::CFX_LCNumeric(int64_t integral, m_Fractional = fractional; m_Exponent = exponent; } -CFX_LCNumeric::CFX_LCNumeric(FX_FLOAT dbRetValue) { +CFX_LCNumeric::CFX_LCNumeric(float dbRetValue) { m_Integral = (int64_t)dbRetValue; m_Fractional = (uint32_t)(((dbRetValue > 0) ? (dbRetValue - m_Integral) : (m_Integral - dbRetValue)) * @@ -227,11 +227,11 @@ CFX_LCNumeric::CFX_LCNumeric(double dbvalue) { CFX_LCNumeric::CFX_LCNumeric(CFX_WideString& wsNumeric) { FX_WStringToNumeric(wsNumeric, *this); } -FX_FLOAT CFX_LCNumeric::GetFloat() const { - FX_FLOAT dbRetValue = m_Fractional / 4294967296.0f; +float CFX_LCNumeric::GetFloat() const { + float dbRetValue = m_Fractional / 4294967296.0f; dbRetValue = m_Integral + (m_Integral >= 0 ? dbRetValue : -dbRetValue); if (m_Exponent != 0) { - dbRetValue *= FXSYS_pow(10, (FX_FLOAT)m_Exponent); + dbRetValue *= FXSYS_pow(10, (float)m_Exponent); } return dbRetValue; } @@ -239,7 +239,7 @@ double CFX_LCNumeric::GetDouble() const { double value = m_Fractional / 4294967296.0; value = m_Integral + (m_Integral >= 0 ? value : -value); if (m_Exponent != 0) { - value *= FXSYS_pow(10, (FX_FLOAT)m_Exponent); + value *= FXSYS_pow(10, (float)m_Exponent); } return value; } @@ -718,7 +718,7 @@ bool CFX_FormatString::ParseText(const CFX_WideString& wsSrcText, } bool CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_WideString& wsPattern, - FX_FLOAT& fValue) { + float& fValue) { fValue = 0.0f; if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty()) { return false; @@ -1412,7 +1412,7 @@ bool CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } } if (iExponent) { - dbRetValue *= FXSYS_pow(10, (FX_FLOAT)iExponent); + dbRetValue *= FXSYS_pow(10, (float)iExponent); } if (bHavePercentSymbol) { dbRetValue /= 100.0; @@ -1420,7 +1420,7 @@ bool CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (bNeg) { dbRetValue = -dbRetValue; } - fValue = (FX_FLOAT)dbRetValue; + fValue = (float)dbRetValue; return true; } @@ -1893,7 +1893,7 @@ bool CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (iExponent || bHavePercentSymbol) { CFX_Decimal decimal = CFX_Decimal(wsValue.AsStringC()); if (iExponent) { - decimal = decimal * CFX_Decimal(FXSYS_pow(10, (FX_FLOAT)iExponent)); + decimal = decimal * CFX_Decimal(FXSYS_pow(10, (float)iExponent)); } if (bHavePercentSymbol) { decimal = decimal / CFX_Decimal(100); @@ -3492,7 +3492,7 @@ bool CFX_FormatString::FormatNum(const CFX_WideString& wsSrcNum, } return FormatStrNum(wsSrcNum.AsStringC(), wsPattern, wsOutput); } -bool CFX_FormatString::FormatNum(FX_FLOAT fNum, +bool CFX_FormatString::FormatNum(float fNum, const CFX_WideString& wsPattern, CFX_WideString& wsOutput) { if (wsPattern.IsEmpty()) { @@ -4412,8 +4412,8 @@ CFX_Decimal::CFX_Decimal(int64_t val) { SetNegate(); } } -CFX_Decimal::CFX_Decimal(FX_FLOAT val, uint8_t scale) { - FX_FLOAT newval = fabs(val); +CFX_Decimal::CFX_Decimal(float val, uint8_t scale) { + float newval = fabs(val); uint64_t phi, pmid, plo; plo = (uint64_t)newval; pmid = (uint64_t)(newval / 1e32); diff --git a/xfa/fgas/localization/fgas_locale.h b/xfa/fgas/localization/fgas_locale.h index f15766d2dd..42f20f1c0f 100644 --- a/xfa/fgas/localization/fgas_locale.h +++ b/xfa/fgas/localization/fgas_locale.h @@ -103,7 +103,7 @@ class CFX_Decimal { explicit CFX_Decimal(uint64_t val); explicit CFX_Decimal(int32_t val); explicit CFX_Decimal(int64_t val); - explicit CFX_Decimal(FX_FLOAT val, uint8_t scale = 3); + explicit CFX_Decimal(float val, uint8_t scale = 3); explicit CFX_Decimal(const CFX_WideStringC& str); explicit CFX_Decimal(const CFX_ByteStringC& str); operator CFX_WideString() const; diff --git a/xfa/fgas/localization/fgas_localeimp.h b/xfa/fgas/localization/fgas_localeimp.h index a66921b61c..684dfee20b 100644 --- a/xfa/fgas/localization/fgas_localeimp.h +++ b/xfa/fgas/localization/fgas_localeimp.h @@ -28,7 +28,7 @@ class CFX_FormatString { CFX_WideString& wsValue); bool ParseNum(const CFX_WideString& wsSrcNum, const CFX_WideString& wsPattern, - FX_FLOAT& fValue); + float& fValue); bool ParseNum(const CFX_WideString& wsSrcNum, const CFX_WideString& wsPattern, CFX_WideString& wsValue); @@ -46,7 +46,7 @@ class CFX_FormatString { bool FormatNum(const CFX_WideString& wsSrcNum, const CFX_WideString& wsPattern, CFX_WideString& wsOutput); - bool FormatNum(FX_FLOAT fNum, + bool FormatNum(float fNum, const CFX_WideString& wsPattern, CFX_WideString& wsOutput); bool FormatDateTime(const CFX_WideString& wsSrcDateTime, diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp index ca31094fe6..c1ca3296b9 100644 --- a/xfa/fwl/cfwl_checkbox.cpp +++ b/xfa/fwl/cfwl_checkbox.cpp @@ -47,7 +47,7 @@ FWL_Type CFWL_CheckBox::GetClassID() const { return FWL_Type::CheckBox; } -void CFWL_CheckBox::SetBoxSize(FX_FLOAT fHeight) { +void CFWL_CheckBox::SetBoxSize(float fHeight) { m_fBoxHeight = fHeight; } @@ -129,7 +129,7 @@ void CFWL_CheckBox::Layout() { FXSYS_round(m_pProperties->m_rtWidget.height); m_rtClient = GetClientRect(); - FX_FLOAT fTextLeft = m_rtClient.left + m_fBoxHeight; + float fTextLeft = m_rtClient.left + m_fBoxHeight; m_rtBox = CFX_RectF(m_rtClient.TopLeft(), m_fBoxHeight, m_fBoxHeight); m_rtCaption = CFX_RectF(fTextLeft, m_rtClient.top, m_rtClient.right() - fTextLeft, m_rtClient.height); diff --git a/xfa/fwl/cfwl_checkbox.h b/xfa/fwl/cfwl_checkbox.h index 6df7440894..2f434f23cf 100644 --- a/xfa/fwl/cfwl_checkbox.h +++ b/xfa/fwl/cfwl_checkbox.h @@ -47,7 +47,7 @@ class CFWL_CheckBox : public CFWL_Widget { void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; - void SetBoxSize(FX_FLOAT fHeight); + void SetBoxSize(float fHeight); private: void SetCheckState(int32_t iCheck); @@ -69,7 +69,7 @@ class CFWL_CheckBox : public CFWL_Widget { uint32_t m_dwTTOStyles; int32_t m_iTTOAlign; bool m_bBtnDown; - FX_FLOAT m_fBoxHeight; + float m_fBoxHeight; }; #endif // XFA_FWL_CFWL_CHECKBOX_H_ diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp index 6083943f94..61c363c95b 100644 --- a/xfa/fwl/cfwl_combobox.cpp +++ b/xfa/fwl/cfwl_combobox.cpp @@ -376,7 +376,7 @@ void CFWL_ComboBox::Layout() { if (!theme) return; - FX_FLOAT fBtn = theme->GetScrollBarWidth(); + float fBtn = theme->GetScrollBarWidth(); m_rtBtn = CFX_RectF(m_rtClient.right() - fBtn, m_rtClient.top, fBtn, m_rtClient.height); if (!IsDropDownStyle() || !m_pEdit) @@ -543,13 +543,13 @@ void CFWL_ComboBox::DisForm_ShowDropList(bool bActivate) { ResetListItemAlignment(); pComboList->ChangeSelected(m_iCurSel); - FX_FLOAT fItemHeight = pComboList->CalcItemHeight(); - FX_FLOAT fBorder = GetBorderSize(true); - FX_FLOAT fPopupMin = 0.0f; + float fItemHeight = pComboList->CalcItemHeight(); + float fBorder = GetBorderSize(true); + float fPopupMin = 0.0f; if (iItems > 3) fPopupMin = fItemHeight * 3 + fBorder * 2; - FX_FLOAT fPopupMax = fItemHeight * iItems + fBorder * 2; + float fPopupMax = fItemHeight * iItems + fBorder * 2; CFX_RectF rtList(m_rtClient.left, 0, m_pProperties->m_rtWidget.width, 0); GetPopupPos(fPopupMin, fPopupMax, m_pProperties->m_rtWidget, rtList); @@ -666,8 +666,8 @@ void CFWL_ComboBox::DisForm_Layout() { if (!theme) return; - FX_FLOAT borderWidth = 1; - FX_FLOAT fBtn = theme->GetScrollBarWidth(); + float borderWidth = 1; + float fBtn = theme->GetScrollBarWidth(); if (!(GetStylesEx() & FWL_STYLEEXT_CMB_ReadOnly)) { m_rtBtn = CFX_RectF(m_rtClient.right() - fBtn, m_rtClient.top + borderWidth, diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp index a6ba65a3b2..e1d3a748d6 100644 --- a/xfa/fwl/cfwl_datetimepicker.cpp +++ b/xfa/fwl/cfwl_datetimepicker.cpp @@ -81,7 +81,7 @@ void CFWL_DateTimePicker::Update() { if (!theme) return; - FX_FLOAT fBtn = theme->GetScrollBarWidth(); + float fBtn = theme->GetScrollBarWidth(); m_rtBtn = CFX_RectF(m_rtClient.right() - fBtn, m_rtClient.top, fBtn - 1, m_rtClient.height - 1); @@ -349,8 +349,8 @@ void CFWL_DateTimePicker::DisForm_ShowMonthCalendar(bool bActivate) { if (bActivate) { CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect(); - FX_FLOAT fPopupMin = rtMonthCal.height; - FX_FLOAT fPopupMax = rtMonthCal.height; + float fPopupMin = rtMonthCal.height; + float fPopupMax = rtMonthCal.height; CFX_RectF rtAnchor(m_pProperties->m_rtWidget); rtAnchor.width = rtMonthCal.width; rtMonthCal.left = m_rtClient.left; diff --git a/xfa/fwl/cfwl_datetimepicker.h b/xfa/fwl/cfwl_datetimepicker.h index 2935ee8b1c..0f086d6b32 100644 --- a/xfa/fwl/cfwl_datetimepicker.h +++ b/xfa/fwl/cfwl_datetimepicker.h @@ -101,7 +101,7 @@ class CFWL_DateTimePicker : public CFWL_Widget { std::unique_ptr<CFWL_DateTimeEdit> m_pEdit; std::unique_ptr<CFWL_MonthCalendar> m_pMonthCal; std::unique_ptr<CFWL_FormProxy> m_pForm; - FX_FLOAT m_fBtn; + float m_fBtn; }; #endif // XFA_FWL_CFWL_DATETIMEPICKER_H_ diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index b3b05a52d0..4ddc3a624b 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -45,13 +45,13 @@ bool FX_EDIT_ISLATINWORD(wchar_t c) { } void AddSquigglyPath(CFX_Path* pPathData, - FX_FLOAT fStartX, - FX_FLOAT fEndX, - FX_FLOAT fY, - FX_FLOAT fStep) { + float fStartX, + float fEndX, + float fY, + float fStep) { pPathData->MoveTo(CFX_PointF(fStartX, fY)); int i = 1; - for (FX_FLOAT fx = fStartX + fStep; fx < fEndX; fx += fStep, ++i) + for (float fx = fStartX + fStep; fx < fEndX; fx += fStep, ++i) pPathData->LineTo(CFX_PointF(fx, fY + (i & 1) * fStep)); } @@ -161,16 +161,16 @@ FWL_WidgetHit CFWL_Edit::HitTest(const CFX_PointF& point) { void CFWL_Edit::AddSpellCheckObj(CFX_Path& PathData, int32_t nStart, int32_t nCount, - FX_FLOAT fOffSetX, - FX_FLOAT fOffSetY) { - FX_FLOAT fStartX = 0.0f; - FX_FLOAT fEndX = 0.0f; - FX_FLOAT fY = 0.0f; - FX_FLOAT fStep = 0.0f; + float fOffSetX, + float fOffSetY) { + float fStartX = 0.0f; + float fEndX = 0.0f; + float fY = 0.0f; + float fStep = 0.0f; CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); const FDE_TXTEDTPARAMS* txtEdtParams = m_EdtEngine.GetEditParams(); - FX_FLOAT fAsent = static_cast<FX_FLOAT>(txtEdtParams->pFont->GetAscent()) * - txtEdtParams->fFontSize / 1000; + float fAsent = static_cast<float>(txtEdtParams->pFont->GetAscent()) * + txtEdtParams->fFontSize / 1000; std::vector<CFX_RectF> rectArray; pPage->CalcRangeRectArray(nStart, nCount, &rectArray); @@ -195,8 +195,8 @@ void CFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics, CFX_ByteString sLatinWord; CFX_Path pathSpell; int32_t nStart = 0; - FX_FLOAT fOffSetX = m_rtEngine.left - m_fScrollOffsetX; - FX_FLOAT fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset; + float fOffSetX = m_rtEngine.left - m_fScrollOffsetX; + float fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset; CFX_WideString wsSpell = GetText(); int32_t nContentLen = wsSpell.GetLength(); for (int i = 0; i < nContentLen; i++) { @@ -468,7 +468,7 @@ bool CFWL_Edit::OnValidate(const CFX_WideString& wsText) { return event.bValidate; } -void CFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) { +void CFWL_Edit::SetScrollOffset(float fScrollOffset) { m_fScrollOffsetY = fScrollOffset; } @@ -516,8 +516,8 @@ void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics, pGraphics->SaveGraphState(); CFX_RectF rtClip = m_rtEngine; - FX_FLOAT fOffSetX = m_rtEngine.left - m_fScrollOffsetX; - FX_FLOAT fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset; + float fOffSetX = m_rtEngine.left - m_fScrollOffsetX; + float fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset; CFX_Matrix mt(1, 0, 0, 1, fOffSetX, fOffSetY); if (pMatrix) { pMatrix->TransformRect(rtClip); @@ -577,8 +577,8 @@ void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics, pGraphics->RestoreGraphState(); CFX_Path path; int32_t iLimit = m_nLimit > 0 ? m_nLimit : 1; - FX_FLOAT fStep = m_rtEngine.width / iLimit; - FX_FLOAT fLeft = m_rtEngine.left + 1; + float fStep = m_rtEngine.width / iLimit; + float fLeft = m_rtEngine.left + 1; for (int32_t i = 1; i < iLimit; i++) { fLeft += fStep; path.AddLine(CFX_PointF(fLeft, m_rtClient.top), @@ -710,8 +710,8 @@ void CFWL_Edit::UpdateEditLayout() { bool CFWL_Edit::UpdateOffset() { CFX_RectF rtCaret; m_EdtEngine.GetCaretRect(rtCaret); - FX_FLOAT fOffSetX = m_rtEngine.left - m_fScrollOffsetX; - FX_FLOAT fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset; + float fOffSetX = m_rtEngine.left - m_fScrollOffsetX; + float fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset; rtCaret.Offset(fOffSetX, fOffSetY); const CFX_RectF& rtEidt = m_rtEngine; if (rtEidt.Contains(rtCaret)) { @@ -732,8 +732,8 @@ bool CFWL_Edit::UpdateOffset() { return false; } - FX_FLOAT offsetX = 0.0; - FX_FLOAT offsetY = 0.0; + float offsetX = 0.0; + float offsetY = 0.0; if (rtCaret.left < rtEidt.left) offsetX = rtCaret.left - rtEidt.left; if (rtCaret.right() > rtEidt.right()) @@ -749,7 +749,7 @@ bool CFWL_Edit::UpdateOffset() { return true; } -bool CFWL_Edit::UpdateOffset(CFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged) { +bool CFWL_Edit::UpdateOffset(CFWL_ScrollBar* pScrollBar, float fPosChanged) { if (pScrollBar == m_pHorzScrollBar.get()) m_fScrollOffsetX += fPosChanged; else @@ -763,9 +763,9 @@ void CFWL_Edit::UpdateVAlignment() { return; const CFX_RectF& rtFDE = pPage->GetContentsBox(); - FX_FLOAT fOffsetY = 0.0f; - FX_FLOAT fSpaceAbove = 0.0f; - FX_FLOAT fSpaceBelow = 0.0f; + float fOffsetY = 0.0f; + float fSpaceAbove = 0.0f; + float fSpaceBelow = 0.0f; IFWL_ThemeProvider* theme = GetAvailableTheme(); if (theme) { CFWL_ThemePart part; @@ -807,7 +807,7 @@ void CFWL_Edit::UpdateCaret() { CFX_RectF rtClient = GetClientRect(); rtCaret.Intersect(rtClient); if (rtCaret.left > rtClient.right()) { - FX_FLOAT right = rtCaret.right(); + float right = rtCaret.right(); rtCaret.left = rtClient.right() - 1; rtCaret.width = right - rtCaret.left; } @@ -838,10 +838,10 @@ CFWL_ScrollBar* CFWL_Edit::UpdateScroll() { CFX_RectF rtScroll = m_pHorzScrollBar->GetWidgetRect(); if (rtScroll.width < rtFDE.width) { m_pHorzScrollBar->LockUpdate(); - FX_FLOAT fRange = rtFDE.width - rtScroll.width; + float fRange = rtFDE.width - rtScroll.width; m_pHorzScrollBar->SetRange(0.0f, fRange); - FX_FLOAT fPos = std::min(std::max(m_fScrollOffsetX, 0.0f), fRange); + float fPos = std::min(std::max(m_fScrollOffsetX, 0.0f), fRange); m_pHorzScrollBar->SetPos(fPos); m_pHorzScrollBar->SetTrackPos(fPos); m_pHorzScrollBar->SetPageSize(rtScroll.width); @@ -864,11 +864,11 @@ CFWL_ScrollBar* CFWL_Edit::UpdateScroll() { CFX_RectF rtScroll = m_pVertScrollBar->GetWidgetRect(); if (rtScroll.height < rtFDE.height) { m_pVertScrollBar->LockUpdate(); - FX_FLOAT fStep = m_EdtEngine.GetEditParams()->fLineSpace; - FX_FLOAT fRange = std::max(rtFDE.height - m_rtEngine.height, fStep); + float fStep = m_EdtEngine.GetEditParams()->fLineSpace; + float fRange = std::max(rtFDE.height - m_rtEngine.height, fStep); m_pVertScrollBar->SetRange(0.0f, fRange); - FX_FLOAT fPos = std::min(std::max(m_fScrollOffsetY, 0.0f), fRange); + float fPos = std::min(std::max(m_fScrollOffsetY, 0.0f), fRange); m_pVertScrollBar->SetPos(fPos); m_pVertScrollBar->SetTrackPos(fPos); m_pVertScrollBar->SetPageSize(rtScroll.height); @@ -934,7 +934,7 @@ void CFWL_Edit::Layout() { if (!theme) return; - FX_FLOAT fWidth = theme->GetScrollBarWidth(); + float fWidth = theme->GetScrollBarWidth(); CFWL_ThemePart part; if (!m_pOuter) { part.m_pWidget = this; @@ -1004,7 +1004,7 @@ void CFWL_Edit::LayoutScrollBar() { bool bShowHorzScrollbar = IsShowScrollBar(false); IFWL_ThemeProvider* theme = GetAvailableTheme(); - FX_FLOAT fWidth = theme ? theme->GetScrollBarWidth() : 0; + float fWidth = theme ? theme->GetScrollBarWidth() : 0; if (bShowVertScrollbar) { if (!m_pVertScrollBar) { InitVerticalScrollBar(); @@ -1483,11 +1483,11 @@ void CFWL_Edit::OnChar(CFWL_MessageKey* pMsg) { bool CFWL_Edit::OnScroll(CFWL_ScrollBar* pScrollBar, CFWL_EventScroll::Code dwCode, - FX_FLOAT fPos) { + float fPos) { CFX_SizeF fs; pScrollBar->GetRange(&fs.width, &fs.height); - FX_FLOAT iCurPos = pScrollBar->GetPos(); - FX_FLOAT fStep = pScrollBar->GetStepSize(); + float iCurPos = pScrollBar->GetPos(); + float fStep = pScrollBar->GetStepSize(); switch (dwCode) { case CFWL_EventScroll::Code::Min: { fPos = fs.width; diff --git a/xfa/fwl/cfwl_edit.h b/xfa/fwl/cfwl_edit.h index 13e4be2c68..0dbbcd6eef 100644 --- a/xfa/fwl/cfwl_edit.h +++ b/xfa/fwl/cfwl_edit.h @@ -100,7 +100,7 @@ class CFWL_Edit : public CFWL_Widget { bool OnPageUnload(int32_t nPageIndex); void OnAddDoRecord(std::unique_ptr<IFDE_TxtEdtDoRecord> pRecord); bool OnValidate(const CFX_WideString& wsText); - void SetScrollOffset(FX_FLOAT fScrollOffset); + void SetScrollOffset(float fScrollOffset); protected: void ShowCaret(CFX_RectF* pRect); @@ -121,7 +121,7 @@ class CFWL_Edit : public CFWL_Widget { void UpdateEditParams(); void UpdateEditLayout(); bool UpdateOffset(); - bool UpdateOffset(CFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged); + bool UpdateOffset(CFWL_ScrollBar* pScrollBar, float fPosChanged); void UpdateVAlignment(); void UpdateCaret(); CFWL_ScrollBar* UpdateScroll(); @@ -141,8 +141,8 @@ class CFWL_Edit : public CFWL_Widget { void AddSpellCheckObj(CFX_Path& PathData, int32_t nStart, int32_t nCount, - FX_FLOAT fOffSetX, - FX_FLOAT fOffSetY); + float fOffSetX, + float fOffSetY); void DoButtonDown(CFWL_MessageMouse* pMsg); void OnFocusChanged(CFWL_Message* pMsg, bool bSet); @@ -154,19 +154,19 @@ class CFWL_Edit : public CFWL_Widget { void OnChar(CFWL_MessageKey* pMsg); bool OnScroll(CFWL_ScrollBar* pScrollBar, CFWL_EventScroll::Code dwCode, - FX_FLOAT fPos); + float fPos); CFX_RectF m_rtClient; CFX_RectF m_rtEngine; CFX_RectF m_rtStatic; - FX_FLOAT m_fVAlignOffset; - FX_FLOAT m_fScrollOffsetX; - FX_FLOAT m_fScrollOffsetY; + float m_fVAlignOffset; + float m_fScrollOffsetX; + float m_fScrollOffsetY; CFDE_TxtEdtEngine m_EdtEngine; bool m_bLButtonDown; int32_t m_nSelStart; int32_t m_nLimit; - FX_FLOAT m_fFontSize; + float m_fFontSize; bool m_bSetRange; int32_t m_iMax; std::unique_ptr<CFWL_ScrollBar> m_pVertScrollBar; diff --git a/xfa/fwl/cfwl_eventscroll.h b/xfa/fwl/cfwl_eventscroll.h index 2fdef9e7b1..a13eeef020 100644 --- a/xfa/fwl/cfwl_eventscroll.h +++ b/xfa/fwl/cfwl_eventscroll.h @@ -28,7 +28,7 @@ class CFWL_EventScroll : public CFWL_Event { ~CFWL_EventScroll() override; Code m_iScrollCode; - FX_FLOAT m_fPos; + float m_fPos; }; #endif // XFA_FWL_CFWL_EVENTSCROLL_H_ diff --git a/xfa/fwl/cfwl_form.cpp b/xfa/fwl/cfwl_form.cpp index 5e956ade2d..1b2d668e5a 100644 --- a/xfa/fwl/cfwl_form.cpp +++ b/xfa/fwl/cfwl_form.cpp @@ -161,8 +161,8 @@ void CFWL_Form::DrawBackground(CFX_Graphics* pGraphics, CFX_RectF CFWL_Form::GetEdgeRect() { CFX_RectF rtEdge = m_rtRelative; if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { - FX_FLOAT fCX = GetBorderSize(true); - FX_FLOAT fCY = GetBorderSize(false); + float fCX = GetBorderSize(true); + float fCY = GetBorderSize(false); rtEdge.Deflate(fCX, fCY, fCX, fCY); } return rtEdge; diff --git a/xfa/fwl/cfwl_form.h b/xfa/fwl/cfwl_form.h index 7202cb279b..ec7fc137be 100644 --- a/xfa/fwl/cfwl_form.h +++ b/xfa/fwl/cfwl_form.h @@ -63,8 +63,8 @@ class CFWL_Form : public CFWL_Widget { CFX_RectF m_rtRelative; std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop; CFWL_Widget* m_pSubFocus; - FX_FLOAT m_fCXBorder; - FX_FLOAT m_fCYBorder; + float m_fCXBorder; + float m_fCYBorder; }; #endif // XFA_FWL_CFWL_FORM_H_ diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp index 0b82709972..925c6f1f72 100644 --- a/xfa/fwl/cfwl_listbox.cpp +++ b/xfa/fwl/cfwl_listbox.cpp @@ -306,11 +306,11 @@ void CFWL_ListBox::SetFocusItem(CFWL_ListItem* pItem) { CFWL_ListItem* CFWL_ListBox::GetItemAtPoint(const CFX_PointF& point) { CFX_PointF pos = point - m_rtConent.TopLeft(); - FX_FLOAT fPosX = 0.0f; + float fPosX = 0.0f; if (m_pHorzScrollBar) fPosX = m_pHorzScrollBar->GetPos(); - FX_FLOAT fPosY = 0.0; + float fPosY = 0.0; if (m_pVertScrollBar) fPosY = m_pVertScrollBar->GetPos(); @@ -334,7 +334,7 @@ bool CFWL_ListBox::ScrollToVisible(CFWL_ListItem* pItem) { CFX_RectF rtItem = pItem ? pItem->GetRect() : CFX_RectF(); bool bScroll = false; - FX_FLOAT fPosY = m_pVertScrollBar->GetPos(); + float fPosY = m_pVertScrollBar->GetPos(); rtItem.Offset(0, -fPosY + m_rtConent.top); if (rtItem.top < m_rtConent.top) { fPosY += rtItem.top - m_rtConent.top; @@ -378,11 +378,11 @@ void CFWL_ListBox::DrawBkground(CFX_Graphics* pGraphics, void CFWL_ListBox::DrawItems(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix) { - FX_FLOAT fPosX = 0.0f; + float fPosX = 0.0f; if (m_pHorzScrollBar) fPosX = m_pHorzScrollBar->GetPos(); - FX_FLOAT fPosY = 0.0f; + float fPosY = 0.0f; if (m_pVertScrollBar) fPosY = m_pVertScrollBar->GetPos(); @@ -484,11 +484,10 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { pUIMargin.height); } - FX_FLOAT fWidth = GetMaxTextWidth(); + float fWidth = GetMaxTextWidth(); fWidth += 2 * kItemTextMargin; if (!bAutoSize) { - FX_FLOAT fActualWidth = - m_rtClient.width - rtUIMargin.left - rtUIMargin.width; + float fActualWidth = m_rtClient.width - rtUIMargin.left - rtUIMargin.width; fWidth = std::max(fWidth, fActualWidth); } m_fItemHeight = CalcItemHeight(); @@ -502,7 +501,7 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { if (bAutoSize) return fs; - FX_FLOAT iHeight = m_rtClient.height; + float iHeight = m_rtClient.height; bool bShowVertScr = false; bool bShowHorzScr = false; if (!bShowVertScr && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll)) @@ -527,7 +526,7 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { m_pVertScrollBar->SetPageSize(rtScrollBar.height * 9 / 10); m_pVertScrollBar->SetStepSize(m_fItemHeight); - FX_FLOAT fPos = + float fPos = std::min(std::max(m_pVertScrollBar->GetPos(), 0.f), szRange.height); m_pVertScrollBar->SetPos(fPos); m_pVertScrollBar->SetTrackPos(fPos); @@ -559,7 +558,7 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { m_pHorzScrollBar->SetPageSize(fWidth * 9 / 10); m_pHorzScrollBar->SetStepSize(fWidth / 10); - FX_FLOAT fPos = + float fPos = std::min(std::max(m_pHorzScrollBar->GetPos(), 0.f), szRange.height); m_pHorzScrollBar->SetPos(fPos); m_pHorzScrollBar->SetTrackPos(fPos); @@ -584,8 +583,8 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { void CFWL_ListBox::UpdateItemSize(CFWL_ListItem* pItem, CFX_SizeF& size, - FX_FLOAT fWidth, - FX_FLOAT fItemHeight, + float fWidth, + float fItemHeight, bool bAutoSize) const { if (!bAutoSize && pItem) { CFX_RectF rtItem(0, size.height, fWidth, fItemHeight); @@ -595,8 +594,8 @@ void CFWL_ListBox::UpdateItemSize(CFWL_ListItem* pItem, size.height += fItemHeight; } -FX_FLOAT CFWL_ListBox::GetMaxTextWidth() { - FX_FLOAT fRet = 0.0f; +float CFWL_ListBox::GetMaxTextWidth() { + float fRet = 0.0f; int32_t iCount = CountItems(this); for (int32_t i = 0; i < iCount; i++) { CFWL_ListItem* pItem = GetItem(this, i); @@ -610,12 +609,12 @@ FX_FLOAT CFWL_ListBox::GetMaxTextWidth() { return fRet; } -FX_FLOAT CFWL_ListBox::GetScrollWidth() { +float CFWL_ListBox::GetScrollWidth() { IFWL_ThemeProvider* theme = GetAvailableTheme(); return theme ? theme->GetScrollBarWidth() : 0.0f; } -FX_FLOAT CFWL_ListBox::CalcItemHeight() { +float CFWL_ListBox::CalcItemHeight() { IFWL_ThemeProvider* theme = GetAvailableTheme(); CFWL_ThemePart part; part.m_pWidget = this; @@ -838,11 +837,11 @@ void CFWL_ListBox::OnVK(CFWL_ListItem* pItem, bool bShift, bool bCtrl) { bool CFWL_ListBox::OnScroll(CFWL_ScrollBar* pScrollBar, CFWL_EventScroll::Code dwCode, - FX_FLOAT fPos) { + float fPos) { CFX_SizeF fs; pScrollBar->GetRange(&fs.width, &fs.height); - FX_FLOAT iCurPos = pScrollBar->GetPos(); - FX_FLOAT fStep = pScrollBar->GetStepSize(); + float iCurPos = pScrollBar->GetPos(); + float fStep = pScrollBar->GetStepSize(); switch (dwCode) { case CFWL_EventScroll::Code::Min: { fPos = fs.width; diff --git a/xfa/fwl/cfwl_listbox.h b/xfa/fwl/cfwl_listbox.h index caa4f509f8..18aaf4cbd5 100644 --- a/xfa/fwl/cfwl_listbox.h +++ b/xfa/fwl/cfwl_listbox.h @@ -63,8 +63,8 @@ class CFWL_ListBox : public CFWL_Widget { int32_t GetSelIndex(int32_t nIndex); void SetSelItem(CFWL_ListItem* hItem, bool bSelect); - FX_FLOAT GetItemHeight() const { return m_fItemHeight; } - FX_FLOAT CalcItemHeight(); + float GetItemHeight() const { return m_fItemHeight; } + float CalcItemHeight(); protected: CFWL_ListItem* GetListItem(CFWL_ListItem* hItem, uint32_t dwKeyCode); @@ -101,11 +101,11 @@ class CFWL_ListBox : public CFWL_Widget { CFX_SizeF CalcSize(bool bAutoSize); void UpdateItemSize(CFWL_ListItem* hItem, CFX_SizeF& size, - FX_FLOAT fWidth, - FX_FLOAT fHeight, + float fWidth, + float fHeight, bool bAutoSize) const; - FX_FLOAT GetMaxTextWidth(); - FX_FLOAT GetScrollWidth(); + float GetMaxTextWidth(); + float GetScrollWidth(); void OnFocusChanged(CFWL_Message* pMsg, bool bSet); void OnLButtonDown(CFWL_MessageMouse* pMsg); @@ -115,7 +115,7 @@ class CFWL_ListBox : public CFWL_Widget { void OnVK(CFWL_ListItem* hItem, bool bShift, bool bCtrl); bool OnScroll(CFWL_ScrollBar* pScrollBar, CFWL_EventScroll::Code dwCode, - FX_FLOAT fPos); + float fPos); CFX_RectF m_rtClient; CFX_RectF m_rtStatic; @@ -125,8 +125,8 @@ class CFWL_ListBox : public CFWL_Widget { uint32_t m_dwTTOStyles; int32_t m_iTTOAligns; CFWL_ListItem* m_hAnchor; - FX_FLOAT m_fItemHeight; - FX_FLOAT m_fScorllBarWidth; + float m_fItemHeight; + float m_fScorllBarWidth; bool m_bLButtonDown; IFWL_ThemeProvider* m_pScrollBarTP; std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp index 2dcac03731..6d6066370d 100644 --- a/xfa/fwl/cfwl_monthcalendar.cpp +++ b/xfa/fwl/cfwl_monthcalendar.cpp @@ -415,8 +415,8 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() { CFWL_ThemePart params; params.m_pWidget = this; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; - FX_FLOAT fMaxWeekW = 0.0f; - FX_FLOAT fMaxWeekH = 0.0f; + float fMaxWeekW = 0.0f; + float fMaxWeekH = 0.0f; for (uint32_t i = 0; i < 7; ++i) { CFX_SizeF sz = CalcTextSize(GetCapacityForDay(pTheme, params, i), @@ -425,8 +425,8 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() { fMaxWeekH = (fMaxWeekH >= sz.height) ? fMaxWeekH : sz.height; } - FX_FLOAT fDayMaxW = 0.0f; - FX_FLOAT fDayMaxH = 0.0f; + float fDayMaxW = 0.0f; + float fDayMaxH = 0.0f; for (int day = 10; day <= 31; day++) { CFX_WideString wsDay; wsDay.Format(L"%d", day); @@ -434,16 +434,16 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() { fDayMaxW = (fDayMaxW >= sz.width) ? fDayMaxW : sz.width; fDayMaxH = (fDayMaxH >= sz.height) ? fDayMaxH : sz.height; } - m_szCell.width = FX_FLOAT((fMaxWeekW >= fDayMaxW) ? (int)(fMaxWeekW + 0.5) - : (int)(fDayMaxW + 0.5)); + m_szCell.width = float((fMaxWeekW >= fDayMaxW) ? (int)(fMaxWeekW + 0.5) + : (int)(fDayMaxW + 0.5)); m_szCell.height = (fMaxWeekH >= fDayMaxH) ? fMaxWeekH : fDayMaxH; CFX_SizeF fs; fs.width = m_szCell.width * MONTHCAL_COLUMNS + MONTHCAL_HMARGIN * MONTHCAL_COLUMNS * 2 + MONTHCAL_HEADER_BTN_HMARGIN * 2; - FX_FLOAT fMonthMaxW = 0.0f; - FX_FLOAT fMonthMaxH = 0.0f; + float fMonthMaxW = 0.0f; + float fMonthMaxH = 0.0f; for (uint32_t i = 0; i < 12; ++i) { CFX_SizeF sz = CalcTextSize(GetCapacityForMonth(pTheme, params, i), @@ -472,8 +472,8 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() { } void CFWL_MonthCalendar::CalcHeadSize() { - FX_FLOAT fHeadHMargin = (m_rtClient.width - m_szHead.width) / 2; - FX_FLOAT fHeadVMargin = (m_szCell.width - m_szHead.height) / 2; + float fHeadHMargin = (m_rtClient.width - m_szHead.width) / 2; + float fHeadVMargin = (m_szCell.width - m_szHead.height) / 2; m_rtHeadText = CFX_RectF(m_rtClient.left + fHeadHMargin, m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN + fHeadVMargin, @@ -527,8 +527,8 @@ void CFWL_MonthCalendar::Layout() { void CFWL_MonthCalendar::CalDateItem() { bool bNewWeek = false; int32_t iWeekOfMonth = 0; - FX_FLOAT fLeft = m_rtDates.left; - FX_FLOAT fTop = m_rtDates.top; + float fLeft = m_rtDates.left; + float fTop = m_rtDates.top; for (const auto& pDateInfo : m_arrDates) { if (bNewWeek) { iWeekOfMonth++; diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp index 1da2674550..abe99dacce 100644 --- a/xfa/fwl/cfwl_scrollbar.cpp +++ b/xfa/fwl/cfwl_scrollbar.cpp @@ -90,14 +90,14 @@ void CFWL_ScrollBar::DrawWidget(CFX_Graphics* pGraphics, DrawThumb(pGraphics, pTheme, pMatrix); } -void CFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { +void CFWL_ScrollBar::SetTrackPos(float fTrackPos) { m_fTrackPos = fTrackPos; m_rtThumb = CalcThumbButtonRect(m_rtThumb); m_rtMinTrack = CalcMinTrackRect(m_rtMinTrack); m_rtMaxTrack = CalcMaxTrackRect(m_rtMaxTrack); } -bool CFWL_ScrollBar::DoScroll(CFWL_EventScroll::Code dwCode, FX_FLOAT fPos) { +bool CFWL_ScrollBar::DoScroll(CFWL_EventScroll::Code dwCode, float fPos) { if (dwCode == CFWL_EventScroll::Code::None) return false; return OnScroll(dwCode, fPos); @@ -164,7 +164,7 @@ void CFWL_ScrollBar::Layout() { void CFWL_ScrollBar::CalcButtonLen() { m_fButtonLen = IsVertical() ? m_rtClient.width : m_rtClient.height; - FX_FLOAT fLength = IsVertical() ? m_rtClient.height : m_rtClient.width; + float fLength = IsVertical() ? m_rtClient.height : m_rtClient.width; if (fLength < m_fButtonLen * 2) { m_fButtonLen = fLength / 2; m_bMinSize = true; @@ -199,7 +199,7 @@ CFX_RectF CFWL_ScrollBar::CalcThumbButtonRect(const CFX_RectF& rtThumb) { return rect; } - FX_FLOAT fRange = m_fRangeMax - m_fRangeMin; + float fRange = m_fRangeMax - m_fRangeMin; if (fRange < 0) { if (IsVertical()) { return CFX_RectF(m_rtClient.left, m_rtMaxBtn.bottom(), m_rtClient.width, @@ -209,22 +209,21 @@ CFX_RectF CFWL_ScrollBar::CalcThumbButtonRect(const CFX_RectF& rtThumb) { } CFX_RectF rtClient = m_rtClient; - FX_FLOAT fLength = IsVertical() ? rtClient.height : rtClient.width; - FX_FLOAT fSize = m_fButtonLen; + float fLength = IsVertical() ? rtClient.height : rtClient.width; + float fSize = m_fButtonLen; fLength -= fSize * 2.0f; if (fLength < fSize) fLength = 0.0f; - FX_FLOAT fThumbSize = fLength * fLength / (fRange + fLength); + float fThumbSize = fLength * fLength / (fRange + fLength); fThumbSize = std::max(fThumbSize, kMinThumbSize); - FX_FLOAT fDiff = std::max(fLength - fThumbSize, 0.0f); - FX_FLOAT fTrackPos = - std::max(std::min(m_fTrackPos, m_fRangeMax), m_fRangeMin); + float fDiff = std::max(fLength - fThumbSize, 0.0f); + float fTrackPos = std::max(std::min(m_fTrackPos, m_fRangeMax), m_fRangeMin); if (!fRange) return rect; - FX_FLOAT iPos = fSize + fDiff * (fTrackPos - m_fRangeMin) / fRange; + float iPos = fSize + fDiff * (fTrackPos - m_fRangeMin) / fRange; rect.left = rtClient.left; rect.top = rtClient.top; if (IsVertical()) { @@ -264,20 +263,20 @@ CFX_RectF CFWL_ScrollBar::CalcMaxTrackRect(const CFX_RectF& rtMaxRect) { return CFX_RectF(rtMaxRect.TopLeft(), 0, 0); if (IsVertical()) { - FX_FLOAT iy = (m_rtThumb.top + m_rtThumb.bottom()) / 2; + float iy = (m_rtThumb.top + m_rtThumb.bottom()) / 2; return CFX_RectF(m_rtClient.left, iy, m_rtClient.width, m_rtClient.bottom() - iy); } - FX_FLOAT ix = (m_rtThumb.left + m_rtThumb.right()) / 2; + float ix = (m_rtThumb.left + m_rtThumb.right()) / 2; return CFX_RectF(ix, m_rtClient.top, m_rtClient.height - ix, m_rtClient.height); } -FX_FLOAT CFWL_ScrollBar::GetTrackPointPos(const CFX_PointF& point) { +float CFWL_ScrollBar::GetTrackPointPos(const CFX_PointF& point) { CFX_PointF diff = point - m_cpTrackPoint; - FX_FLOAT fRange = m_fRangeMax - m_fRangeMin; - FX_FLOAT fPos; + float fRange = m_fRangeMax - m_fRangeMin; + float fPos; if (IsVertical()) { fPos = fRange * diff.y / @@ -317,7 +316,7 @@ bool CFWL_ScrollBar::SendEvent() { return true; } -bool CFWL_ScrollBar::OnScroll(CFWL_EventScroll::Code dwCode, FX_FLOAT fPos) { +bool CFWL_ScrollBar::OnScroll(CFWL_EventScroll::Code dwCode, float fPos) { CFWL_EventScroll ev(this); ev.m_iScrollCode = dwCode; ev.m_fPos = fPos; diff --git a/xfa/fwl/cfwl_scrollbar.h b/xfa/fwl/cfwl_scrollbar.h index 6a67fa8687..262d0794d8 100644 --- a/xfa/fwl/cfwl_scrollbar.h +++ b/xfa/fwl/cfwl_scrollbar.h @@ -35,23 +35,23 @@ class CFWL_ScrollBar : public CFWL_Widget { void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; - void GetRange(FX_FLOAT* fMin, FX_FLOAT* fMax) const { + void GetRange(float* fMin, float* fMax) const { ASSERT(fMin); ASSERT(fMax); *fMin = m_fRangeMin; *fMax = m_fRangeMax; } - void SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { + void SetRange(float fMin, float fMax) { m_fRangeMin = fMin; m_fRangeMax = fMax; } - FX_FLOAT GetPageSize() const { return m_fPageSize; } - void SetPageSize(FX_FLOAT fPageSize) { m_fPageSize = fPageSize; } - FX_FLOAT GetStepSize() const { return m_fStepSize; } - void SetStepSize(FX_FLOAT fStepSize) { m_fStepSize = fStepSize; } - FX_FLOAT GetPos() const { return m_fPos; } - void SetPos(FX_FLOAT fPos) { m_fPos = fPos; } - void SetTrackPos(FX_FLOAT fTrackPos); + float GetPageSize() const { return m_fPageSize; } + void SetPageSize(float fPageSize) { m_fPageSize = fPageSize; } + float GetStepSize() const { return m_fStepSize; } + void SetStepSize(float fStepSize) { m_fStepSize = fStepSize; } + float GetPos() const { return m_fPos; } + void SetPos(float fPos) { m_fPos = fPos; } + void SetTrackPos(float fTrackPos); private: class Timer : public CFWL_Timer { @@ -84,16 +84,16 @@ class CFWL_ScrollBar : public CFWL_Widget { CFX_RectF CalcThumbButtonRect(const CFX_RectF& rtThumbRect); CFX_RectF CalcMinTrackRect(const CFX_RectF& rtMinRect); CFX_RectF CalcMaxTrackRect(const CFX_RectF& rtMaxRect); - FX_FLOAT GetTrackPointPos(const CFX_PointF& point); + float GetTrackPointPos(const CFX_PointF& point); bool SendEvent(); - bool OnScroll(CFWL_EventScroll::Code dwCode, FX_FLOAT fPos); + bool OnScroll(CFWL_EventScroll::Code dwCode, float fPos); void OnLButtonDown(const CFX_PointF& point); void OnLButtonUp(const CFX_PointF& point); void OnMouseMove(const CFX_PointF& point); void OnMouseLeave(); void OnMouseWheel(const CFX_PointF& delta); - bool DoScroll(CFWL_EventScroll::Code dwCode, FX_FLOAT fPos); + bool DoScroll(CFWL_EventScroll::Code dwCode, float fPos); void DoMouseDown(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState, @@ -110,22 +110,22 @@ class CFWL_ScrollBar : public CFWL_Widget { void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); CFWL_TimerInfo* m_pTimerInfo; - FX_FLOAT m_fRangeMin; - FX_FLOAT m_fRangeMax; - FX_FLOAT m_fPageSize; - FX_FLOAT m_fStepSize; - FX_FLOAT m_fPos; - FX_FLOAT m_fTrackPos; + float m_fRangeMin; + float m_fRangeMax; + float m_fPageSize; + float m_fStepSize; + float m_fPos; + float m_fTrackPos; int32_t m_iMinButtonState; int32_t m_iMaxButtonState; int32_t m_iThumbButtonState; int32_t m_iMinTrackState; int32_t m_iMaxTrackState; - FX_FLOAT m_fLastTrackPos; + float m_fLastTrackPos; CFX_PointF m_cpTrackPoint; int32_t m_iMouseWheel; bool m_bMouseDown; - FX_FLOAT m_fButtonLen; + float m_fButtonLen; bool m_bMinSize; CFX_RectF m_rtClient; CFX_RectF m_rtThumb; diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp index b5b8bf4c7d..f3ca6c012a 100644 --- a/xfa/fwl/cfwl_widget.cpp +++ b/xfa/fwl/cfwl_widget.cpp @@ -77,7 +77,7 @@ CFX_RectF CFWL_Widget::GetWidgetRect() { void CFWL_Widget::InflateWidgetRect(CFX_RectF& rect) { if (HasBorder()) { - FX_FLOAT fBorder = GetBorderSize(true); + float fBorder = GetBorderSize(true); rect.Inflate(fBorder, fBorder); } } @@ -269,14 +269,14 @@ CFX_RectF CFWL_Widget::GetEdgeRect() { CFX_RectF rtEdge(0, 0, m_pProperties->m_rtWidget.width, m_pProperties->m_rtWidget.height); if (HasBorder()) { - FX_FLOAT fCX = GetBorderSize(true); - FX_FLOAT fCY = GetBorderSize(false); + float fCX = GetBorderSize(true); + float fCY = GetBorderSize(false); rtEdge.Deflate(fCX, fCY); } return rtEdge; } -FX_FLOAT CFWL_Widget::GetBorderSize(bool bCX) { +float CFWL_Widget::GetBorderSize(bool bCX) { IFWL_ThemeProvider* theme = GetAvailableTheme(); if (!theme) return 0.0f; @@ -328,8 +328,7 @@ CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText, calPart.m_dwTTOStyles = bMultiLine ? FDE_TTOSTYLE_LineWrap : FDE_TTOSTYLE_SingleLine; calPart.m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft; - FX_FLOAT fWidth = - bMultiLine ? FWL_WGT_CalcMultiLineDefWidth : FWL_WGT_CalcWidth; + float fWidth = bMultiLine ? FWL_WGT_CalcMultiLineDefWidth : FWL_WGT_CalcWidth; CFX_RectF rect(0, 0, fWidth, FWL_WGT_CalcHeight); pTheme->CalcTextRect(&calPart, rect); return CFX_SizeF(rect.width, rect.height); @@ -378,8 +377,8 @@ void CFWL_Widget::SetGrab(bool bSet) { pDriver->SetGrab(this, bSet); } -void CFWL_Widget::GetPopupPos(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, +void CFWL_Widget::GetPopupPos(float fMinHeight, + float fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) { if (GetClassID() == FWL_Type::ComboBox) { @@ -400,13 +399,13 @@ void CFWL_Widget::GetPopupPos(FX_FLOAT fMinHeight, GetPopupPosGeneral(fMinHeight, fMaxHeight, rtAnchor, rtPopup); } -bool CFWL_Widget::GetPopupPosMenu(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, +bool CFWL_Widget::GetPopupPosMenu(float fMinHeight, + float fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) { if (GetStylesEx() & FWL_STYLEEXT_MNU_Vert) { bool bLeft = m_pProperties->m_rtWidget.left < 0; - FX_FLOAT fRight = rtAnchor.right() + rtPopup.width; + float fRight = rtAnchor.right() + rtPopup.width; CFX_PointF point = TransformTo(nullptr, CFX_PointF()); if (fRight + point.x > 0.0f || bLeft) { rtPopup = CFX_RectF(rtAnchor.left - rtPopup.width, rtAnchor.top, @@ -419,7 +418,7 @@ bool CFWL_Widget::GetPopupPosMenu(FX_FLOAT fMinHeight, return true; } - FX_FLOAT fBottom = rtAnchor.bottom() + rtPopup.height; + float fBottom = rtAnchor.bottom() + rtPopup.height; CFX_PointF point = TransformTo(nullptr, point); if (fBottom + point.y > 0.0f) { rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.top - rtPopup.height, @@ -432,18 +431,18 @@ bool CFWL_Widget::GetPopupPosMenu(FX_FLOAT fMinHeight, return true; } -bool CFWL_Widget::GetPopupPosComboBox(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, +bool CFWL_Widget::GetPopupPosComboBox(float fMinHeight, + float fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) { - FX_FLOAT fPopHeight = rtPopup.height; + float fPopHeight = rtPopup.height; if (rtPopup.height > fMaxHeight) fPopHeight = fMaxHeight; else if (rtPopup.height < fMinHeight) fPopHeight = fMinHeight; - FX_FLOAT fWidth = std::max(rtAnchor.width, rtPopup.width); - FX_FLOAT fBottom = rtAnchor.bottom() + fPopHeight; + float fWidth = std::max(rtAnchor.width, rtPopup.width); + float fBottom = rtAnchor.bottom() + fPopHeight; CFX_PointF point = TransformTo(nullptr, CFX_PointF()); if (fBottom + point.y > 0.0f) { rtPopup = @@ -456,8 +455,8 @@ bool CFWL_Widget::GetPopupPosComboBox(FX_FLOAT fMinHeight, return true; } -bool CFWL_Widget::GetPopupPosGeneral(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, +bool CFWL_Widget::GetPopupPosGeneral(float fMinHeight, + float fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) { CFX_PointF point = TransformTo(nullptr, CFX_PointF()); diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h index 2387b753e5..b556e7a424 100644 --- a/xfa/fwl/cfwl_widget.h +++ b/xfa/fwl/cfwl_widget.h @@ -122,7 +122,7 @@ class CFWL_Widget : public IFWL_WidgetDelegate { bool IsLocked() const { return m_iLock > 0; } bool HasBorder() const; CFX_RectF GetEdgeRect(); - FX_FLOAT GetBorderSize(bool bCX); + float GetBorderSize(bool bCX); CFX_RectF GetRelativeRect(); IFWL_ThemeProvider* GetAvailableTheme(); CFX_SizeF CalcTextSize(const CFX_WideString& wsText, @@ -134,8 +134,8 @@ class CFWL_Widget : public IFWL_WidgetDelegate { int32_t iTTOAlign, CFX_RectF& rect); void SetGrab(bool bSet); - void GetPopupPos(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, + void GetPopupPos(float fMinHeight, + float fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup); void RegisterEventTarget(CFWL_Widget* pEventSource); @@ -161,16 +161,16 @@ class CFWL_Widget : public IFWL_WidgetDelegate { bool IsPopup() const; bool IsChild() const; CFWL_Widget* GetRootOuter(); - bool GetPopupPosMenu(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, + bool GetPopupPosMenu(float fMinHeight, + float fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup); - bool GetPopupPosComboBox(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, + bool GetPopupPosComboBox(float fMinHeight, + float fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup); - bool GetPopupPosGeneral(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, + bool GetPopupPosGeneral(float fMinHeight, + float fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup); void DrawBackground(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index 7c0fddd419..d87556e158 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp @@ -383,8 +383,8 @@ bool CFWL_WidgetMgr::IsAbleNative(CFWL_Widget* pWidget) const { } void CFWL_WidgetMgr::GetAdapterPopupPos(CFWL_Widget* pWidget, - FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, + float fMinHeight, + float fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) const { m_pAdapter->GetPopupPos(pWidget, fMinHeight, fMaxHeight, rtAnchor, rtPopup); @@ -533,8 +533,8 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget, bool bOrginPtIntersectWidthDirty = rtDirty.Contains(rtWidget.TopLeft()); static FWL_NEEDREPAINTHITDATA hitPoint[kNeedRepaintHitPoints]; FXSYS_memset(hitPoint, 0, sizeof(hitPoint)); - FX_FLOAT fxPiece = rtWidget.width / kNeedRepaintHitPiece; - FX_FLOAT fyPiece = rtWidget.height / kNeedRepaintHitPiece; + float fxPiece = rtWidget.width / kNeedRepaintHitPiece; + float fyPiece = rtWidget.height / kNeedRepaintHitPiece; hitPoint[2].hitPoint.x = hitPoint[6].hitPoint.x = rtWidget.left; hitPoint[0].hitPoint.x = hitPoint[3].hitPoint.x = hitPoint[7].hitPoint.x = hitPoint[10].hitPoint.x = fxPiece + rtWidget.left; diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h index 2d436bd8e2..c3dca31d76 100644 --- a/xfa/fwl/cfwl_widgetmgr.h +++ b/xfa/fwl/cfwl_widgetmgr.h @@ -64,8 +64,8 @@ class CFWL_WidgetMgr : public CFWL_WidgetMgrDelegate { } void GetAdapterPopupPos(CFWL_Widget* pWidget, - FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, + float fMinHeight, + float fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) const; diff --git a/xfa/fwl/cfx_barcode.cpp b/xfa/fwl/cfx_barcode.cpp index 1c22367901..cbd6b09975 100644 --- a/xfa/fwl/cfx_barcode.cpp +++ b/xfa/fwl/cfx_barcode.cpp @@ -160,7 +160,7 @@ bool CFX_Barcode::SetFont(CFX_Font* pFont) { } } -bool CFX_Barcode::SetFontSize(FX_FLOAT size) { +bool CFX_Barcode::SetFontSize(float size) { switch (GetType()) { case BC_CODE39: case BC_CODABAR: diff --git a/xfa/fwl/cfx_barcode.h b/xfa/fwl/cfx_barcode.h index 3f4b340d95..d3df216977 100644 --- a/xfa/fwl/cfx_barcode.h +++ b/xfa/fwl/cfx_barcode.h @@ -46,7 +46,7 @@ class CFX_Barcode { bool SetCalChecksum(bool state); bool SetFont(CFX_Font* pFont); - bool SetFontSize(FX_FLOAT size); + bool SetFontSize(float size); bool SetFontColor(FX_ARGB color); bool SetTextLocation(BC_TEXT_LOC location); diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index 1d185b4c33..76a20fe14a 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -92,8 +92,8 @@ void CFWL_CheckBoxTP::DrawSignCross(CFX_Graphics* pGraphics, FX_ARGB argbFill, CFX_Matrix* pMatrix) { CFX_Path path; - FX_FLOAT fRight = pRtSign->right(); - FX_FLOAT fBottom = pRtSign->bottom(); + float fRight = pRtSign->right(); + float fBottom = pRtSign->bottom(); path.AddLine(pRtSign->TopLeft(), CFX_PointF(fRight, fBottom)); path.AddLine(CFX_PointF(pRtSign->left, fBottom), CFX_PointF(fRight, pRtSign->top)); @@ -111,9 +111,9 @@ void CFWL_CheckBoxTP::DrawSignDiamond(CFX_Graphics* pGraphics, FX_ARGB argbFill, CFX_Matrix* pMatrix) { CFX_Path path; - FX_FLOAT fWidth = pRtSign->width; - FX_FLOAT fHeight = pRtSign->height; - FX_FLOAT fBottom = pRtSign->bottom(); + float fWidth = pRtSign->width; + float fHeight = pRtSign->height; + float fBottom = pRtSign->bottom(); path.MoveTo(CFX_PointF(pRtSign->left + fWidth / 2, pRtSign->top)); path.LineTo(CFX_PointF(pRtSign->left, pRtSign->top + fHeight / 2)); path.LineTo(CFX_PointF(pRtSign->left + fWidth / 2, fBottom)); @@ -146,18 +146,18 @@ void CFWL_CheckBoxTP::DrawSignStar(CFX_Graphics* pGraphics, FX_ARGB argbFill, CFX_Matrix* pMatrix) { CFX_Path path; - FX_FLOAT fBottom = pRtSign->bottom(); - FX_FLOAT fRadius = - (pRtSign->top - fBottom) / (1 + static_cast<FX_FLOAT>(cos(FX_PI / 5.0f))); + float fBottom = pRtSign->bottom(); + float fRadius = + (pRtSign->top - fBottom) / (1 + static_cast<float>(cos(FX_PI / 5.0f))); CFX_PointF ptCenter((pRtSign->left + pRtSign->right()) / 2.0f, (pRtSign->top + fBottom) / 2.0f); CFX_PointF points[5]; - FX_FLOAT fAngel = FX_PI / 10.0f; + float fAngel = FX_PI / 10.0f; for (int32_t i = 0; i < 5; i++) { points[i] = - ptCenter + CFX_PointF(fRadius * static_cast<FX_FLOAT>(cos(fAngel)), - fRadius * static_cast<FX_FLOAT>(sin(fAngel))); + ptCenter + CFX_PointF(fRadius * static_cast<float>(cos(fAngel)), + fRadius * static_cast<float>(sin(fAngel))); fAngel += FX_PI * 2 / 5.0f; } @@ -216,13 +216,13 @@ void CFWL_CheckBoxTP::SetThemeData() { m_pThemeData->clrSignNeutralPressed = ArgbEncode(255, 28, 134, 26); } -void CFWL_CheckBoxTP::InitCheckPath(FX_FLOAT fCheckLen) { +void CFWL_CheckBoxTP::InitCheckPath(float fCheckLen) { if (!m_pCheckPath) { m_pCheckPath = pdfium::MakeUnique<CFX_Path>(); - FX_FLOAT fWidth = kSignPath; - FX_FLOAT fHeight = -kSignPath; - FX_FLOAT fBottom = kSignPath; + float fWidth = kSignPath; + float fHeight = -kSignPath; + float fBottom = kSignPath; CFX_PointF pt1(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f); CFX_PointF pt2(fWidth / 4.5f, fBottom + fHeight / 16.0f); CFX_PointF pt3(fWidth / 3.0f, fBottom); @@ -262,7 +262,7 @@ void CFWL_CheckBoxTP::InitCheckPath(FX_FLOAT fCheckLen) { p2 = CFX_PointF(pt15.x - pt1.x, pt15.y - pt1.y) * FX_BEZIER; m_pCheckPath->BezierTo(pt5 + p1, pt1 + p2, pt1); - FX_FLOAT fScale = fCheckLen / kSignPath; + float fScale = fCheckLen / kSignPath; CFX_Matrix mt(1, 0, 0, 1, 0, 0); mt.Scale(fScale, fScale); diff --git a/xfa/fwl/theme/cfwl_checkboxtp.h b/xfa/fwl/theme/cfwl_checkboxtp.h index 979b970b39..1070b12598 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.h +++ b/xfa/fwl/theme/cfwl_checkboxtp.h @@ -65,7 +65,7 @@ class CFWL_CheckBoxTP : public CFWL_WidgetTP { FX_ARGB argbFill, CFX_Matrix* pMatrix); - void InitCheckPath(FX_FLOAT fCheckLen); + void InitCheckPath(float fCheckLen); std::unique_ptr<CKBThemeData> m_pThemeData; std::unique_ptr<CFX_Path> m_pCheckPath; diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp index 43160177d7..ebc23bf129 100644 --- a/xfa/fwl/theme/cfwl_edittp.cpp +++ b/xfa/fwl/theme/cfwl_edittp.cpp @@ -22,7 +22,7 @@ void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (CFWL_Part::CombTextLine == pParams->m_iPart) { CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); FX_ARGB cr = 0xFF000000; - FX_FLOAT fWidth = 1.0f; + float fWidth = 1.0f; if (CXFA_Border borderUI = pWidget->GetDataAcc()->GetUIBorder()) { CXFA_Edge edge = borderUI.GetEdge(0); if (edge) { @@ -74,7 +74,7 @@ void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { } case CFWL_Part::CombTextLine: { FX_ARGB cr = 0xFF000000; - FX_FLOAT fWidth = 1.0f; + float fWidth = 1.0f; CFX_Color crLine(cr); pParams->m_pGraphics->SetStrokeColor(&crLine); pParams->m_pGraphics->SetLineWidth(fWidth); diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp index 56268a8507..6bb34d0657 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp +++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp @@ -29,8 +29,8 @@ void CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { } case CFWL_Part::Background: { CFX_RectF& rect = pParams->m_rtPart; - FX_FLOAT fRight = rect.right(); - FX_FLOAT fBottom = rect.bottom(); + float fRight = rect.right(); + float fBottom = rect.bottom(); CFX_Path strokePath; strokePath.MoveTo( diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp index 121d4dea34..bab9a3f3be 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.cpp +++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp @@ -124,13 +124,13 @@ void CFWL_ScrollBarTP::DrawPaw(CFX_Graphics* pGraphics, CFX_Matrix* pMatrix) { CFX_Path path; if (bVert) { - FX_FLOAT fPawLen = kPawLength; + float fPawLen = kPawLength; if (pRect->width / 2 <= fPawLen) { fPawLen = (pRect->width - 6) / 2; } - FX_FLOAT fX = pRect->left + pRect->width / 4; - FX_FLOAT fY = pRect->top + pRect->height / 2; + float fX = pRect->left + pRect->width / 4; + float fY = pRect->top + pRect->height / 2; path.MoveTo(CFX_PointF(fX, fY - 4)); path.LineTo(CFX_PointF(fX + fPawLen, fY - 4)); path.MoveTo(CFX_PointF(fX, fY - 2)); @@ -161,13 +161,13 @@ void CFWL_ScrollBarTP::DrawPaw(CFX_Graphics* pGraphics, pGraphics->SetStrokeColor(&clrDark); pGraphics->StrokePath(&path, pMatrix); } else { - FX_FLOAT fPawLen = kPawLength; + float fPawLen = kPawLength; if (pRect->height / 2 <= fPawLen) { fPawLen = (pRect->height - 6) / 2; } - FX_FLOAT fX = pRect->left + pRect->width / 2; - FX_FLOAT fY = pRect->top + pRect->height / 4; + float fX = pRect->left + pRect->width / 2; + float fY = pRect->top + pRect->height / 4; path.MoveTo(CFX_PointF(fX - 4, fY)); path.LineTo(CFX_PointF(fX - 4, fY + fPawLen)); path.MoveTo(CFX_PointF(fX - 2, fY)); @@ -212,8 +212,8 @@ void CFWL_ScrollBarTP::DrawTrack(CFX_Graphics* pGraphics, pGraphics->SaveGraphState(); CFX_Color colorLine(ArgbEncode(255, 238, 237, 229)); CFX_Path path; - FX_FLOAT fRight = pRect->right(); - FX_FLOAT fBottom = pRect->bottom(); + float fRight = pRect->right(); + float fBottom = pRect->bottom(); if (bVert) { path.AddRectangle(pRect->left, pRect->top, 1, pRect->height); path.AddRectangle(fRight - 1, pRect->top, 1, pRect->height); @@ -226,10 +226,10 @@ void CFWL_ScrollBarTP::DrawTrack(CFX_Graphics* pGraphics, path.Clear(); path.AddRectangle(pRect->left + 1, pRect->top, pRect->width - 2, pRect->height); - FX_FLOAT x1 = bVert ? pRect->left + 1 : pRect->left; - FX_FLOAT y1 = bVert ? pRect->top : pRect->top + 1; - FX_FLOAT x2 = bVert ? fRight - 1 : pRect->left; - FX_FLOAT y2 = bVert ? pRect->top : fBottom - 1; + float x1 = bVert ? pRect->left + 1 : pRect->left; + float y1 = bVert ? pRect->top : pRect->top + 1; + float x2 = bVert ? fRight - 1 : pRect->left; + float y2 = bVert ? pRect->top : fBottom - 1; pGraphics->RestoreGraphState(); DrawAxialShading(pGraphics, x1, y1, x2, y2, m_pThemeData->clrTrackBKStart, m_pThemeData->clrTrackBKEnd, &path, FXFILL_WINDING, pMatrix); diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index fbcbcffb85..6ce86fb269 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -138,10 +138,10 @@ void CFWL_WidgetTP::FillSoildRect(CFX_Graphics* pGraphics, } void CFWL_WidgetTP::DrawAxialShading(CFX_Graphics* pGraphics, - FX_FLOAT fx1, - FX_FLOAT fy1, - FX_FLOAT fx2, - FX_FLOAT fy2, + float fx1, + float fy1, + float fx2, + float fy2, FX_ARGB beginColor, FX_ARGB endColor, CFX_Path* path, @@ -170,7 +170,7 @@ void CFWL_WidgetTP::DrawFocus(CFX_Graphics* pGraphics, pGraphics->SaveGraphState(); CFX_Color cr(0xFF000000); pGraphics->SetStrokeColor(&cr); - FX_FLOAT DashPattern[2] = {1, 1}; + float DashPattern[2] = {1, 1}; pGraphics->SetLineDash(0.0f, DashPattern, 2); CFX_Path path; path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); @@ -185,10 +185,10 @@ void CFWL_WidgetTP::DrawArrow(CFX_Graphics* pGraphics, CFX_Matrix* pMatrix) { bool bVert = (eDict == FWLTHEME_DIRECTION_Up || eDict == FWLTHEME_DIRECTION_Down); - FX_FLOAT fLeft = - (FX_FLOAT)(((pRect->width - (bVert ? 9 : 6)) / 2 + pRect->left) + 0.5); - FX_FLOAT fTop = - (FX_FLOAT)(((pRect->height - (bVert ? 6 : 9)) / 2 + pRect->top) + 0.5); + float fLeft = + (float)(((pRect->width - (bVert ? 9 : 6)) / 2 + pRect->left) + 0.5); + float fTop = + (float)(((pRect->height - (bVert ? 6 : 9)) / 2 + pRect->top) + 0.5); CFX_Path path; switch (eDict) { case FWLTHEME_DIRECTION_Down: { @@ -240,8 +240,8 @@ void CFWL_WidgetTP::DrawBtn(CFX_Graphics* pGraphics, CFX_Path path; InitializeArrowColorData(); - FX_FLOAT fRight = pRect->right(); - FX_FLOAT fBottom = pRect->bottom(); + float fRight = pRect->right(); + float fBottom = pRect->bottom(); path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); DrawAxialShading(pGraphics, pRect->left, pRect->top, fRight, fBottom, m_pColorData->clrStart[eState - 1], diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h index c81950793a..730a39cd17 100644 --- a/xfa/fwl/theme/cfwl_widgettp.h +++ b/xfa/fwl/theme/cfwl_widgettp.h @@ -66,10 +66,10 @@ class CFWL_WidgetTP { const CFX_RectF* pRect, CFX_Matrix* pMatrix = nullptr); void DrawAxialShading(CFX_Graphics* pGraphics, - FX_FLOAT fx1, - FX_FLOAT fy1, - FX_FLOAT fx2, - FX_FLOAT fy2, + float fx1, + float fy1, + float fx2, + float fy2, FX_ARGB beginColor, FX_ARGB endColor, CFX_Path* path, diff --git a/xfa/fxbarcode/BC_TwoDimWriter.cpp b/xfa/fxbarcode/BC_TwoDimWriter.cpp index b9aae361d6..328352c6c1 100644 --- a/xfa/fxbarcode/BC_TwoDimWriter.cpp +++ b/xfa/fxbarcode/BC_TwoDimWriter.cpp @@ -23,7 +23,7 @@ void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix) { CFX_GraphStateData stateData; CFX_PathData path; - path.AppendRect(0, 0, (FX_FLOAT)m_Width, (FX_FLOAT)m_Height); + path.AppendRect(0, 0, (float)m_Width, (float)m_Height); device->DrawPath(&path, matrix, &stateData, m_backgroundColor, m_backgroundColor, FXFILL_ALTERNATE); int32_t leftPos = 0; @@ -34,17 +34,17 @@ void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device, } CFX_Matrix matri = *matrix; if (m_Width < m_output->GetWidth() && m_Height < m_output->GetHeight()) { - CFX_Matrix matriScale( - (FX_FLOAT)m_Width / (FX_FLOAT)m_output->GetWidth(), 0.0, 0.0, - (FX_FLOAT)m_Height / (FX_FLOAT)m_output->GetHeight(), 0.0, 0.0); + CFX_Matrix matriScale((float)m_Width / (float)m_output->GetWidth(), 0.0, + 0.0, (float)m_Height / (float)m_output->GetHeight(), + 0.0, 0.0); matriScale.Concat(*matrix); matri = matriScale; } for (int32_t x = 0; x < m_output->GetWidth(); x++) { for (int32_t y = 0; y < m_output->GetHeight(); y++) { CFX_PathData rect; - rect.AppendRect((FX_FLOAT)leftPos + x, (FX_FLOAT)topPos + y, - (FX_FLOAT)(leftPos + x + 1), (FX_FLOAT)(topPos + y + 1)); + rect.AppendRect((float)leftPos + x, (float)topPos + y, + (float)(leftPos + x + 1), (float)(topPos + y + 1)); if (m_output->Get(x, y)) { CFX_GraphStateData data; device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING); @@ -98,7 +98,7 @@ void CBC_TwoDimWriter::RenderResult(uint8_t* code, int32_t inputHeight = codeHeight; int32_t tempWidth = inputWidth + 2; int32_t tempHeight = inputHeight + 2; - FX_FLOAT moduleHSize = std::min(m_ModuleWidth, m_ModuleHeight); + float moduleHSize = std::min(m_ModuleWidth, m_ModuleHeight); moduleHSize = std::min(moduleHSize, 8.0f); moduleHSize = std::max(moduleHSize, 1.0f); pdfium::base::CheckedNumeric<int32_t> scaledWidth = tempWidth; @@ -115,14 +115,14 @@ void CBC_TwoDimWriter::RenderResult(uint8_t* code, } } else { if (m_Width > outputWidth || m_Height > outputHeight) { - outputWidth = (int32_t)(outputWidth * - ceil((FX_FLOAT)m_Width / (FX_FLOAT)outputWidth)); - outputHeight = (int32_t)( - outputHeight * ceil((FX_FLOAT)m_Height / (FX_FLOAT)outputHeight)); + outputWidth = + (int32_t)(outputWidth * ceil((float)m_Width / (float)outputWidth)); + outputHeight = + (int32_t)(outputHeight * ceil((float)m_Height / (float)outputHeight)); } } - int32_t multiX = (int32_t)ceil((FX_FLOAT)outputWidth / (FX_FLOAT)tempWidth); - int32_t multiY = (int32_t)ceil((FX_FLOAT)outputHeight / (FX_FLOAT)tempHeight); + int32_t multiX = (int32_t)ceil((float)outputWidth / (float)tempWidth); + int32_t multiY = (int32_t)ceil((float)outputHeight / (float)tempHeight); if (m_bFixedSize) { multiX = std::min(multiX, multiY); multiY = multiX; diff --git a/xfa/fxbarcode/cbc_onecode.cpp b/xfa/fxbarcode/cbc_onecode.cpp index 55c2837bd4..cf916402fb 100644 --- a/xfa/fxbarcode/cbc_onecode.cpp +++ b/xfa/fxbarcode/cbc_onecode.cpp @@ -62,7 +62,7 @@ bool CBC_OneCode::SetFont(CFX_Font* cFont) { return false; } -void CBC_OneCode::SetFontSize(FX_FLOAT size) { +void CBC_OneCode::SetFontSize(float size) { if (m_pBCWriter) static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetFontSize(size); } diff --git a/xfa/fxbarcode/cbc_onecode.h b/xfa/fxbarcode/cbc_onecode.h index e348b4ee2c..ac7eacebfb 100644 --- a/xfa/fxbarcode/cbc_onecode.h +++ b/xfa/fxbarcode/cbc_onecode.h @@ -27,7 +27,7 @@ class CBC_OneCode : public CBC_CodeBase { virtual void SetDataLength(int32_t length); virtual void SetCalChecksum(bool calc); virtual bool SetFont(CFX_Font* cFont); - virtual void SetFontSize(FX_FLOAT size); + virtual void SetFontSize(float size); virtual void SetFontStyle(int32_t style); virtual void SetFontColor(FX_ARGB color); }; diff --git a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp index ec6eb02b1c..90877c7ef3 100644 --- a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp @@ -140,7 +140,7 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, if (startpos >= msg.GetLength()) { return currentMode; } - std::vector<FX_FLOAT> charCounts; + std::vector<float> charCounts; if (currentMode == ASCII_ENCODATION) { charCounts.push_back(0); charCounts.push_back(1); @@ -189,12 +189,10 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, if (isDigit(c)) { charCounts[ASCII_ENCODATION] += 0.5; } else if (isExtendedASCII(c)) { - charCounts[ASCII_ENCODATION] = - (FX_FLOAT)ceil(charCounts[ASCII_ENCODATION]); + charCounts[ASCII_ENCODATION] = (float)ceil(charCounts[ASCII_ENCODATION]); charCounts[ASCII_ENCODATION] += 2; } else { - charCounts[ASCII_ENCODATION] = - (FX_FLOAT)ceil(charCounts[ASCII_ENCODATION]); + charCounts[ASCII_ENCODATION] = (float)ceil(charCounts[ASCII_ENCODATION]); charCounts[ASCII_ENCODATION]++; } if (isNativeC40(c)) { @@ -320,7 +318,7 @@ wchar_t CBC_HighLevelEncoder::randomize253State(wchar_t ch, : (wchar_t)(tempVariable - 254); } int32_t CBC_HighLevelEncoder::findMinimums( - std::vector<FX_FLOAT>& charCounts, + std::vector<float>& charCounts, CFX_ArrayTemplate<int32_t>& intCharCounts, int32_t min, CFX_ArrayTemplate<uint8_t>& mins) { diff --git a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h index cfd16ed676..821dedd29f 100644 --- a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h +++ b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h @@ -63,7 +63,7 @@ class CBC_HighLevelEncoder : public CBC_SymbolShapeHint { private: static wchar_t randomize253State(wchar_t ch, int32_t codewordPosition); - static int32_t findMinimums(std::vector<FX_FLOAT>& charCounts, + static int32_t findMinimums(std::vector<float>& charCounts, CFX_ArrayTemplate<int32_t>& intCharCounts, int32_t min, CFX_ArrayTemplate<uint8_t>& mins); diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp index dd7fcaa864..02ae58dc84 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp @@ -71,7 +71,7 @@ bool CBC_OneDimWriter::SetFont(CFX_Font* cFont) { return true; } -void CBC_OneDimWriter::SetFontSize(FX_FLOAT size) { +void CBC_OneDimWriter::SetFontSize(float size) { m_fFontSize = size; } @@ -151,39 +151,39 @@ int32_t CBC_OneDimWriter::AppendPattern(uint8_t* target, void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, FXTEXT_CHARPOS* charPos, CFX_Font* cFont, - FX_FLOAT geWidth, + float geWidth, int32_t fontSize, - FX_FLOAT& charsLen) { + float& charsLen) { std::unique_ptr<CFX_UnicodeEncodingEx> encoding( FX_CreateFontEncodingEx(cFont)); int32_t length = text.GetLength(); uint32_t* pCharCode = FX_Alloc(uint32_t, text.GetLength()); - FX_FLOAT charWidth = 0; + float charWidth = 0; for (int32_t j = 0; j < text.GetLength(); j++) { pCharCode[j] = encoding->CharCodeFromUnicode(text[j]); int32_t glyp_code = encoding->GlyphFromCharCode(pCharCode[j]); int32_t glyp_value = cFont->GetGlyphWidth(glyp_code); - FX_FLOAT temp = (FX_FLOAT)((glyp_value)*fontSize / 1000.0); + float temp = (float)((glyp_value)*fontSize / 1000.0); charWidth += temp; } charsLen = charWidth; - FX_FLOAT leftPositon = (FX_FLOAT)(geWidth - charsLen) / 2.0f; + float leftPositon = (float)(geWidth - charsLen) / 2.0f; if (leftPositon < 0 && geWidth == 0) { leftPositon = 0; } - FX_FLOAT penX = 0.0; - FX_FLOAT penY = - (FX_FLOAT)FXSYS_abs(cFont->GetDescent()) * (FX_FLOAT)fontSize / 1000.0f; - FX_FLOAT left = leftPositon; - FX_FLOAT top = 0.0; + float penX = 0.0; + float penY = + (float)FXSYS_abs(cFont->GetDescent()) * (float)fontSize / 1000.0f; + float left = leftPositon; + float top = 0.0; charPos[0].m_Origin = CFX_PointF(penX + left, penY + top); charPos[0].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[0]); charPos[0].m_FontCharWidth = cFont->GetGlyphWidth(charPos[0].m_GlyphIndex); #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ charPos[0].m_ExtGID = charPos[0].m_GlyphIndex; #endif - penX += (FX_FLOAT)(charPos[0].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f; + penX += (float)(charPos[0].m_FontCharWidth) * (float)fontSize / 1000.0f; for (int32_t i = 1; i < length; i++) { charPos[i].m_Origin = CFX_PointF(penX + left, penY + top); charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[i]); @@ -191,8 +191,7 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ charPos[i].m_ExtGID = charPos[i].m_GlyphIndex; #endif - penX += - (FX_FLOAT)(charPos[i].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f; + penX += (float)(charPos[i].m_FontCharWidth) * (float)fontSize / 1000.0f; } FX_Free(pCharCode); } @@ -200,37 +199,37 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device, const CFX_Matrix* matrix, const CFX_ByteString str, - FX_FLOAT geWidth, + float geWidth, FXTEXT_CHARPOS* pCharPos, - FX_FLOAT locX, - FX_FLOAT locY, + float locX, + float locY, int32_t barWidth) { int32_t iFontSize = (int32_t)fabs(m_fFontSize); int32_t iTextHeight = iFontSize + 1; - CFX_FloatRect rect((FX_FLOAT)locX, (FX_FLOAT)locY, (FX_FLOAT)(locX + geWidth), - (FX_FLOAT)(locY + iTextHeight)); + CFX_FloatRect rect((float)locX, (float)locY, (float)(locX + geWidth), + (float)(locY + iTextHeight)); if (geWidth != m_Width) { rect.right -= 1; } matrix->TransformRect(rect); FX_RECT re = rect.GetOuterRect(); device->FillRect(&re, m_backgroundColor); - CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (FX_FLOAT)locX, - (FX_FLOAT)(locY + iFontSize)); + CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (float)locX, + (float)(locY + iFontSize)); if (matrix) { affine_matrix.Concat(*matrix); } device->DrawNormalText(str.GetLength(), pCharPos, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix, + static_cast<float>(iFontSize), &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); } void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap, const CFX_ByteString str, - FX_FLOAT geWidth, + float geWidth, FXTEXT_CHARPOS* pCharPos, - FX_FLOAT locX, - FX_FLOAT locY, + float locX, + float locY, int32_t barWidth) { int32_t iFontSize = (int32_t)fabs(m_fFontSize); int32_t iTextHeight = iFontSize + 1; @@ -239,10 +238,10 @@ void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap, FX_RECT geRect(0, 0, (int)geWidth, iTextHeight); ge.FillRect(&geRect, m_backgroundColor); CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, - static_cast<FX_FLOAT>(iFontSize)); + static_cast<float>(iFontSize)); ge.DrawNormalText(str.GetLength(), pCharPos, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix, - m_fontColor, FXTEXT_CLEARTYPE); + static_cast<float>(iFontSize), &affine_matrix, m_fontColor, + FXTEXT_CLEARTYPE); CFX_FxgeDevice geBitmap; geBitmap.Attach(pOutBitmap, false, nullptr, false); geBitmap.SetDIBits(ge.GetBitmap(), (int)locX, (int)locY); @@ -267,14 +266,14 @@ void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, int32_t iLen = str.GetLength(); FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen); FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen); - FX_FLOAT charsLen = 0; - FX_FLOAT geWidth = 0; + float charsLen = 0; + float geWidth = 0; if (m_locTextLoc == BC_TEXT_LOC_ABOVEEMBED || m_locTextLoc == BC_TEXT_LOC_BELOWEMBED) { geWidth = 0; } else if (m_locTextLoc == BC_TEXT_LOC_ABOVE || m_locTextLoc == BC_TEXT_LOC_BELOW) { - geWidth = (FX_FLOAT)barWidth; + geWidth = (float)barWidth; } int32_t iFontSize = (int32_t)fabs(m_fFontSize); int32_t iTextHeight = iFontSize + 1; @@ -293,7 +292,7 @@ void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, case BC_TEXT_LOC_ABOVE: locX = 0; locY = 0; - geWidth = (FX_FLOAT)barWidth; + geWidth = (float)barWidth; break; case BC_TEXT_LOC_BELOWEMBED: locX = (int32_t)(barWidth - charsLen) / 2; @@ -304,15 +303,15 @@ void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, default: locX = 0; locY = m_Height - iTextHeight; - geWidth = (FX_FLOAT)barWidth; + geWidth = (float)barWidth; break; } if (device) { - ShowDeviceChars(device, matrix, str, geWidth, pCharPos, (FX_FLOAT)locX, - (FX_FLOAT)locY, barWidth); + ShowDeviceChars(device, matrix, str, geWidth, pCharPos, (float)locX, + (float)locY, barWidth); } else { - ShowBitmapChars(pOutBitmap, str, geWidth, pCharPos, (FX_FLOAT)locX, - (FX_FLOAT)locY, barWidth); + ShowBitmapChars(pOutBitmap, str, geWidth, pCharPos, (float)locX, + (float)locY, barWidth); } FX_Free(pCharPos); } @@ -364,16 +363,15 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, CFX_GraphStateData stateData; CFX_PathData path; - path.AppendRect(0, 0, (FX_FLOAT)m_Width, (FX_FLOAT)m_Height); + path.AppendRect(0, 0, (float)m_Width, (float)m_Height); device->DrawPath(&path, matrix, &stateData, m_backgroundColor, m_backgroundColor, FXFILL_ALTERNATE); - CFX_Matrix matri(m_outputHScale, 0.0, 0.0, (FX_FLOAT)m_Height, 0.0, 0.0); + CFX_Matrix matri(m_outputHScale, 0.0, 0.0, (float)m_Height, 0.0, 0.0); matri.Concat(*matrix); for (int32_t x = 0; x < m_output->GetWidth(); x++) { for (int32_t y = 0; y < m_output->GetHeight(); y++) { CFX_PathData rect; - rect.AppendRect((FX_FLOAT)x, (FX_FLOAT)y, (FX_FLOAT)(x + 1), - (FX_FLOAT)(y + 1)); + rect.AppendRect((float)x, (float)y, (float)(x + 1), (float)(y + 1)); if (m_output->Get(x, y)) { CFX_GraphStateData data; device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING); @@ -417,18 +415,18 @@ void CBC_OneDimWriter::RenderResult(const CFX_WideStringC& contents, codeLength += rightPadding; m_outputHScale = 1.0; if (m_Width > 0) { - m_outputHScale = (FX_FLOAT)m_Width / (FX_FLOAT)codeLength; + m_outputHScale = (float)m_Width / (float)codeLength; } if (!isDevice) { m_outputHScale = - std::max(m_outputHScale, static_cast<FX_FLOAT>(m_ModuleWidth)); + std::max(m_outputHScale, static_cast<float>(m_ModuleWidth)); } - FX_FLOAT dataLengthScale = 1.0; + float dataLengthScale = 1.0; if (m_iDataLenth > 0 && contents.GetLength() != 0) { - dataLengthScale = FX_FLOAT(contents.GetLength()) / FX_FLOAT(m_iDataLenth); + dataLengthScale = float(contents.GetLength()) / float(m_iDataLenth); } if (m_iDataLenth > 0 && contents.GetLength() == 0) { - dataLengthScale = FX_FLOAT(1) / FX_FLOAT(m_iDataLenth); + dataLengthScale = float(1) / float(m_iDataLenth); } m_multiple = 1; if (!isDevice) { diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.h b/xfa/fxbarcode/oned/BC_OneDimWriter.h index b7c5cebe06..b2447cffb7 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.h +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.h @@ -55,7 +55,7 @@ class CBC_OneDimWriter : public CBC_Writer { virtual void SetPrintChecksum(bool checksum); virtual void SetDataLength(int32_t length); virtual void SetCalcChecksum(bool state); - virtual void SetFontSize(FX_FLOAT size); + virtual void SetFontSize(float size); virtual void SetFontStyle(int32_t style); virtual void SetFontColor(FX_ARGB color); bool SetFont(CFX_Font* cFont); @@ -64,9 +64,9 @@ class CBC_OneDimWriter : public CBC_Writer { virtual void CalcTextInfo(const CFX_ByteString& text, FXTEXT_CHARPOS* charPos, CFX_Font* cFont, - FX_FLOAT geWidth, + float geWidth, int32_t fontSize, - FX_FLOAT& charsLen); + float& charsLen); virtual void ShowChars(const CFX_WideStringC& contents, CFX_DIBitmap* pOutBitmap, CFX_RenderDevice* device, @@ -76,18 +76,18 @@ class CBC_OneDimWriter : public CBC_Writer { int32_t& e); virtual void ShowBitmapChars(CFX_DIBitmap* pOutBitmap, const CFX_ByteString str, - FX_FLOAT geWidth, + float geWidth, FXTEXT_CHARPOS* pCharPos, - FX_FLOAT locX, - FX_FLOAT locY, + float locX, + float locY, int32_t barWidth); virtual void ShowDeviceChars(CFX_RenderDevice* device, const CFX_Matrix* matrix, const CFX_ByteString str, - FX_FLOAT geWidth, + float geWidth, FXTEXT_CHARPOS* pCharPos, - FX_FLOAT locX, - FX_FLOAT locY, + float locX, + float locY, int32_t barWidth); virtual int32_t AppendPattern(uint8_t* target, int32_t pos, @@ -102,7 +102,7 @@ class CBC_OneDimWriter : public CBC_Writer { int32_t m_iDataLenth; bool m_bCalcChecksum; CFX_Font* m_pFont; - FX_FLOAT m_fFontSize; + float m_fFontSize; int32_t m_iFontStyle; uint32_t m_fontColor; BC_TEXT_LOC m_locTextLoc; @@ -112,7 +112,7 @@ class CBC_OneDimWriter : public CBC_Writer { std::unique_ptr<CBC_CommonBitMatrix> m_output; int32_t m_barWidth; int32_t m_multiple; - FX_FLOAT m_outputHScale; + float m_outputHScale; }; #endif // XFA_FXBARCODE_ONED_BC_ONEDIMWRITER_H_ diff --git a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp index 47e47eaddb..555b58643d 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp @@ -194,18 +194,16 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents, int32_t strWidth = multiple * 42; if (!pOutBitmap) { CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); - CFX_FloatRect rect( - (FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height); + CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight), + (float)(leftPosition + strWidth - 0.5), (float)m_Height); matr.Concat(*matrix); matr.TransformRect(rect); FX_RECT re = rect.GetOuterRect(); device->FillRect(&re, m_backgroundColor); - CFX_FloatRect rect1( - (FX_FLOAT)(leftPosition + 47 * multiple), - (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)(leftPosition + 47 * multiple + strWidth - 0.5), - (FX_FLOAT)m_Height); + CFX_FloatRect rect1((float)(leftPosition + 47 * multiple), + (float)(m_Height - iTextHeight), + (float)(leftPosition + 47 * multiple + strWidth - 0.5), + (float)m_Height); CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); matr1.Concat(*matrix); matr1.TransformRect(rect1); @@ -213,63 +211,63 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents, device->FillRect(&re, m_backgroundColor); int32_t strWidth1 = multiple * 7; CFX_Matrix matr2(m_outputHScale, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f); - CFX_FloatRect rect2(0.0f, (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)strWidth1 - 0.5f, (FX_FLOAT)m_Height); + CFX_FloatRect rect2(0.0f, (float)(m_Height - iTextHeight), + (float)strWidth1 - 0.5f, (float)m_Height); matr2.Concat(*matrix); matr2.TransformRect(rect2); re = rect2.GetOuterRect(); device->FillRect(&re, m_backgroundColor); } - FX_FLOAT blank = 0.0; + float blank = 0.0; iLen = tempStr.GetLength(); if (!pOutBitmap) { strWidth = (int32_t)(strWidth * m_outputHScale); } - CalcTextInfo(tempStr, pCharPos + 1, m_pFont, (FX_FLOAT)strWidth, iFontSize, + CalcTextInfo(tempStr, pCharPos + 1, m_pFont, (float)strWidth, iFontSize, blank); - CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); + CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (float)iFontSize); CFX_FxgeDevice ge; if (pOutBitmap) { ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); FX_RECT rect(0, 0, strWidth, iTextHeight); ge.FillRect(&rect, m_backgroundColor); ge.DrawNormalText(iLen, pCharPos + 1, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix, + static_cast<float>(iFontSize), &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight); } else { CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, - (FX_FLOAT)leftPosition * m_outputHScale, - (FX_FLOAT)(m_Height - iTextHeight) + iFontSize); + (float)leftPosition * m_outputHScale, + (float)(m_Height - iTextHeight) + iFontSize); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos + 1, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } tempStr = str.Mid(7, 6); iLen = tempStr.GetLength(); - CalcTextInfo(tempStr, pCharPos + 7, m_pFont, (FX_FLOAT)strWidth, iFontSize, + CalcTextInfo(tempStr, pCharPos + 7, m_pFont, (float)strWidth, iFontSize, blank); if (pOutBitmap) { FX_RECT rect1(0, 0, strWidth, iTextHeight); ge.FillRect(&rect1, m_backgroundColor); ge.DrawNormalText(iLen, pCharPos + 7, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix, + static_cast<float>(iFontSize), &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 47 * multiple, m_Height - iTextHeight); } else { CFX_Matrix affine_matrix1( 1.0, 0.0, 0.0, -1.0, - (FX_FLOAT)(leftPosition + 47 * multiple) * m_outputHScale, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)(leftPosition + 47 * multiple) * m_outputHScale, + (float)(m_Height - iTextHeight + iFontSize)); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos + 7, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } tempStr = str.Mid(0, 1); @@ -278,23 +276,22 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents, if (!pOutBitmap) strWidth = (int32_t)(strWidth * m_outputHScale); - CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, - blank); + CalcTextInfo(tempStr, pCharPos, m_pFont, (float)strWidth, iFontSize, blank); if (pOutBitmap) { delete ge.GetBitmap(); ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); ge.GetBitmap()->Clear(m_backgroundColor); - ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<FX_FLOAT>(iFontSize), + ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<float>(iFontSize), &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight); } else { CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0.0, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)(m_Height - iTextHeight + iFontSize)); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } FX_Free(pCharPos); diff --git a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp index cd21759a19..5f571c2a30 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -185,7 +185,7 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, CFX_ByteString tempStr = str.Mid(0, 4); int32_t iLen = tempStr.GetLength(); int32_t strWidth = 7 * multiple * 4; - FX_FLOAT blank = 0.0; + float blank = 0.0; CFX_FxgeDevice geBitmap; if (pOutBitmap) geBitmap.Attach(pOutBitmap, false, nullptr, false); @@ -194,19 +194,17 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, int32_t iTextHeight = iFontSize + 1; if (!pOutBitmap) { CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); - CFX_FloatRect rect( - (FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height); + CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight), + (float)(leftPosition + strWidth - 0.5), (float)m_Height); matr.Concat(*matrix); matr.TransformRect(rect); FX_RECT re = rect.GetOuterRect(); device->FillRect(&re, m_backgroundColor); CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); - CFX_FloatRect rect1( - (FX_FLOAT)(leftPosition + 33 * multiple), - (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)(leftPosition + 33 * multiple + strWidth - 0.5), - (FX_FLOAT)m_Height); + CFX_FloatRect rect1((float)(leftPosition + 33 * multiple), + (float)(m_Height - iTextHeight), + (float)(leftPosition + 33 * multiple + strWidth - 0.5), + (float)m_Height); matr1.Concat(*matrix); matr1.TransformRect(rect1); re = rect1.GetOuterRect(); @@ -215,49 +213,48 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, if (!pOutBitmap) strWidth = (int32_t)(strWidth * m_outputHScale); - CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, - blank); - CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); + CalcTextInfo(tempStr, pCharPos, m_pFont, (float)strWidth, iFontSize, blank); + CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (float)iFontSize); CFX_FxgeDevice ge; if (pOutBitmap) { delete ge.GetBitmap(); ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); ge.GetBitmap()->Clear(m_backgroundColor); - ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<FX_FLOAT>(iFontSize), + ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<float>(iFontSize), &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight); } else { CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, - (FX_FLOAT)leftPosition * m_outputHScale, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)leftPosition * m_outputHScale, + (float)(m_Height - iTextHeight + iFontSize)); affine_matrix1.Concat(*matrix); device->DrawNormalText(iLen, pCharPos, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } tempStr = str.Mid(4, 4); iLen = tempStr.GetLength(); - CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (FX_FLOAT)strWidth, iFontSize, + CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (float)strWidth, iFontSize, blank); if (pOutBitmap) { delete ge.GetBitmap(); ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); ge.GetBitmap()->Clear(m_backgroundColor); ge.DrawNormalText(iLen, pCharPos + 4, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix, + static_cast<float>(iFontSize), &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 33 * multiple, m_Height - iTextHeight); } else { CFX_Matrix affine_matrix1( 1.0, 0.0, 0.0, -1.0, - (FX_FLOAT)(leftPosition + 33 * multiple) * m_outputHScale, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)(leftPosition + 33 * multiple) * m_outputHScale, + (float)(m_Height - iTextHeight + iFontSize)); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos + 4, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } FX_Free(pCharPos); diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp index 3cb72f204a..cefae97d8d 100644 --- a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp @@ -136,8 +136,8 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen); FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen); CFX_ByteString tempStr = str.Mid(1, 5); - FX_FLOAT strWidth = (FX_FLOAT)35 * multiple; - FX_FLOAT blank = 0.0; + float strWidth = (float)35 * multiple; + float blank = 0.0; CFX_FxgeDevice geBitmap; if (pOutBitmap) geBitmap.Attach(pOutBitmap, false, nullptr, false); @@ -147,37 +147,34 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, int32_t iTextHeight = iFontSize + 1; if (!pOutBitmap) { CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); - CFX_FloatRect rect( - (FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height); + CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight), + (float)(leftPosition + strWidth - 0.5), (float)m_Height); matr.Concat(*matrix); matr.TransformRect(rect); FX_RECT re = rect.GetOuterRect(); device->FillRect(&re, m_backgroundColor); CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); CFX_FloatRect rect1( - (FX_FLOAT)(leftPosition + 40 * multiple), - (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)((leftPosition + 40 * multiple) + strWidth - 0.5), - (FX_FLOAT)m_Height); + (float)(leftPosition + 40 * multiple), (float)(m_Height - iTextHeight), + (float)((leftPosition + 40 * multiple) + strWidth - 0.5), + (float)m_Height); matr1.Concat(*matrix); matr1.TransformRect(rect1); re = rect1.GetOuterRect(); device->FillRect(&re, m_backgroundColor); - FX_FLOAT strWidth1 = (FX_FLOAT)multiple * 7; + float strWidth1 = (float)multiple * 7; CFX_Matrix matr2(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); - CFX_FloatRect rect2(0.0, (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)strWidth1 - 1, (FX_FLOAT)m_Height); + CFX_FloatRect rect2(0.0, (float)(m_Height - iTextHeight), + (float)strWidth1 - 1, (float)m_Height); matr2.Concat(*matrix); matr2.TransformRect(rect2); re = rect2.GetOuterRect(); device->FillRect(&re, m_backgroundColor); CFX_Matrix matr3(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); CFX_FloatRect rect3( - (FX_FLOAT)(leftPosition + 85 * multiple), - (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)((leftPosition + 85 * multiple) + strWidth1 - 0.5), - (FX_FLOAT)m_Height); + (float)(leftPosition + 85 * multiple), (float)(m_Height - iTextHeight), + (float)((leftPosition + 85 * multiple) + strWidth1 - 0.5), + (float)m_Height); matr3.Concat(*matrix); matr3.TransformRect(rect3); re = rect3.GetOuterRect(); @@ -187,24 +184,24 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, strWidth = strWidth * m_outputHScale; CalcTextInfo(tempStr, pCharPos + 1, m_pFont, strWidth, iFontSize, blank); - CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); + CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (float)iFontSize); CFX_FxgeDevice ge; if (pOutBitmap) { ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr); ge.GetBitmap()->Clear(m_backgroundColor); ge.DrawNormalText(iLen, pCharPos + 1, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix, + static_cast<float>(iFontSize), &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight); } else { CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, - (FX_FLOAT)leftPosition * m_outputHScale, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)leftPosition * m_outputHScale, + (float)(m_Height - iTextHeight + iFontSize)); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos + 1, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } tempStr = str.Mid(6, 5); @@ -214,25 +211,25 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, FX_RECT rect2(0, 0, (int)strWidth, iTextHeight); ge.FillRect(&rect2, m_backgroundColor); ge.DrawNormalText(iLen, pCharPos + 6, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix, + static_cast<float>(iFontSize), &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 40 * multiple, m_Height - iTextHeight); } else { CFX_Matrix affine_matrix1( 1.0, 0.0, 0.0, -1.0, - (FX_FLOAT)(leftPosition + 40 * multiple) * m_outputHScale, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)(leftPosition + 40 * multiple) * m_outputHScale, + (float)(m_Height - iTextHeight + iFontSize)); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos + 6, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } tempStr = str.Mid(0, 1); iLen = tempStr.GetLength(); - strWidth = (FX_FLOAT)multiple * 7; + strWidth = (float)multiple * 7; if (!pOutBitmap) strWidth = strWidth * m_outputHScale; @@ -241,17 +238,17 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, delete ge.GetBitmap(); ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr); ge.GetBitmap()->Clear(m_backgroundColor); - ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<FX_FLOAT>(iFontSize), + ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<float>(iFontSize), &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight); } else { CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)(m_Height - iTextHeight + iFontSize)); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } tempStr = str.Mid(11, 1); @@ -262,20 +259,20 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr); ge.GetBitmap()->Clear(m_backgroundColor); ge.DrawNormalText(iLen, pCharPos + 11, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix, + static_cast<float>(iFontSize), &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 85 * multiple, m_Height - iTextHeight); } else { CFX_Matrix affine_matrix1( 1.0, 0.0, 0.0, -1.0, - (FX_FLOAT)(leftPosition + 85 * multiple) * m_outputHScale, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)(leftPosition + 85 * multiple) * m_outputHScale, + (float)(m_Height - iTextHeight + iFontSize)); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos + 11, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } FX_Free(pCharPos); diff --git a/xfa/fxbarcode/pdf417/BC_PDF417.cpp b/xfa/fxbarcode/pdf417/BC_PDF417.cpp index 94c65b8538..f7aad69953 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417.cpp @@ -540,7 +540,7 @@ CFX_ArrayTemplate<int32_t>* CBC_PDF417::determineDimensions( int32_t sourceCodeWords, int32_t errorCorrectionCodeWords, int32_t& e) { - FX_FLOAT ratio = 0.0f; + float ratio = 0.0f; CFX_ArrayTemplate<int32_t>* dimension = nullptr; for (int32_t cols = m_minCols; cols <= m_maxCols; cols++) { int32_t rows = @@ -551,7 +551,7 @@ CFX_ArrayTemplate<int32_t>* CBC_PDF417::determineDimensions( if (rows > m_maxRows) { continue; } - FX_FLOAT newRatio = + float newRatio = ((17 * cols + 69) * DEFAULT_MODULE_WIDTH) / (rows * HEIGHT); if (dimension && fabsf(newRatio - PREFERRED_RATIO) > fabsf(ratio - PREFERRED_RATIO)) { diff --git a/xfa/fxbarcode/pdf417/BC_PDF417.h b/xfa/fxbarcode/pdf417/BC_PDF417.h index 3ba5aa2f0c..b382e5d26e 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417.h +++ b/xfa/fxbarcode/pdf417/BC_PDF417.h @@ -36,9 +36,9 @@ class CBC_PDF417 { static const int32_t START_PATTERN = 0x1fea8; static const int32_t STOP_PATTERN = 0x3fa29; static const int32_t CODEWORD_TABLE[][929]; - static constexpr FX_FLOAT PREFERRED_RATIO = 3.0f; - static constexpr FX_FLOAT DEFAULT_MODULE_WIDTH = 0.357f; - static constexpr FX_FLOAT HEIGHT = 2.0f; + static constexpr float PREFERRED_RATIO = 3.0f; + static constexpr float DEFAULT_MODULE_WIDTH = 0.357f; + static constexpr float HEIGHT = 2.0f; static int32_t calculateNumberOfRows(int32_t m, int32_t k, int32_t c); static int32_t getNumberOfPadCodewords(int32_t m, diff --git a/xfa/fxfa/app/cxfa_loadercontext.h b/xfa/fxfa/app/cxfa_loadercontext.h index d8ccdbe7e2..4d1a2b3a6b 100644 --- a/xfa/fxfa/app/cxfa_loadercontext.h +++ b/xfa/fxfa/app/cxfa_loadercontext.h @@ -22,19 +22,19 @@ class CXFA_LoaderContext { ~CXFA_LoaderContext(); bool m_bSaveLineHeight; - FX_FLOAT m_fWidth; - FX_FLOAT m_fHeight; - FX_FLOAT m_fLastPos; - FX_FLOAT m_fStartLineOffset; + float m_fWidth; + float m_fHeight; + float m_fLastPos; + float m_fStartLineOffset; int32_t m_iChar; int32_t m_iLines; int32_t m_iTotalLines; CFDE_XMLNode* m_pXMLNode; CXFA_Node* m_pNode; CFX_RetainPtr<CFDE_CSSComputedStyle> m_pParentStyle; - CFX_ArrayTemplate<FX_FLOAT> m_lineHeights; + CFX_ArrayTemplate<float> m_lineHeights; uint32_t m_dwFlags; - std::vector<FX_FLOAT> m_BlocksHeight; + std::vector<float> m_BlocksHeight; }; #endif // XFA_FXFA_APP_CXFA_LOADERCONTEXT_H_ diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index 3c0087de09..f25f6cceee 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -101,11 +101,11 @@ std::unique_ptr<CFX_RTFBreak> CXFA_TextLayout::CreateBreak(bool bDefault) { return pBreak; } -void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) { +void CXFA_TextLayout::InitBreak(float fLineWidth) { CXFA_Font font = m_pTextProvider->GetFontNode(); CXFA_Para para = m_pTextProvider->GetParaNode(); - FX_FLOAT fStart = 0; - FX_FLOAT fStartPos = 0; + float fStart = 0; + float fStartPos = 0; if (para) { CFX_RTFLineAlignment iAlign = CFX_RTFLineAlignment::Left; switch (para.GetHorizontalAlign()) { @@ -135,7 +135,7 @@ void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) { fLineWidth = fStart; fStartPos = fStart; - FX_FLOAT fIndent = para.GetTextIndent(); + float fIndent = para.GetTextIndent(); if (fIndent > 0) fStartPos += fIndent; } @@ -148,7 +148,7 @@ void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) { m_pBreak->SetCharSpace(font.GetLetterSpacing()); } - FX_FLOAT fFontSize = m_textParser.GetFontSize(m_pTextProvider, nullptr); + float fFontSize = m_textParser.GetFontSize(m_pTextProvider, nullptr); m_pBreak->SetFontSize(fFontSize); m_pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, nullptr)); m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f); @@ -156,7 +156,7 @@ void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) { void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle, FDE_CSSDisplay eDisplay, - FX_FLOAT fLineWidth, + float fLineWidth, CFDE_XMLNode* pXMLNode, CFDE_CSSComputedStyle* pParentStyle) { if (!pStyle) { @@ -185,7 +185,7 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle, } m_pBreak->SetAlignment(iAlign); - FX_FLOAT fStart = 0; + float fStart = 0; const FDE_CSSRect* pRect = pStyle->GetMarginWidth(); const FDE_CSSRect* pPaddingRect = pStyle->GetPaddingWidth(); if (pRect) { @@ -215,7 +215,7 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle, } } m_pBreak->SetLineBoundary(fStart, fLineWidth); - FX_FLOAT fIndent = pStyle->GetTextIndent().GetValue(); + float fIndent = pStyle->GetTextIndent().GetValue(); if (fIndent > 0) fStart += fIndent; @@ -230,7 +230,7 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle, } } - FX_FLOAT fFontSize = m_textParser.GetFontSize(m_pTextProvider, pStyle); + float fFontSize = m_textParser.GetFontSize(m_pTextProvider, pStyle); m_pBreak->SetFontSize(fFontSize); m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f); m_pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, pStyle)); @@ -248,7 +248,7 @@ int32_t CXFA_TextLayout::GetText(CFX_WideString& wsText) { return wsText.GetLength(); } -FX_FLOAT CXFA_TextLayout::GetLayoutHeight() { +float CXFA_TextLayout::GetLayoutHeight() { if (!m_pLoader) return 0; @@ -263,7 +263,7 @@ FX_FLOAT CXFA_TextLayout::GetLayoutHeight() { return szDef.height; } - FX_FLOAT fHeight = m_pLoader->m_fHeight; + float fHeight = m_pLoader->m_fHeight; if (fHeight < 0.1f) { fHeight = 0; for (int32_t i = 0; i < iCount; i++) @@ -272,7 +272,7 @@ FX_FLOAT CXFA_TextLayout::GetLayoutHeight() { return fHeight; } -FX_FLOAT CXFA_TextLayout::StartLayout(FX_FLOAT fWidth) { +float CXFA_TextLayout::StartLayout(float fWidth) { if (!m_pLoader) m_pLoader = pdfium::MakeUnique<CXFA_LoaderContext>(); @@ -298,14 +298,14 @@ FX_FLOAT CXFA_TextLayout::StartLayout(FX_FLOAT fWidth) { } bool CXFA_TextLayout::DoLayout(int32_t iBlockIndex, - FX_FLOAT& fCalcHeight, - FX_FLOAT fContentAreaHeight, - FX_FLOAT fTextHeight) { + float& fCalcHeight, + float fContentAreaHeight, + float fTextHeight) { if (!m_pLoader) return false; int32_t iBlockCount = m_Blocks.GetSize(); - FX_FLOAT fHeight = fTextHeight; + float fHeight = fTextHeight; if (fHeight < 0) fHeight = GetLayoutHeight(); @@ -326,7 +326,7 @@ bool CXFA_TextLayout::DoLayout(int32_t iBlockIndex, } } - FX_FLOAT fLinePos = m_pLoader->m_fStartLineOffset; + float fLinePos = m_pLoader->m_fStartLineOffset; int32_t iLineIndex = 0; if (iBlockCount > 1) { if (iBlockCount >= (iBlockIndex + 1) * 2) { @@ -344,7 +344,7 @@ bool CXFA_TextLayout::DoLayout(int32_t iBlockIndex, int32_t iCount = m_pLoader->m_lineHeights.GetSize(); int32_t i = 0; for (i = iLineIndex; i < iCount; i++) { - FX_FLOAT fLineHeight = m_pLoader->m_lineHeights.ElementAt(i); + float fLineHeight = m_pLoader->m_lineHeights.ElementAt(i); if ((i == iLineIndex) && (fLineHeight - fContentAreaHeight > 0.001)) { fCalcHeight = 0; return true; @@ -364,7 +364,7 @@ bool CXFA_TextLayout::DoLayout(int32_t iBlockIndex, (m_pLoader->m_BlocksHeight[iBlockIndex * 2] == iBlockIndex)) { m_pLoader->m_BlocksHeight[iBlockIndex * 2 + 1] = fCalcHeight; } else { - m_pLoader->m_BlocksHeight.push_back((FX_FLOAT)iBlockIndex); + m_pLoader->m_BlocksHeight.push_back((float)iBlockIndex); m_pLoader->m_BlocksHeight.push_back(fCalcHeight); } } @@ -392,7 +392,7 @@ bool CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize, defaultSize.width = 0xFFFF; m_pBreak = CreateBreak(false); - FX_FLOAT fLinePos = 0; + float fLinePos = 0; m_iLines = 0; m_fMaxWidth = 0; Loader(defaultSize, fLinePos, false); @@ -404,7 +404,7 @@ bool CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize, return true; } -bool CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) { +bool CXFA_TextLayout::Layout(const CFX_SizeF& size, float* fHeight) { if (size.width < 1) return false; @@ -416,7 +416,7 @@ bool CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) { } m_iLines = 0; - FX_FLOAT fLinePos = 0; + float fLinePos = 0; Loader(size, fLinePos, true); UpdateAlign(size.height, fLinePos); m_pTabstopContext.reset(); @@ -433,7 +433,7 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) { m_pLoader->m_iTotalLines = -1; m_iLines = 0; - FX_FLOAT fLinePos = 0; + float fLinePos = 0; CXFA_Node* pNode = nullptr; CFX_SizeF szText(m_pLoader->m_fWidth, m_pLoader->m_fHeight); int32_t iCount = m_Blocks.GetSize(); @@ -523,7 +523,7 @@ void CXFA_TextLayout::ItemBlocks(const CFX_RectF& rtText, int32_t iBlockIndex) { bool bEndItem = true; int32_t iBlockCount = m_Blocks.GetSize(); - FX_FLOAT fLinePos = m_pLoader->m_fStartLineOffset; + float fLinePos = m_pLoader->m_fStartLineOffset; int32_t iLineIndex = 0; if (iBlockIndex > 0) { int32_t iBlockHeightCount = @@ -540,7 +540,7 @@ void CXFA_TextLayout::ItemBlocks(const CFX_RectF& rtText, int32_t iBlockIndex) { int32_t i = 0; for (i = iLineIndex; i < iCountHeight; i++) { - FX_FLOAT fLineHeight = m_pLoader->m_lineHeights.ElementAt(i); + float fLineHeight = m_pLoader->m_lineHeights.ElementAt(i); if (fLinePos + fLineHeight - rtText.height > 0.001) { m_Blocks.Add(iLineIndex); m_Blocks.Add(i - iLineIndex); @@ -619,7 +619,7 @@ bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, return iPieceLines > 0; } -void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) { +void CXFA_TextLayout::UpdateAlign(float fHeight, float fBottom) { fHeight -= fBottom; if (fHeight < 0.1f) return; @@ -641,7 +641,7 @@ void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) { } bool CXFA_TextLayout::Loader(const CFX_SizeF& szText, - FX_FLOAT& fLinePos, + float& fLinePos, bool bSavePieces) { GetTextDataNode(); if (!m_pTextDataNode) @@ -665,12 +665,12 @@ bool CXFA_TextLayout::Loader(const CFX_SizeF& szText, void CXFA_TextLayout::LoadText(CXFA_Node* pNode, const CFX_SizeF& szText, - FX_FLOAT& fLinePos, + float& fLinePos, bool bSavePieces) { InitBreak(szText.width); CXFA_Para para = m_pTextProvider->GetParaNode(); - FX_FLOAT fSpaceAbove = 0; + float fSpaceAbove = 0; if (para) { fSpaceAbove = para.GetSpaceAbove(); if (fSpaceAbove < 0.1f) { @@ -699,7 +699,7 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode, bool CXFA_TextLayout::LoadRichText( CFDE_XMLNode* pXMLNode, const CFX_SizeF& szText, - FX_FLOAT& fLinePos, + float& fLinePos, const CFX_RetainPtr<CFDE_CSSComputedStyle>& pParentStyle, bool bSavePieces, CFX_RetainPtr<CXFA_LinkUserData> pLinkData, @@ -713,7 +713,7 @@ bool CXFA_TextLayout::LoadRichText( m_textParser.GetParseContextFromMap(pXMLNode); FDE_CSSDisplay eDisplay = FDE_CSSDisplay::None; bool bContentNode = false; - FX_FLOAT fSpaceBelow = 0; + float fSpaceBelow = 0; CFX_RetainPtr<CFDE_CSSComputedStyle> pStyle; CFX_WideString wsName; if (bEndBreak) { @@ -887,8 +887,8 @@ bool CXFA_TextLayout::LoadRichText( } bool CXFA_TextLayout::AppendChar(const CFX_WideString& wsText, - FX_FLOAT& fLinePos, - FX_FLOAT fSpaceAbove, + float& fLinePos, + float fSpaceAbove, bool bSavePieces) { CFX_BreakType dwStatus = CFX_BreakType::None; int32_t iChar = 0; @@ -950,7 +950,7 @@ void CXFA_TextLayout::ProcessText(CFX_WideString& wsText) { } void CXFA_TextLayout::EndBreak(CFX_BreakType dwStatus, - FX_FLOAT& fLinePos, + float& fLinePos, bool bSavePieces) { dwStatus = m_pBreak->EndBreak(dwStatus); if (dwStatus != CFX_BreakType::None && dwStatus != CFX_BreakType::Piece) @@ -977,7 +977,7 @@ void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle, if (iCount > 0) { iTabstopsIndex++; m_pTabstopContext->m_bTabstops = true; - FX_FLOAT fRight = 0; + float fRight = 0; if (iPieces > 1) { XFA_TextPiece* p = pPieceLine->m_textPieces[iPieces - 2].get(); fRight = p->rtPiece.right(); @@ -985,7 +985,7 @@ void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle, m_pTabstopContext->m_fTabWidth = pPiece->rtPiece.width + pPiece->rtPiece.left - fRight; } else if (iTabstopsIndex > -1) { - FX_FLOAT fLeft = 0; + float fLeft = 0; if (m_pTabstopContext->m_bTabstops) { XFA_TABSTOPS* pTabstops = m_pTabstopContext->m_tabstops.GetDataPtr(iTabstopsIndex); @@ -1014,7 +1014,7 @@ void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle, } void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus, - FX_FLOAT& fLinePos, + float& fLinePos, bool bSavePieces, bool bEndBreak) { int32_t iPieces = m_pBreak->CountBreakPieces(); @@ -1029,7 +1029,7 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus, if (m_pTabstopContext) m_pTabstopContext->Reset(); - FX_FLOAT fLineStep = 0, fBaseLine = 0; + float fLineStep = 0, fBaseLine = 0; int32_t i = 0; for (i = 0; i < iPieces; i++) { const CFX_BreakPiece* pPiece = m_pBreak->GetBreakPieceUnstable(i); @@ -1037,7 +1037,7 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus, static_cast<CXFA_TextUserData*>(pPiece->m_pUserData.Get()); if (pUserData) pStyle = pUserData->m_pStyle; - FX_FLOAT fVerScale = pPiece->m_iVerticalScale / 100.0f; + float fVerScale = pPiece->m_iVerticalScale / 100.0f; auto pTP = pdfium::MakeUnique<XFA_TextPiece>(); pTP->iChars = pPiece->m_iChars; @@ -1055,15 +1055,15 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus, pTP->fFontSize = m_textParser.GetFontSize(m_pTextProvider, pStyle.Get()); pTP->rtPiece.left = pPiece->m_iStartPos / 20000.0f; pTP->rtPiece.width = pPiece->m_iWidth / 20000.0f; - pTP->rtPiece.height = (FX_FLOAT)pPiece->m_iFontSize * fVerScale / 20.0f; - FX_FLOAT fBaseLineTemp = + pTP->rtPiece.height = (float)pPiece->m_iFontSize * fVerScale / 20.0f; + float fBaseLineTemp = m_textParser.GetBaseline(m_pTextProvider, pStyle.Get()); pTP->rtPiece.top = fBaseLineTemp; - FX_FLOAT fLineHeight = m_textParser.GetLineHeight( + float fLineHeight = m_textParser.GetLineHeight( m_pTextProvider, pStyle.Get(), m_iLines == 0, fVerScale); if (fBaseLineTemp > 0) { - FX_FLOAT fLineHeightTmp = fBaseLineTemp + pTP->rtPiece.height; + float fLineHeightTmp = fBaseLineTemp + pTP->rtPiece.height; if (fLineHeight < fLineHeightTmp) fLineHeight = fLineHeightTmp; else @@ -1077,29 +1077,28 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus, DoTabstops(pStyle.Get(), pPieceLine); } for (const auto& pTP : pPieceLine->m_textPieces) { - FX_FLOAT& fTop = pTP->rtPiece.top; - FX_FLOAT fBaseLineTemp = fTop; + float& fTop = pTP->rtPiece.top; + float fBaseLineTemp = fTop; fTop = fLinePos + fLineStep - pTP->rtPiece.height - fBaseLineTemp; fTop = std::max(0.0f, fTop); } fLinePos += fLineStep + fBaseLine; } else { - FX_FLOAT fLineStep = 0; - FX_FLOAT fLineWidth = 0; + float fLineStep = 0; + float fLineWidth = 0; for (int32_t i = 0; i < iPieces; i++) { const CFX_BreakPiece* pPiece = m_pBreak->GetBreakPieceUnstable(i); CXFA_TextUserData* pUserData = static_cast<CXFA_TextUserData*>(pPiece->m_pUserData.Get()); if (pUserData) pStyle = pUserData->m_pStyle; - FX_FLOAT fVerScale = pPiece->m_iVerticalScale / 100.0f; - FX_FLOAT fBaseLine = - m_textParser.GetBaseline(m_pTextProvider, pStyle.Get()); - FX_FLOAT fLineHeight = m_textParser.GetLineHeight( + float fVerScale = pPiece->m_iVerticalScale / 100.0f; + float fBaseLine = m_textParser.GetBaseline(m_pTextProvider, pStyle.Get()); + float fLineHeight = m_textParser.GetLineHeight( m_pTextProvider, pStyle.Get(), m_iLines == 0, fVerScale); if (fBaseLine > 0) { - FX_FLOAT fLineHeightTmp = - fBaseLine + (FX_FLOAT)pPiece->m_iFontSize * fVerScale / 20.0f; + float fLineHeightTmp = + fBaseLine + (float)pPiece->m_iFontSize * fVerScale / 20.0f; if (fLineHeight < fLineHeightTmp) { fLineHeight = fLineHeightTmp; } @@ -1110,7 +1109,7 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus, fLinePos += fLineStep; m_fMaxWidth = std::max(m_fMaxWidth, fLineWidth); if (m_pLoader && m_pLoader->m_bSaveLineHeight) { - FX_FLOAT fHeight = fLinePos - m_pLoader->m_fLastPos; + float fHeight = fLinePos - m_pLoader->m_fLastPos; m_pLoader->m_fLastPos = fLinePos; m_pLoader->m_lineHeights.Add(fHeight); } @@ -1122,12 +1121,12 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus, if (!pStyle && bEndBreak) { CXFA_Para para = m_pTextProvider->GetParaNode(); if (para) { - FX_FLOAT fStartPos = para.GetMarginLeft(); - FX_FLOAT fIndent = para.GetTextIndent(); + float fStartPos = para.GetMarginLeft(); + float fIndent = para.GetTextIndent(); if (fIndent > 0) fStartPos += fIndent; - FX_FLOAT fSpaceBelow = para.GetSpaceBelow(); + float fSpaceBelow = para.GetSpaceBelow(); if (fSpaceBelow < 0.1f) fSpaceBelow = 0; @@ -1138,12 +1137,12 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus, } if (pStyle) { - FX_FLOAT fStart = 0; + float fStart = 0; const FDE_CSSRect* pRect = pStyle->GetMarginWidth(); if (pRect) fStart = pRect->left.GetValue(); - FX_FLOAT fTextIndent = pStyle->GetTextIndent().GetValue(); + float fTextIndent = pStyle->GetTextIndent().GetValue(); if (fTextIndent < 0) fStart -= fTextIndent; @@ -1185,7 +1184,7 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, int32_t iChars = GetDisplayPos(pPiece, pCharPos); if (iChars > 0) { CFX_PointF pt1, pt2; - FX_FLOAT fEndY = pCharPos[0].m_Origin.y + 1.05f; + float fEndY = pCharPos[0].m_Origin.y + 1.05f; if (pPiece->iPeriod == XFA_ATTRIBUTEENUM_Word) { for (int32_t i = 0; i < pPiece->iUnderline; i++) { for (int32_t j = 0; j < iChars; j++) { @@ -1244,8 +1243,8 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, if (iCharsTmp == 0) return; - FX_FLOAT fOrgX = 0.0f; - FX_FLOAT fEndX = 0.0f; + float fOrgX = 0.0f; + float fEndX = 0.0f; pPiece = pPieceLine->m_textPieces[iPiecePrev].get(); iChars = GetDisplayPos(pPiece, pCharPos); if (iChars < 1) @@ -1263,7 +1262,7 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, CFX_PointF pt2; pt1.x = fOrgX; pt2.x = fEndX; - FX_FLOAT fEndY = pCharPos[0].m_Origin.y + 1.05f; + float fEndY = pCharPos[0].m_Origin.y + 1.05f; for (int32_t i = 0; i < pPiece->iUnderline; i++) { pt1.y = fEndY; pt2.y = fEndY; diff --git a/xfa/fxfa/app/cxfa_textlayout.h b/xfa/fxfa/app/cxfa_textlayout.h index cbf3d33ad9..dcf415ac16 100644 --- a/xfa/fxfa/app/cxfa_textlayout.h +++ b/xfa/fxfa/app/cxfa_textlayout.h @@ -37,17 +37,17 @@ class CXFA_TextLayout { ~CXFA_TextLayout(); int32_t GetText(CFX_WideString& wsText); - FX_FLOAT GetLayoutHeight(); - FX_FLOAT StartLayout(FX_FLOAT fWidth = -1); + float GetLayoutHeight(); + float StartLayout(float fWidth = -1); bool DoLayout(int32_t iBlockIndex, - FX_FLOAT& fCalcHeight, - FX_FLOAT fContentAreaHeight = -1, - FX_FLOAT fTextHeight = -1); + float& fCalcHeight, + float fContentAreaHeight = -1, + float fTextHeight = -1); bool CalcSize(const CFX_SizeF& minSize, const CFX_SizeF& maxSize, CFX_SizeF& defaultSize); - bool Layout(const CFX_SizeF& size, FX_FLOAT* fHeight = nullptr); + bool Layout(const CFX_SizeF& size, float* fHeight = nullptr); void ItemBlocks(const CFX_RectF& rtText, int32_t iBlockIndex); bool DrawString(CFX_RenderDevice* pFxDevice, const CFX_Matrix& tmDoc2Device, @@ -66,22 +66,22 @@ class CXFA_TextLayout { void GetTextDataNode(); CFDE_XMLNode* GetXMLContainerNode(); std::unique_ptr<CFX_RTFBreak> CreateBreak(bool bDefault); - void InitBreak(FX_FLOAT fLineWidth); + void InitBreak(float fLineWidth); void InitBreak(CFDE_CSSComputedStyle* pStyle, FDE_CSSDisplay eDisplay, - FX_FLOAT fLineWidth, + float fLineWidth, CFDE_XMLNode* pXMLNode, CFDE_CSSComputedStyle* pParentStyle = nullptr); bool Loader(const CFX_SizeF& szText, - FX_FLOAT& fLinePos, + float& fLinePos, bool bSavePieces = true); void LoadText(CXFA_Node* pNode, const CFX_SizeF& szText, - FX_FLOAT& fLinePos, + float& fLinePos, bool bSavePieces); bool LoadRichText(CFDE_XMLNode* pXMLNode, const CFX_SizeF& szText, - FX_FLOAT& fLinePos, + float& fLinePos, const CFX_RetainPtr<CFDE_CSSComputedStyle>& pParentStyle, bool bSavePieces, CFX_RetainPtr<CXFA_LinkUserData> pLinkData, @@ -89,17 +89,17 @@ class CXFA_TextLayout { bool bIsOl = false, int32_t iLiCount = 0); bool AppendChar(const CFX_WideString& wsText, - FX_FLOAT& fLinePos, - FX_FLOAT fSpaceAbove, + float& fLinePos, + float fSpaceAbove, bool bSavePieces); void AppendTextLine(CFX_BreakType dwStatus, - FX_FLOAT& fLinePos, + float& fLinePos, bool bSavePieces, bool bEndBreak = false); - void EndBreak(CFX_BreakType dwStatus, FX_FLOAT& fLinePos, bool bDefault); + void EndBreak(CFX_BreakType dwStatus, float& fLinePos, bool bDefault); bool IsEnd(bool bSavePieces); void ProcessText(CFX_WideString& wsText); - void UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom); + void UpdateAlign(float fHeight, float fBottom); void RenderString(CFDE_RenderDevice* pDevice, CFDE_Brush* pBrush, CXFA_PieceLine* pPieceLine, @@ -126,7 +126,7 @@ class CXFA_TextLayout { std::unique_ptr<CFX_RTFBreak> m_pBreak; std::unique_ptr<CXFA_LoaderContext> m_pLoader; int32_t m_iLines; - FX_FLOAT m_fMaxWidth; + float m_fMaxWidth; CXFA_TextParser m_textParser; std::vector<std::unique_ptr<CXFA_PieceLine>> m_pieceLines; std::unique_ptr<CXFA_TextTabstopsContext> m_pTabstopContext; diff --git a/xfa/fxfa/app/cxfa_textparser.cpp b/xfa/fxfa/app/cxfa_textparser.cpp index 750a0baaff..6a9aeb04d8 100644 --- a/xfa/fxfa/app/cxfa_textparser.cpp +++ b/xfa/fxfa/app/cxfa_textparser.cpp @@ -67,7 +67,7 @@ void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) { CFGAS_FontMgr* pFontMgr = pDoc->GetApp()->GetFDEFontMgr(); ASSERT(pFontMgr); m_pSelector = pdfium::MakeUnique<CFDE_CSSStyleSelector>(pFontMgr); - FX_FLOAT fFontSize = 10; + float fFontSize = 10; CXFA_Font font = pTextProvider->GetFontNode(); if (font) { fFontSize = font.GetFontSize(); @@ -106,8 +106,8 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::CreateRootStyle( CXFA_Font font = pTextProvider->GetFontNode(); CXFA_Para para = pTextProvider->GetParaNode(); auto pStyle = m_pSelector->CreateComputedStyle(nullptr); - FX_FLOAT fLineHeight = 0; - FX_FLOAT fFontSize = 10; + float fLineHeight = 0; + float fFontSize = 10; if (para) { fLineHeight = para.GetLineHeight(); @@ -171,7 +171,7 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::CreateStyle( return pNewStyle; uint32_t dwDecoration = pParentStyle->GetTextDecoration(); - FX_FLOAT fBaseLine = 0; + float fBaseLine = 0; if (pParentStyle->GetVerticalAlign() == FDE_CSSVerticalAlign::Number) fBaseLine = pParentStyle->GetNumberVerticalAlign(); @@ -307,7 +307,7 @@ int32_t CXFA_TextParser::GetVAlign(CXFA_TextProvider* pTextProvider) const { return para ? para.GetVerticalAlign() : XFA_ATTRIBUTEENUM_Top; } -FX_FLOAT CXFA_TextParser::GetTabInterval(CFDE_CSSComputedStyle* pStyle) const { +float CXFA_TextParser::GetTabInterval(CFDE_CSSComputedStyle* pStyle) const { CFX_WideString wsValue; if (pStyle && pStyle->GetCustomStyle(L"tab-interval", wsValue)) return CXFA_Measurement(wsValue.AsStringC()).ToUnit(XFA_UNIT_Pt); @@ -361,8 +361,8 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont( return pFontMgr->GetFont(pDoc, wsFamily, dwStyle); } -FX_FLOAT CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider, - CFDE_CSSComputedStyle* pStyle) const { +float CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider, + CFDE_CSSComputedStyle* pStyle) const { if (pStyle) return pStyle->GetFontSize(); @@ -466,8 +466,8 @@ FX_ARGB CXFA_TextParser::GetColor(CXFA_TextProvider* pTextProvider, return 0xFF000000; } -FX_FLOAT CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider, - CFDE_CSSComputedStyle* pStyle) const { +float CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider, + CFDE_CSSComputedStyle* pStyle) const { if (pStyle) { if (pStyle->GetVerticalAlign() == FDE_CSSVerticalAlign::Number) return pStyle->GetNumberVerticalAlign(); @@ -477,18 +477,18 @@ FX_FLOAT CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider, return 0; } -FX_FLOAT CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider, - CFDE_CSSComputedStyle* pStyle, - bool bFirst, - FX_FLOAT fVerScale) const { - FX_FLOAT fLineHeight = 0; +float CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider, + CFDE_CSSComputedStyle* pStyle, + bool bFirst, + float fVerScale) const { + float fLineHeight = 0; if (pStyle) fLineHeight = pStyle->GetLineHeight(); else if (CXFA_Para para = pTextProvider->GetParaNode()) fLineHeight = para.GetLineHeight(); if (bFirst) { - FX_FLOAT fFontSize = GetFontSize(pTextProvider, pStyle); + float fFontSize = GetFontSize(pTextProvider, pStyle); if (fLineHeight < 0.1f) fLineHeight = fFontSize; else @@ -618,7 +618,7 @@ bool CXFA_TextParser::GetTabstops(CFDE_CSSComputedStyle* pStyle, if (ch == ' ') { uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringC(), true); CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast)); - FX_FLOAT fPos = ms.ToUnit(XFA_UNIT_Pt); + float fPos = ms.ToUnit(XFA_UNIT_Pt); pTabstopContext->Append(dwHashCode, fPos); wsAlign.clear(); eStatus = TabStopStatus::None; @@ -633,7 +633,7 @@ bool CXFA_TextParser::GetTabstops(CFDE_CSSComputedStyle* pStyle, if (!wsAlign.IsEmpty()) { uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringC(), true); CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast)); - FX_FLOAT fPos = ms.ToUnit(XFA_UNIT_Pt); + float fPos = ms.ToUnit(XFA_UNIT_Pt); pTabstopContext->Append(dwHashCode, fPos); } return true; diff --git a/xfa/fxfa/app/cxfa_textparser.h b/xfa/fxfa/app/cxfa_textparser.h index 86da502dbf..524f125665 100644 --- a/xfa/fxfa/app/cxfa_textparser.h +++ b/xfa/fxfa/app/cxfa_textparser.h @@ -43,7 +43,7 @@ class CXFA_TextParser { int32_t GetVAlign(CXFA_TextProvider* pTextProvider) const; - FX_FLOAT GetTabInterval(CFDE_CSSComputedStyle* pStyle) const; + float GetTabInterval(CFDE_CSSComputedStyle* pStyle) const; int32_t CountTabs(CFDE_CSSComputedStyle* pStyle) const; bool IsSpaceRun(CFDE_CSSComputedStyle* pStyle) const; @@ -52,8 +52,8 @@ class CXFA_TextParser { CFX_RetainPtr<CFGAS_GEFont> GetFont(CXFA_TextProvider* pTextProvider, CFDE_CSSComputedStyle* pStyle) const; - FX_FLOAT GetFontSize(CXFA_TextProvider* pTextProvider, - CFDE_CSSComputedStyle* pStyle) const; + float GetFontSize(CXFA_TextProvider* pTextProvider, + CFDE_CSSComputedStyle* pStyle) const; int32_t GetHorScale(CXFA_TextProvider* pTextProvider, CFDE_CSSComputedStyle* pStyle, @@ -70,12 +70,12 @@ class CXFA_TextParser { int32_t& iLinethrough) const; FX_ARGB GetColor(CXFA_TextProvider* pTextProvider, CFDE_CSSComputedStyle* pStyle) const; - FX_FLOAT GetBaseline(CXFA_TextProvider* pTextProvider, - CFDE_CSSComputedStyle* pStyle) const; - FX_FLOAT GetLineHeight(CXFA_TextProvider* pTextProvider, - CFDE_CSSComputedStyle* pStyle, - bool bFirst, - FX_FLOAT fVerScale) const; + float GetBaseline(CXFA_TextProvider* pTextProvider, + CFDE_CSSComputedStyle* pStyle) const; + float GetLineHeight(CXFA_TextProvider* pTextProvider, + CFDE_CSSComputedStyle* pStyle, + bool bFirst, + float fVerScale) const; bool GetEmbbedObj(CXFA_TextProvider* pTextProvider, CFDE_XMLNode* pXMLNode, diff --git a/xfa/fxfa/app/cxfa_texttabstopscontext.cpp b/xfa/fxfa/app/cxfa_texttabstopscontext.cpp index 3209603af3..b654e87a04 100644 --- a/xfa/fxfa/app/cxfa_texttabstopscontext.cpp +++ b/xfa/fxfa/app/cxfa_texttabstopscontext.cpp @@ -15,7 +15,7 @@ CXFA_TextTabstopsContext::CXFA_TextTabstopsContext() CXFA_TextTabstopsContext::~CXFA_TextTabstopsContext() {} -void CXFA_TextTabstopsContext::Append(uint32_t dwAlign, FX_FLOAT fTabstops) { +void CXFA_TextTabstopsContext::Append(uint32_t dwAlign, float fTabstops) { int32_t i = 0; for (i = 0; i < m_iTabCount; i++) { XFA_TABSTOPS* pTabstop = m_tabstops.GetDataPtr(i); diff --git a/xfa/fxfa/app/cxfa_texttabstopscontext.h b/xfa/fxfa/app/cxfa_texttabstopscontext.h index 8fe0e6273f..64b83a4421 100644 --- a/xfa/fxfa/app/cxfa_texttabstopscontext.h +++ b/xfa/fxfa/app/cxfa_texttabstopscontext.h @@ -11,7 +11,7 @@ struct XFA_TABSTOPS { uint32_t dwAlign; - FX_FLOAT fTabstops; + float fTabstops; }; class CXFA_TextTabstopsContext { @@ -19,7 +19,7 @@ class CXFA_TextTabstopsContext { CXFA_TextTabstopsContext(); ~CXFA_TextTabstopsContext(); - void Append(uint32_t dwAlign, FX_FLOAT fTabstops); + void Append(uint32_t dwAlign, float fTabstops); void RemoveAll(); void Reset(); @@ -27,8 +27,8 @@ class CXFA_TextTabstopsContext { int32_t m_iTabCount; int32_t m_iTabIndex; bool m_bTabstops; - FX_FLOAT m_fTabWidth; - FX_FLOAT m_fLeft; + float m_fTabWidth; + float m_fLeft; }; #endif // XFA_FXFA_APP_CXFA_TEXTTABSTOPSCONTEXT_H_ diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index 3bbef30d06..6b13069ed2 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -176,7 +176,7 @@ void CXFA_FFBarcode::UpdateWidgetProperty() { int32_t intVal; char charVal; bool boolVal; - FX_FLOAT floatVal; + float floatVal; if (pAcc->GetBarcodeAttribute_CharEncoding(intVal)) { pBarCodeWidget->SetCharEncoding((BC_CHAR_ENCODING)intVal); } diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp index f088b5d4dd..22fdb3d9df 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp +++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp @@ -49,7 +49,7 @@ void CXFA_FFCheckButton::UpdateWidgetProperty() { if (!m_pNormalWidget) { return; } - FX_FLOAT fSize = m_pDataAcc->GetCheckButtonSize(); + float fSize = m_pDataAcc->GetCheckButtonSize(); pCheckBox->SetBoxSize(fSize); uint32_t dwStyleEx = FWL_STYLEEXT_CKB_SignShapeCross; int32_t iCheckMark = m_pDataAcc->GetCheckButtonMark(); @@ -86,14 +86,14 @@ void CXFA_FFCheckButton::UpdateWidgetProperty() { } bool CXFA_FFCheckButton::PerformLayout() { CXFA_FFWidget::PerformLayout(); - FX_FLOAT fCheckSize = m_pDataAcc->GetCheckButtonSize(); + float fCheckSize = m_pDataAcc->GetCheckButtonSize(); CXFA_Margin mgWidget = m_pDataAcc->GetMargin(); CFX_RectF rtWidget = GetRectWithoutRotate(); if (mgWidget) { XFA_RectWidthoutMargin(rtWidget, mgWidget); } int32_t iCapPlacement = -1; - FX_FLOAT fCapReserve = 0; + float fCapReserve = 0; CXFA_Caption caption = m_pDataAcc->GetCaption(); if (caption && caption.GetPresence()) { m_rtCaption = rtWidget; @@ -189,8 +189,8 @@ void CXFA_FFCheckButton::CapLeftRightPlacement(CXFA_Margin mgCap) { void CXFA_FFCheckButton::AddUIMargin(int32_t iCapPlacement) { CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin(); m_rtUI.top -= rtUIMargin.top / 2 - rtUIMargin.height / 2; - FX_FLOAT fLeftAddRight = rtUIMargin.left + rtUIMargin.width; - FX_FLOAT fTopAddBottom = rtUIMargin.top + rtUIMargin.height; + float fLeftAddRight = rtUIMargin.left + rtUIMargin.width; + float fTopAddBottom = rtUIMargin.top + rtUIMargin.height; if (m_rtUI.width < fLeftAddRight) { if (iCapPlacement == XFA_ATTRIBUTEENUM_Right || iCapPlacement == XFA_ATTRIBUTEENUM_Left) { diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 630d04311f..06763be094 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -94,7 +94,7 @@ void CXFA_FFField::DrawFocus(CFX_Graphics* pGS, CFX_Matrix* pMatrix) { if (m_dwStatus & XFA_WidgetStatus_Focused) { CFX_Color cr(0xFF000000); pGS->SetStrokeColor(&cr); - FX_FLOAT DashPattern[2] = {1, 1}; + float DashPattern[2] = {1, 1}; pGS->SetLineDash(0.0f, DashPattern, 2); pGS->SetLineWidth(0, false); @@ -124,7 +124,7 @@ void CXFA_FFField::SetEditScrollOffset() { XFA_Element eType = m_pDataAcc->GetUIType(); if (eType == XFA_Element::TextEdit || eType == XFA_Element::NumericEdit || eType == XFA_Element::PasswordEdit) { - FX_FLOAT fScrollOffset = 0; + float fScrollOffset = 0; CXFA_FFField* pPrev = static_cast<CXFA_FFField*>(GetPrev()); if (pPrev) { CFX_RectF rtMargin = m_pDataAcc->GetUIMargin(); @@ -153,7 +153,7 @@ void CXFA_FFField::CapPlacement() { CXFA_Margin mgWidget = m_pDataAcc->GetMargin(); if (mgWidget) { CXFA_LayoutItem* pItem = this; - FX_FLOAT fLeftInset = 0, fRightInset = 0, fTopInset = 0, fBottomInset = 0; + float fLeftInset = 0, fRightInset = 0, fTopInset = 0, fBottomInset = 0; mgWidget.GetLeftInset(fLeftInset); mgWidget.GetRightInset(fRightInset); mgWidget.GetTopInset(fTopInset); @@ -171,7 +171,7 @@ void CXFA_FFField::CapPlacement() { } XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; - FX_FLOAT fCapReserve = 0; + float fCapReserve = 0; CXFA_Caption caption = m_pDataAcc->GetCaption(); if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType(); @@ -260,8 +260,8 @@ void CXFA_FFField::CapTopBottomPlacement(CXFA_Caption caption, m_rtCaption.top += m_rtCaption.height; } } - FX_FLOAT fWidth = rtUIMargin.left + rtUIMargin.width; - FX_FLOAT fHeight = m_rtCaption.height + rtUIMargin.top + rtUIMargin.height; + float fWidth = rtUIMargin.left + rtUIMargin.width; + float fHeight = m_rtCaption.height + rtUIMargin.top + rtUIMargin.height; if (fWidth > rtWidget.width) { m_rtUI.width += fWidth - rtWidget.width; } @@ -287,8 +287,8 @@ void CXFA_FFField::CapLeftRightPlacement(CXFA_Caption caption, m_rtCaption.top += m_rtCaption.height; } } - FX_FLOAT fWidth = m_rtCaption.width + rtUIMargin.left + rtUIMargin.width; - FX_FLOAT fHeight = rtUIMargin.top + rtUIMargin.height; + float fWidth = m_rtCaption.width + rtUIMargin.left + rtUIMargin.width; + float fHeight = rtUIMargin.top + rtUIMargin.height; if (fWidth > rtWidget.width) { m_rtUI.width += fWidth - rtWidget.width; if (iCapPlacement == XFA_ATTRIBUTEENUM_Right) { @@ -323,7 +323,7 @@ void CXFA_FFField::SetFWLRect() { if (rtUi.width < 1.0) rtUi.width = 1.0; if (!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { - FX_FLOAT fFontSize = m_pDataAcc->GetFontSize(); + float fFontSize = m_pDataAcc->GetFontSize(); if (rtUi.height < fFontSize) { rtUi.height = fFontSize; } @@ -563,7 +563,7 @@ void CXFA_FFField::LayoutCaption() { if (!pCapTextLayout) return; - FX_FLOAT fHeight = 0; + float fHeight = 0; pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height), &fHeight); if (m_rtCaption.height < fHeight) diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp index a0b834b96b..ce6d7db4e2 100644 --- a/xfa/fxfa/app/xfa_ffnotify.cpp +++ b/xfa/fxfa/app/xfa_ffnotify.cpp @@ -171,8 +171,8 @@ CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) { } void CXFA_FFNotify::StartFieldDrawLayout(CXFA_Node* pItem, - FX_FLOAT& fCalcWidth, - FX_FLOAT& fCalcHeight) { + float& fCalcWidth, + float& fCalcHeight) { CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pItem->GetWidgetData()); if (!pAcc) return; @@ -182,7 +182,7 @@ void CXFA_FFNotify::StartFieldDrawLayout(CXFA_Node* pItem, bool CXFA_FFNotify::FindSplitPos(CXFA_Node* pItem, int32_t iBlockIndex, - FX_FLOAT& fCalcHeightPos) { + float& fCalcHeightPos) { CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pItem->GetWidgetData()); return pAcc && pAcc->FindSplitPos(iBlockIndex, fCalcHeightPos); } diff --git a/xfa/fxfa/app/xfa_ffnotify.h b/xfa/fxfa/app/xfa_ffnotify.h index f76d35b639..c002ed4c15 100644 --- a/xfa/fxfa/app/xfa_ffnotify.h +++ b/xfa/fxfa/app/xfa_ffnotify.h @@ -44,11 +44,11 @@ class CXFA_FFNotify { CXFA_LayoutItem* pSender); void StartFieldDrawLayout(CXFA_Node* pItem, - FX_FLOAT& fCalcWidth, - FX_FLOAT& fCalcHeight); + float& fCalcWidth, + float& fCalcHeight); bool FindSplitPos(CXFA_Node* pItem, int32_t iBlockIndex, - FX_FLOAT& fCalcHeightPos); + float& fCalcHeightPos); bool RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem); int32_t ExecEventByDeepFirst(CXFA_Node* pFormNode, XFA_EVENTTYPE eEventType, diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp index 181f0f19a5..d54e1472a1 100644 --- a/xfa/fxfa/app/xfa_ffpageview.cpp +++ b/xfa/fxfa/app/xfa_ffpageview.cpp @@ -35,37 +35,29 @@ CFX_Matrix GetPageMatrix(const CFX_RectF& docPageRect, bool bFlipY = (dwCoordinatesType & 0x02) != 0; CFX_Matrix m((bFlipX ? -1.0f : 1.0f), 0, 0, (bFlipY ? -1.0f : 1.0f), 0, 0); if (iRotate == 0 || iRotate == 2) { - m.a *= (FX_FLOAT)devicePageRect.width / docPageRect.width; - m.d *= (FX_FLOAT)devicePageRect.height / docPageRect.height; + m.a *= (float)devicePageRect.width / docPageRect.width; + m.d *= (float)devicePageRect.height / docPageRect.height; } else { - m.a *= (FX_FLOAT)devicePageRect.height / docPageRect.width; - m.d *= (FX_FLOAT)devicePageRect.width / docPageRect.height; + m.a *= (float)devicePageRect.height / docPageRect.width; + m.d *= (float)devicePageRect.width / docPageRect.height; } m.Rotate(iRotate * 1.57079632675f); switch (iRotate) { case 0: - m.e = bFlipX ? (FX_FLOAT)devicePageRect.right() - : (FX_FLOAT)devicePageRect.left; - m.f = bFlipY ? (FX_FLOAT)devicePageRect.bottom() - : (FX_FLOAT)devicePageRect.top; + m.e = bFlipX ? (float)devicePageRect.right() : (float)devicePageRect.left; + m.f = bFlipY ? (float)devicePageRect.bottom() : (float)devicePageRect.top; break; case 1: - m.e = bFlipY ? (FX_FLOAT)devicePageRect.left - : (FX_FLOAT)devicePageRect.right(); - m.f = bFlipX ? (FX_FLOAT)devicePageRect.bottom() - : (FX_FLOAT)devicePageRect.top; + m.e = bFlipY ? (float)devicePageRect.left : (float)devicePageRect.right(); + m.f = bFlipX ? (float)devicePageRect.bottom() : (float)devicePageRect.top; break; case 2: - m.e = bFlipX ? (FX_FLOAT)devicePageRect.left - : (FX_FLOAT)devicePageRect.right(); - m.f = bFlipY ? (FX_FLOAT)devicePageRect.top - : (FX_FLOAT)devicePageRect.bottom(); + m.e = bFlipX ? (float)devicePageRect.left : (float)devicePageRect.right(); + m.f = bFlipY ? (float)devicePageRect.top : (float)devicePageRect.bottom(); break; case 3: - m.e = bFlipY ? (FX_FLOAT)devicePageRect.right() - : (FX_FLOAT)devicePageRect.left; - m.f = bFlipX ? (FX_FLOAT)devicePageRect.top - : (FX_FLOAT)devicePageRect.bottom(); + m.e = bFlipY ? (float)devicePageRect.right() : (float)devicePageRect.left; + m.f = bFlipX ? (float)devicePageRect.top : (float)devicePageRect.bottom(); break; default: break; @@ -367,7 +359,7 @@ static int32_t XFA_TabOrderWidgetComparator(const void* phWidget1, auto* param2 = *static_cast<CXFA_TabParam**>(const_cast<void*>(phWidget2)); CFX_RectF rt1 = param1->m_pWidget->GetWidgetRect(); CFX_RectF rt2 = param2->m_pWidget->GetWidgetRect(); - FX_FLOAT x1 = rt1.left, y1 = rt1.top, x2 = rt2.left, y2 = rt2.top; + float x1 = rt1.left, y1 = rt1.top, x2 = rt2.left, y2 = rt2.top; if (y1 < y2 || (y1 - y2 < XFA_FLOAT_PERCISION && x1 < x2)) return -1; return 1; diff --git a/xfa/fxfa/app/xfa_ffpath.cpp b/xfa/fxfa/app/xfa_ffpath.cpp index 43016fe5c6..186d1b1dbd 100644 --- a/xfa/fxfa/app/xfa_ffpath.cpp +++ b/xfa/fxfa/app/xfa_ffpath.cpp @@ -20,8 +20,8 @@ CXFA_FFLine::~CXFA_FFLine() {} void CXFA_FFLine::GetRectFromHand(CFX_RectF& rect, int32_t iHand, - FX_FLOAT fLineWidth) { - FX_FLOAT fHalfWidth = fLineWidth / 2.0f; + float fLineWidth) { + float fHalfWidth = fLineWidth / 2.0f; if (rect.height < 1.0f) { switch (iHand) { case XFA_ATTRIBUTEENUM_Left: @@ -64,7 +64,7 @@ void CXFA_FFLine::RenderWidget(CFX_Graphics* pGS, CXFA_Line lineObj = value.GetLine(); FX_ARGB lineColor = 0xFF000000; int32_t iStrokeType = 0; - FX_FLOAT fLineWidth = 1.0f; + float fLineWidth = 1.0f; int32_t iCap = 0; CXFA_Edge edge = lineObj.GetEdge(); if (edge) { diff --git a/xfa/fxfa/app/xfa_ffpath.h b/xfa/fxfa/app/xfa_ffpath.h index 002f75d262..6df53f4e1d 100644 --- a/xfa/fxfa/app/xfa_ffpath.h +++ b/xfa/fxfa/app/xfa_ffpath.h @@ -20,7 +20,7 @@ class CXFA_FFLine : public CXFA_FFDraw { uint32_t dwStatus) override; private: - void GetRectFromHand(CFX_RectF& rect, int32_t iHand, FX_FLOAT fLineWidth); + void GetRectFromHand(CFX_RectF& rect, int32_t iHand, float fLineWidth); }; class CXFA_FFArc : public CXFA_FFDraw { diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp index 7b6be82035..7989e3207d 100644 --- a/xfa/fxfa/app/xfa_ffpushbutton.cpp +++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp @@ -117,7 +117,7 @@ bool CXFA_FFPushButton::PerformLayout() { return true; } -FX_FLOAT CXFA_FFPushButton::GetLineWidth() { +float CXFA_FFPushButton::GetLineWidth() { CXFA_Border border = m_pDataAcc->GetBorder(); if (border && border.GetPresence() == XFA_ATTRIBUTEENUM_Visible) { CXFA_Edge edge = border.GetEdge(0); @@ -210,7 +210,7 @@ void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics, if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) && (m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) { CFX_RectF rtFill(0, 0, m_pNormalWidget->GetWidgetRect().Size()); - FX_FLOAT fLineWith = GetLineWidth(); + float fLineWith = GetLineWidth(); rtFill.Deflate(fLineWith, fLineWith); CFX_Color cr(FXARGB_MAKE(128, 128, 255, 255)); pGraphics->SetFillColor(&cr); @@ -223,7 +223,7 @@ void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics, XFA_FWL_PSBSTYLEEXT_HiliteOutLine) { if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) && (m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) { - FX_FLOAT fLineWidth = GetLineWidth(); + float fLineWidth = GetLineWidth(); CFX_Color cr(FXARGB_MAKE(255, 128, 255, 255)); pGraphics->SetStrokeColor(&cr); pGraphics->SetLineWidth(fLineWidth); diff --git a/xfa/fxfa/app/xfa_ffpushbutton.h b/xfa/fxfa/app/xfa_ffpushbutton.h index eb18ccb11c..70853e8942 100644 --- a/xfa/fxfa/app/xfa_ffpushbutton.h +++ b/xfa/fxfa/app/xfa_ffpushbutton.h @@ -38,7 +38,7 @@ class CXFA_FFPushButton : public CXFA_FFField { void LoadHighlightCaption(); void LayoutHighlightCaption(); void RenderHighlightCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix = nullptr); - FX_FLOAT GetLineWidth(); + float GetLineWidth(); FX_ARGB GetLineColor(); FX_ARGB GetFillColor(); diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp index 04de9d918a..c4b533f855 100644 --- a/xfa/fxfa/app/xfa_fftext.cpp +++ b/xfa/fxfa/app/xfa_fftext.cpp @@ -46,10 +46,10 @@ void CXFA_FFText::RenderWidget(CFX_Graphics* pGS, if (!pItem->GetPrev() && !pItem->GetNext()) { XFA_RectWidthoutMargin(rtText, mgWidget); } else { - FX_FLOAT fLeftInset; - FX_FLOAT fRightInset; - FX_FLOAT fTopInset = 0; - FX_FLOAT fBottomInset = 0; + float fLeftInset; + float fRightInset; + float fTopInset = 0; + float fBottomInset = 0; mgWidget.GetLeftInset(fLeftInset); mgWidget.GetRightInset(fRightInset); if (!pItem->GetPrev()) @@ -91,11 +91,11 @@ bool CXFA_FFText::PerformLayout() { CFX_RectF rtText = pItem->GetRect(false); if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) { if (!pItem->GetPrev()) { - FX_FLOAT fTopInset; + float fTopInset; mgWidget.GetTopInset(fTopInset); rtText.height -= fTopInset; } else if (!pItem->GetNext()) { - FX_FLOAT fBottomInset; + float fBottomInset; mgWidget.GetBottomInset(fBottomInset); rtText.height -= fBottomInset; } diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index ad175349f6..43bb32feec 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -57,7 +57,7 @@ CFX_RectF CXFA_FFWidget::RecacheWidgetRect() { CFX_RectF CXFA_FFWidget::GetRectWithoutRotate() { CFX_RectF rtWidget = GetWidgetRect(); - FX_FLOAT fValue = 0; + float fValue = 0; switch (m_pDataAcc->GetRotate()) { case 90: rtWidget.top = rtWidget.bottom(); @@ -357,8 +357,8 @@ static void XFA_GetMatrix(CFX_Matrix& m, if (!iRotate) { return; } - FX_FLOAT fAnchorX = 0; - FX_FLOAT fAnchorY = 0; + float fAnchorX = 0; + float fAnchorY = 0; switch (at) { case XFA_ATTRIBUTEENUM_TopLeft: fAnchorX = rt.left, fAnchorY = rt.top; @@ -502,7 +502,7 @@ int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics, int32_t iCapType) { switch (iStrokeType) { case XFA_ATTRIBUTEENUM_DashDot: { - FX_FLOAT dashArray[] = {4, 1, 2, 1}; + float dashArray[] = {4, 1, 2, 1}; if (iCapType != XFA_ATTRIBUTEENUM_Butt) { dashArray[1] = 2; dashArray[3] = 2; @@ -511,7 +511,7 @@ int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics, return FX_DASHSTYLE_DashDot; } case XFA_ATTRIBUTEENUM_DashDotDot: { - FX_FLOAT dashArray[] = {4, 1, 2, 1, 2, 1}; + float dashArray[] = {4, 1, 2, 1, 2, 1}; if (iCapType != XFA_ATTRIBUTEENUM_Butt) { dashArray[1] = 2; dashArray[3] = 2; @@ -521,7 +521,7 @@ int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics, return FX_DASHSTYLE_DashDotDot; } case XFA_ATTRIBUTEENUM_Dashed: { - FX_FLOAT dashArray[] = {5, 1}; + float dashArray[] = {5, 1}; if (iCapType != XFA_ATTRIBUTEENUM_Butt) { dashArray[1] = 2; } @@ -529,7 +529,7 @@ int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics, return FX_DASHSTYLE_Dash; } case XFA_ATTRIBUTEENUM_Dotted: { - FX_FLOAT dashArray[] = {2, 1}; + float dashArray[] = {2, 1}; if (iCapType != XFA_ATTRIBUTEENUM_Butt) { dashArray[1] = 2; } @@ -849,12 +849,12 @@ void XFA_DrawImage(CFX_Graphics* pGS, CFX_RectF rtFit( rtImage.TopLeft(), - XFA_UnitPx2Pt((FX_FLOAT)pDIBitmap->GetWidth(), (FX_FLOAT)iImageXDpi), - XFA_UnitPx2Pt((FX_FLOAT)pDIBitmap->GetHeight(), (FX_FLOAT)iImageYDpi)); + XFA_UnitPx2Pt((float)pDIBitmap->GetWidth(), (float)iImageXDpi), + XFA_UnitPx2Pt((float)pDIBitmap->GetHeight(), (float)iImageYDpi)); switch (iAspect) { case XFA_ATTRIBUTEENUM_Fit: { - FX_FLOAT f1 = rtImage.height / rtFit.height; - FX_FLOAT f2 = rtImage.width / rtFit.width; + float f1 = rtImage.height / rtFit.height; + float f2 = rtImage.width / rtFit.width; f1 = std::min(f1, f2); rtFit.height = rtFit.height * f1; rtFit.width = rtFit.width * f1; @@ -862,7 +862,7 @@ void XFA_DrawImage(CFX_Graphics* pGS, case XFA_ATTRIBUTEENUM_Actual: break; case XFA_ATTRIBUTEENUM_Height: { - FX_FLOAT f1 = rtImage.height / rtFit.height; + float f1 = rtImage.height / rtFit.height; rtFit.height = rtImage.height; rtFit.width = f1 * rtFit.width; } break; @@ -871,7 +871,7 @@ void XFA_DrawImage(CFX_Graphics* pGS, rtFit.width = rtImage.width; break; case XFA_ATTRIBUTEENUM_Width: { - FX_FLOAT f1 = rtImage.width / rtFit.width; + float f1 = rtImage.width / rtFit.width; rtFit.width = rtImage.width; rtFit.height = rtFit.height * f1; } break; @@ -1137,8 +1137,8 @@ CFX_DIBitmap* XFA_LoadImageFromBuffer( dibAttr.m_nYDPI = (int32_t)(dibAttr.m_nYDPI * 2.54f); break; case FXCODEC_RESUNIT_METER: - dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI / (FX_FLOAT)100 * 2.54f); - dibAttr.m_nYDPI = (int32_t)(dibAttr.m_nYDPI / (FX_FLOAT)100 * 2.54f); + dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI / (float)100 * 2.54f); + dibAttr.m_nYDPI = (int32_t)(dibAttr.m_nYDPI / (float)100 * 2.54f); break; default: break; @@ -1171,7 +1171,7 @@ void XFA_RectWidthoutMargin(CFX_RectF& rt, const CXFA_Margin& mg, bool bUI) { if (!mg) { return; } - FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset; + float fLeftInset, fTopInset, fRightInset, fBottomInset; mg.GetLeftInset(fLeftInset); mg.GetTopInset(fTopInset); mg.GetRightInset(fRightInset); @@ -1191,7 +1191,7 @@ static void XFA_BOX_GetPath_Arc(CXFA_Box box, CFX_RectF rtDraw, CFX_Path& fillPath, uint32_t dwFlags) { - FX_FLOAT a, b; + float a, b; a = rtDraw.width / 2.0f; b = rtDraw.height / 2.0f; if (box.IsCircular() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) { @@ -1202,7 +1202,7 @@ static void XFA_BOX_GetPath_Arc(CXFA_Box box, rtDraw.top = center.y - b; rtDraw.width = a + a; rtDraw.height = b + b; - FX_FLOAT startAngle = 0, sweepAngle = 360; + float startAngle = 0, sweepAngle = 360; bool bStart = box.GetStartAngle(startAngle); bool bEnd = box.GetSweepAngle(sweepAngle); if (!bStart && !bEnd) { @@ -1225,14 +1225,14 @@ static void XFA_BOX_GetPath(CXFA_Box box, int32_t n = (nIndex & 1) ? nIndex - 1 : nIndex; CXFA_Corner corner1(strokes[n].GetNode()); CXFA_Corner corner2(strokes[(n + 2) % 8].GetNode()); - FX_FLOAT fRadius1 = bCorner ? corner1.GetRadius() : 0.0f; - FX_FLOAT fRadius2 = bCorner ? corner2.GetRadius() : 0.0f; + float fRadius1 = bCorner ? corner1.GetRadius() : 0.0f; + float fRadius2 = bCorner ? corner2.GetRadius() : 0.0f; bool bInverted = corner1.IsInverted(); - FX_FLOAT offsetY = 0.0f; - FX_FLOAT offsetX = 0.0f; + float offsetY = 0.0f; + float offsetX = 0.0f; bool bRound = corner1.GetJoinType() == XFA_ATTRIBUTEENUM_Round; - FX_FLOAT halfAfter = 0.0f; - FX_FLOAT halfBefore = 0.0f; + float halfAfter = 0.0f; + float halfBefore = 0.0f; CXFA_Stroke stroke = strokes[nIndex]; if (stroke.IsCorner()) { CXFA_Stroke edgeBefore = strokes[(nIndex + 1 * 8 - 1) % 8]; @@ -1253,14 +1253,14 @@ static void XFA_BOX_GetPath(CXFA_Box box, halfAfter = edgeAfter.GetThickness() / 2; } } - FX_FLOAT offsetEX = 0.0f; - FX_FLOAT offsetEY = 0.0f; - FX_FLOAT sx = 0.0f; - FX_FLOAT sy = 0.0f; - FX_FLOAT vx = 1.0f; - FX_FLOAT vy = 1.0f; - FX_FLOAT nx = 1.0f; - FX_FLOAT ny = 1.0f; + float offsetEX = 0.0f; + float offsetEY = 0.0f; + float sx = 0.0f; + float sy = 0.0f; + float vx = 1.0f; + float vy = 1.0f; + float nx = 1.0f; + float ny = 1.0f; CFX_PointF cpStart; CFX_PointF cp1; CFX_PointF cp2; @@ -1390,11 +1390,11 @@ static void XFA_BOX_GetFillPath(CXFA_Box box, uint16_t dwFlags) { if (box.IsArc() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) { CXFA_Edge edge = box.GetEdge(0); - FX_FLOAT fThickness = edge.GetThickness(); + float fThickness = edge.GetThickness(); if (fThickness < 0) { fThickness = 0; } - FX_FLOAT fHalf = fThickness / 2; + float fHalf = fThickness / 2; int32_t iHand = box.GetHand(); if (iHand == XFA_ATTRIBUTEENUM_Left) { rtWidget.Inflate(fHalf, fHalf); @@ -1442,17 +1442,17 @@ static void XFA_BOX_GetFillPath(CXFA_Box box, } for (int32_t i = 0; i < 8; i += 2) { - FX_FLOAT sx = 0.0f; - FX_FLOAT sy = 0.0f; - FX_FLOAT vx = 1.0f; - FX_FLOAT vy = 1.0f; - FX_FLOAT nx = 1.0f; - FX_FLOAT ny = 1.0f; + float sx = 0.0f; + float sy = 0.0f; + float vx = 1.0f; + float vy = 1.0f; + float nx = 1.0f; + float ny = 1.0f; CFX_PointF cp1, cp2; CXFA_Corner corner1(strokes[i].GetNode()); CXFA_Corner corner2(strokes[(i + 2) % 8].GetNode()); - FX_FLOAT fRadius1 = corner1.GetRadius(); - FX_FLOAT fRadius2 = corner2.GetRadius(); + float fRadius1 = corner1.GetRadius(); + float fRadius2 = corner2.GetRadius(); bool bInverted = corner1.IsInverted(); bool bRound = corner1.GetJoinType() == XFA_ATTRIBUTEENUM_Round; if (bRound) { @@ -1682,7 +1682,7 @@ static void XFA_BOX_StrokePath(CXFA_Stroke stroke, if (!stroke || !stroke.IsVisible()) { return; } - FX_FLOAT fThickness = stroke.GetThickness(); + float fThickness = stroke.GetThickness(); if (fThickness < 0.001f) { return; } @@ -1709,14 +1709,14 @@ static void XFA_BOX_StrokeArc(CXFA_Box box, return; } bool bVisible = false; - FX_FLOAT fThickness = 0; + float fThickness = 0; int32_t i3DType = box.Get3DStyle(bVisible, fThickness); if (i3DType) { if (bVisible && fThickness >= 0.001f) { dwFlags |= XFA_DRAWBOX_Lowered3D; } } - FX_FLOAT fHalf = edge.GetThickness() / 2; + float fHalf = edge.GetThickness() / 2; if (fHalf < 0) { fHalf = 0; } @@ -1739,7 +1739,7 @@ static void XFA_BOX_StrokeArc(CXFA_Box box, pGS->SaveGraphState(); pGS->SetLineWidth(fHalf); - FX_FLOAT a, b; + float a, b; a = rtWidget.width / 2.0f; b = rtWidget.height / 2.0f; if (dwFlags & XFA_DRAWBOX_ForceRound) { @@ -1753,7 +1753,7 @@ static void XFA_BOX_StrokeArc(CXFA_Box box, rtWidget.width = a + a; rtWidget.height = b + b; - FX_FLOAT startAngle = 0, sweepAngle = 360; + float startAngle = 0, sweepAngle = 360; startAngle = startAngle * FX_PI / 180.0f; sweepAngle = -sweepAngle * FX_PI / 180.0f; @@ -1790,14 +1790,14 @@ static void XFA_BOX_StrokeArc(CXFA_Box box, } static void XFA_Draw3DRect(CFX_Graphics* pGraphic, const CFX_RectF& rt, - FX_FLOAT fLineWidth, + float fLineWidth, CFX_Matrix* pMatrix, FX_ARGB argbTopLeft, FX_ARGB argbBottomRight) { CFX_Color crLT(argbTopLeft); pGraphic->SetFillColor(&crLT); - FX_FLOAT fBottom = rt.bottom(); - FX_FLOAT fRight = rt.right(); + float fBottom = rt.bottom(); + float fRight = rt.right(); CFX_Path pathLT; pathLT.MoveTo(CFX_PointF(rt.left, fBottom)); pathLT.LineTo(CFX_PointF(rt.left, rt.top)); @@ -1823,9 +1823,9 @@ static void XFA_Draw3DRect(CFX_Graphics* pGraphic, } static void XFA_BOX_Stroke_3DRect_Lowered(CFX_Graphics* pGS, CFX_RectF rt, - FX_FLOAT fThickness, + float fThickness, CFX_Matrix* pMatrix) { - FX_FLOAT fHalfWidth = fThickness / 2.0f; + float fHalfWidth = fThickness / 2.0f; CFX_RectF rtInner(rt); rtInner.Deflate(fHalfWidth, fHalfWidth); CFX_Color cr(0xFF000000); @@ -1838,9 +1838,9 @@ static void XFA_BOX_Stroke_3DRect_Lowered(CFX_Graphics* pGS, } static void XFA_BOX_Stroke_3DRect_Raised(CFX_Graphics* pGS, CFX_RectF rt, - FX_FLOAT fThickness, + float fThickness, CFX_Matrix* pMatrix) { - FX_FLOAT fHalfWidth = fThickness / 2.0f; + float fHalfWidth = fThickness / 2.0f; CFX_RectF rtInner(rt); rtInner.Deflate(fHalfWidth, fHalfWidth); CFX_Color cr(0xFF000000); @@ -1853,9 +1853,9 @@ static void XFA_BOX_Stroke_3DRect_Raised(CFX_Graphics* pGS, } static void XFA_BOX_Stroke_3DRect_Etched(CFX_Graphics* pGS, CFX_RectF rt, - FX_FLOAT fThickness, + float fThickness, CFX_Matrix* pMatrix) { - FX_FLOAT fHalfWidth = fThickness / 2.0f; + float fHalfWidth = fThickness / 2.0f; XFA_Draw3DRect(pGS, rt, fThickness, pMatrix, 0xFF808080, 0xFFFFFFFF); CFX_RectF rtInner(rt); rtInner.Deflate(fHalfWidth, fHalfWidth); @@ -1863,9 +1863,9 @@ static void XFA_BOX_Stroke_3DRect_Etched(CFX_Graphics* pGS, } static void XFA_BOX_Stroke_3DRect_Embossed(CFX_Graphics* pGS, CFX_RectF rt, - FX_FLOAT fThickness, + float fThickness, CFX_Matrix* pMatrix) { - FX_FLOAT fHalfWidth = fThickness / 2.0f; + float fHalfWidth = fThickness / 2.0f; XFA_Draw3DRect(pGS, rt, fThickness, pMatrix, 0xFF808080, 0xFF000000); CFX_RectF rtInner(rt); rtInner.Deflate(fHalfWidth, fHalfWidth); @@ -1877,7 +1877,7 @@ static void XFA_BOX_Stroke_Rect(CXFA_Box box, CFX_RectF rtWidget, CFX_Matrix* pMatrix) { bool bVisible = false; - FX_FLOAT fThickness = 0; + float fThickness = 0; int32_t i3DType = box.Get3DStyle(bVisible, fThickness); if (i3DType) { if (!bVisible || fThickness < 0.001f) { @@ -1981,11 +1981,11 @@ static void XFA_BOX_Stroke(CXFA_Box box, } for (int32_t i = 1; i < 8; i += 2) { CXFA_Edge edge(strokes[i].GetNode()); - FX_FLOAT fThickness = edge.GetThickness(); + float fThickness = edge.GetThickness(); if (fThickness < 0) { fThickness = 0; } - FX_FLOAT fHalf = fThickness / 2; + float fHalf = fThickness / 2; int32_t iHand = box.GetHand(); switch (i) { case 1: diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 655c9da511..52c11508aa 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -45,7 +45,7 @@ class CXFA_WidgetLayoutData { CXFA_WidgetLayoutData() : m_fWidgetHeight(-1) {} virtual ~CXFA_WidgetLayoutData() {} - FX_FLOAT m_fWidgetHeight; + float m_fWidgetHeight; }; class CXFA_TextLayoutData : public CXFA_WidgetLayoutData { @@ -128,7 +128,7 @@ class CXFA_FieldLayoutData : public CXFA_WidgetLayoutData { std::unique_ptr<CXFA_TextLayout> m_pCapTextLayout; std::unique_ptr<CXFA_TextProvider> m_pCapTextProvider; std::unique_ptr<CFDE_TextOut> m_pTextOut; - std::vector<FX_FLOAT> m_FieldSplitArray; + std::vector<float> m_FieldSplitArray; }; class CXFA_TextEditData : public CXFA_FieldLayoutData { @@ -718,7 +718,7 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { LoadCaption(); XFA_Element eUIType = GetUIType(); int32_t iCapPlacement = caption.GetPlacementType(); - FX_FLOAT fCapReserve = caption.GetReserve(); + float fCapReserve = caption.GetReserve(); const bool bVert = iCapPlacement == XFA_ATTRIBUTEENUM_Top || iCapPlacement == XFA_ATTRIBUTEENUM_Bottom; const bool bReserveExit = fCapReserve > 0.01; @@ -735,7 +735,7 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { bVert ? szCap.height = fCapReserve : szCap.width = fCapReserve; } } else { - FX_FLOAT fFontSize = 10.0f; + float fFontSize = 10.0f; if (CXFA_Font font = caption.GetFont()) { fFontSize = font.GetFontSize(); } else if (CXFA_Font widgetfont = GetFont()) { @@ -749,7 +749,7 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { } } if (CXFA_Margin mgCap = caption.GetMargin()) { - FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset; + float fLeftInset, fTopInset, fRightInset, fBottomInset; mgCap.GetLeftInset(fLeftInset); mgCap.GetTopInset(fTopInset); mgCap.GetRightInset(fRightInset); @@ -792,7 +792,7 @@ bool CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) { bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { CXFA_Margin mgWidget = GetMargin(); if (mgWidget) { - FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset; + float fLeftInset, fTopInset, fRightInset, fBottomInset; mgWidget.GetLeftInset(fLeftInset); mgWidget.GetTopInset(fTopInset); mgWidget.GetRightInset(fRightInset); @@ -804,9 +804,9 @@ bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { if (para) size.width += para.GetMarginLeft() + para.GetTextIndent(); - FX_FLOAT fVal = 0; - FX_FLOAT fMin = 0; - FX_FLOAT fMax = 0; + float fVal = 0; + float fMin = 0; + float fMax = 0; if (GetWidth(fVal)) { size.width = fVal; } else { @@ -830,7 +830,7 @@ bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { } void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) { - FX_FLOAT fFontSize = GetFontSize(); + float fFontSize = GetFontSize(); CFX_WideString wsText; GetValue(wsText, XFA_VALUEPICTURE_Display); if (wsText.IsEmpty()) { @@ -885,7 +885,7 @@ bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { size.width -= rtUIMargin.left + rtUIMargin.width; CXFA_Margin mgWidget = GetMargin(); if (mgWidget) { - FX_FLOAT fLeftInset, fRightInset; + float fLeftInset, fRightInset; mgWidget.GetLeftInset(fLeftInset); mgWidget.GetRightInset(fRightInset); size.width -= fLeftInset + fRightInset; @@ -914,7 +914,7 @@ bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { return CalculateFieldAutoSize(size); } bool CXFA_WidgetAcc::CalculateCheckButtonAutoSize(CFX_SizeF& size) { - FX_FLOAT fCheckSize = GetCheckButtonSize(); + float fCheckSize = GetCheckButtonSize(); size = CFX_SizeF(fCheckSize, fCheckSize); return CalculateFieldAutoSize(size); } @@ -932,9 +932,8 @@ bool CXFA_WidgetAcc::CalculateImageAutoSize(CFX_SizeF& size) { int32_t iImageYDpi = 0; GetImageDpi(iImageXDpi, iImageYDpi); CFX_RectF rtImage( - 0, 0, - XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetWidth(), (FX_FLOAT)iImageXDpi), - XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetHeight(), (FX_FLOAT)iImageYDpi)); + 0, 0, XFA_UnitPx2Pt((float)pBitmap->GetWidth(), (float)iImageXDpi), + XFA_UnitPx2Pt((float)pBitmap->GetHeight(), (float)iImageYDpi)); CFX_RectF rtFit; if (GetWidth(rtFit.width)) { @@ -961,9 +960,8 @@ bool CXFA_WidgetAcc::CalculateImageEditAutoSize(CFX_SizeF& size) { int32_t iImageYDpi = 0; GetImageEditDpi(iImageXDpi, iImageYDpi); CFX_RectF rtImage( - 0, 0, - XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetWidth(), (FX_FLOAT)iImageXDpi), - XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetHeight(), (FX_FLOAT)iImageYDpi)); + 0, 0, XFA_UnitPx2Pt((float)pBitmap->GetWidth(), (float)iImageXDpi), + XFA_UnitPx2Pt((float)pBitmap->GetHeight(), (float)iImageYDpi)); CFX_RectF rtFit; if (GetWidth(rtFit.width)) { @@ -1017,15 +1015,15 @@ void CXFA_WidgetAcc::LoadText() { InitLayoutData(); static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->LoadText(this); } -FX_FLOAT CXFA_WidgetAcc::CalculateWidgetAutoWidth(FX_FLOAT fWidthCalc) { +float CXFA_WidgetAcc::CalculateWidgetAutoWidth(float fWidthCalc) { CXFA_Margin mgWidget = GetMargin(); if (mgWidget) { - FX_FLOAT fLeftInset, fRightInset; + float fLeftInset, fRightInset; mgWidget.GetLeftInset(fLeftInset); mgWidget.GetRightInset(fRightInset); fWidthCalc += fLeftInset + fRightInset; } - FX_FLOAT fMin = 0, fMax = 0; + float fMin = 0, fMax = 0; if (GetMinWidth(fMin)) { fWidthCalc = std::max(fWidthCalc, fMin); } @@ -1034,25 +1032,25 @@ FX_FLOAT CXFA_WidgetAcc::CalculateWidgetAutoWidth(FX_FLOAT fWidthCalc) { } return fWidthCalc; } -FX_FLOAT CXFA_WidgetAcc::GetWidthWithoutMargin(FX_FLOAT fWidthCalc) { +float CXFA_WidgetAcc::GetWidthWithoutMargin(float fWidthCalc) { CXFA_Margin mgWidget = GetMargin(); if (mgWidget) { - FX_FLOAT fLeftInset, fRightInset; + float fLeftInset, fRightInset; mgWidget.GetLeftInset(fLeftInset); mgWidget.GetRightInset(fRightInset); fWidthCalc -= fLeftInset + fRightInset; } return fWidthCalc; } -FX_FLOAT CXFA_WidgetAcc::CalculateWidgetAutoHeight(FX_FLOAT fHeightCalc) { +float CXFA_WidgetAcc::CalculateWidgetAutoHeight(float fHeightCalc) { CXFA_Margin mgWidget = GetMargin(); if (mgWidget) { - FX_FLOAT fTopInset, fBottomInset; + float fTopInset, fBottomInset; mgWidget.GetTopInset(fTopInset); mgWidget.GetBottomInset(fBottomInset); fHeightCalc += fTopInset + fBottomInset; } - FX_FLOAT fMin = 0, fMax = 0; + float fMin = 0, fMax = 0; if (GetMinHeight(fMin)) { fHeightCalc = std::max(fHeightCalc, fMin); } @@ -1061,18 +1059,17 @@ FX_FLOAT CXFA_WidgetAcc::CalculateWidgetAutoHeight(FX_FLOAT fHeightCalc) { } return fHeightCalc; } -FX_FLOAT CXFA_WidgetAcc::GetHeightWithoutMargin(FX_FLOAT fHeightCalc) { +float CXFA_WidgetAcc::GetHeightWithoutMargin(float fHeightCalc) { CXFA_Margin mgWidget = GetMargin(); if (mgWidget) { - FX_FLOAT fTopInset, fBottomInset; + float fTopInset, fBottomInset; mgWidget.GetTopInset(fTopInset); mgWidget.GetBottomInset(fBottomInset); fHeightCalc -= fTopInset + fBottomInset; } return fHeightCalc; } -void CXFA_WidgetAcc::StartWidgetLayout(FX_FLOAT& fCalcWidth, - FX_FLOAT& fCalcHeight) { +void CXFA_WidgetAcc::StartWidgetLayout(float& fCalcWidth, float& fCalcHeight) { InitLayoutData(); XFA_Element eUIType = GetUIType(); if (eUIType == XFA_Element::Text) { @@ -1085,7 +1082,7 @@ void CXFA_WidgetAcc::StartWidgetLayout(FX_FLOAT& fCalcWidth, return; } m_pLayoutData->m_fWidgetHeight = -1; - FX_FLOAT fWidth = 0; + float fWidth = 0; if (fCalcWidth > 0 && fCalcHeight < 0) { if (!GetHeight(fCalcHeight)) { CalculateAccWidthAndHeight(eUIType, fCalcWidth, fCalcHeight); @@ -1102,8 +1099,8 @@ void CXFA_WidgetAcc::StartWidgetLayout(FX_FLOAT& fCalcWidth, m_pLayoutData->m_fWidgetHeight = fCalcHeight; } void CXFA_WidgetAcc::CalculateAccWidthAndHeight(XFA_Element eUIType, - FX_FLOAT& fWidth, - FX_FLOAT& fCalcHeight) { + float& fWidth, + float& fCalcHeight) { CFX_SizeF sz(fWidth, m_pLayoutData->m_fWidgetHeight); switch (eUIType) { case XFA_Element::Barcode: @@ -1143,7 +1140,7 @@ void CXFA_WidgetAcc::CalculateAccWidthAndHeight(XFA_Element eUIType, m_pLayoutData->m_fWidgetHeight = sz.height; fCalcHeight = sz.height; } -bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight) { +bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, float& fCalcHeight) { XFA_Element eUIType = GetUIType(); if (eUIType == XFA_Element::Subform) { return false; @@ -1154,8 +1151,8 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight) { fCalcHeight = 0; return true; } - FX_FLOAT fTopInset = 0; - FX_FLOAT fBottomInset = 0; + float fTopInset = 0; + float fBottomInset = 0; if (iBlockIndex == 0) { CXFA_Margin mgWidget = GetMargin(); if (mgWidget) { @@ -1167,7 +1164,7 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight) { fBottomInset += rtUIMargin.width; } if (eUIType == XFA_Element::Text) { - FX_FLOAT fHeight = fCalcHeight; + float fHeight = fCalcHeight; if (iBlockIndex == 0) { fCalcHeight = fCalcHeight - fTopInset; if (fCalcHeight < 0) { @@ -1189,7 +1186,7 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight) { return true; } XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; - FX_FLOAT fCapReserve = 0; + float fCapReserve = 0; if (iBlockIndex == 0) { CXFA_Caption caption = GetCaption(); if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { @@ -1213,20 +1210,20 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight) { CXFA_FieldLayoutData* pFieldData = static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get()); int32_t iLinesCount = 0; - FX_FLOAT fHeight = m_pLayoutData->m_fWidgetHeight; + float fHeight = m_pLayoutData->m_fWidgetHeight; CFX_WideString wsText; GetValue(wsText, XFA_VALUEPICTURE_Display); if (wsText.IsEmpty()) { iLinesCount = 1; } else { if (!pFieldData->m_pTextOut) { - FX_FLOAT fWidth = 0; + float fWidth = 0; GetWidth(fWidth); CalculateAccWidthAndHeight(eUIType, fWidth, fHeight); } iLinesCount = pFieldData->m_pTextOut->GetTotalLines(); } - std::vector<FX_FLOAT>* pFieldArray = &pFieldData->m_FieldSplitArray; + std::vector<float>* pFieldArray = &pFieldData->m_FieldSplitArray; int32_t iFieldSplitCount = pdfium::CollectionSize<int32_t>(*pFieldArray); for (int32_t i = 0; i < iBlockIndex * 3; i += 3) { iLinesCount -= (int32_t)(*pFieldArray)[i + 1]; @@ -1235,17 +1232,17 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight) { if (iLinesCount == 0) { return false; } - FX_FLOAT fLineHeight = GetLineHeight(); - FX_FLOAT fFontSize = GetFontSize(); - FX_FLOAT fTextHeight = iLinesCount * fLineHeight - fLineHeight + fFontSize; - FX_FLOAT fSpaceAbove = 0; - FX_FLOAT fStartOffset = 0; + float fLineHeight = GetLineHeight(); + float fFontSize = GetFontSize(); + float fTextHeight = iLinesCount * fLineHeight - fLineHeight + fFontSize; + float fSpaceAbove = 0; + float fStartOffset = 0; if (fHeight > 0.1f && iBlockIndex == 0) { fStartOffset = fTopInset; fHeight -= (fTopInset + fBottomInset); if (CXFA_Para para = GetPara()) { fSpaceAbove = para.GetSpaceAbove(); - FX_FLOAT fSpaceBelow = para.GetSpaceBelow(); + float fSpaceBelow = para.GetSpaceBelow(); fHeight -= (fSpaceAbove + fSpaceBelow); switch (para.GetVerticalAlign()) { case XFA_ATTRIBUTEENUM_Top: @@ -1322,17 +1319,17 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight) { } return true; } - FX_FLOAT fTextNum = + float fTextNum = fCalcHeight + XFA_FLOAT_PERCISION - fCapReserve - fStartOffset; int32_t iLineNum = (int32_t)((fTextNum + (fLineHeight - fFontSize)) / fLineHeight); if (iLineNum >= iLinesCount) { if (fCalcHeight - fStartOffset - fTextHeight >= fFontSize) { if (iFieldSplitCount / 3 == (iBlockIndex + 1)) { - (*pFieldArray)[iBlockIndex * 3 + 1] = (FX_FLOAT)iLinesCount; + (*pFieldArray)[iBlockIndex * 3 + 1] = (float)iLinesCount; (*pFieldArray)[iBlockIndex * 3 + 2] = fCalcHeight; } else { - pFieldArray->push_back((FX_FLOAT)iLinesCount); + pFieldArray->push_back((float)iLinesCount); pFieldArray->push_back(fCalcHeight); } return false; @@ -1348,13 +1345,12 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight) { } } if (iLineNum > 0) { - FX_FLOAT fSplitHeight = - iLineNum * fLineHeight + fCapReserve + fStartOffset; + float fSplitHeight = iLineNum * fLineHeight + fCapReserve + fStartOffset; if (iFieldSplitCount / 3 == (iBlockIndex + 1)) { - (*pFieldArray)[iBlockIndex * 3 + 1] = (FX_FLOAT)iLineNum; + (*pFieldArray)[iBlockIndex * 3 + 1] = (float)iLineNum; (*pFieldArray)[iBlockIndex * 3 + 2] = fSplitHeight; } else { - pFieldArray->push_back((FX_FLOAT)iLineNum); + pFieldArray->push_back((float)iLineNum); pFieldArray->push_back(fSplitHeight); } if (fabs(fSplitHeight - fCalcHeight) < XFA_FLOAT_PERCISION) { @@ -1394,14 +1390,13 @@ void CXFA_WidgetAcc::InitLayoutData() { m_pLayoutData = pdfium::MakeUnique<CXFA_WidgetLayoutData>(); } -void CXFA_WidgetAcc::StartTextLayout(FX_FLOAT& fCalcWidth, - FX_FLOAT& fCalcHeight) { +void CXFA_WidgetAcc::StartTextLayout(float& fCalcWidth, float& fCalcHeight) { LoadText(); CXFA_TextLayout* pTextLayout = static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout(); - FX_FLOAT fTextHeight = 0; + float fTextHeight = 0; if (fCalcWidth > 0 && fCalcHeight > 0) { - FX_FLOAT fWidth = GetWidthWithoutMargin(fCalcWidth); + float fWidth = GetWidthWithoutMargin(fCalcWidth); pTextLayout->StartLayout(fWidth); fTextHeight = fCalcHeight; fTextHeight = GetHeightWithoutMargin(fTextHeight); @@ -1409,17 +1404,17 @@ void CXFA_WidgetAcc::StartTextLayout(FX_FLOAT& fCalcWidth, return; } if (fCalcWidth > 0 && fCalcHeight < 0) { - FX_FLOAT fWidth = GetWidthWithoutMargin(fCalcWidth); + float fWidth = GetWidthWithoutMargin(fCalcWidth); pTextLayout->StartLayout(fWidth); } if (fCalcWidth < 0 && fCalcHeight < 0) { - FX_FLOAT fMaxWidth = -1; + float fMaxWidth = -1; bool bRet = GetWidth(fMaxWidth); if (bRet) { - FX_FLOAT fWidth = GetWidthWithoutMargin(fMaxWidth); + float fWidth = GetWidthWithoutMargin(fMaxWidth); pTextLayout->StartLayout(fWidth); } else { - FX_FLOAT fWidth = pTextLayout->StartLayout(fMaxWidth); + float fWidth = pTextLayout->StartLayout(fMaxWidth); fMaxWidth = CalculateWidgetAutoWidth(fWidth); fWidth = GetWidthWithoutMargin(fMaxWidth); pTextLayout->StartLayout(fWidth); @@ -1509,15 +1504,15 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_WidgetAcc::GetFDEFont() { return pDoc->GetApp()->GetXFAFontMgr()->GetFont(pDoc, wsFontName, dwFontStyle); } -FX_FLOAT CXFA_WidgetAcc::GetFontSize() { - FX_FLOAT fFontSize = 10.0f; +float CXFA_WidgetAcc::GetFontSize() { + float fFontSize = 10.0f; if (CXFA_Font font = GetFont()) { fFontSize = font.GetFontSize(); } return fFontSize < 0.1f ? 10.0f : fFontSize; } -FX_FLOAT CXFA_WidgetAcc::GetLineHeight() { - FX_FLOAT fLineHeight = 0; +float CXFA_WidgetAcc::GetLineHeight() { + float fLineHeight = 0; if (CXFA_Para para = GetPara()) { fLineHeight = para.GetLineHeight(); } @@ -1636,7 +1631,7 @@ CXFA_Font CXFA_TextProvider::GetFontNode() { bool CXFA_TextProvider::IsCheckButtonAndAutoWidth() { XFA_Element eType = m_pWidgetAcc->GetUIType(); if (eType == XFA_Element::CheckButton) { - FX_FLOAT fWidth = 0; + float fWidth = 0; return !m_pWidgetAcc->GetWidth(fWidth); } return false; diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp index 2fddfb6156..dc3850c778 100644 --- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp +++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp @@ -499,7 +499,7 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateFontNode(CXFA_Node* pParent) const { CXFA_Node* CXFA_FFWidgetHandler::CreateMarginNode(CXFA_Node* pParent, uint32_t dwFlags, - FX_FLOAT fInsets[4]) const { + float fInsets[4]) const { CXFA_Node* pMargin = CreateCopyNode(XFA_Element::Margin, pParent); if (dwFlags & 0x01) pMargin->SetMeasure(XFA_ATTRIBUTE_LeftInset, diff --git a/xfa/fxfa/app/xfa_fwladapter.cpp b/xfa/fxfa/app/xfa_fwladapter.cpp index e1f3e202ed..af578fcf8f 100644 --- a/xfa/fxfa/app/xfa_fwladapter.cpp +++ b/xfa/fxfa/app/xfa_fwladapter.cpp @@ -25,8 +25,8 @@ void CXFA_FWLAdapterWidgetMgr::RepaintWidget(CFWL_Widget* pWidget) { } bool CXFA_FWLAdapterWidgetMgr::GetPopupPos(CFWL_Widget* pWidget, - FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, + float fMinHeight, + float fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) { CXFA_FFWidget* pFFWidget = pWidget->GetLayoutItem(); diff --git a/xfa/fxfa/app/xfa_fwladapter.h b/xfa/fxfa/app/xfa_fwladapter.h index c68fb7015f..b4a3481588 100644 --- a/xfa/fxfa/app/xfa_fwladapter.h +++ b/xfa/fxfa/app/xfa_fwladapter.h @@ -19,8 +19,8 @@ class CXFA_FWLAdapterWidgetMgr { void RepaintWidget(CFWL_Widget* pWidget); bool GetPopupPos(CFWL_Widget* pWidget, - FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, + float fMinHeight, + float fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup); }; diff --git a/xfa/fxfa/app/xfa_textpiece.h b/xfa/fxfa/app/xfa_textpiece.h index 6802df5566..fd1f3bdbaa 100644 --- a/xfa/fxfa/app/xfa_textpiece.h +++ b/xfa/fxfa/app/xfa_textpiece.h @@ -32,7 +32,7 @@ class XFA_TextPiece { int32_t iPeriod; int32_t iLineThrough; FX_ARGB dwColor; - FX_FLOAT fFontSize; + float fFontSize; CFX_RectF rtPiece; CFX_RetainPtr<CFGAS_GEFont> pFont; CFX_RetainPtr<CXFA_LinkUserData> pLinkData; diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 3ecea1643c..2ee687d326 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -914,7 +914,7 @@ void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, static_cast<uint8_t>(std::min(std::max(dPrecision, 0.0), 12.0)); } - CFX_Decimal decimalValue((FX_FLOAT)dValue, uPrecision); + CFX_Decimal decimalValue((float)dValue, uPrecision); CFX_WideString wsValue = decimalValue; args.GetReturnValue()->SetString(wsValue.UTF8Encode().AsStringC()); } @@ -1465,7 +1465,7 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, args.GetReturnValue()->SetNull(); return; } - FX_FLOAT fTime = ValueToFloat(pThis, timeValue.get()); + float fTime = ValueToFloat(pThis, timeValue.get()); if (FXSYS_fabs(fTime) < 1.0) { args.GetReturnValue()->SetNull(); return; @@ -2134,7 +2134,7 @@ int32_t CXFA_FM2JSContext::DateString2Num(const CFX_ByteStringC& szDateString) { } } - FX_FLOAT dDays = 0; + float dDays = 0; int32_t i = 1; if (iYear < 1900) return 0; @@ -2407,17 +2407,17 @@ void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis, return; } - FX_FLOAT nRate = ValueToFloat(pThis, argOne.get()); - FX_FLOAT nFutureValue = ValueToFloat(pThis, argTwo.get()); - FX_FLOAT nInitAmount = ValueToFloat(pThis, argThree.get()); + float nRate = ValueToFloat(pThis, argOne.get()); + float nFutureValue = ValueToFloat(pThis, argTwo.get()); + float nInitAmount = ValueToFloat(pThis, argThree.get()); if ((nRate <= 0) || (nFutureValue <= 0) || (nInitAmount <= 0)) { pContext->ThrowArgumentMismatchException(); return; } args.GetReturnValue()->SetFloat( - FXSYS_log((FX_FLOAT)(nFutureValue / nInitAmount)) / - FXSYS_log((FX_FLOAT)(1 + nRate))); + FXSYS_log((float)(nFutureValue / nInitAmount)) / + FXSYS_log((float)(1 + nRate))); } // static @@ -2483,22 +2483,22 @@ void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, return; } - FX_FLOAT nPrincipalAmount = ValueToFloat(pThis, argOne.get()); - FX_FLOAT nRate = ValueToFloat(pThis, argTwo.get()); - FX_FLOAT nPayment = ValueToFloat(pThis, argThree.get()); - FX_FLOAT nFirstMonth = ValueToFloat(pThis, argFour.get()); - FX_FLOAT nNumberOfMonths = ValueToFloat(pThis, argFive.get()); + float nPrincipalAmount = ValueToFloat(pThis, argOne.get()); + float nRate = ValueToFloat(pThis, argTwo.get()); + float nPayment = ValueToFloat(pThis, argThree.get()); + float nFirstMonth = ValueToFloat(pThis, argFour.get()); + float nNumberOfMonths = ValueToFloat(pThis, argFive.get()); if ((nPrincipalAmount <= 0) || (nRate <= 0) || (nPayment <= 0) || (nFirstMonth < 0) || (nNumberOfMonths < 0)) { pContext->ThrowArgumentMismatchException(); return; } - FX_FLOAT nRateOfMonth = nRate / 12; + float nRateOfMonth = nRate / 12; int32_t iNums = (int32_t)( - (FXSYS_log10((FX_FLOAT)(nPayment / nPrincipalAmount)) - - FXSYS_log10((FX_FLOAT)(nPayment / nPrincipalAmount - nRateOfMonth))) / - FXSYS_log10((FX_FLOAT)(1 + nRateOfMonth))); + (FXSYS_log10((float)(nPayment / nPrincipalAmount)) - + FXSYS_log10((float)(nPayment / nPrincipalAmount - nRateOfMonth))) / + FXSYS_log10((float)(1 + nRateOfMonth))); int32_t iEnd = std::min((int32_t)(nFirstMonth + nNumberOfMonths - 1), iNums); if (nPayment < nPrincipalAmount * nRateOfMonth) { @@ -2510,7 +2510,7 @@ void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, for (i = 0; i < nFirstMonth - 1; ++i) nPrincipalAmount -= nPayment - nPrincipalAmount * nRateOfMonth; - FX_FLOAT nSum = 0; + float nSum = 0; for (; i < iEnd; ++i) { nSum += nPrincipalAmount * nRateOfMonth; nPrincipalAmount -= nPayment - nPrincipalAmount * nRateOfMonth; @@ -2580,16 +2580,16 @@ void CXFA_FM2JSContext::Pmt(CFXJSE_Value* pThis, return; } - FX_FLOAT nPrincipal = ValueToFloat(pThis, argOne.get()); - FX_FLOAT nRate = ValueToFloat(pThis, argTwo.get()); - FX_FLOAT nPeriods = ValueToFloat(pThis, argThree.get()); + float nPrincipal = ValueToFloat(pThis, argOne.get()); + float nRate = ValueToFloat(pThis, argTwo.get()); + float nPeriods = ValueToFloat(pThis, argThree.get()); if ((nPrincipal <= 0) || (nRate <= 0) || (nPeriods <= 0)) { pContext->ThrowArgumentMismatchException(); return; } - FX_FLOAT nTmp = 1 + nRate; - FX_FLOAT nSum = nTmp; + float nTmp = 1 + nRate; + float nSum = nTmp; for (int32_t i = 0; i < nPeriods - 1; ++i) nSum *= nTmp; @@ -2618,22 +2618,22 @@ void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis, return; } - FX_FLOAT nPrincipalAmount = ValueToFloat(pThis, argOne.get()); - FX_FLOAT nRate = ValueToFloat(pThis, argTwo.get()); - FX_FLOAT nPayment = ValueToFloat(pThis, argThree.get()); - FX_FLOAT nFirstMonth = ValueToFloat(pThis, argFour.get()); - FX_FLOAT nNumberOfMonths = ValueToFloat(pThis, argFive.get()); + float nPrincipalAmount = ValueToFloat(pThis, argOne.get()); + float nRate = ValueToFloat(pThis, argTwo.get()); + float nPayment = ValueToFloat(pThis, argThree.get()); + float nFirstMonth = ValueToFloat(pThis, argFour.get()); + float nNumberOfMonths = ValueToFloat(pThis, argFive.get()); if ((nPrincipalAmount <= 0) || (nRate <= 0) || (nPayment <= 0) || (nFirstMonth < 0) || (nNumberOfMonths < 0)) { pContext->ThrowArgumentMismatchException(); return; } - FX_FLOAT nRateOfMonth = nRate / 12; + float nRateOfMonth = nRate / 12; int32_t iNums = (int32_t)( - (FXSYS_log10((FX_FLOAT)(nPayment / nPrincipalAmount)) - - FXSYS_log10((FX_FLOAT)(nPayment / nPrincipalAmount - nRateOfMonth))) / - FXSYS_log10((FX_FLOAT)(1 + nRateOfMonth))); + (FXSYS_log10((float)(nPayment / nPrincipalAmount)) - + FXSYS_log10((float)(nPayment / nPrincipalAmount - nRateOfMonth))) / + FXSYS_log10((float)(1 + nRateOfMonth))); int32_t iEnd = std::min((int32_t)(nFirstMonth + nNumberOfMonths - 1), iNums); if (nPayment < nPrincipalAmount * nRateOfMonth) { pContext->ThrowArgumentMismatchException(); @@ -2644,8 +2644,8 @@ void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis, for (i = 0; i < nFirstMonth - 1; ++i) nPrincipalAmount -= nPayment - nPrincipalAmount * nRateOfMonth; - FX_FLOAT nTemp = 0; - FX_FLOAT nSum = 0; + float nTemp = 0; + float nSum = 0; for (; i < iEnd; ++i) { nTemp = nPayment - nPrincipalAmount * nRateOfMonth; nSum += nTemp; @@ -2708,17 +2708,16 @@ void CXFA_FM2JSContext::Rate(CFXJSE_Value* pThis, return; } - FX_FLOAT nFuture = ValueToFloat(pThis, argOne.get()); - FX_FLOAT nPresent = ValueToFloat(pThis, argTwo.get()); - FX_FLOAT nTotalNumber = ValueToFloat(pThis, argThree.get()); + float nFuture = ValueToFloat(pThis, argOne.get()); + float nPresent = ValueToFloat(pThis, argTwo.get()); + float nTotalNumber = ValueToFloat(pThis, argThree.get()); if ((nFuture <= 0) || (nPresent < 0) || (nTotalNumber <= 0)) { pContext->ThrowArgumentMismatchException(); return; } args.GetReturnValue()->SetFloat( - FXSYS_pow((FX_FLOAT)(nFuture / nPresent), (FX_FLOAT)(1 / nTotalNumber)) - - 1); + FXSYS_pow((float)(nFuture / nPresent), (float)(1 / nTotalNumber)) - 1); } // static @@ -2740,17 +2739,17 @@ void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis, return; } - FX_FLOAT nMount = ValueToFloat(pThis, argOne.get()); - FX_FLOAT nRate = ValueToFloat(pThis, argTwo.get()); - FX_FLOAT nFuture = ValueToFloat(pThis, argThree.get()); + float nMount = ValueToFloat(pThis, argOne.get()); + float nRate = ValueToFloat(pThis, argTwo.get()); + float nFuture = ValueToFloat(pThis, argThree.get()); if ((nMount <= 0) || (nRate <= 0) || (nFuture <= 0)) { pContext->ThrowArgumentMismatchException(); return; } args.GetReturnValue()->SetFloat( - FXSYS_log((FX_FLOAT)(nFuture / nMount * nRate) + 1) / - FXSYS_log((FX_FLOAT)(1 + nRate))); + FXSYS_log((float)(nFuture / nMount * nRate) + 1) / + FXSYS_log((float)(1 + nRate))); } // static @@ -2897,9 +2896,9 @@ void CXFA_FM2JSContext::Within(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argLow = GetSimpleValue(pThis, args, 1); std::unique_ptr<CFXJSE_Value> argHigh = GetSimpleValue(pThis, args, 2); if (argOne->IsNumber()) { - FX_FLOAT oneNumber = ValueToFloat(pThis, argOne.get()); - FX_FLOAT lowNumber = ValueToFloat(pThis, argLow.get()); - FX_FLOAT heightNumber = ValueToFloat(pThis, argHigh.get()); + float oneNumber = ValueToFloat(pThis, argOne.get()); + float lowNumber = ValueToFloat(pThis, argLow.get()); + float heightNumber = ValueToFloat(pThis, argHigh.get()); args.GetReturnValue()->SetInteger((oneNumber >= lowNumber) && (oneNumber <= heightNumber)); return; @@ -4373,7 +4372,7 @@ void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, args.GetReturnValue()->SetNull(); return; } - FX_FLOAT fNumber = ValueToFloat(pThis, numberValue.get()); + float fNumber = ValueToFloat(pThis, numberValue.get()); int32_t iWidth = 10; if (argc > 1) { @@ -4640,7 +4639,7 @@ void CXFA_FM2JSContext::WordNum(CFXJSE_Value* pThis, args.GetReturnValue()->SetNull(); return; } - FX_FLOAT fNumber = ValueToFloat(pThis, numberValue.get()); + float fNumber = ValueToFloat(pThis, numberValue.get()); int32_t iIdentifier = 0; if (argc > 1) { @@ -5019,8 +5018,8 @@ void CXFA_FM2JSContext::logical_or_operator(CFXJSE_Value* pThis, return; } - FX_FLOAT first = ValueToFloat(pThis, argFirst.get()); - FX_FLOAT second = ValueToFloat(pThis, argSecond.get()); + float first = ValueToFloat(pThis, argFirst.get()); + float second = ValueToFloat(pThis, argSecond.get()); args.GetReturnValue()->SetInteger((first || second) ? 1 : 0); } @@ -5040,8 +5039,8 @@ void CXFA_FM2JSContext::logical_and_operator(CFXJSE_Value* pThis, return; } - FX_FLOAT first = ValueToFloat(pThis, argFirst.get()); - FX_FLOAT second = ValueToFloat(pThis, argSecond.get()); + float first = ValueToFloat(pThis, argFirst.get()); + float second = ValueToFloat(pThis, argSecond.get()); args.GetReturnValue()->SetInteger((first && second) ? 1 : 0); } @@ -5946,8 +5945,8 @@ bool CXFA_FM2JSContext::simpleValueCompare(CFXJSE_Value* pThis, return firstString == secondString; } if (firstValue->IsNumber()) { - FX_FLOAT first = ValueToFloat(pThis, firstValue); - FX_FLOAT second = ValueToFloat(pThis, secondValue); + float first = ValueToFloat(pThis, firstValue); + float second = ValueToFloat(pThis, secondValue); return (first == second); } if (firstValue->IsBoolean()) @@ -6222,8 +6221,7 @@ int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, } // static -FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, - CFXJSE_Value* arg) { +float CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* arg) { if (!arg) return 0.0f; @@ -6248,7 +6246,7 @@ FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, return ValueToFloat(pThis, newPropertyValue.get()); } if (arg->IsString()) - return (FX_FLOAT)XFA_ByteStringToDouble(arg->ToString().AsStringC()); + return (float)XFA_ByteStringToDouble(arg->ToString().AsStringC()); if (arg->IsUndefined()) return 0; diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.h b/xfa/fxfa/fm2js/xfa_fm2jscontext.h index 5008ceda6e..29591f4352 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.h +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.h @@ -436,7 +436,7 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { uint32_t index); static bool ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* pValue); static int32_t ValueToInteger(CFXJSE_Value* pThis, CFXJSE_Value* pValue); - static FX_FLOAT ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* pValue); + static float ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* pValue); static double ValueToDouble(CFXJSE_Value* pThis, CFXJSE_Value* pValue); static void ValueToUTF8String(CFXJSE_Value* pValue, CFX_ByteString& outputValue); diff --git a/xfa/fxfa/fxfa.h b/xfa/fxfa/fxfa.h index dd5fc0fcbc..8a268269e0 100644 --- a/xfa/fxfa/fxfa.h +++ b/xfa/fxfa/fxfa.h @@ -239,8 +239,8 @@ class IXFA_DocEnvironment { bool bVisible, const CFX_RectF* pRtAnchor) = 0; virtual bool GetPopupPos(CXFA_FFWidget* hWidget, - FX_FLOAT fMinPopup, - FX_FLOAT fMaxPopup, + float fMinPopup, + float fMaxPopup, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) = 0; virtual bool PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup) = 0; diff --git a/xfa/fxfa/fxfa_widget.h b/xfa/fxfa/fxfa_widget.h index 74c63c9d52..b71c622d74 100644 --- a/xfa/fxfa/fxfa_widget.h +++ b/xfa/fxfa/fxfa_widget.h @@ -59,8 +59,8 @@ class CXFA_WidgetAcc : public CXFA_WidgetData { CFXJSE_Value** pRetValue = nullptr); CXFA_FFWidget* GetNextWidget(CXFA_FFWidget* pWidget); - void StartWidgetLayout(FX_FLOAT& fCalcWidth, FX_FLOAT& fCalcHeight); - bool FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight); + void StartWidgetLayout(float& fCalcWidth, float& fCalcHeight); + bool FindSplitPos(int32_t iBlockIndex, float& fCalcHeight); bool LoadCaption(); void LoadText(); bool LoadImageImage(); @@ -77,9 +77,9 @@ class CXFA_WidgetAcc : public CXFA_WidgetData { CXFA_Node* GetDatasets(); CFX_RetainPtr<CFGAS_GEFont> GetFDEFont(); - FX_FLOAT GetFontSize(); + float GetFontSize(); FX_ARGB GetTextColor(); - FX_FLOAT GetLineHeight(); + float GetLineHeight(); CXFA_WidgetLayoutData* GetWidgetLayoutData(); protected: @@ -102,16 +102,16 @@ class CXFA_WidgetAcc : public CXFA_WidgetData { bool CalculateImageEditAutoSize(CFX_SizeF& size); bool CalculateImageAutoSize(CFX_SizeF& size); bool CalculateTextAutoSize(CFX_SizeF& size); - FX_FLOAT CalculateWidgetAutoHeight(FX_FLOAT fHeightCalc); - FX_FLOAT CalculateWidgetAutoWidth(FX_FLOAT fWidthCalc); - FX_FLOAT GetWidthWithoutMargin(FX_FLOAT fWidthCalc); - FX_FLOAT GetHeightWithoutMargin(FX_FLOAT fHeightCalc); + float CalculateWidgetAutoHeight(float fHeightCalc); + float CalculateWidgetAutoWidth(float fWidthCalc); + float GetWidthWithoutMargin(float fWidthCalc); + float GetHeightWithoutMargin(float fHeightCalc); void CalculateTextContentSize(CFX_SizeF& size); void CalculateAccWidthAndHeight(XFA_Element eUIType, - FX_FLOAT& fWidth, - FX_FLOAT& fCalcHeight); + float& fWidth, + float& fCalcHeight); void InitLayoutData(); - void StartTextLayout(FX_FLOAT& fCalcWidth, FX_FLOAT& fCalcHeight); + void StartTextLayout(float& fCalcWidth, float& fCalcHeight); CXFA_FFDocView* m_pDocView; std::unique_ptr<CXFA_WidgetLayoutData> m_pLayoutData; diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp index aa3117a734..9ffad911b2 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp @@ -122,7 +122,7 @@ void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments, break; } XFA_UNIT unit = measure.GetUnit(wsUnit.AsStringC()); - FX_FLOAT fValue = measure.ToUnit(unit); + float fValue = measure.ToUnit(unit); fValue = FXSYS_round(fValue * 1000) / 1000.0f; if (pValue) pValue->SetFloat(fValue); diff --git a/xfa/fxfa/parser/cxfa_box.cpp b/xfa/fxfa/parser/cxfa_box.cpp index 552c98031a..a6cced5426 100644 --- a/xfa/fxfa/parser/cxfa_box.cpp +++ b/xfa/fxfa/parser/cxfa_box.cpp @@ -109,7 +109,7 @@ bool CXFA_Box::IsCircular() const { return m_pNode->GetBoolean(XFA_ATTRIBUTE_Circular); } -bool CXFA_Box::GetStartAngle(FX_FLOAT& fStartAngle) const { +bool CXFA_Box::GetStartAngle(float& fStartAngle) const { fStartAngle = 0; if (!m_pNode) return false; @@ -122,7 +122,7 @@ bool CXFA_Box::GetStartAngle(FX_FLOAT& fStartAngle) const { return bRet; } -bool CXFA_Box::GetSweepAngle(FX_FLOAT& fSweepAngle) const { +bool CXFA_Box::GetSweepAngle(float& fSweepAngle) const { fSweepAngle = 360; if (!m_pNode) return false; @@ -148,7 +148,7 @@ CXFA_Margin CXFA_Box::GetMargin() const { : nullptr); } -int32_t CXFA_Box::Get3DStyle(bool& bVisible, FX_FLOAT& fThickness) const { +int32_t CXFA_Box::Get3DStyle(bool& bVisible, float& fThickness) const { if (IsArc()) return 0; diff --git a/xfa/fxfa/parser/cxfa_box.h b/xfa/fxfa/parser/cxfa_box.h index a0af2f449b..d2b79fae56 100644 --- a/xfa/fxfa/parser/cxfa_box.h +++ b/xfa/fxfa/parser/cxfa_box.h @@ -32,23 +32,23 @@ class CXFA_Box : public CXFA_Data { CXFA_Edge GetEdge(int32_t nIndex = 0) const; void GetStrokes(std::vector<CXFA_Stroke>* strokes) const; bool IsCircular() const; - bool GetStartAngle(FX_FLOAT& fStartAngle) const; - FX_FLOAT GetStartAngle() const { - FX_FLOAT fStartAngle; + bool GetStartAngle(float& fStartAngle) const; + float GetStartAngle() const { + float fStartAngle; GetStartAngle(fStartAngle); return fStartAngle; } - bool GetSweepAngle(FX_FLOAT& fSweepAngle) const; - FX_FLOAT GetSweepAngle() const { - FX_FLOAT fSweepAngle; + bool GetSweepAngle(float& fSweepAngle) const; + float GetSweepAngle() const { + float fSweepAngle; GetSweepAngle(fSweepAngle); return fSweepAngle; } CXFA_Fill GetFill(bool bModified = false) const; CXFA_Margin GetMargin() const; - int32_t Get3DStyle(bool& bVisible, FX_FLOAT& fThickness) const; + int32_t Get3DStyle(bool& bVisible, float& fThickness) const; }; #endif // XFA_FXFA_PARSER_CXFA_BOX_H_ diff --git a/xfa/fxfa/parser/cxfa_caption.cpp b/xfa/fxfa/parser/cxfa_caption.cpp index 7f9e88e8e7..5b9365ab16 100644 --- a/xfa/fxfa/parser/cxfa_caption.cpp +++ b/xfa/fxfa/parser/cxfa_caption.cpp @@ -23,7 +23,7 @@ int32_t CXFA_Caption::GetPlacementType() { return eAttr; } -FX_FLOAT CXFA_Caption::GetReserve() { +float CXFA_Caption::GetReserve() { CXFA_Measurement ms; m_pNode->TryMeasure(XFA_ATTRIBUTE_Reserve, ms); return ms.ToUnit(XFA_UNIT_Pt); diff --git a/xfa/fxfa/parser/cxfa_caption.h b/xfa/fxfa/parser/cxfa_caption.h index 70dd435653..74650ef9a2 100644 --- a/xfa/fxfa/parser/cxfa_caption.h +++ b/xfa/fxfa/parser/cxfa_caption.h @@ -20,7 +20,7 @@ class CXFA_Caption : public CXFA_Data { int32_t GetPresence(); int32_t GetPlacementType(); - FX_FLOAT GetReserve(); + float GetReserve(); CXFA_Margin GetMargin(); CXFA_Font GetFont(); CXFA_Value GetValue(); diff --git a/xfa/fxfa/parser/cxfa_data.cpp b/xfa/fxfa/parser/cxfa_data.cpp index 3544a1de4c..456cc7f223 100644 --- a/xfa/fxfa/parser/cxfa_data.cpp +++ b/xfa/fxfa/parser/cxfa_data.cpp @@ -66,7 +66,7 @@ XFA_Element CXFA_Data::GetElementType() const { } bool CXFA_Data::TryMeasure(XFA_ATTRIBUTE eAttr, - FX_FLOAT& fValue, + float& fValue, bool bUseDefault) const { CXFA_Measurement ms; if (m_pNode->TryMeasure(eAttr, ms, bUseDefault)) { @@ -76,7 +76,7 @@ bool CXFA_Data::TryMeasure(XFA_ATTRIBUTE eAttr, return false; } -bool CXFA_Data::SetMeasure(XFA_ATTRIBUTE eAttr, FX_FLOAT fValue) { +bool CXFA_Data::SetMeasure(XFA_ATTRIBUTE eAttr, float fValue) { CXFA_Measurement ms(fValue, XFA_UNIT_Pt); return m_pNode->SetMeasure(eAttr, ms); } diff --git a/xfa/fxfa/parser/cxfa_data.h b/xfa/fxfa/parser/cxfa_data.h index 890486d5fa..4801f08dc5 100644 --- a/xfa/fxfa/parser/cxfa_data.h +++ b/xfa/fxfa/parser/cxfa_data.h @@ -25,9 +25,9 @@ class CXFA_Data { protected: bool TryMeasure(XFA_ATTRIBUTE eAttr, - FX_FLOAT& fValue, + float& fValue, bool bUseDefault = false) const; - bool SetMeasure(XFA_ATTRIBUTE eAttr, FX_FLOAT fValue); + bool SetMeasure(XFA_ATTRIBUTE eAttr, float fValue); CXFA_Node* m_pNode; }; diff --git a/xfa/fxfa/parser/cxfa_font.cpp b/xfa/fxfa/parser/cxfa_font.cpp index cedfda6294..f310f76bc6 100644 --- a/xfa/fxfa/parser/cxfa_font.cpp +++ b/xfa/fxfa/parser/cxfa_font.cpp @@ -13,25 +13,25 @@ CXFA_Font::CXFA_Font(CXFA_Node* pNode) : CXFA_Data(pNode) {} -FX_FLOAT CXFA_Font::GetBaselineShift() { +float CXFA_Font::GetBaselineShift() { return m_pNode->GetMeasure(XFA_ATTRIBUTE_BaselineShift).ToUnit(XFA_UNIT_Pt); } -FX_FLOAT CXFA_Font::GetHorizontalScale() { +float CXFA_Font::GetHorizontalScale() { CFX_WideString wsValue; m_pNode->TryCData(XFA_ATTRIBUTE_FontHorizontalScale, wsValue); int32_t iScale = FXSYS_wtoi(wsValue.c_str()); - return iScale > 0 ? (FX_FLOAT)iScale : 100.0f; + return iScale > 0 ? (float)iScale : 100.0f; } -FX_FLOAT CXFA_Font::GetVerticalScale() { +float CXFA_Font::GetVerticalScale() { CFX_WideString wsValue; m_pNode->TryCData(XFA_ATTRIBUTE_FontVerticalScale, wsValue); int32_t iScale = FXSYS_wtoi(wsValue.c_str()); - return iScale > 0 ? (FX_FLOAT)iScale : 100.0f; + return iScale > 0 ? (float)iScale : 100.0f; } -FX_FLOAT CXFA_Font::GetLetterSpacing() { +float CXFA_Font::GetLetterSpacing() { CFX_WideStringC wsValue; if (!m_pNode->TryCData(XFA_ATTRIBUTE_LetterSpacing, wsValue)) return 0; @@ -60,7 +60,7 @@ int32_t CXFA_Font::GetUnderlinePeriod() { return eAttr; } -FX_FLOAT CXFA_Font::GetFontSize() { +float CXFA_Font::GetFontSize() { CXFA_Measurement ms; m_pNode->TryMeasure(XFA_ATTRIBUTE_Size, ms); return ms.ToUnit(XFA_UNIT_Pt); diff --git a/xfa/fxfa/parser/cxfa_font.h b/xfa/fxfa/parser/cxfa_font.h index 0342f68b27..2a5fef1122 100644 --- a/xfa/fxfa/parser/cxfa_font.h +++ b/xfa/fxfa/parser/cxfa_font.h @@ -16,14 +16,14 @@ class CXFA_Font : public CXFA_Data { public: explicit CXFA_Font(CXFA_Node* pNode); - FX_FLOAT GetBaselineShift(); - FX_FLOAT GetHorizontalScale(); - FX_FLOAT GetVerticalScale(); - FX_FLOAT GetLetterSpacing(); + float GetBaselineShift(); + float GetHorizontalScale(); + float GetVerticalScale(); + float GetLetterSpacing(); int32_t GetLineThrough(); int32_t GetUnderline(); int32_t GetUnderlinePeriod(); - FX_FLOAT GetFontSize(); + float GetFontSize(); void GetTypeface(CFX_WideStringC& wsTypeFace); bool IsBold(); diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index f38ef0ebfd..c8f4b65a16 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -454,13 +454,13 @@ void CXFA_LayoutPageMgr::SubmitContentItem( } } -FX_FLOAT CXFA_LayoutPageMgr::GetAvailHeight() { +float CXFA_LayoutPageMgr::GetAvailHeight() { CXFA_ContainerLayoutItem* pLayoutItem = GetCurrentContainerRecord()->pCurContentArea; if (!pLayoutItem || !pLayoutItem->m_pFormNode) return 0.0f; - FX_FLOAT fAvailHeight = + float fAvailHeight = pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); if (fAvailHeight >= XFA_LAYOUT_FLOAT_PERCISION) return fAvailHeight; @@ -647,7 +647,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { } } bool bUsable = true; - CFX_ArrayTemplate<FX_FLOAT> rgUsedHeights; + CFX_ArrayTemplate<float> rgUsedHeights; for (CXFA_LayoutItem* pChildLayoutItem = pLastPageAreaLayoutItem->m_pFirstChild; pChildLayoutItem; @@ -656,7 +656,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { XFA_Element::ContentArea) { continue; } - FX_FLOAT fUsedHeight = 0; + float fUsedHeight = 0; for (CXFA_LayoutItem* pContentChildLayoutItem = pChildLayoutItem->m_pFirstChild; pContentChildLayoutItem; @@ -1511,7 +1511,7 @@ void CXFA_LayoutPageMgr::ProcessLastPageSet() { } } -bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) { +bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(float fChildHeight) { CXFA_Node* pCurContentNode = GetCurrentContainerRecord()->pCurContentArea->m_pFormNode; if (!pCurContentNode) @@ -1520,7 +1520,7 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) { pCurContentNode = pCurContentNode->GetNextSameClassSibling(XFA_Element::ContentArea); if (pCurContentNode) { - FX_FLOAT fNextContentHeight = + float fNextContentHeight = pCurContentNode->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); return fNextContentHeight > fChildHeight; } @@ -1549,7 +1549,7 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) { CXFA_Node* pContentArea = pNextPage->GetFirstChildByClass(XFA_Element::ContentArea); if (pContentArea) { - FX_FLOAT fNextContentHeight = + float fNextContentHeight = pContentArea->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); if (fNextContentHeight > fChildHeight) return true; @@ -1561,7 +1561,7 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) { CXFA_Node* pContentArea = pPageNode->GetFirstChildByClass(XFA_Element::ContentArea); - FX_FLOAT fNextContentHeight = + float fNextContentHeight = pContentArea->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); if (fNextContentHeight < XFA_LAYOUT_FLOAT_PERCISION) return true; diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.h b/xfa/fxfa/parser/cxfa_layoutpagemgr.h index 3c8e7f9d1e..be90b4674f 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.h +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.h @@ -23,8 +23,8 @@ class CXFA_LayoutPageMgr { bool InitLayoutPage(CXFA_Node* pFormNode); bool PrepareFirstPage(CXFA_Node* pRootSubform); - FX_FLOAT GetAvailHeight(); - bool GetNextAvailContentHeight(FX_FLOAT fChildHeight); + float GetAvailHeight(); + bool GetNextAvailContentHeight(float fChildHeight); void SubmitContentItem(CXFA_ContentLayoutItem* pContentLayoutItem, XFA_ItemLayoutProcessorResult eStatus); void FinishPaginatedPageSets(); diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp index e179d38985..a41b546aa8 100644 --- a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp @@ -64,10 +64,10 @@ int32_t CXFA_LayoutProcessor::DoLayout(IFX_Pause* pPause) { XFA_ItemLayoutProcessorResult eStatus; CXFA_Node* pFormNode = m_pRootItemLayoutProcessor->GetFormNode(); - FX_FLOAT fPosX = pFormNode->GetMeasure(XFA_ATTRIBUTE_X).ToUnit(XFA_UNIT_Pt); - FX_FLOAT fPosY = pFormNode->GetMeasure(XFA_ATTRIBUTE_Y).ToUnit(XFA_UNIT_Pt); + float fPosX = pFormNode->GetMeasure(XFA_ATTRIBUTE_X).ToUnit(XFA_UNIT_Pt); + float fPosY = pFormNode->GetMeasure(XFA_ATTRIBUTE_Y).ToUnit(XFA_UNIT_Pt); do { - FX_FLOAT fAvailHeight = m_pLayoutPageMgr->GetAvailHeight(); + float fAvailHeight = m_pLayoutPageMgr->GetAvailHeight(); eStatus = m_pRootItemLayoutProcessor->DoLayout(true, fAvailHeight, fAvailHeight, nullptr); if (eStatus != XFA_ItemLayoutProcessorResult::Done) diff --git a/xfa/fxfa/parser/cxfa_margin.cpp b/xfa/fxfa/parser/cxfa_margin.cpp index 38f9626a88..fc4a0f1a63 100644 --- a/xfa/fxfa/parser/cxfa_margin.cpp +++ b/xfa/fxfa/parser/cxfa_margin.cpp @@ -10,22 +10,22 @@ CXFA_Margin::CXFA_Margin(CXFA_Node* pNode) : CXFA_Data(pNode) {} -bool CXFA_Margin::GetLeftInset(FX_FLOAT& fInset, FX_FLOAT fDefInset) const { +bool CXFA_Margin::GetLeftInset(float& fInset, float fDefInset) const { fInset = fDefInset; return TryMeasure(XFA_ATTRIBUTE_LeftInset, fInset); } -bool CXFA_Margin::GetTopInset(FX_FLOAT& fInset, FX_FLOAT fDefInset) const { +bool CXFA_Margin::GetTopInset(float& fInset, float fDefInset) const { fInset = fDefInset; return TryMeasure(XFA_ATTRIBUTE_TopInset, fInset); } -bool CXFA_Margin::GetRightInset(FX_FLOAT& fInset, FX_FLOAT fDefInset) const { +bool CXFA_Margin::GetRightInset(float& fInset, float fDefInset) const { fInset = fDefInset; return TryMeasure(XFA_ATTRIBUTE_RightInset, fInset); } -bool CXFA_Margin::GetBottomInset(FX_FLOAT& fInset, FX_FLOAT fDefInset) const { +bool CXFA_Margin::GetBottomInset(float& fInset, float fDefInset) const { fInset = fDefInset; return TryMeasure(XFA_ATTRIBUTE_BottomInset, fInset); } diff --git a/xfa/fxfa/parser/cxfa_margin.h b/xfa/fxfa/parser/cxfa_margin.h index d1c1955194..89fc4ce38a 100644 --- a/xfa/fxfa/parser/cxfa_margin.h +++ b/xfa/fxfa/parser/cxfa_margin.h @@ -16,10 +16,10 @@ class CXFA_Margin : public CXFA_Data { public: explicit CXFA_Margin(CXFA_Node* pNode); - bool GetLeftInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const; - bool GetTopInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const; - bool GetRightInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const; - bool GetBottomInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const; + bool GetLeftInset(float& fInset, float fDefInset = 0) const; + bool GetTopInset(float& fInset, float fDefInset = 0) const; + bool GetRightInset(float& fInset, float fDefInset = 0) const; + bool GetBottomInset(float& fInset, float fDefInset = 0) const; }; #endif // XFA_FXFA_PARSER_CXFA_MARGIN_H_ diff --git a/xfa/fxfa/parser/cxfa_measurement.cpp b/xfa/fxfa/parser/cxfa_measurement.cpp index ebf7b7bff7..fd00c42d34 100644 --- a/xfa/fxfa/parser/cxfa_measurement.cpp +++ b/xfa/fxfa/parser/cxfa_measurement.cpp @@ -16,7 +16,7 @@ CXFA_Measurement::CXFA_Measurement() { Set(-1, XFA_UNIT_Unknown); } -CXFA_Measurement::CXFA_Measurement(FX_FLOAT fValue, XFA_UNIT eUnit) { +CXFA_Measurement::CXFA_Measurement(float fValue, XFA_UNIT eUnit) { Set(fValue, eUnit); } @@ -28,8 +28,8 @@ void CXFA_Measurement::Set(const CFX_WideStringC& wsMeasure) { } int32_t iUsedLen = 0; int32_t iOffset = (wsMeasure.GetAt(0) == L'=') ? 1 : 0; - FX_FLOAT fValue = FXSYS_wcstof(wsMeasure.c_str() + iOffset, - wsMeasure.GetLength() - iOffset, &iUsedLen); + float fValue = FXSYS_wcstof(wsMeasure.c_str() + iOffset, + wsMeasure.GetLength() - iOffset, &iUsedLen); XFA_UNIT eUnit = GetUnit(wsMeasure.Mid(iOffset + iUsedLen)); Set(fValue, eUnit); } @@ -66,7 +66,7 @@ bool CXFA_Measurement::ToString(CFX_WideString& wsMeasure) const { } } -bool CXFA_Measurement::ToUnit(XFA_UNIT eUnit, FX_FLOAT& fValue) const { +bool CXFA_Measurement::ToUnit(XFA_UNIT eUnit, float& fValue) const { fValue = GetValue(); XFA_UNIT eFrom = GetUnit(); if (eFrom == eUnit) diff --git a/xfa/fxfa/parser/cxfa_measurement.h b/xfa/fxfa/parser/cxfa_measurement.h index 40f71a7fab..34cf780f81 100644 --- a/xfa/fxfa/parser/cxfa_measurement.h +++ b/xfa/fxfa/parser/cxfa_measurement.h @@ -15,27 +15,27 @@ class CXFA_Measurement { public: explicit CXFA_Measurement(const CFX_WideStringC& wsMeasure); CXFA_Measurement(); - CXFA_Measurement(FX_FLOAT fValue, XFA_UNIT eUnit); + CXFA_Measurement(float fValue, XFA_UNIT eUnit); void Set(const CFX_WideStringC& wsMeasure); - void Set(FX_FLOAT fValue, XFA_UNIT eUnit) { + void Set(float fValue, XFA_UNIT eUnit) { m_fValue = fValue; m_eUnit = eUnit; } XFA_UNIT GetUnit(const CFX_WideStringC& wsUnit); XFA_UNIT GetUnit() const { return m_eUnit; } - FX_FLOAT GetValue() const { return m_fValue; } + float GetValue() const { return m_fValue; } bool ToString(CFX_WideString& wsMeasure) const; - bool ToUnit(XFA_UNIT eUnit, FX_FLOAT& fValue) const; - FX_FLOAT ToUnit(XFA_UNIT eUnit) const { - FX_FLOAT f; + bool ToUnit(XFA_UNIT eUnit, float& fValue) const; + float ToUnit(XFA_UNIT eUnit) const { + float f; return ToUnit(eUnit, f) ? f : 0; } private: - FX_FLOAT m_fValue; + float m_fValue; XFA_UNIT m_eUnit; }; diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 086c0e929d..8d618e9719 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -2034,7 +2034,7 @@ void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, pValue->SetInteger(FXSYS_wtoi(content.c_str())); } else if (eType == XFA_Element::Float || eType == XFA_Element::Decimal) { CFX_Decimal decimal(content.AsStringC()); - pValue->SetFloat((FX_FLOAT)(double)decimal); + pValue->SetFloat((float)(double)decimal); } else { pValue->SetString(content.UTF8Encode().AsStringC()); } @@ -2255,7 +2255,7 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, pValue->SetString(content.UTF8Encode().AsStringC()); } else { CFX_Decimal decimal(content.AsStringC()); - pValue->SetFloat((FX_FLOAT)(double)decimal); + pValue->SetFloat((float)(double)decimal); } } else if (pNode && pNode->GetElementType() == XFA_Element::Integer) { pValue->SetInteger(FXSYS_wtoi(content.c_str())); @@ -2263,7 +2263,7 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, pValue->SetBoolean(FXSYS_wtoi(content.c_str()) == 0 ? false : true); } else if (pNode && pNode->GetElementType() == XFA_Element::Float) { CFX_Decimal decimal(content.AsStringC()); - pValue->SetFloat((FX_FLOAT)(double)decimal); + pValue->SetFloat((float)(double)decimal); } else { pValue->SetString(content.UTF8Encode().AsStringC()); } diff --git a/xfa/fxfa/parser/cxfa_para.cpp b/xfa/fxfa/parser/cxfa_para.cpp index bd3a1bb8ff..3fe4b68f05 100644 --- a/xfa/fxfa/parser/cxfa_para.cpp +++ b/xfa/fxfa/parser/cxfa_para.cpp @@ -23,37 +23,37 @@ int32_t CXFA_Para::GetVerticalAlign() { return eAttr; } -FX_FLOAT CXFA_Para::GetLineHeight() { +float CXFA_Para::GetLineHeight() { CXFA_Measurement ms; m_pNode->TryMeasure(XFA_ATTRIBUTE_LineHeight, ms); return ms.ToUnit(XFA_UNIT_Pt); } -FX_FLOAT CXFA_Para::GetMarginLeft() { +float CXFA_Para::GetMarginLeft() { CXFA_Measurement ms; m_pNode->TryMeasure(XFA_ATTRIBUTE_MarginLeft, ms); return ms.ToUnit(XFA_UNIT_Pt); } -FX_FLOAT CXFA_Para::GetMarginRight() { +float CXFA_Para::GetMarginRight() { CXFA_Measurement ms; m_pNode->TryMeasure(XFA_ATTRIBUTE_MarginRight, ms); return ms.ToUnit(XFA_UNIT_Pt); } -FX_FLOAT CXFA_Para::GetSpaceAbove() { +float CXFA_Para::GetSpaceAbove() { CXFA_Measurement ms; m_pNode->TryMeasure(XFA_ATTRIBUTE_SpaceAbove, ms); return ms.ToUnit(XFA_UNIT_Pt); } -FX_FLOAT CXFA_Para::GetSpaceBelow() { +float CXFA_Para::GetSpaceBelow() { CXFA_Measurement ms; m_pNode->TryMeasure(XFA_ATTRIBUTE_SpaceBelow, ms); return ms.ToUnit(XFA_UNIT_Pt); } -FX_FLOAT CXFA_Para::GetTextIndent() { +float CXFA_Para::GetTextIndent() { CXFA_Measurement ms; m_pNode->TryMeasure(XFA_ATTRIBUTE_TextIndent, ms); return ms.ToUnit(XFA_UNIT_Pt); diff --git a/xfa/fxfa/parser/cxfa_para.h b/xfa/fxfa/parser/cxfa_para.h index e12d48f9fa..c2d67b8a19 100644 --- a/xfa/fxfa/parser/cxfa_para.h +++ b/xfa/fxfa/parser/cxfa_para.h @@ -18,12 +18,12 @@ class CXFA_Para : public CXFA_Data { int32_t GetHorizontalAlign(); int32_t GetVerticalAlign(); - FX_FLOAT GetLineHeight(); - FX_FLOAT GetMarginLeft(); - FX_FLOAT GetMarginRight(); - FX_FLOAT GetSpaceAbove(); - FX_FLOAT GetSpaceBelow(); - FX_FLOAT GetTextIndent(); + float GetLineHeight(); + float GetMarginLeft(); + float GetMarginRight(); + float GetSpaceAbove(); + float GetSpaceBelow(); + float GetTextIndent(); }; #endif // XFA_FXFA_PARSER_CXFA_PARA_H_ diff --git a/xfa/fxfa/parser/cxfa_stroke.cpp b/xfa/fxfa/parser/cxfa_stroke.cpp index 602f2f9f1f..2faad24a97 100644 --- a/xfa/fxfa/parser/cxfa_stroke.cpp +++ b/xfa/fxfa/parser/cxfa_stroke.cpp @@ -25,7 +25,7 @@ int32_t CXFA_Stroke::GetStrokeType() const { : XFA_ATTRIBUTEENUM_Solid; } -FX_FLOAT CXFA_Stroke::GetThickness() const { +float CXFA_Stroke::GetThickness() const { return GetMSThickness().ToUnit(XFA_UNIT_Pt); } @@ -80,7 +80,7 @@ bool CXFA_Stroke::IsInverted() const { return m_pNode ? m_pNode->GetBoolean(XFA_ATTRIBUTE_Inverted) : false; } -FX_FLOAT CXFA_Stroke::GetRadius() const { +float CXFA_Stroke::GetRadius() const { return m_pNode ? m_pNode->GetMeasure(XFA_ATTRIBUTE_Radius).ToUnit(XFA_UNIT_Pt) : 0; } diff --git a/xfa/fxfa/parser/cxfa_stroke.h b/xfa/fxfa/parser/cxfa_stroke.h index cf941c8f0f..63709b9160 100644 --- a/xfa/fxfa/parser/cxfa_stroke.h +++ b/xfa/fxfa/parser/cxfa_stroke.h @@ -30,14 +30,14 @@ class CXFA_Stroke : public CXFA_Data { int32_t GetPresence() const; int32_t GetCapType() const; int32_t GetStrokeType() const; - FX_FLOAT GetThickness() const; + float GetThickness() const; CXFA_Measurement GetMSThickness() const; void SetMSThickness(CXFA_Measurement msThinkness); FX_ARGB GetColor() const; void SetColor(FX_ARGB argb); int32_t GetJoinType() const; bool IsInverted() const; - FX_FLOAT GetRadius() const; + float GetRadius() const; bool SameStyles(CXFA_Stroke stroke, uint32_t dwFlags = 0) const; }; diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index ca0303d00c..cbdb7cfed4 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -18,10 +18,10 @@ namespace { -FX_FLOAT GetEdgeThickness(const std::vector<CXFA_Stroke>& strokes, - bool b3DStyle, - int32_t nIndex) { - FX_FLOAT fThickness = 0; +float GetEdgeThickness(const std::vector<CXFA_Stroke>& strokes, + bool b3DStyle, + int32_t nIndex) { + float fThickness = 0; if (strokes[nIndex * 2 + 1].GetPresence() == XFA_ATTRIBUTEENUM_Visible) { if (nIndex == 0) @@ -375,27 +375,27 @@ CXFA_Assist CXFA_WidgetData::GetAssist(bool bModified) { return CXFA_Assist(m_pNode->GetProperty(0, XFA_Element::Assist, bModified)); } -bool CXFA_WidgetData::GetWidth(FX_FLOAT& fWidth) { +bool CXFA_WidgetData::GetWidth(float& fWidth) { return TryMeasure(XFA_ATTRIBUTE_W, fWidth); } -bool CXFA_WidgetData::GetHeight(FX_FLOAT& fHeight) { +bool CXFA_WidgetData::GetHeight(float& fHeight) { return TryMeasure(XFA_ATTRIBUTE_H, fHeight); } -bool CXFA_WidgetData::GetMinWidth(FX_FLOAT& fMinWidth) { +bool CXFA_WidgetData::GetMinWidth(float& fMinWidth) { return TryMeasure(XFA_ATTRIBUTE_MinW, fMinWidth); } -bool CXFA_WidgetData::GetMinHeight(FX_FLOAT& fMinHeight) { +bool CXFA_WidgetData::GetMinHeight(float& fMinHeight) { return TryMeasure(XFA_ATTRIBUTE_MinH, fMinHeight); } -bool CXFA_WidgetData::GetMaxWidth(FX_FLOAT& fMaxWidth) { +bool CXFA_WidgetData::GetMaxWidth(float& fMaxWidth) { return TryMeasure(XFA_ATTRIBUTE_MaxW, fMaxWidth); } -bool CXFA_WidgetData::GetMaxHeight(FX_FLOAT& fMaxHeight) { +bool CXFA_WidgetData::GetMaxHeight(float& fMaxHeight) { return TryMeasure(XFA_ATTRIBUTE_MaxH, fMaxHeight); } @@ -419,14 +419,14 @@ CFX_RectF CXFA_WidgetData::GetUIMargin() { if (border && border.GetPresence() != XFA_ATTRIBUTEENUM_Visible) return CFX_RectF(); - FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset; + float fLeftInset, fTopInset, fRightInset, fBottomInset; bool bLeft = mgUI.GetLeftInset(fLeftInset); bool bTop = mgUI.GetTopInset(fTopInset); bool bRight = mgUI.GetRightInset(fRightInset); bool bBottom = mgUI.GetBottomInset(fBottomInset); if (border) { bool bVisible = false; - FX_FLOAT fThickness = 0; + float fThickness = 0; border.Get3DStyle(bVisible, fThickness); if (!bLeft || !bTop || !bRight || !bBottom) { std::vector<CXFA_Stroke> strokes; @@ -509,7 +509,7 @@ bool CXFA_WidgetData::IsRadioButton() { return false; } -FX_FLOAT CXFA_WidgetData::GetCheckButtonSize() { +float CXFA_WidgetData::GetCheckButtonSize() { CXFA_Node* pUIChild = GetUIChild(); if (pUIChild) return pUIChild->GetMeasure(XFA_ATTRIBUTE_Size).ToUnit(XFA_UNIT_Pt); @@ -1393,20 +1393,20 @@ bool CXFA_WidgetData::GetBarcodeAttribute_Truncate(bool& val) { return false; } -bool CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(FX_FLOAT& val) { +bool CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(float& val) { CXFA_Node* pUIChild = GetUIChild(); CFX_WideString wsWideNarrowRatio; if (pUIChild->TryCData(XFA_ATTRIBUTE_WideNarrowRatio, wsWideNarrowRatio)) { FX_STRSIZE ptPos = wsWideNarrowRatio.Find(':'); - FX_FLOAT fRatio = 0; + float fRatio = 0; if (ptPos >= 0) { - fRatio = (FX_FLOAT)FXSYS_wtoi(wsWideNarrowRatio.c_str()); + fRatio = (float)FXSYS_wtoi(wsWideNarrowRatio.c_str()); } else { int32_t fA, fB; fA = FXSYS_wtoi(wsWideNarrowRatio.Left(ptPos).c_str()); fB = FXSYS_wtoi(wsWideNarrowRatio.Mid(ptPos + 1).c_str()); if (fB) - fRatio = (FX_FLOAT)fA / fB; + fRatio = (float)fA / fB; } val = fRatio; return true; diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index 3eca270320..1de04df088 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -63,12 +63,12 @@ class CXFA_WidgetData : public CXFA_Data { CXFA_Validate GetValidate(bool bModified = false); CXFA_Bind GetBind(bool bModified = false); CXFA_Assist GetAssist(bool bModified = false); - bool GetWidth(FX_FLOAT& fWidth); - bool GetHeight(FX_FLOAT& fHeight); - bool GetMinWidth(FX_FLOAT& fMinWidth); - bool GetMinHeight(FX_FLOAT& fMinHeight); - bool GetMaxWidth(FX_FLOAT& fMaxWidth); - bool GetMaxHeight(FX_FLOAT& fMaxHeight); + bool GetWidth(float& fWidth); + bool GetHeight(float& fHeight); + bool GetMinWidth(float& fMinWidth); + bool GetMinHeight(float& fMinHeight); + bool GetMaxWidth(float& fMaxWidth); + bool GetMaxHeight(float& fMaxHeight); CXFA_Border GetUIBorder(); CFX_RectF GetUIMargin(); int32_t GetButtonHighlight(); @@ -76,7 +76,7 @@ class CXFA_WidgetData : public CXFA_Data { bool GetButtonDown(CFX_WideString& wsDown, bool& bRichText); int32_t GetCheckButtonShape(); int32_t GetCheckButtonMark(); - FX_FLOAT GetCheckButtonSize(); + float GetCheckButtonSize(); bool IsAllowNeutral(); bool IsRadioButton(); XFA_CHECKSTATE GetCheckState(); @@ -148,7 +148,7 @@ class CXFA_WidgetData : public CXFA_Data { bool GetBarcodeAttribute_PrintChecksum(bool& val); bool GetBarcodeAttribute_TextLocation(int32_t& val); bool GetBarcodeAttribute_Truncate(bool& val); - bool GetBarcodeAttribute_WideNarrowRatio(FX_FLOAT& val); + bool GetBarcodeAttribute_WideNarrowRatio(float& val); void GetPasswordChar(CFX_WideString& wsPassWord); bool IsMultiLine(); int32_t GetVerticalScrollPolicy(); diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index 193ffdd497..01d2164432 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -50,8 +50,8 @@ std::vector<CFX_WideString> SeparateStringW(const wchar_t* pStr, } void UpdateWidgetSize(CXFA_ContentLayoutItem* pLayoutItem, - FX_FLOAT* fWidth, - FX_FLOAT* fHeight) { + float* fWidth, + float* fHeight) { CXFA_Node* pNode = pLayoutItem->m_pFormNode; switch (pNode->GetElementType()) { case XFA_Element::Subform: @@ -114,9 +114,9 @@ CFX_SizeF CalculateContainerSpecifiedSize(CXFA_Node* pFormNode, CFX_SizeF CalculateContainerComponentSizeFromContentSize( CXFA_Node* pFormNode, bool bContainerWidthAutoSize, - FX_FLOAT fContentCalculatedWidth, + float fContentCalculatedWidth, bool bContainerHeightAutoSize, - FX_FLOAT fContentCalculatedHeight, + float fContentCalculatedHeight, const CFX_SizeF& currentContainerSize) { CFX_SizeF componentSize = currentContainerSize; CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_Element::Margin); @@ -147,7 +147,7 @@ CFX_SizeF CalculateContainerComponentSizeFromContentSize( void RelocateTableRowCells( CXFA_ContentLayoutItem* pLayoutRow, - const CFX_ArrayTemplate<FX_FLOAT>& rgSpecifiedColumnWidths, + const CFX_ArrayTemplate<float>& rgSpecifiedColumnWidths, XFA_ATTRIBUTEENUM eLayout) { bool bContainerWidthAutoSize = true; bool bContainerHeightAutoSize = true; @@ -156,10 +156,10 @@ void RelocateTableRowCells( &bContainerHeightAutoSize); CXFA_Node* pMarginNode = pLayoutRow->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); - FX_FLOAT fLeftInset = 0; - FX_FLOAT fTopInset = 0; - FX_FLOAT fRightInset = 0; - FX_FLOAT fBottomInset = 0; + float fLeftInset = 0; + float fTopInset = 0; + float fRightInset = 0; + float fBottomInset = 0; if (pMarginNode) { fLeftInset = pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); @@ -171,14 +171,14 @@ void RelocateTableRowCells( pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); } - FX_FLOAT fContentWidthLimit = + float fContentWidthLimit = bContainerWidthAutoSize ? FLT_MAX : containerSize.width - fLeftInset - fRightInset; - FX_FLOAT fContentCurrentHeight = + float fContentCurrentHeight = pLayoutRow->m_sSize.height - fTopInset - fBottomInset; - FX_FLOAT fContentCalculatedWidth = 0; - FX_FLOAT fContentCalculatedHeight = 0; - FX_FLOAT fCurrentColX = 0; + float fContentCalculatedWidth = 0; + float fContentCalculatedHeight = 0; + float fCurrentColX = 0; int32_t nCurrentColIdx = 0; bool bMetWholeRowCell = false; @@ -189,7 +189,7 @@ void RelocateTableRowCells( int32_t nOriginalColSpan = pLayoutChild->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan); int32_t nColSpan = nOriginalColSpan; - FX_FLOAT fColSpanWidth = 0; + float fColSpanWidth = 0; if (nColSpan == -1 || nCurrentColIdx + nColSpan > rgSpecifiedColumnWidths.GetSize()) { nColSpan = rgSpecifiedColumnWidths.GetSize() - nCurrentColIdx; @@ -212,7 +212,7 @@ void RelocateTableRowCells( fCurrentColX += fColSpanWidth; nCurrentColIdx += nColSpan; - FX_FLOAT fNewHeight = bContainerHeightAutoSize ? -1 : fContentCurrentHeight; + float fNewHeight = bContainerHeightAutoSize ? -1 : fContentCurrentHeight; UpdateWidgetSize(pLayoutChild, &fColSpanWidth, &fNewHeight); pLayoutChild->m_sSize.height = fNewHeight; if (bContainerHeightAutoSize) { @@ -228,12 +228,12 @@ void RelocateTableRowCells( pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { UpdateWidgetSize(pLayoutChild, &pLayoutChild->m_sSize.width, &fContentCalculatedHeight); - FX_FLOAT fOldChildHeight = pLayoutChild->m_sSize.height; + float fOldChildHeight = pLayoutChild->m_sSize.height; pLayoutChild->m_sSize.height = fContentCalculatedHeight; CXFA_Node* pParaNode = pLayoutChild->m_pFormNode->GetFirstChildByClass(XFA_Element::Para); if (pParaNode && pLayoutChild->m_pFirstChild) { - FX_FLOAT fOffHeight = fContentCalculatedHeight - fOldChildHeight; + float fOffHeight = fContentCalculatedHeight - fOldChildHeight; XFA_ATTRIBUTEENUM eVType = pParaNode->GetEnum(XFA_ATTRIBUTE_VAlign); switch (eVType) { case XFA_ATTRIBUTEENUM_Middle: @@ -260,7 +260,7 @@ void RelocateTableRowCells( } if (bContainerWidthAutoSize) { - FX_FLOAT fChildSuppliedWidth = fCurrentColX; + float fChildSuppliedWidth = fCurrentColX; if (fContentWidthLimit < FLT_MAX && fContentWidthLimit > fChildSuppliedWidth) { fChildSuppliedWidth = fContentWidthLimit; @@ -303,15 +303,15 @@ void UpdatePendingItemLayout(CXFA_ItemLayoutProcessor* pProcessor, } void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, - FX_FLOAT fSplitPos, + float fSplitPos, CXFA_ContentLayoutItem* pTrailerLayoutItem, bool bUseInherited) { if (!pTrailerLayoutItem) return; - FX_FLOAT fHeight = pTrailerLayoutItem->m_sSize.height; + float fHeight = pTrailerLayoutItem->m_sSize.height; if (bUseInherited) { - FX_FLOAT fNewSplitPos = 0; + float fNewSplitPos = 0; if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION) fNewSplitPos = pProcessor->FindSplitPos(fSplitPos - fHeight); if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION) @@ -322,10 +322,10 @@ void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, UpdatePendingItemLayout(pProcessor, pTrailerLayoutItem); CXFA_Node* pMarginNode = pProcessor->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); - FX_FLOAT fLeftInset = 0; - FX_FLOAT fTopInset = 0; - FX_FLOAT fRightInset = 0; - FX_FLOAT fBottomInset = 0; + float fLeftInset = 0; + float fTopInset = 0; + float fRightInset = 0; + float fBottomInset = 0; if (pMarginNode) { fLeftInset = pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); @@ -346,7 +346,7 @@ void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, return; } - FX_FLOAT fNewSplitPos = 0; + float fNewSplitPos = 0; if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION) fNewSplitPos = pProcessor->FindSplitPos(fSplitPos - fHeight); @@ -384,8 +384,8 @@ void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor, CXFA_Node* pMarginNode = pProcessor->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); - FX_FLOAT fLeftInset = 0; - FX_FLOAT fRightInset = 0; + float fLeftInset = 0; + float fRightInset = 0; if (pMarginNode) { fLeftInset = pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); @@ -393,7 +393,7 @@ void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor, pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); } - FX_FLOAT fHeight = pLeaderLayoutItem->m_sSize.height; + float fHeight = pLeaderLayoutItem->m_sSize.height; for (CXFA_ContentLayoutItem* pChildItem = (CXFA_ContentLayoutItem*)pProcessor->m_pLayoutItem->m_pFirstChild; pChildItem; @@ -430,9 +430,9 @@ void AddPendingNode(CXFA_ItemLayoutProcessor* pProcessor, pProcessor->m_bBreakPending = bBreakPending; } -FX_FLOAT InsertPendingItems(CXFA_ItemLayoutProcessor* pProcessor, - CXFA_Node* pCurChildNode) { - FX_FLOAT fTotalHeight = 0; +float InsertPendingItems(CXFA_ItemLayoutProcessor* pProcessor, + CXFA_Node* pCurChildNode) { + float fTotalHeight = 0; if (pProcessor->m_PendingNodes.empty()) return fTotalHeight; @@ -605,17 +605,17 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( CXFA_ItemLayoutProcessor* pProcessor, bool bContainerWidthAutoSize, bool bContainerHeightAutoSize, - FX_FLOAT fContainerHeight, + float fContainerHeight, XFA_ATTRIBUTEENUM eFlowStrategy, uint8_t* uCurHAlignState, CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3], bool bUseBreakControl, - FX_FLOAT fAvailHeight, - FX_FLOAT fRealHeight, - FX_FLOAT fContentWidthLimit, - FX_FLOAT* fContentCurRowY, - FX_FLOAT* fContentCurRowAvailWidth, - FX_FLOAT* fContentCurRowHeight, + float fAvailHeight, + float fRealHeight, + float fContentWidthLimit, + float* fContentCurRowY, + float* fContentCurRowAvailWidth, + float* fContentCurRowHeight, bool* bAddedItemInRow, bool* bForceEndPage, CXFA_LayoutContext* pLayoutContext, @@ -808,8 +808,7 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( } *bForceEndPage = true; - FX_FLOAT fSplitPos = - pProcessor->FindSplitPos(fAvailHeight - *fContentCurRowY); + float fSplitPos = pProcessor->FindSplitPos(fAvailHeight - *fContentCurRowY); if (fSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { XFA_ATTRIBUTEENUM eLayout = pProcessor->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); @@ -940,8 +939,8 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( } bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem, - FX_FLOAT fCurVerticalOffset, - FX_FLOAT* fProposedSplitPos, + float fCurVerticalOffset, + float* fProposedSplitPos, bool* bAppChange, bool bCalculateMargin) { CXFA_Node* pFormNode = pLayoutItem->m_pFormNode; @@ -956,7 +955,7 @@ bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem, bool bAnyChanged = false; CXFA_Document* pDocument = pFormNode->GetDocument(); CXFA_FFNotify* pNotify = pDocument->GetNotify(); - FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0; + float fCurTopMargin = 0, fCurBottomMargin = 0; CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_Element::Margin); if (pMarginNode && bCalculateMargin) { @@ -969,7 +968,7 @@ bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem, while (bChanged) { bChanged = false; { - FX_FLOAT fRelSplitPos = *fProposedSplitPos - fCurVerticalOffset; + float fRelSplitPos = *fProposedSplitPos - fCurVerticalOffset; if (pNotify->FindSplitPos(pFormNode, pLayoutItem->GetIndex(), fRelSplitPos)) { bAnyChanged = true; @@ -982,12 +981,12 @@ bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem, } } } - FX_FLOAT fRelSplitPos = *fProposedSplitPos - fCurBottomMargin; + float fRelSplitPos = *fProposedSplitPos - fCurBottomMargin; for (CXFA_ContentLayoutItem* pChildItem = (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; pChildItem; pChildItem = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) { - FX_FLOAT fChildOffset = + float fChildOffset = fCurVerticalOffset + fCurTopMargin + pChildItem->m_sPos.y; bool bChange = false; if (FindLayoutItemSplitPos(pChildItem, fChildOffset, &fRelSplitPos, @@ -1149,7 +1148,7 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( return pLayoutItem; } -FX_FLOAT CXFA_ItemLayoutProcessor::FindSplitPos(FX_FLOAT fProposedSplitPos) { +float CXFA_ItemLayoutProcessor::FindSplitPos(float fProposedSplitPos) { ASSERT(m_pLayoutItem); XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); bool bCalculateMargin = eLayout != XFA_ATTRIBUTEENUM_Position; @@ -1166,8 +1165,8 @@ FX_FLOAT CXFA_ItemLayoutProcessor::FindSplitPos(FX_FLOAT fProposedSplitPos) { void CXFA_ItemLayoutProcessor::SplitLayoutItem( CXFA_ContentLayoutItem* pLayoutItem, CXFA_ContentLayoutItem* pSecondParent, - FX_FLOAT fSplitPos) { - FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0; + float fSplitPos) { + float fCurTopMargin = 0, fCurBottomMargin = 0; XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); bool bCalculateMargin = true; if (eLayout == XFA_ATTRIBUTEENUM_Position) @@ -1218,9 +1217,9 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( CXFA_ContentLayoutItem* pChildren = (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; pLayoutItem->m_pFirstChild = nullptr; - FX_FLOAT lHeightForKeep = 0; + float lHeightForKeep = 0; CFX_ArrayTemplate<CXFA_ContentLayoutItem*> keepLayoutItems; - FX_FLOAT fAddMarginHeight = 0; + float fAddMarginHeight = 0; for (CXFA_ContentLayoutItem *pChildItem = pChildren, *pChildNext = nullptr; pChildItem; pChildItem = pChildNext) { pChildNext = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling; @@ -1273,7 +1272,7 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( continue; } - FX_FLOAT fOldHeight = pSecondLayoutItem->m_sSize.height; + float fOldHeight = pSecondLayoutItem->m_sSize.height; SplitLayoutItem( pChildItem, pSecondLayoutItem, fSplitPos - fCurTopMargin - fCurBottomMargin - pChildItem->m_sPos.y); @@ -1282,7 +1281,7 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( } } -void CXFA_ItemLayoutProcessor::SplitLayoutItem(FX_FLOAT fSplitPos) { +void CXFA_ItemLayoutProcessor::SplitLayoutItem(float fSplitPos) { ASSERT(m_pLayoutItem); SplitLayoutItem(m_pLayoutItem, nullptr, fSplitPos); } @@ -1624,10 +1623,10 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( CFX_SizeF containerSize = CalculateContainerSpecifiedSize( m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize); - FX_FLOAT fContentCalculatedWidth = 0; - FX_FLOAT fContentCalculatedHeight = 0; - FX_FLOAT fHiddenContentCalculatedWidth = 0; - FX_FLOAT fHiddenContentCalculatedHeight = 0; + float fContentCalculatedWidth = 0; + float fContentCalculatedHeight = 0; + float fHiddenContentCalculatedWidth = 0; + float fHiddenContentCalculatedHeight = 0; if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, false); @@ -1678,7 +1677,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( pProcessor->SetCurrentComponentPos(absolutePos); if (bContainerWidthAutoSize) { - FX_FLOAT fChildSuppliedWidth = absolutePos.x + size.width; + float fChildSuppliedWidth = absolutePos.x + size.width; if (bChangeParentSize) { fContentCalculatedWidth = std::max(fContentCalculatedWidth, fChildSuppliedWidth); @@ -1691,7 +1690,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( } if (bContainerHeightAutoSize) { - FX_FLOAT fChildSuppliedHeight = absolutePos.y + size.height; + float fChildSuppliedHeight = absolutePos.y + size.height; if (bChangeParentSize) { fContentCalculatedHeight = std::max(fContentCalculatedHeight, fChildSuppliedHeight); @@ -1730,12 +1729,12 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { bool bContainerHeightAutoSize = true; CFX_SizeF containerSize = CalculateContainerSpecifiedSize( m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize); - FX_FLOAT fContentCalculatedWidth = 0; - FX_FLOAT fContentCalculatedHeight = 0; + float fContentCalculatedWidth = 0; + float fContentCalculatedHeight = 0; CXFA_Node* pMarginNode = m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); - FX_FLOAT fLeftInset = 0; - FX_FLOAT fRightInset = 0; + float fLeftInset = 0; + float fRightInset = 0; if (pMarginNode) { fLeftInset = pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); @@ -1743,7 +1742,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); } - FX_FLOAT fContentWidthLimit = + float fContentWidthLimit = bContainerWidthAutoSize ? FLT_MAX : containerSize.width - fLeftInset - fRightInset; CFX_WideStringC wsColumnWidths; @@ -1791,7 +1790,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { { CFX_ArrayTemplate<CXFA_ContentLayoutItem*> rgRowItems; CFX_ArrayTemplate<int32_t> rgRowItemsSpan; - CFX_ArrayTemplate<FX_FLOAT> rgRowItemsWidth; + CFX_ArrayTemplate<float> rgRowItemsWidth; for (CXFA_ContentLayoutItem* pLayoutChild = (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; pLayoutChild; @@ -1864,7 +1863,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { if (!bMoreColumns) continue; - FX_FLOAT fFinalColumnWidth = 0.0f; + float fFinalColumnWidth = 0.0f; if (iColCount < m_rgSpecifiedColumnWidths.GetSize()) fFinalColumnWidth = m_rgSpecifiedColumnWidths[iColCount]; for (int32_t i = 0; i < iRowCount; ++i) { @@ -1877,7 +1876,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { } } - FX_FLOAT fCurrentRowY = 0; + float fCurrentRowY = 0; for (CXFA_ContentLayoutItem* pLayoutChild = (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; pLayoutChild; @@ -1916,7 +1915,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { } if (bContainerWidthAutoSize) { - FX_FLOAT fChildSuppliedWidth = + float fChildSuppliedWidth = pLayoutChild->m_sPos.x + pLayoutChild->m_sSize.width; if (fContentWidthLimit < FLT_MAX && fContentWidthLimit > fChildSuppliedWidth) { @@ -1942,12 +1941,12 @@ bool CXFA_ItemLayoutProcessor::IsAddNewRowForTrailer( if (!pTrailerItem) return false; - FX_FLOAT fWidth = pTrailerItem->m_sSize.width; + float fWidth = pTrailerItem->m_sSize.width; XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); return eLayout == XFA_ATTRIBUTEENUM_Tb || m_fWidthLimite <= fWidth; } -FX_FLOAT CXFA_ItemLayoutProcessor::InsertKeepLayoutItems() { +float CXFA_ItemLayoutProcessor::InsertKeepLayoutItems() { if (m_arrayKeepItems.empty()) return 0; @@ -1956,7 +1955,7 @@ FX_FLOAT CXFA_ItemLayoutProcessor::InsertKeepLayoutItems() { m_pLayoutItem->m_sSize.clear(); } - FX_FLOAT fTotalHeight = 0; + float fTotalHeight = 0; for (auto iter = m_arrayKeepItems.rbegin(); iter != m_arrayKeepItems.rend(); iter++) { AddLeaderAfterSplit(this, *iter); @@ -1972,9 +1971,9 @@ bool CXFA_ItemLayoutProcessor::ProcessKeepForSplit( CXFA_ItemLayoutProcessor* pChildProcessor, XFA_ItemLayoutProcessorResult eRetValue, CFX_ArrayTemplate<CXFA_ContentLayoutItem*>* rgCurLineLayoutItem, - FX_FLOAT* fContentCurRowAvailWidth, - FX_FLOAT* fContentCurRowHeight, - FX_FLOAT* fContentCurRowY, + float* fContentCurRowAvailWidth, + float* fContentCurRowHeight, + float* fContentCurRowY, bool* bAddedItemInRow, bool* bForceEndPage, XFA_ItemLayoutProcessorResult* result) { @@ -2017,12 +2016,12 @@ bool CXFA_ItemLayoutProcessor::ProcessKeepForSplit( bool CXFA_ItemLayoutProcessor::JudgePutNextPage( CXFA_ContentLayoutItem* pParentLayoutItem, - FX_FLOAT fChildHeight, + float fChildHeight, std::vector<CXFA_ContentLayoutItem*>* pKeepItems) { if (!pParentLayoutItem) return false; - FX_FLOAT fItemsHeight = 0; + float fItemsHeight = 0; for (CXFA_ContentLayoutItem* pChildLayoutItem = (CXFA_ContentLayoutItem*)pParentLayoutItem->m_pFirstChild; pChildLayoutItem; @@ -2084,8 +2083,8 @@ void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( bool bUseBreakControl, XFA_ATTRIBUTEENUM eFlowStrategy, - FX_FLOAT fHeightLimit, - FX_FLOAT fRealHeight, + float fHeightLimit, + float fRealHeight, CXFA_LayoutContext* pContext, bool bRootForceTb) { m_bHasAvailHeight = true; @@ -2126,10 +2125,10 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( CXFA_Node* pMarginNode = m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); - FX_FLOAT fLeftInset = 0; - FX_FLOAT fTopInset = 0; - FX_FLOAT fRightInset = 0; - FX_FLOAT fBottomInset = 0; + float fLeftInset = 0; + float fTopInset = 0; + float fRightInset = 0; + float fBottomInset = 0; if (pMarginNode) { fLeftInset = pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); @@ -2140,17 +2139,17 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( fBottomInset = pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); } - FX_FLOAT fContentWidthLimit = + float fContentWidthLimit = bContainerWidthAutoSize ? FLT_MAX : containerSize.width - fLeftInset - fRightInset; - FX_FLOAT fContentCalculatedWidth = 0; - FX_FLOAT fContentCalculatedHeight = 0; - FX_FLOAT fAvailHeight = fHeightLimit - fTopInset - fBottomInset; + float fContentCalculatedWidth = 0; + float fContentCalculatedHeight = 0; + float fAvailHeight = fHeightLimit - fTopInset - fBottomInset; if (fAvailHeight < 0) m_bHasAvailHeight = false; fRealHeight = fRealHeight - fTopInset - fBottomInset; - FX_FLOAT fContentCurRowY = 0; + float fContentCurRowY = 0; CXFA_ContentLayoutItem* pLayoutChild = nullptr; if (m_pLayoutItem) { if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done && @@ -2202,8 +2201,8 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( } while (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done) { - FX_FLOAT fContentCurRowHeight = 0; - FX_FLOAT fContentCurRowAvailWidth = fContentWidthLimit; + float fContentCurRowHeight = 0; + float fContentCurRowAvailWidth = fContentWidthLimit; m_fWidthLimite = fContentCurRowAvailWidth; CFX_ArrayTemplate<CXFA_ContentLayoutItem*> rgCurLineLayoutItems[3]; uint8_t uCurHAlignState = @@ -2535,14 +2534,14 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( XFA_ATTRIBUTEENUM eFlowStrategy, bool bContainerHeightAutoSize, bool bContainerWidthAutoSize, - FX_FLOAT* fContentCalculatedWidth, - FX_FLOAT* fContentCalculatedHeight, - FX_FLOAT* fContentCurRowY, - FX_FLOAT fContentCurRowHeight, - FX_FLOAT fContentWidthLimit, + float* fContentCalculatedWidth, + float* fContentCalculatedHeight, + float* fContentCurRowY, + float fContentCurRowHeight, + float fContentWidthLimit, bool bRootForceTb) { int32_t nGroupLengths[3] = {0, 0, 0}; - FX_FLOAT fGroupWidths[3] = {0, 0, 0}; + float fGroupWidths[3] = {0, 0, 0}; int32_t nTotalLength = 0; for (int32_t i = 0; i < 3; i++) { nGroupLengths[i] = rgCurLineLayoutItems[i].GetSize(); @@ -2567,7 +2566,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); if (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb) { - FX_FLOAT fCurPos; + float fCurPos; fCurPos = 0; for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) { if (bRootForceTb) { @@ -2622,7 +2621,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( m_fLastRowWidth = fCurPos; } } else { - FX_FLOAT fCurPos; + float fCurPos; fCurPos = fGroupWidths[0]; for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) { if (XFA_ItemLayoutProcessor_IsTakingSpace( @@ -2662,7 +2661,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( m_fLastRowY = *fContentCurRowY; *fContentCurRowY += fContentCurRowHeight; if (bContainerWidthAutoSize) { - FX_FLOAT fChildSuppliedWidth = fGroupWidths[0]; + float fChildSuppliedWidth = fGroupWidths[0]; if (fContentWidthLimit < FLT_MAX && fContentWidthLimit > fChildSuppliedWidth) { fChildSuppliedWidth = fContentWidthLimit; @@ -2715,8 +2714,8 @@ void CXFA_ItemLayoutProcessor::DoLayoutField() { XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout( bool bUseBreakControl, - FX_FLOAT fHeightLimit, - FX_FLOAT fRealHeight, + float fHeightLimit, + float fRealHeight, CXFA_LayoutContext* pContext) { switch (m_pFormNode->GetElementType()) { case XFA_Element::Subform: diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.h b/xfa/fxfa/parser/xfa_layout_itemlayout.h index d411bf0e9f..7b19283b9b 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.h +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.h @@ -56,8 +56,8 @@ class CXFA_LayoutContext { m_pOverflowNode(nullptr) {} ~CXFA_LayoutContext() {} - CFX_ArrayTemplate<FX_FLOAT>* m_prgSpecifiedColumnWidths; - FX_FLOAT m_fCurColumnWidth; + CFX_ArrayTemplate<float>* m_prgSpecifiedColumnWidths; + float m_fCurColumnWidth; bool m_bCurColumnWidthAvaiable; CXFA_ItemLayoutProcessor* m_pOverflowProcessor; CXFA_Node* m_pOverflowNode; @@ -75,8 +75,8 @@ class CXFA_ItemLayoutProcessor { ~CXFA_ItemLayoutProcessor(); XFA_ItemLayoutProcessorResult DoLayout(bool bUseBreakControl, - FX_FLOAT fHeightLimit, - FX_FLOAT fRealHeight, + float fHeightLimit, + float fRealHeight, CXFA_LayoutContext* pContext); void DoLayoutPageArea(CXFA_ContainerLayoutItem* pPageAreaLayoutItem); @@ -84,18 +84,18 @@ class CXFA_ItemLayoutProcessor { CXFA_Node* GetFormNode() { return m_pFormNode; } bool HasLayoutItem() const { return !!m_pLayoutItem; } CXFA_ContentLayoutItem* ExtractLayoutItem(); - void SplitLayoutItem(FX_FLOAT fSplitPos); + void SplitLayoutItem(float fSplitPos); - FX_FLOAT FindSplitPos(FX_FLOAT fProposedSplitPos); + float FindSplitPos(float fProposedSplitPos); bool ProcessKeepForSplit( CXFA_ItemLayoutProcessor* pParentProcessor, CXFA_ItemLayoutProcessor* pChildProcessor, XFA_ItemLayoutProcessorResult eRetValue, CFX_ArrayTemplate<CXFA_ContentLayoutItem*>* rgCurLineLayoutItem, - FX_FLOAT* fContentCurRowAvailWidth, - FX_FLOAT* fContentCurRowHeight, - FX_FLOAT* fContentCurRowY, + float* fContentCurRowAvailWidth, + float* fContentCurRowHeight, + float* fContentCurRowY, bool* bAddedItemInRow, bool* bForceEndPage, XFA_ItemLayoutProcessorResult* result); @@ -111,14 +111,14 @@ class CXFA_ItemLayoutProcessor { CXFA_Node* m_pFormNode; CXFA_ContentLayoutItem* m_pLayoutItem; CXFA_Node* m_pCurChildNode; - FX_FLOAT m_fUsedSize; + float m_fUsedSize; CXFA_LayoutPageMgr* m_pPageMgr; std::list<CXFA_Node*> m_PendingNodes; bool m_bBreakPending; - CFX_ArrayTemplate<FX_FLOAT> m_rgSpecifiedColumnWidths; + CFX_ArrayTemplate<float> m_rgSpecifiedColumnWidths; std::vector<CXFA_ContentLayoutItem*> m_arrayKeepItems; - FX_FLOAT m_fLastRowWidth; - FX_FLOAT m_fLastRowY; + float m_fLastRowWidth; + float m_fLastRowY; bool m_bUseInheriated; XFA_ItemLayoutProcessorResult m_ePreProcessRs; @@ -128,22 +128,22 @@ class CXFA_ItemLayoutProcessor { void SplitLayoutItem(CXFA_ContentLayoutItem* pLayoutItem, CXFA_ContentLayoutItem* pSecondParent, - FX_FLOAT fSplitPos); - FX_FLOAT InsertKeepLayoutItems(); + float fSplitPos); + float InsertKeepLayoutItems(); bool CalculateRowChildPosition( CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3], XFA_ATTRIBUTEENUM eFlowStrategy, bool bContainerHeightAutoSize, bool bContainerWidthAutoSize, - FX_FLOAT* fContentCalculatedWidth, - FX_FLOAT* fContentCalculatedHeight, - FX_FLOAT* fContentCurRowY, - FX_FLOAT fContentCurRowHeight, - FX_FLOAT fContentWidthLimit, + float* fContentCalculatedWidth, + float* fContentCalculatedHeight, + float* fContentCurRowY, + float fContentCurRowHeight, + float fContentWidthLimit, bool bRootForceTb); void ProcessUnUseBinds(CXFA_Node* pFormNode); bool JudgePutNextPage(CXFA_ContentLayoutItem* pParentLayoutItem, - FX_FLOAT fChildHeight, + float fChildHeight, std::vector<CXFA_ContentLayoutItem*>* pKeepItems); void DoLayoutPositionedContainer(CXFA_LayoutContext* pContext); @@ -151,8 +151,8 @@ class CXFA_ItemLayoutProcessor { XFA_ItemLayoutProcessorResult DoLayoutFlowedContainer( bool bUseBreakControl, XFA_ATTRIBUTEENUM eFlowStrategy, - FX_FLOAT fHeightLimit, - FX_FLOAT fRealHeight, + float fHeightLimit, + float fRealHeight, CXFA_LayoutContext* pContext, bool bRootForceTb); void DoLayoutField(); @@ -181,7 +181,7 @@ class CXFA_ItemLayoutProcessor { CXFA_ItemLayoutProcessor* m_pCurChildPreprocessor; XFA_ItemLayoutProcessorStages m_nCurChildNodeStage; std::map<CXFA_Node*, int32_t> m_PendingNodesCount; - FX_FLOAT m_fWidthLimite; + float m_fWidthLimite; bool m_bHasAvailHeight; }; diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp index b011f0fdad..b86ab90f19 100644 --- a/xfa/fxfa/parser/xfa_localevalue.cpp +++ b/xfa/fxfa/parser/xfa_localevalue.cpp @@ -210,7 +210,7 @@ CFX_WideString CXFA_LocaleValue::GetText() const { } return CFX_WideString(); } -FX_FLOAT CXFA_LocaleValue::GetNum() const { +float CXFA_LocaleValue::GetNum() const { if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER || m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) { int64_t nIntegral = 0; @@ -277,10 +277,10 @@ FX_FLOAT CXFA_LocaleValue::GetNum() const { } nExponent = bExpSign ? -nExponent : nExponent; } - FX_FLOAT fValue = (FX_FLOAT)(dwFractional / 4294967296.0); + float fValue = (float)(dwFractional / 4294967296.0); fValue = nIntegral + (nIntegral >= 0 ? fValue : -fValue); if (nExponent != 0) { - fValue *= FXSYS_pow(10, (FX_FLOAT)nExponent); + fValue *= FXSYS_pow(10, (float)nExponent); } return fValue; } @@ -356,7 +356,7 @@ double CXFA_LocaleValue::GetDoubleNum() const { double dValue = (dwFractional / 4294967296.0); dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue); if (nExponent != 0) { - dValue *= FXSYS_pow(10, (FX_FLOAT)nExponent); + dValue *= FXSYS_pow(10, (float)nExponent); } return dValue; } @@ -404,7 +404,7 @@ bool CXFA_LocaleValue::SetText(const CFX_WideString& wsText, m_dwType = XFA_VT_TEXT; return m_bValid = ParsePatternValue(wsText, wsFormat, pLocale); } -bool CXFA_LocaleValue::SetNum(FX_FLOAT fNum) { +bool CXFA_LocaleValue::SetNum(float fNum) { m_dwType = XFA_VT_FLOAT; m_wsValue.Format(L"%.8g", (double)fNum); return true; diff --git a/xfa/fxfa/parser/xfa_localevalue.h b/xfa/fxfa/parser/xfa_localevalue.h index 084f63cb6e..a239fa7609 100644 --- a/xfa/fxfa/parser/xfa_localevalue.h +++ b/xfa/fxfa/parser/xfa_localevalue.h @@ -70,7 +70,7 @@ class CXFA_LocaleValue { uint32_t GetType() const; void SetValue(const CFX_WideString& wsValue, uint32_t dwType); CFX_WideString GetText() const; - FX_FLOAT GetNum() const; + float GetNum() const; double GetDoubleNum() const; CFX_Unitime GetDate() const; CFX_Unitime GetTime() const; @@ -79,7 +79,7 @@ class CXFA_LocaleValue { bool SetText(const CFX_WideString& wsText, const CFX_WideString& wsFormat, IFX_Locale* pLocale); - bool SetNum(FX_FLOAT fNum); + bool SetNum(float fNum); bool SetNum(const CFX_WideString& wsNum, const CFX_WideString& wsFormat, IFX_Locale* pLocale); diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp index c41902676d..101a6cf90e 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -109,7 +109,7 @@ double WideStringToDouble(const CFX_WideString& wsStringVal) { double dValue = (dwFractional / 4294967296.0); dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue); if (nExponent != 0) { - dValue *= FXSYS_pow(10, (FX_FLOAT)nExponent); + dValue *= FXSYS_pow(10, (float)nExponent); } return dValue; } diff --git a/xfa/fxfa/xfa_ffwidget.h b/xfa/fxfa/xfa_ffwidget.h index 5345bc451e..7b923506ff 100644 --- a/xfa/fxfa/xfa_ffwidget.h +++ b/xfa/fxfa/xfa_ffwidget.h @@ -21,7 +21,7 @@ class CXFA_FFDoc; class CXFA_FFApp; enum class FWL_WidgetHit; -inline FX_FLOAT XFA_UnitPx2Pt(FX_FLOAT fPx, FX_FLOAT fDpi) { +inline float XFA_UnitPx2Pt(float fPx, float fDpi) { return fPx * 72.0f / fDpi; } diff --git a/xfa/fxfa/xfa_ffwidgethandler.h b/xfa/fxfa/xfa_ffwidgethandler.h index 66bda3e02a..01bdd66786 100644 --- a/xfa/fxfa/xfa_ffwidgethandler.h +++ b/xfa/fxfa/xfa_ffwidgethandler.h @@ -108,7 +108,7 @@ class CXFA_FFWidgetHandler { CXFA_Node* CreateFontNode(CXFA_Node* pParent) const; CXFA_Node* CreateMarginNode(CXFA_Node* pParent, uint32_t dwFlags, - FX_FLOAT fInsets[4]) const; + float fInsets[4]) const; CXFA_Node* CreateValueNode(XFA_Element eValue, CXFA_Node* pParent) const; CXFA_Document* GetObjFactory() const; CXFA_Document* GetXFADoc() const; diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cfx_graphics.cpp index d2f2151d91..48d8f6f80f 100644 --- a/xfa/fxgraphics/cfx_graphics.cpp +++ b/xfa/fxgraphics/cfx_graphics.cpp @@ -134,15 +134,15 @@ void CFX_Graphics::SetLineCap(CFX_GraphStateData::LineCap lineCap) { } } -void CFX_Graphics::SetLineDash(FX_FLOAT dashPhase, - FX_FLOAT* dashArray, +void CFX_Graphics::SetLineDash(float dashPhase, + float* dashArray, int32_t dashCount) { if (dashCount > 0 && !dashArray) return; dashCount = dashCount < 0 ? 0 : dashCount; if (m_type == FX_CONTEXT_Device && m_renderDevice) { - FX_FLOAT scale = 1.0; + float scale = 1.0; if (m_info.isActOnDash) { scale = m_info.graphState.m_LineWidth; } @@ -159,7 +159,7 @@ void CFX_Graphics::SetLineDash(FX_DashStyle dashStyle) { RenderDeviceSetLineDash(dashStyle); } -void CFX_Graphics::SetLineWidth(FX_FLOAT lineWidth, bool isActOnDash) { +void CFX_Graphics::SetLineWidth(float lineWidth, bool isActOnDash) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.graphState.m_LineWidth = lineWidth; m_info.isActOnDash = isActOnDash; @@ -226,7 +226,7 @@ CFX_RectF CFX_Graphics::GetClipRect() const { return CFX_RectF(); FX_RECT r = m_renderDevice->GetClipBox(); - return CFX_Rect(r.left, r.top, r.Width(), r.Height()).As<FX_FLOAT>(); + return CFX_Rect(r.left, r.top, r.Width(), r.Height()).As<float>(); } void CFX_Graphics::SetClipRect(const CFX_RectF& rect) { @@ -248,22 +248,22 @@ void CFX_Graphics::RenderDeviceSetLineDash(FX_DashStyle dashStyle) { return; } case FX_DASHSTYLE_Dash: { - FX_FLOAT dashArray[] = {3, 1}; + float dashArray[] = {3, 1}; SetLineDash(0, dashArray, 2); return; } case FX_DASHSTYLE_Dot: { - FX_FLOAT dashArray[] = {1, 1}; + float dashArray[] = {1, 1}; SetLineDash(0, dashArray, 2); return; } case FX_DASHSTYLE_DashDot: { - FX_FLOAT dashArray[] = {3, 1, 1, 1}; + float dashArray[] = {3, 1, 1, 1}; SetLineDash(0, dashArray, 4); return; } case FX_DASHSTYLE_DashDotDot: { - FX_FLOAT dashArray[] = {4, 1, 2, 1, 2, 1}; + float dashArray[] = {4, 1, 2, 1, 2, 1}; SetLineDash(0, dashArray, 6); return; } @@ -388,10 +388,10 @@ void CFX_Graphics::FillPathWithShading(CFX_Path* path, CFX_DIBitmap* bitmap = m_renderDevice->GetBitmap(); int32_t width = bitmap->GetWidth(); int32_t height = bitmap->GetHeight(); - FX_FLOAT start_x = m_info.fillColor->m_shading->m_beginPoint.x; - FX_FLOAT start_y = m_info.fillColor->m_shading->m_beginPoint.y; - FX_FLOAT end_x = m_info.fillColor->m_shading->m_endPoint.x; - FX_FLOAT end_y = m_info.fillColor->m_shading->m_endPoint.y; + float start_x = m_info.fillColor->m_shading->m_beginPoint.x; + float start_y = m_info.fillColor->m_shading->m_beginPoint.y; + float end_x = m_info.fillColor->m_shading->m_endPoint.x; + float end_y = m_info.fillColor->m_shading->m_endPoint.y; CFX_DIBitmap bmp; bmp.Create(width, height, FXDIB_Argb); m_renderDevice->GetDIBits(&bmp, 0, 0); @@ -399,17 +399,16 @@ void CFX_Graphics::FillPathWithShading(CFX_Path* path, bool result = false; switch (m_info.fillColor->m_shading->m_type) { case FX_SHADING_Axial: { - FX_FLOAT x_span = end_x - start_x; - FX_FLOAT y_span = end_y - start_y; - FX_FLOAT axis_len_square = (x_span * x_span) + (y_span * y_span); + float x_span = end_x - start_x; + float y_span = end_y - start_y; + float axis_len_square = (x_span * x_span) + (y_span * y_span); for (int32_t row = 0; row < height; row++) { uint32_t* dib_buf = (uint32_t*)(bmp.GetBuffer() + row * pitch); for (int32_t column = 0; column < width; column++) { - FX_FLOAT x = (FX_FLOAT)(column); - FX_FLOAT y = (FX_FLOAT)(row); - FX_FLOAT scale = - (((x - start_x) * x_span) + ((y - start_y) * y_span)) / - axis_len_square; + float x = (float)(column); + float y = (float)(row); + float scale = (((x - start_x) * x_span) + ((y - start_y) * y_span)) / + axis_len_square; if (scale < 0) { if (!m_info.fillColor->m_shading->m_isExtendedBegin) { continue; @@ -429,31 +428,31 @@ void CFX_Graphics::FillPathWithShading(CFX_Path* path, break; } case FX_SHADING_Radial: { - FX_FLOAT start_r = m_info.fillColor->m_shading->m_beginRadius; - FX_FLOAT end_r = m_info.fillColor->m_shading->m_endRadius; - FX_FLOAT a = ((start_x - end_x) * (start_x - end_x)) + - ((start_y - end_y) * (start_y - end_y)) - - ((start_r - end_r) * (start_r - end_r)); + float start_r = m_info.fillColor->m_shading->m_beginRadius; + float end_r = m_info.fillColor->m_shading->m_endRadius; + float a = ((start_x - end_x) * (start_x - end_x)) + + ((start_y - end_y) * (start_y - end_y)) - + ((start_r - end_r) * (start_r - end_r)); for (int32_t row = 0; row < height; row++) { uint32_t* dib_buf = (uint32_t*)(bmp.GetBuffer() + row * pitch); for (int32_t column = 0; column < width; column++) { - FX_FLOAT x = (FX_FLOAT)(column); - FX_FLOAT y = (FX_FLOAT)(row); - FX_FLOAT b = -2 * (((x - start_x) * (end_x - start_x)) + - ((y - start_y) * (end_y - start_y)) + - (start_r * (end_r - start_r))); - FX_FLOAT c = ((x - start_x) * (x - start_x)) + - ((y - start_y) * (y - start_y)) - (start_r * start_r); - FX_FLOAT s; + float x = (float)(column); + float y = (float)(row); + float b = -2 * (((x - start_x) * (end_x - start_x)) + + ((y - start_y) * (end_y - start_y)) + + (start_r * (end_r - start_r))); + float c = ((x - start_x) * (x - start_x)) + + ((y - start_y) * (y - start_y)) - (start_r * start_r); + float s; if (a == 0) { s = -c / b; } else { - FX_FLOAT b2_4ac = (b * b) - 4 * (a * c); + float b2_4ac = (b * b) - 4 * (a * c); if (b2_4ac < 0) { continue; } - FX_FLOAT root = (FXSYS_sqrt(b2_4ac)); - FX_FLOAT s1, s2; + float root = (FXSYS_sqrt(b2_4ac)); + float s1, s2; if (a > 0) { s1 = (-b - root) / (2 * a); s2 = (-b + root) / (2 * a); @@ -507,8 +506,8 @@ void CFX_Graphics::SetDIBitsWithMatrix(CFX_DIBSource* source, if (matrix->IsIdentity()) { m_renderDevice->SetDIBits(source, 0, 0); } else { - CFX_Matrix m((FX_FLOAT)source->GetWidth(), 0, 0, - (FX_FLOAT)source->GetHeight(), 0, 0); + CFX_Matrix m((float)source->GetWidth(), 0, 0, (float)source->GetHeight(), 0, + 0); m.Concat(*matrix); int32_t left; int32_t top; diff --git a/xfa/fxgraphics/cfx_graphics.h b/xfa/fxgraphics/cfx_graphics.h index c18f8eb4c9..c360813401 100644 --- a/xfa/fxgraphics/cfx_graphics.h +++ b/xfa/fxgraphics/cfx_graphics.h @@ -54,9 +54,9 @@ class CFX_Graphics { CFX_RenderDevice* GetRenderDevice(); void SetLineCap(CFX_GraphStateData::LineCap lineCap); - void SetLineDash(FX_FLOAT dashPhase, FX_FLOAT* dashArray, int32_t dashCount); + void SetLineDash(float dashPhase, float* dashArray, int32_t dashCount); void SetLineDash(FX_DashStyle dashStyle); - void SetLineWidth(FX_FLOAT lineWidth, bool isActOnDash = false); + void SetLineWidth(float lineWidth, bool isActOnDash = false); void SetStrokeColor(CFX_Color* color); void SetFillColor(CFX_Color* color); void SetClipRect(const CFX_RectF& rect); diff --git a/xfa/fxgraphics/cfx_path.cpp b/xfa/fxgraphics/cfx_path.cpp index d56eb13f67..5ff9bffb07 100644 --- a/xfa/fxgraphics/cfx_path.cpp +++ b/xfa/fxgraphics/cfx_path.cpp @@ -39,8 +39,8 @@ void CFX_Path::BezierTo(const CFX_PointF& c1, void CFX_Path::ArcTo(const CFX_PointF& pos, const CFX_SizeF& size, - FX_FLOAT start_angle, - FX_FLOAT sweep_angle) { + float start_angle, + float sweep_angle) { CFX_SizeF new_size = size / 2.0f; ArcToInternal(CFX_PointF(pos.x + new_size.width, pos.y + new_size.height), new_size, start_angle, sweep_angle); @@ -48,16 +48,16 @@ void CFX_Path::ArcTo(const CFX_PointF& pos, void CFX_Path::ArcToInternal(const CFX_PointF& pos, const CFX_SizeF& size, - FX_FLOAT start_angle, - FX_FLOAT sweep_angle) { - FX_FLOAT x0 = FXSYS_cos(sweep_angle / 2); - FX_FLOAT y0 = FXSYS_sin(sweep_angle / 2); - FX_FLOAT tx = ((1.0f - x0) * 4) / (3 * 1.0f); - FX_FLOAT ty = y0 - ((tx * x0) / y0); + float start_angle, + float sweep_angle) { + float x0 = FXSYS_cos(sweep_angle / 2); + float y0 = FXSYS_sin(sweep_angle / 2); + float tx = ((1.0f - x0) * 4) / (3 * 1.0f); + float ty = y0 - ((tx * x0) / y0); CFX_PointF points[] = {CFX_PointF(x0 + tx, -ty), CFX_PointF(x0 + tx, ty)}; - FX_FLOAT sn = FXSYS_sin(start_angle + sweep_angle / 2); - FX_FLOAT cs = FXSYS_cos(start_angle + sweep_angle / 2); + float sn = FXSYS_sin(start_angle + sweep_angle / 2); + float cs = FXSYS_cos(start_angle + sweep_angle / 2); CFX_PointF bezier; bezier.x = pos.x + (size.width * ((points[0].x * cs) - (points[0].y * sn))); @@ -78,10 +78,7 @@ void CFX_Path::AddLine(const CFX_PointF& p1, const CFX_PointF& p2) { data_.AppendPoint(p2, FXPT_TYPE::LineTo, false); } -void CFX_Path::AddRectangle(FX_FLOAT left, - FX_FLOAT top, - FX_FLOAT width, - FX_FLOAT height) { +void CFX_Path::AddRectangle(float left, float top, float width, float height) { data_.AppendRect(left, top, left + width, top + height); } @@ -91,12 +88,12 @@ void CFX_Path::AddEllipse(const CFX_RectF& rect) { void CFX_Path::AddArc(const CFX_PointF& original_pos, const CFX_SizeF& original_size, - FX_FLOAT start_angle, - FX_FLOAT sweep_angle) { + float start_angle, + float sweep_angle) { if (sweep_angle == 0) return; - const FX_FLOAT bezier_arc_angle_epsilon = 0.01f; + const float bezier_arc_angle_epsilon = 0.01f; while (start_angle > FX_PI * 2) start_angle -= FX_PI * 2; while (start_angle < 0) @@ -112,9 +109,9 @@ void CFX_Path::AddArc(const CFX_PointF& original_pos, size.height * FXSYS_sin(start_angle)), FXPT_TYPE::MoveTo, false); - FX_FLOAT total_sweep = 0; - FX_FLOAT local_sweep = 0; - FX_FLOAT prev_sweep = 0; + float total_sweep = 0; + float local_sweep = 0; + float prev_sweep = 0; bool done = false; do { if (sweep_angle < 0) { diff --git a/xfa/fxgraphics/cfx_path.h b/xfa/fxgraphics/cfx_path.h index 267831603a..186465f810 100644 --- a/xfa/fxgraphics/cfx_path.h +++ b/xfa/fxgraphics/cfx_path.h @@ -30,27 +30,24 @@ class CFX_Path final { const CFX_PointF& to); void ArcTo(const CFX_PointF& pos, const CFX_SizeF& size, - FX_FLOAT startAngle, - FX_FLOAT sweepAngle); + float startAngle, + float sweepAngle); void AddLine(const CFX_PointF& p1, const CFX_PointF& p2); - void AddRectangle(FX_FLOAT left, - FX_FLOAT top, - FX_FLOAT width, - FX_FLOAT height); + void AddRectangle(float left, float top, float width, float height); void AddEllipse(const CFX_RectF& rect); void AddArc(const CFX_PointF& pos, const CFX_SizeF& size, - FX_FLOAT startAngle, - FX_FLOAT sweepAngle); + float startAngle, + float sweepAngle); void AddSubpath(CFX_Path* path); private: void ArcToInternal(const CFX_PointF& pos, const CFX_SizeF& size, - FX_FLOAT start_angle, - FX_FLOAT sweep_angle); + float start_angle, + float sweep_angle); CFX_PathData data_; }; diff --git a/xfa/fxgraphics/cfx_shading.cpp b/xfa/fxgraphics/cfx_shading.cpp index 07936302c9..7dc8ce3412 100644 --- a/xfa/fxgraphics/cfx_shading.cpp +++ b/xfa/fxgraphics/cfx_shading.cpp @@ -26,8 +26,8 @@ CFX_Shading::CFX_Shading(const CFX_PointF& beginPoint, CFX_Shading::CFX_Shading(const CFX_PointF& beginPoint, const CFX_PointF& endPoint, - const FX_FLOAT beginRadius, - const FX_FLOAT endRadius, + const float beginRadius, + const float endRadius, bool isExtendedBegin, bool isExtendedEnd, const FX_ARGB beginArgb, @@ -59,11 +59,11 @@ void CFX_Shading::InitArgbArray() { int32_t b2; ArgbDecode(m_endArgb, a2, r2, g2, b2); - FX_FLOAT f = (FX_FLOAT)(FX_SHADING_Steps - 1); - FX_FLOAT aScale = 1.0 * (a2 - a1) / f; - FX_FLOAT rScale = 1.0 * (r2 - r1) / f; - FX_FLOAT gScale = 1.0 * (g2 - g1) / f; - FX_FLOAT bScale = 1.0 * (b2 - b1) / f; + float f = (float)(FX_SHADING_Steps - 1); + float aScale = 1.0 * (a2 - a1) / f; + float rScale = 1.0 * (r2 - r1) / f; + float gScale = 1.0 * (g2 - g1) / f; + float bScale = 1.0 * (b2 - b1) / f; for (int32_t i = 0; i < FX_SHADING_Steps; i++) { int32_t a3 = static_cast<int32_t>(i * aScale); diff --git a/xfa/fxgraphics/cfx_shading.h b/xfa/fxgraphics/cfx_shading.h index 4189581895..1fb34d2b07 100644 --- a/xfa/fxgraphics/cfx_shading.h +++ b/xfa/fxgraphics/cfx_shading.h @@ -28,8 +28,8 @@ class CFX_Shading { // Radial shading. CFX_Shading(const CFX_PointF& beginPoint, const CFX_PointF& endPoint, - const FX_FLOAT beginRadius, - const FX_FLOAT endRadius, + const float beginRadius, + const float endRadius, bool isExtendedBegin, bool isExtendedEnd, const FX_ARGB beginArgb, @@ -44,8 +44,8 @@ class CFX_Shading { const CFX_Shading_Type m_type; const CFX_PointF m_beginPoint; const CFX_PointF m_endPoint; - const FX_FLOAT m_beginRadius; - const FX_FLOAT m_endRadius; + const float m_beginRadius; + const float m_endRadius; const bool m_isExtendedBegin; const bool m_isExtendedEnd; const FX_ARGB m_beginArgb; |