summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp8
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp4
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.cpp2
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.h2
-rw-r--r--core/fpdfapi/font/cpdf_type3font.cpp8
-rw-r--r--core/fpdfapi/page/cpdf_allstates.cpp6
-rw-r--r--core/fpdfapi/page/cpdf_allstates.h8
-rw-r--r--core/fpdfapi/page/cpdf_color.cpp10
-rw-r--r--core/fpdfapi/page/cpdf_color.h6
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.cpp390
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.h47
-rw-r--r--core/fpdfapi/page/cpdf_colorstate.cpp10
-rw-r--r--core/fpdfapi/page/cpdf_colorstate.h14
-rw-r--r--core/fpdfapi/page/cpdf_devicecs_unittest.cpp26
-rw-r--r--core/fpdfapi/page/cpdf_generalstate.cpp12
-rw-r--r--core/fpdfapi/page/cpdf_generalstate.h20
-rw-r--r--core/fpdfapi/page/cpdf_image.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_meshstream.cpp16
-rw-r--r--core/fpdfapi/page/cpdf_meshstream.h20
-rw-r--r--core/fpdfapi/page/cpdf_page.h12
-rw-r--r--core/fpdfapi/page/cpdf_pageobject.h8
-rw-r--r--core/fpdfapi/page/cpdf_pageobjectholder.cpp8
-rw-r--r--core/fpdfapi/page/cpdf_path.cpp9
-rw-r--r--core/fpdfapi/page/cpdf_path.h4
-rw-r--r--core/fpdfapi/page/cpdf_pathobject.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_psengine.h6
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp61
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.h26
-rw-r--r--core/fpdfapi/page/cpdf_textobject.cpp64
-rw-r--r--core/fpdfapi/page/cpdf_textobject.h14
-rw-r--r--core/fpdfapi/page/cpdf_textstate.cpp36
-rw-r--r--core/fpdfapi/page/cpdf_textstate.h46
-rw-r--r--core/fpdfapi/page/cpdf_tilingpattern.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_tilingpattern.h8
-rw-r--r--core/fpdfapi/page/fpdf_page_colors.cpp48
-rw-r--r--core/fpdfapi/page/fpdf_page_func.cpp92
-rw-r--r--core/fpdfapi/page/pageint.h77
-rw-r--r--core/fpdfapi/parser/cpdf_array.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_array.h4
-rw-r--r--core/fpdfapi/parser/cpdf_dictionary.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_dictionary.h4
-rw-r--r--core/fpdfapi/parser/cpdf_number.cpp6
-rw-r--r--core/fpdfapi/parser/cpdf_number.h6
-rw-r--r--core/fpdfapi/parser/cpdf_object.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_object.h2
-rw-r--r--core/fpdfapi/parser/cpdf_object_unittest.cpp6
-rw-r--r--core/fpdfapi/parser/cpdf_reference.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_reference.h2
-rw-r--r--core/fpdfapi/render/cpdf_charposlist.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_charposlist.h4
-rw-r--r--core/fpdfapi/render/cpdf_devicebuffer.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.cpp41
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.h4
-rw-r--r--core/fpdfapi/render/cpdf_docrenderdata.cpp6
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp211
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.h2
-rw-r--r--core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_textrenderer.cpp18
-rw-r--r--core/fpdfapi/render/cpdf_textrenderer.h14
-rw-r--r--core/fpdfapi/render/cpdf_type3cache.cpp14
-rw-r--r--core/fpdfapi/render/cpdf_type3cache.h8
-rw-r--r--core/fpdfapi/render/cpdf_type3glyphs.cpp10
-rw-r--r--core/fpdfapi/render/cpdf_type3glyphs.h5
64 files changed, 700 insertions, 825 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];