summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page.cpp30
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp316
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp28
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp138
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp44
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp98
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp78
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp50
-rw-r--r--core/src/fpdfapi/fpdf_page/pageint.h70
10 files changed, 430 insertions, 430 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index c0cdb228f4..6b15bd1c49 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -44,7 +44,7 @@ void CPDF_PageObject::Copy(const CPDF_PageObject* pSrc)
m_Top = pSrc->m_Top;
m_Bottom = pSrc->m_Bottom;
}
-void CPDF_PageObject::AppendClipPath(CPDF_Path path, int type, FX_BOOL bAutoMerge)
+void CPDF_PageObject::AppendClipPath(CPDF_Path path, int type, bool bAutoMerge)
{
m_ClipPath.AppendPath(path, type, bAutoMerge);
}
@@ -353,7 +353,7 @@ FX_FLOAT CPDF_TextObject::GetCharWidth(FX_DWORD charcode) const
{
FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000;
CPDF_Font* pFont = m_TextState.GetFont();
- FX_BOOL bVertWriting = FALSE;
+ bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
@@ -373,7 +373,7 @@ FX_FLOAT CPDF_TextObject::GetSpaceCharWidth() const
return GetCharWidth(charCode);
}
FX_FLOAT fontSize = m_TextState.GetFontSize() / 4000.0f;
- FX_BOOL bVertWriting = FALSE;
+ bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
@@ -388,7 +388,7 @@ FX_FLOAT CPDF_TextObject::GetSpaceCharWidth() const
void CPDF_TextObject::GetCharRect(int index, CFX_FloatRect& rect) const
{
CPDF_Font* pFont = m_TextState.GetFont();
- FX_BOOL bVertWriting = FALSE;
+ bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
@@ -441,7 +441,7 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX,
FX_FLOAT min_y = 10000 * 1.0f;
FX_FLOAT max_y = -10000 * 1.0f;
CPDF_Font* pFont = m_TextState.GetFont();
- FX_BOOL bVertWriting = FALSE;
+ bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
@@ -570,7 +570,7 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX,
void CPDF_TextObject::CalcCharPos(FX_FLOAT* pPosArray) const
{
CPDF_Font* pFont = m_TextState.GetFont();
- FX_BOOL bVertWriting = FALSE;
+ bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
@@ -720,9 +720,9 @@ void CPDF_FormObject::CalcBoundingBox()
m_Right = form_rect.right;
m_Top = form_rect.top;
}
-CPDF_PageObjects::CPDF_PageObjects(FX_BOOL bReleaseMembers) : m_ObjectList(128)
+CPDF_PageObjects::CPDF_PageObjects(bool bReleaseMembers) : m_ObjectList(128)
{
- m_bBackgroundAlphaNeeded = FALSE;
+ m_bBackgroundAlphaNeeded = false;
m_bReleaseMembers = bReleaseMembers;
m_ParseState = PDF_CONTENT_NOT_PARSED;
m_pParser = NULL;
@@ -858,7 +858,7 @@ CPDF_Page::CPDF_Page()
{
m_pPageRender = NULL;
}
-void CPDF_Page::Load(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, FX_BOOL bPageCache)
+void CPDF_Page::Load(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, bool bPageCache)
{
m_pDocument = (CPDF_Document*)pDocument;
m_pFormDict = pPageDict;
@@ -925,7 +925,7 @@ void CPDF_Page::Load(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, FX_BO
m_Transparency = PDFTRANS_ISOLATED;
LoadTransInfo();
}
-void CPDF_Page::StartParse(CPDF_ParseOptions* pOptions, FX_BOOL bReParse)
+void CPDF_Page::StartParse(CPDF_ParseOptions* pOptions, bool bReParse)
{
if (bReParse) {
ClearCacheObjects();
@@ -937,7 +937,7 @@ void CPDF_Page::StartParse(CPDF_ParseOptions* pOptions, FX_BOOL bReParse)
m_pParser->Start(this, pOptions);
m_ParseState = PDF_CONTENT_PARSING;
}
-void CPDF_Page::ParseContent(CPDF_ParseOptions* pOptions, FX_BOOL bReParse)
+void CPDF_Page::ParseContent(CPDF_ParseOptions* pOptions, bool bReParse)
{
StartParse(pOptions, bReParse);
ContinueParse(NULL);
@@ -1070,8 +1070,8 @@ void CPDF_Page::GetDisplayMatrix(CFX_AffineMatrix& matrix, int xPos, int yPos,
}
CPDF_ParseOptions::CPDF_ParseOptions()
{
- m_bTextOnly = FALSE;
- m_bMarkedContent = TRUE;
- m_bSeparateForm = TRUE;
- m_bDecodeInlineImage = FALSE;
+ m_bTextOnly = false;
+ m_bMarkedContent = true;
+ m_bSeparateForm = true;
+ m_bDecodeInlineImage = false;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
index 198054ef7e..b1c8837326 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -40,7 +40,7 @@ CPDF_DeviceCS::CPDF_DeviceCS(CPDF_Document* pDoc, int family)
: CPDF_ColorSpace(pDoc, family, ComponentsForFamily(family)) {
}
-FX_BOOL CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
if (m_Family == PDFCS_DEVICERGB) {
R = pBuf[0];
@@ -81,56 +81,56 @@ FX_BOOL CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT
} else {
ASSERT(m_Family == PDFCS_PATTERN);
R = G = B = 0;
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_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(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const
{
if (m_Family != PDFCS_DEVICECMYK) {
- return FALSE;
+ return false;
}
c = pBuf[0];
m = pBuf[1];
y = pBuf[2];
k = pBuf[3];
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
+bool CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
{
if (m_Family == PDFCS_DEVICERGB) {
pBuf[0] = R;
pBuf[1] = G;
pBuf[2] = B;
- return TRUE;
+ return true;
}
if (m_Family == PDFCS_DEVICEGRAY) {
if (R == G && R == B) {
*pBuf = R;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
if (m_Family == PDFCS_DEVICECMYK) {
sRGB_to_AdobeCMYK(R, G, B, pBuf[0], pBuf[1], pBuf[2], pBuf[3]);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_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(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k) const
{
if (m_Family == PDFCS_DEVICERGB) {
AdobeCMYK_to_sRGB(c, m, y, k, pBuf[0], pBuf[1], pBuf[2]);
- return TRUE;
+ return true;
}
if (m_Family == PDFCS_DEVICECMYK) {
pBuf[0] = c;
pBuf[1] = m;
pBuf[2] = y;
pBuf[3] = k;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
static void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels)
{
@@ -149,7 +149,7 @@ static void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels)
pSrcBuf += 3;
}
}
-void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const
+void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, bool bTransMask) const
{
if (bTransMask && m_Family == PDFCS_DEVICECMYK) {
for (int i = 0; i < pixels; i ++) {
@@ -274,11 +274,11 @@ public:
explicit CPDF_CalGray(CPDF_Document* pDoc)
: CPDF_ColorSpace(pDoc, PDFCS_CALGRAY, 1) {
}
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) 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 SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width,
- int image_height, FX_BOOL bTransMask = FALSE) const override;
+ int image_height, bool bTransMask = false) const override;
private:
FX_FLOAT m_WhitePoint[3];
@@ -286,7 +286,7 @@ private:
FX_FLOAT m_Gamma;
};
-FX_BOOL CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CPDF_Dictionary* pDict = pArray->GetDict(1);
CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint"));
@@ -302,22 +302,22 @@ FX_BOOL CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
if (m_Gamma == 0) {
m_Gamma = 1.0f;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CalGray::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_CalGray::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
R = G = B = *pBuf;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CalGray::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
+bool CPDF_CalGray::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
{
if (R == G && R == B) {
*pBuf = R;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-void CPDF_CalGray::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const
+void CPDF_CalGray::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, bool bTransMask) const
{
for (int i = 0; i < pixels; i ++) {
*pDestBuf ++ = pSrcBuf[i];
@@ -331,24 +331,24 @@ public:
explicit CPDF_CalRGB(CPDF_Document* pDoc)
: CPDF_ColorSpace(pDoc, PDFCS_CALRGB, 3) {
}
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) 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 SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width,
- int image_height, FX_BOOL bTransMask = FALSE) const override;
+ 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];
- FX_BOOL m_bGamma;
- FX_BOOL m_bMatrix;
+ bool m_bGamma;
+ bool m_bMatrix;
};
-FX_BOOL CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CPDF_Dictionary* pDict = pArray->GetDict(1);
if (!pDict)
- return FALSE;
+ return false;
CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint"));
int i;
@@ -361,25 +361,25 @@ FX_BOOL CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
}
pParam = pDict->GetArray(FX_BSTRC("Gamma"));
if (pParam) {
- m_bGamma = TRUE;
+ m_bGamma = true;
for (i = 0; i < 3; i ++) {
m_Gamma[i] = pParam->GetNumber(i);
}
} else {
- m_bGamma = FALSE;
+ m_bGamma = false;
}
pParam = pDict->GetArray(FX_BSTRC("Matrix"));
if (pParam) {
- m_bMatrix = TRUE;
+ m_bMatrix = true;
for (i = 0; i < 9; i ++) {
m_Matrix[i] = pParam->GetNumber(i);
}
} else {
- m_bMatrix = FALSE;
+ m_bMatrix = false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+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];
@@ -400,16 +400,16 @@ FX_BOOL CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT&
Z = C_;
}
XYZ_to_sRGB_WhitePoint(X, Y, Z, R, G, B, m_WhitePoint[0], m_WhitePoint[1], m_WhitePoint[2]);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CalRGB::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
+bool CPDF_CalRGB::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
{
pBuf[0] = R;
pBuf[1] = G;
pBuf[2] = B;
- return TRUE;
+ return true;
}
-void CPDF_CalRGB::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const
+void CPDF_CalRGB::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, bool bTransMask) const
{
if (bTransMask) {
FX_FLOAT Cal[3];
@@ -435,21 +435,21 @@ public:
: CPDF_ColorSpace(pDoc, PDFCS_LAB, 3) {
}
void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) 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 SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width,
- int image_height, FX_BOOL bTransMask = FALSE) const;
+ int image_height, bool bTransMask = false) const;
FX_FLOAT m_WhitePoint[3];
FX_FLOAT m_BlackPoint[3];
FX_FLOAT m_Ranges[4];
};
-FX_BOOL CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CPDF_Dictionary* pDict = pArray->GetDict(1);
if (!pDict) {
- return FALSE;
+ return false;
}
CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint"));
int i;
@@ -465,7 +465,7 @@ FX_BOOL CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
for (i = 0; i < 4; i ++) {
m_Ranges[i] = pParam ? pParam->GetNumber(i) : def_ranges[i];
}
- return TRUE;
+ return true;
}
void CPDF_LabCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const
{
@@ -484,7 +484,7 @@ void CPDF_LabCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min,
}
}
}
-FX_BOOL CPDF_LabCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+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];
@@ -509,13 +509,13 @@ FX_BOOL CPDF_LabCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B
Z = 1.0889f * N * N * N;
}
XYZ_to_sRGB(X, Y, Z, R, G, B);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_LabCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
+bool CPDF_LabCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
{
- return FALSE;
+ return false;
}
-void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const
+void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, bool bTransMask) const
{
for (int i = 0; i < pixels; i ++) {
FX_FLOAT lab[3];
@@ -532,12 +532,12 @@ void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, i
}
}
CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize):
- m_bsRGB(FALSE),
+ m_bsRGB(false),
m_pTransform(NULL),
m_nSrcComponents(0)
{
if (dwSize == 3144 && FXSYS_memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0) {
- m_bsRGB = TRUE;
+ m_bsRGB = true;
m_nSrcComponents = 3;
}
else if (CPDF_ModuleMgr::Get()->GetIccModule()) {
@@ -559,23 +559,23 @@ public:
m_pProfile(nullptr),
m_pCache(nullptr),
m_pRanges(nullptr),
- m_bOwn(FALSE) {
+ m_bOwn(false) {
}
~CPDF_ICCBasedCS() override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
- FX_BOOL v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const override;
- void EnableStdConversion(FX_BOOL bEnabled) 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 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;
+ void EnableStdConversion(bool bEnabled) override;
void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width,
- int image_height, FX_BOOL bTransMask = FALSE) const override;
+ int image_height, bool bTransMask = false) const override;
CPDF_ColorSpace* m_pAlterCS;
CPDF_IccProfile* m_pProfile;
uint8_t* m_pCache;
FX_FLOAT* m_pRanges;
- FX_BOOL m_bOwn;
+ bool m_bOwn;
};
CPDF_ICCBasedCS::~CPDF_ICCBasedCS()
@@ -594,15 +594,15 @@ CPDF_ICCBasedCS::~CPDF_ICCBasedCS()
}
}
-FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CPDF_Stream* pStream = pArray->GetStream(1);
if (pStream == NULL) {
- return FALSE;
+ return false;
}
m_pProfile = pDoc->LoadIccProfile(pStream);
if (!m_pProfile) {
- return FALSE;
+ return false;
}
m_nComponents = m_pProfile->GetComponents(); //Try using the nComponents from ICC profile
CPDF_Dictionary* pDict = pStream->GetDict();
@@ -615,13 +615,13 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
if (pAlterCS->CountComponents() > 0) { // Use Alternative colorspace
m_nComponents = pAlterCS->CountComponents();
m_pAlterCS = pAlterCS;
- m_bOwn = TRUE;
+ m_bOwn = true;
}
else { // No valid alternative colorspace
pAlterCS->ReleaseCS();
int32_t nDictComponents = pDict ? pDict->GetInteger(FX_BSTRC("N")) : 0;
if (nDictComponents != 1 && nDictComponents != 3 && nDictComponents != 4) {
- return FALSE;
+ return false;
}
m_nComponents = nDictComponents;
}
@@ -633,7 +633,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
}
else {
m_pAlterCS = pAlterCS;
- m_bOwn = TRUE;
+ m_bOwn = true;
}
}
}
@@ -661,15 +661,15 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
m_pRanges[i] = 0;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
if (m_pProfile && m_pProfile->m_bsRGB) {
R = pBuf[0];
G = pBuf[1];
B = pBuf[2];
- return TRUE;
+ return true;
}
ICodec_IccModule *pIccModule = CPDF_ModuleMgr::Get()->GetIccModule();
if (m_pProfile->m_pTransform == NULL || pIccModule == NULL) {
@@ -678,7 +678,7 @@ FX_BOOL CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLO
} else {
R = G = B = 0.0f;
}
- return TRUE;
+ return true;
}
FX_FLOAT rgb[3];
pIccModule->SetComponents(m_nComponents);
@@ -686,31 +686,31 @@ FX_BOOL CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLO
R = rgb[0];
G = rgb[1];
B = rgb[2];
- return TRUE;
+ return true;
}
-FX_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(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const
{
if (m_nComponents != 4) {
- return FALSE;
+ return false;
}
c = pBuf[0];
m = pBuf[1];
y = pBuf[2];
k = pBuf[3];
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ICCBasedCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
+bool CPDF_ICCBasedCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
{
- return FALSE;
+ return false;
}
-void CPDF_ICCBasedCS::EnableStdConversion(FX_BOOL bEnabled)
+void CPDF_ICCBasedCS::EnableStdConversion(bool bEnabled)
{
CPDF_ColorSpace::EnableStdConversion(bEnabled);
if (m_pAlterCS) {
m_pAlterCS->EnableStdConversion(bEnabled);
}
}
-void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const
+void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, bool bTransMask) const
{
if (m_pProfile->m_bsRGB) {
ReverseRGB(pDestBuf, pSrcBuf, pixels);
@@ -765,10 +765,10 @@ public:
}
~CPDF_IndexedCS() override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) 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;
CPDF_ColorSpace* GetBaseCS() const override;
- void EnableStdConversion(FX_BOOL bEnabled) override;
+ void EnableStdConversion(bool bEnabled) override;
CPDF_ColorSpace* m_pBaseCS;
CPDF_CountedColorSpace* m_pCountedBaseCS;
@@ -787,19 +787,19 @@ CPDF_IndexedCS::~CPDF_IndexedCS()
m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
}
}
-FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
if (pArray->GetCount() < 4) {
- return FALSE;
+ return false;
}
CPDF_Object* pBaseObj = pArray->GetElementValue(1);
if (pBaseObj == m_pArray) {
- return FALSE;
+ return false;
}
CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
m_pBaseCS = pDocPageData->GetColorSpace(pBaseObj, NULL);
if (m_pBaseCS == NULL) {
- return FALSE;
+ return false;
}
m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray());
m_nBaseComponents = m_pBaseCS->CountComponents();
@@ -812,29 +812,29 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
m_MaxIndex = pArray->GetInteger(2);
CPDF_Object* pTableObj = pArray->GetElementValue(3);
if (pTableObj == NULL) {
- return FALSE;
+ return false;
}
if (pTableObj->GetType() == PDFOBJ_STRING) {
m_Table = ((CPDF_String*)pTableObj)->GetString();
} else if (pTableObj->GetType() == PDFOBJ_STREAM) {
CPDF_StreamAcc acc;
- acc.LoadAllData((CPDF_Stream*)pTableObj, FALSE);
+ acc.LoadAllData((CPDF_Stream*)pTableObj, false);
m_Table = CFX_ByteStringC(acc.GetData(), acc.GetSize());
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
int index = (int32_t)(*pBuf);
if (index < 0 || index > m_MaxIndex) {
- return FALSE;
+ return false;
}
if (m_nBaseComponents) {
if (index == INT_MAX || (index + 1) > INT_MAX / m_nBaseComponents ||
(index + 1)*m_nBaseComponents > (int)m_Table.GetLength()) {
R = G = B = 0;
- return FALSE;
+ return false;
}
}
CFX_FixedBufGrow<FX_FLOAT, 16> Comps(m_nBaseComponents);
@@ -844,13 +844,13 @@ FX_BOOL CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOA
comps[i] = m_pCompMinMax[i * 2] + m_pCompMinMax[i * 2 + 1] * pTable[index * m_nBaseComponents + i] / 255;
}
m_pBaseCS->GetRGB(comps, R, G, B);
- return TRUE;
+ return true;
}
CPDF_ColorSpace*CPDF_IndexedCS::GetBaseCS() const
{
return m_pBaseCS;
}
-void CPDF_IndexedCS::EnableStdConversion(FX_BOOL bEnabled)
+void CPDF_IndexedCS::EnableStdConversion(bool bEnabled)
{
CPDF_ColorSpace::EnableStdConversion(bEnabled);
if (m_pBaseCS) {
@@ -871,39 +871,39 @@ CPDF_PatternCS::~CPDF_PatternCS()
m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
}
}
-FX_BOOL CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CPDF_Object* pBaseCS = pArray->GetElementValue(1);
if (pBaseCS == m_pArray) {
- return FALSE;
+ return false;
}
CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
m_pBaseCS = pDocPageData->GetColorSpace(pBaseCS, NULL);
if (m_pBaseCS) {
if (m_pBaseCS->GetFamily() == PDFCS_PATTERN) {
- return FALSE;
+ return false;
}
m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray());
m_nComponents = m_pBaseCS->CountComponents() + 1;
if (m_pBaseCS->CountComponents() > MAX_PATTERN_COLORCOMPS) {
- return FALSE;
+ return false;
}
} else {
m_nComponents = 1;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_PatternCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_PatternCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
if (m_pBaseCS) {
ASSERT(m_pBaseCS->GetFamily() != PDFCS_PATTERN);
PatternValue* pvalue = (PatternValue*)pBuf;
if (m_pBaseCS->GetRGB(pvalue->m_Comps, R, G, B)) {
- return TRUE;
+ return true;
}
}
R = G = B = 0.75f;
- return FALSE;
+ return false;
}
CPDF_ColorSpace* CPDF_PatternCS::GetBaseCS() const
{
@@ -919,9 +919,9 @@ public:
}
~CPDF_SeparationCS() override;
void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
- void EnableStdConversion(FX_BOOL bEnabled) 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;
+ void EnableStdConversion(bool bEnabled) override;
CPDF_ColorSpace* m_pAltCS;
CPDF_Function* m_pFunc;
@@ -940,7 +940,7 @@ void CPDF_SeparationCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOA
min = 0;
max = 1.0f;
}
-FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CFX_ByteString name = pArray->GetString(1);
if (name == FX_BSTRC("None")) {
@@ -949,11 +949,11 @@ FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
m_Type = Colorant;
CPDF_Object* pAltCS = pArray->GetElementValue(2);
if (pAltCS == m_pArray) {
- return FALSE;
+ return false;
}
m_pAltCS = Load(pDoc, pAltCS);
if (!m_pAltCS) {
- return FALSE;
+ return false;
}
CPDF_Object* pFuncObj = pArray->GetElementValue(3);
if (pFuncObj && pFuncObj->GetType() != PDFOBJ_NAME) {
@@ -964,16 +964,16 @@ FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
m_pFunc = NULL;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
if (m_Type == None) {
- return FALSE;
+ return false;
}
if (m_pFunc == NULL) {
if (m_pAltCS == NULL) {
- return FALSE;
+ return false;
}
int nComps = m_pAltCS->CountComponents();
CFX_FixedBufGrow<FX_FLOAT, 16> results(nComps);
@@ -981,22 +981,22 @@ FX_BOOL CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_F
results[i] = *pBuf;
}
m_pAltCS->GetRGB(results, R, G, B);
- return TRUE;
+ return true;
}
CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs());
int nresults = 0;
m_pFunc->Call(pBuf, 1, results, nresults);
if (nresults == 0) {
- return FALSE;
+ return false;
}
if (m_pAltCS) {
m_pAltCS->GetRGB(results, R, G, B);
- return TRUE;
+ return true;
}
R = G = B = 0;
- return FALSE;
+ return false;
}
-void CPDF_SeparationCS::EnableStdConversion(FX_BOOL bEnabled)
+void CPDF_SeparationCS::EnableStdConversion(bool bEnabled)
{
CPDF_ColorSpace::EnableStdConversion(bEnabled);
if (m_pAltCS) {
@@ -1013,9 +1013,9 @@ public:
}
~CPDF_DeviceNCS() override;
void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
- void EnableStdConversion(FX_BOOL bEnabled) 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;
+ void EnableStdConversion(bool bEnabled) override;
CPDF_ColorSpace* m_pAltCS;
CPDF_Function* m_pFunc;
@@ -1033,45 +1033,45 @@ void CPDF_DeviceNCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT&
min = 0;
max = 1.0f;
}
-FX_BOOL CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CPDF_Object* pObj = pArray->GetElementValue(1);
if (!pObj) {
- return FALSE;
+ return false;
}
if (pObj->GetType() != PDFOBJ_ARRAY) {
- return FALSE;
+ return false;
}
m_nComponents = ((CPDF_Array*)pObj)->GetCount();
CPDF_Object* pAltCS = pArray->GetElementValue(2);
if (!pAltCS || pAltCS == m_pArray) {
- return FALSE;
+ return false;
}
m_pAltCS = Load(pDoc, pAltCS);
m_pFunc = CPDF_Function::Load(pArray->GetElementValue(3));
if (m_pAltCS == NULL || m_pFunc == NULL) {
- return FALSE;
+ return false;
}
if (m_pFunc->CountOutputs() < m_pAltCS->CountComponents()) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DeviceNCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_DeviceNCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
if (m_pFunc == NULL) {
- return FALSE;
+ return false;
}
CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs());
int nresults = 0;
m_pFunc->Call(pBuf, m_nComponents, results, nresults);
if (nresults == 0) {
- return FALSE;
+ return false;
}
m_pAltCS->GetRGB(results, R, G, B);
- return TRUE;
+ return true;
}
-void CPDF_DeviceNCS::EnableStdConversion(FX_BOOL bEnabled)
+void CPDF_DeviceNCS::EnableStdConversion(bool bEnabled)
{
CPDF_ColorSpace::EnableStdConversion(bEnabled);
if (m_pAltCS) {
@@ -1197,33 +1197,33 @@ FX_FLOAT* CPDF_ColorSpace::CreateBuf()
uint8_t* pBuf = FX_Alloc(uint8_t, size);
return (FX_FLOAT*)pBuf;
}
-FX_BOOL CPDF_ColorSpace::sRGB() const
+bool CPDF_ColorSpace::sRGB() const
{
if (m_Family == PDFCS_DEVICERGB) {
- return TRUE;
+ return true;
}
if (m_Family != PDFCS_ICCBASED) {
- return FALSE;
+ return false;
}
CPDF_ICCBasedCS* pCS = (CPDF_ICCBasedCS*)this;
return pCS->m_pProfile->m_bsRGB;
}
-FX_BOOL CPDF_ColorSpace::GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const
+bool CPDF_ColorSpace::GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const
{
if (v_GetCMYK(pBuf, c, m, y, k)) {
- return TRUE;
+ return true;
}
FX_FLOAT R, G, B;
if (!GetRGB(pBuf, R, G, B)) {
- return FALSE;
+ return false;
}
sRGB_to_AdobeCMYK(R, G, B, c, m, y, k);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ColorSpace::SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k) const
+bool CPDF_ColorSpace::SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k) const
{
if (v_SetCMYK(pBuf, c, m, y, k)) {
- return TRUE;
+ return true;
}
FX_FLOAT R, G, B;
AdobeCMYK_to_sRGB(c, m, y, k, R, G, B);
@@ -1247,7 +1247,7 @@ int CPDF_ColorSpace::GetMaxIndex() const
CPDF_IndexedCS* pCS = (CPDF_IndexedCS*)this;
return pCS->m_MaxIndex;
}
-void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const
+void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, int image_width, int image_height, bool bTransMask) const
{
CFX_FixedBufGrow<FX_FLOAT, 16> srcbuf(m_nComponents);
FX_FLOAT* src = srcbuf;
@@ -1265,7 +1265,7 @@ void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf, const uint8_t* src_b
*dest_buf ++ = (int32_t)(R * 255);
}
}
-void CPDF_ColorSpace::EnableStdConversion(FX_BOOL bEnabled)
+void CPDF_ColorSpace::EnableStdConversion(bool bEnabled)
{
if (bEnabled) {
m_dwStdConversion ++;
@@ -1397,23 +1397,23 @@ void CPDF_Color::Copy(const CPDF_Color* pSrc)
if (m_pCS->GetFamily() == PDFCS_PATTERN) {
PatternValue* pvalue = (PatternValue*)m_pBuffer;
if (pvalue->m_pPattern && pvalue->m_pPattern->m_pDocument) {
- pvalue->m_pPattern = pvalue->m_pPattern->m_pDocument->GetPageData()->GetPattern(pvalue->m_pPattern->m_pPatternObj, FALSE, &pvalue->m_pPattern->m_ParentMatrix);
+ pvalue->m_pPattern = pvalue->m_pPattern->m_pDocument->GetPageData()->GetPattern(pvalue->m_pPattern->m_pPatternObj, false, &pvalue->m_pPattern->m_ParentMatrix);
}
}
}
-FX_BOOL CPDF_Color::GetRGB(int& R, int& G, int& B) const
+bool CPDF_Color::GetRGB(int& R, int& G, int& B) const
{
if (m_pCS == NULL || m_pBuffer == NULL) {
- return FALSE;
+ return false;
}
FX_FLOAT r=0.0f, g=0.0f, b=0.0f;
if (!m_pCS->GetRGB(m_pBuffer, r, g, b)) {
- return FALSE;
+ return false;
}
R = (int32_t)(r * 255 + 0.5f);
G = (int32_t)(g * 255 + 0.5f);
B = (int32_t)(b * 255 + 0.5f);
- return TRUE;
+ return true;
}
CPDF_Pattern* CPDF_Color::GetPattern() const
{
@@ -1438,10 +1438,10 @@ FX_FLOAT* CPDF_Color::GetPatternColor() const
PatternValue* pvalue = (PatternValue*)m_pBuffer;
return pvalue->m_nComps ? pvalue->m_Comps : NULL;
}
-FX_BOOL CPDF_Color::IsEqual(const CPDF_Color& other) const
+bool CPDF_Color::IsEqual(const CPDF_Color& other) const
{
if (m_pCS != other.m_pCS || m_pCS == NULL) {
- return FALSE;
+ return false;
}
return FXSYS_memcmp(m_pBuffer, other.m_pBuffer, m_pCS->GetBufSize()) == 0;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index 05233a12a4..568863a89b 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -78,7 +78,7 @@ void CPDF_PageModule::ReleaseDoc(CPDF_Document* pDoc)
}
void CPDF_PageModule::ClearDoc(CPDF_Document* pDoc)
{
- pDoc->GetPageData()->Clear(FALSE);
+ pDoc->GetPageData()->Clear(false);
}
void CPDF_PageModule::NotifyCJKAvailable()
{
@@ -88,7 +88,7 @@ void CPDF_PageModule::NotifyCJKAvailable()
CPDF_Font* CPDF_Document::LoadFont(CPDF_Dictionary* pFontDict)
{
ASSERT(pFontDict);
- return GetValidatePageData()->GetFont(pFontDict, FALSE);
+ return GetValidatePageData()->GetFont(pFontDict, false);
}
CPDF_StreamAcc* CPDF_Document::LoadFontFile(CPDF_Stream* pStream)
@@ -101,7 +101,7 @@ CPDF_ColorSpace* CPDF_Document::LoadColorSpace(CPDF_Object* pCSObj, CPDF_Diction
{
return GetValidatePageData()->GetColorSpace(pCSObj, pResources);
}
-CPDF_Pattern* CPDF_Document::LoadPattern(CPDF_Object* pPatternObj, FX_BOOL bShading, const CFX_AffineMatrix* matrix)
+CPDF_Pattern* CPDF_Document::LoadPattern(CPDF_Object* pPatternObj, bool bShading, const CFX_AffineMatrix* matrix)
{
return GetValidatePageData()->GetPattern(pPatternObj, bShading, matrix);
}
@@ -126,14 +126,14 @@ void CPDF_Document::RemoveColorSpaceFromPageData(CPDF_Object* pCSObj)
}
CPDF_DocPageData::CPDF_DocPageData(CPDF_Document* pPDFDoc)
: m_pPDFDoc(pPDFDoc),
- m_bForceClear(FALSE)
+ m_bForceClear(false)
{
}
CPDF_DocPageData::~CPDF_DocPageData()
{
- Clear(FALSE);
- Clear(TRUE);
+ Clear(false);
+ Clear(true);
for (auto& it : m_PatternMap)
delete it.second;
@@ -148,7 +148,7 @@ CPDF_DocPageData::~CPDF_DocPageData()
m_ColorSpaceMap.clear();
}
-void CPDF_DocPageData::Clear(FX_BOOL bForceRelease)
+void CPDF_DocPageData::Clear(bool bForceRelease)
{
m_bForceClear = bForceRelease;
@@ -235,7 +235,7 @@ void CPDF_DocPageData::Clear(FX_BOOL bForceRelease)
}
}
-CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict, FX_BOOL findOnly)
+CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict, bool findOnly)
{
if (!pFontDict) {
return NULL;
@@ -432,7 +432,7 @@ void CPDF_DocPageData::ReleaseColorSpace(CPDF_Object* pColorSpace)
}
}
-CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj, FX_BOOL bShading, const CFX_AffineMatrix* matrix)
+CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj, bool bShading, const CFX_AffineMatrix* matrix)
{
if (!pPatternObj)
return nullptr;
@@ -455,7 +455,7 @@ CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj, FX_BOOL bSh
if (type == 1) {
pPattern = new CPDF_TilingPattern(m_pPDFDoc, pPatternObj, matrix);
} else if (type == 2) {
- pPattern = new CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, FALSE, matrix);
+ pPattern = new CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, false, matrix);
}
}
}
@@ -501,7 +501,7 @@ CPDF_Image* CPDF_DocPageData::GetImage(CPDF_Object* pImageStream)
}
CPDF_Image* pImage = new CPDF_Image(m_pPDFDoc);
- pImage->LoadImageF((CPDF_Stream*)pImageStream, FALSE);
+ pImage->LoadImageF((CPDF_Stream*)pImageStream, false);
CPDF_CountedImage* imageData = new CPDF_CountedImage(pImage);
m_ImageMap[dwImageObjNum] = imageData;
@@ -540,7 +540,7 @@ CPDF_IccProfile* CPDF_DocPageData::GetIccProfile(CPDF_Stream* pIccProfileStream)
}
CPDF_StreamAcc stream;
- stream.LoadAllData(pIccProfileStream, FALSE);
+ stream.LoadAllData(pIccProfileStream, false);
uint8_t digest[20];
CPDF_Stream* pCopiedStream = nullptr;
CRYPT_SHA1Generate(stream.GetData(), stream.GetSize(), digest);
@@ -590,14 +590,14 @@ CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc(CPDF_Stream* pFontStream)
org_size = 0;
CPDF_StreamAcc* pFontFile = new CPDF_StreamAcc;
- pFontFile->LoadAllData(pFontStream, FALSE, org_size);
+ pFontFile->LoadAllData(pFontStream, false, org_size);
CPDF_CountedStreamAcc* ftData = new CPDF_CountedStreamAcc(pFontFile);
m_FontFileMap[pFontStream] = ftData;
return ftData->AddRef();
}
-void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOOL bForce)
+void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, bool bForce)
{
if (!pFontStream)
return;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
index c961f8b20f..a92219d268 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -25,8 +25,8 @@ class CPDF_PSProc
{
public:
~CPDF_PSProc();
- FX_BOOL Parse(CPDF_SimpleParser& parser);
- FX_BOOL Execute(CPDF_PSEngine* pEngine);
+ bool Parse(CPDF_SimpleParser& parser);
+ bool Execute(CPDF_PSEngine* pEngine);
CFX_PtrArray m_Operators;
};
#define PSENGINE_STACKSIZE 100
@@ -35,12 +35,12 @@ class CPDF_PSEngine
public:
CPDF_PSEngine();
~CPDF_PSEngine();
- FX_BOOL Parse(const FX_CHAR* string, int size);
- FX_BOOL Execute()
+ bool Parse(const FX_CHAR* string, int size);
+ bool Execute()
{
return m_MainProc.Execute(this);
}
- FX_BOOL DoOperator(PDF_PSOP op);
+ bool DoOperator(PDF_PSOP op);
void Reset()
{
m_StackCount = 0;
@@ -73,7 +73,7 @@ CPDF_PSProc::~CPDF_PSProc()
}
}
}
-FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine)
+bool CPDF_PSProc::Execute(CPDF_PSEngine* pEngine)
{
int size = m_Operators.GetSize();
for (int i = 0; i < size; i ++) {
@@ -85,7 +85,7 @@ FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine)
i ++;
} else if (op == PSOP_IF) {
if (i < 2 || m_Operators[i - 2] != (void*)PSOP_PROC) {
- return FALSE;
+ return false;
}
if ((int)pEngine->Pop()) {
((CPDF_PSProc*)m_Operators[i - 1])->Execute(pEngine);
@@ -93,7 +93,7 @@ FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine)
} else if (op == PSOP_IFELSE) {
if (i < 4 || m_Operators[i - 2] != (void*)PSOP_PROC ||
m_Operators[i - 4] != (void*)PSOP_PROC) {
- return FALSE;
+ return false;
}
if ((int)pEngine->Pop()) {
((CPDF_PSProc*)m_Operators[i - 3])->Execute(pEngine);
@@ -104,7 +104,7 @@ FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine)
pEngine->DoOperator(op);
}
}
- return TRUE;
+ return true;
}
CPDF_PSEngine::CPDF_PSEngine()
{
@@ -145,31 +145,31 @@ const struct _PDF_PSOpName {
{"copy", PSOP_COPY}, {"index", PSOP_INDEX}, {"roll", PSOP_ROLL},
{NULL, PSOP_PROC}
};
-FX_BOOL CPDF_PSEngine::Parse(const FX_CHAR* string, int size)
+bool CPDF_PSEngine::Parse(const FX_CHAR* string, int size)
{
CPDF_SimpleParser parser((uint8_t*)string, size);
CFX_ByteStringC word = parser.GetWord();
if (word != FX_BSTRC("{")) {
- return FALSE;
+ return false;
}
return m_MainProc.Parse(parser);
}
-FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser)
+bool CPDF_PSProc::Parse(CPDF_SimpleParser& parser)
{
while (1) {
CFX_ByteStringC word = parser.GetWord();
if (word.IsEmpty()) {
- return FALSE;
+ return false;
}
if (word == FX_BSTRC("}")) {
- return TRUE;
+ return true;
}
if (word == FX_BSTRC("{")) {
CPDF_PSProc* pProc = new CPDF_PSProc;
m_Operators.Add((void*)PSOP_PROC);
m_Operators.Add(pProc);
if (!pProc->Parse(parser)) {
- return FALSE;
+ return false;
}
} else {
int i = 0;
@@ -190,7 +190,7 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser)
}
}
#define PI 3.1415926535897932384626433832795f
-FX_BOOL CPDF_PSEngine::DoOperator(PDF_PSOP op)
+bool CPDF_PSEngine::DoOperator(PDF_PSOP op)
{
int i1, i2;
FX_FLOAT d1, d2;
@@ -418,7 +418,7 @@ FX_BOOL CPDF_PSEngine::DoOperator(PDF_PSOP op)
default:
break;
}
- return TRUE;
+ return true;
}
static FX_FLOAT PDF_Interpolate(FX_FLOAT x, FX_FLOAT xmin, FX_FLOAT xmax, FX_FLOAT ymin, FX_FLOAT ymax)
{
@@ -445,8 +445,8 @@ class CPDF_SampledFunc : public CPDF_Function
public:
CPDF_SampledFunc();
virtual ~CPDF_SampledFunc();
- virtual FX_BOOL v_Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
+ virtual bool v_Init(CPDF_Object* pObj);
+ virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
SampleEncodeInfo* m_pEncodeInfo;
SampleDecodeInfo* m_pDecodeInfo;
FX_DWORD m_nBitsPerSample;
@@ -469,10 +469,10 @@ CPDF_SampledFunc::~CPDF_SampledFunc()
FX_Free(m_pDecodeInfo);
}
}
-FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj)
+bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj)
{
if (pObj->GetType() != PDFOBJ_STREAM) {
- return FALSE;
+ return false;
}
CPDF_Stream* pStream = (CPDF_Stream*)pObj;
CPDF_Dictionary* pDict = pStream->GetDict();
@@ -481,11 +481,11 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj)
CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode"));
m_nBitsPerSample = pDict->GetInteger(FX_BSTRC("BitsPerSample"));
if (m_nBitsPerSample > 32) {
- return FALSE;
+ return false;
}
m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample);
m_pSampleStream = new CPDF_StreamAcc;
- m_pSampleStream->LoadAllData(pStream, FALSE);
+ m_pSampleStream->LoadAllData(pStream, false);
m_pEncodeInfo = FX_Alloc(SampleEncodeInfo, m_nInputs);
FX_SAFE_DWORD nTotalSampleBits = 1;
for (int i = 0; i < m_nInputs; i ++) {
@@ -514,7 +514,7 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj)
if (!nTotalSampleBytes.IsValid() ||
nTotalSampleBytes.ValueOrDie() == 0 ||
nTotalSampleBytes.ValueOrDie() > m_pSampleStream->GetSize()) {
- return FALSE;
+ return false;
}
m_pDecodeInfo = FX_Alloc(SampleDecodeInfo, m_nOutputs);
for (int i = 0; i < m_nOutputs; i ++) {
@@ -526,9 +526,9 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj)
m_pDecodeInfo[i].decode_max = m_pRanges[i * 2 + 1];
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
+bool CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
{
int pos = 0;
CFX_FixedBufGrow<FX_FLOAT, 16> encoded_input_buf(m_nInputs);
@@ -555,21 +555,21 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
FX_SAFE_INT32 bits_to_output = m_nOutputs;
bits_to_output *= m_nBitsPerSample;
if (!bits_to_output.IsValid()) {
- return FALSE;
+ return false;
}
FX_SAFE_INT32 bitpos = pos;
bitpos *= bits_to_output.ValueOrDie();
if (!bitpos.IsValid()) {
- return FALSE;
+ return false;
}
FX_SAFE_INT32 range_check = bitpos;
range_check += bits_to_output.ValueOrDie();
if (!range_check.IsValid()) {
- return FALSE;
+ return false;
}
const uint8_t* pSampleData = m_pSampleStream->GetData();
if (!pSampleData) {
- return FALSE;
+ return false;
}
for (int j = 0; j < m_nOutputs; j ++) {
FX_DWORD sample = _GetBits32(pSampleData, bitpos.ValueOrDie() + j * m_nBitsPerSample, m_nBitsPerSample);
@@ -586,7 +586,7 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
bitpos2 += j;
bitpos2 *= m_nBitsPerSample;
if (!bitpos2.IsValid()) {
- return FALSE;
+ return false;
}
FX_DWORD sample1 = _GetBits32(pSampleData, bitpos2.ValueOrDie(), m_nBitsPerSample);
encoded += (encoded_input[i] - index[i]) * ((FX_FLOAT)sample1 - (FX_FLOAT)sample);
@@ -595,23 +595,23 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
results[j] = PDF_Interpolate(encoded, 0, (FX_FLOAT)m_SampleMax,
m_pDecodeInfo[j].decode_min, m_pDecodeInfo[j].decode_max);
}
- return TRUE;
+ return true;
}
class CPDF_PSFunc : public CPDF_Function
{
public:
- virtual FX_BOOL v_Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
+ virtual bool v_Init(CPDF_Object* pObj);
+ virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
CPDF_PSEngine m_PS;
};
-FX_BOOL CPDF_PSFunc::v_Init(CPDF_Object* pObj)
+bool CPDF_PSFunc::v_Init(CPDF_Object* pObj)
{
CPDF_Stream* pStream = (CPDF_Stream*)pObj;
CPDF_StreamAcc acc;
- acc.LoadAllData(pStream, FALSE);
+ acc.LoadAllData(pStream, false);
return m_PS.Parse((const FX_CHAR*)acc.GetData(), acc.GetSize());
}
-FX_BOOL CPDF_PSFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
+bool CPDF_PSFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
{
CPDF_PSEngine& PS = (CPDF_PSEngine&)m_PS;
PS.Reset();
@@ -621,20 +621,20 @@ FX_BOOL CPDF_PSFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
}
PS.Execute();
if (PS.GetStackSize() < m_nOutputs) {
- return FALSE;
+ return false;
}
for (i = 0; i < m_nOutputs; i ++) {
results[m_nOutputs - i - 1] = PS.Pop();
}
- return TRUE;
+ return true;
}
class CPDF_ExpIntFunc : public CPDF_Function
{
public:
CPDF_ExpIntFunc();
virtual ~CPDF_ExpIntFunc();
- virtual FX_BOOL v_Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
+ virtual bool v_Init(CPDF_Object* pObj);
+ virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
FX_FLOAT m_Exponent;
FX_FLOAT* m_pBeginValues;
FX_FLOAT* m_pEndValues;
@@ -654,11 +654,11 @@ CPDF_ExpIntFunc::~CPDF_ExpIntFunc()
FX_Free(m_pEndValues);
}
}
-FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj)
+bool CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj)
{
CPDF_Dictionary* pDict = pObj->GetDict();
if (pDict == NULL) {
- return FALSE;
+ return false;
}
CPDF_Array* pArray0 = pDict->GetArray(FX_BSTRC("C0"));
if (m_nOutputs == 0) {
@@ -677,27 +677,27 @@ FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj)
m_Exponent = pDict->GetFloat(FX_BSTRC("N"));
m_nOrigOutputs = m_nOutputs;
if (m_nOutputs && m_nInputs > INT_MAX / m_nOutputs) {
- return FALSE;
+ return false;
}
m_nOutputs *= m_nInputs;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ExpIntFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
+bool CPDF_ExpIntFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
{
for (int i = 0; i < m_nInputs; i ++)
for (int j = 0; j < m_nOrigOutputs; j ++) {
results[i * m_nOrigOutputs + j] = m_pBeginValues[j] + (FX_FLOAT)FXSYS_pow(inputs[i], m_Exponent) *
(m_pEndValues[j] - m_pBeginValues[j]);
}
- return TRUE;
+ return true;
}
class CPDF_StitchFunc : public CPDF_Function
{
public:
CPDF_StitchFunc();
virtual ~CPDF_StitchFunc();
- virtual FX_BOOL v_Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
+ virtual bool v_Init(CPDF_Object* pObj);
+ virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
int m_nSubs;
CPDF_Function** m_pSubFunctions;
FX_FLOAT* m_pBounds;
@@ -724,19 +724,19 @@ CPDF_StitchFunc::~CPDF_StitchFunc()
FX_Free(m_pEncode);
}
}
-FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj)
+bool CPDF_StitchFunc::v_Init(CPDF_Object* pObj)
{
CPDF_Dictionary* pDict = pObj->GetDict();
if (pDict == NULL) {
- return FALSE;
+ return false;
}
CPDF_Array* pArray = pDict->GetArray(FX_BSTRC("Functions"));
if (pArray == NULL) {
- return FALSE;
+ return false;
}
m_nSubs = pArray->GetCount();
if (m_nSubs == 0) {
- return FALSE;
+ return false;
}
m_pSubFunctions = FX_Alloc(CPDF_Function*, m_nSubs);
m_nOutputs = 0;
@@ -744,11 +744,11 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj)
for (i = 0; i < m_nSubs; i ++) {
CPDF_Object* pSub = pArray->GetElementValue(i);
if (pSub == pObj) {
- return FALSE;
+ return false;
}
m_pSubFunctions[i] = CPDF_Function::Load(pSub);
if (m_pSubFunctions[i] == NULL) {
- return FALSE;
+ return false;
}
if (m_pSubFunctions[i]->CountOutputs() > m_nOutputs) {
m_nOutputs = m_pSubFunctions[i]->CountOutputs();
@@ -758,7 +758,7 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj)
m_pBounds[0] = m_pDomains[0];
pArray = pDict->GetArray(FX_BSTRC("Bounds"));
if (pArray == NULL) {
- return FALSE;
+ return false;
}
for (i = 0; i < m_nSubs - 1; i ++) {
m_pBounds[i + 1] = pArray->GetFloat(i);
@@ -767,14 +767,14 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj)
m_pEncode = FX_Alloc2D(FX_FLOAT, m_nSubs, 2);
pArray = pDict->GetArray(FX_BSTRC("Encode"));
if (pArray == NULL) {
- return FALSE;
+ return false;
}
for (i = 0; i < m_nSubs * 2; i ++) {
m_pEncode[i] = pArray->GetFloat(i);
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const
+bool CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const
{
FX_FLOAT input = inputs[0];
int i;
@@ -783,12 +783,12 @@ FX_BOOL CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const
break;
}
if (m_pSubFunctions[i] == NULL) {
- return FALSE;
+ return false;
}
input = PDF_Interpolate(input, m_pBounds[i], m_pBounds[i + 1], m_pEncode[i * 2], m_pEncode[i * 2 + 1]);
int nresults;
m_pSubFunctions[i]->Call(&input, m_nInputs, outputs, nresults);
- return TRUE;
+ return true;
}
CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj)
{
@@ -837,7 +837,7 @@ CPDF_Function::~CPDF_Function()
m_pRanges = NULL;
}
}
-FX_BOOL CPDF_Function::Init(CPDF_Object* pObj)
+bool CPDF_Function::Init(CPDF_Object* pObj)
{
CPDF_Dictionary* pDict;
if (pObj->GetType() == PDFOBJ_STREAM) {
@@ -847,11 +847,11 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj)
}
CPDF_Array* pDomains = pDict->GetArray(FX_BSTRC("Domain"));
if (pDomains == NULL) {
- return FALSE;
+ return false;
}
m_nInputs = pDomains->GetCount() / 2;
if (m_nInputs == 0) {
- return FALSE;
+ return false;
}
m_pDomains = FX_Alloc2D(FX_FLOAT, m_nInputs, 2);
for (int i = 0; i < m_nInputs * 2; i ++) {
@@ -868,7 +868,7 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj)
}
FX_DWORD old_outputs = m_nOutputs;
if (!v_Init(pObj)) {
- return FALSE;
+ return false;
}
if (m_pRanges && m_nOutputs > (int)old_outputs) {
m_pRanges = FX_Realloc(FX_FLOAT, m_pRanges, m_nOutputs * 2);
@@ -876,12 +876,12 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj)
FXSYS_memset(m_pRanges + (old_outputs * 2), 0, sizeof(FX_FLOAT) * (m_nOutputs - old_outputs) * 2);
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_Function::Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, int& nresults) const
+bool CPDF_Function::Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, int& nresults) const
{
if (m_nInputs != ninputs) {
- return FALSE;
+ return false;
}
nresults = m_nOutputs;
for (int i = 0; i < m_nInputs; i ++) {
@@ -901,5 +901,5 @@ FX_BOOL CPDF_Function::Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, in
}
}
}
- return TRUE;
+ return true;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
index b4d030e679..3264be42c6 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
@@ -97,7 +97,7 @@ void CPDF_ClipPathData::SetCount(int path_count, int text_count)
CPDF_Rect CPDF_ClipPath::GetClipBox() const
{
CPDF_Rect rect;
- FX_BOOL bStarted = FALSE;
+ bool bStarted = false;
int count = GetPathCount();
if (count) {
rect = GetPath(0).GetBoundingBox();
@@ -105,26 +105,26 @@ CPDF_Rect CPDF_ClipPath::GetClipBox() const
CPDF_Rect path_rect = GetPath(i).GetBoundingBox();
rect.Intersect(path_rect);
}
- bStarted = TRUE;
+ bStarted = true;
}
count = GetTextCount();
if (count) {
CPDF_Rect layer_rect;
- FX_BOOL bLayerStarted = FALSE;
+ bool bLayerStarted = false;
for (int i = 0; i < count; i ++) {
CPDF_TextObject* pTextObj = GetText(i);
if (pTextObj == NULL) {
if (!bStarted) {
rect = layer_rect;
- bStarted = TRUE;
+ bStarted = true;
} else {
rect.Intersect(layer_rect);
}
- bLayerStarted = FALSE;
+ bLayerStarted = false;
} else {
if (!bLayerStarted) {
layer_rect = pTextObj->GetBBox(NULL);
- bLayerStarted = TRUE;
+ bLayerStarted = true;
} else {
layer_rect.Union(pTextObj->GetBBox(NULL));
}
@@ -133,7 +133,7 @@ CPDF_Rect CPDF_ClipPath::GetClipBox() const
}
return rect;
}
-void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge)
+void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, bool bAutoMerge)
{
CPDF_ClipPathData* pData = GetModify();
if (pData->m_PathCount && bAutoMerge) {
@@ -256,7 +256,7 @@ void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern, FX_FLOAT* pValue, i
CPDF_ColorStateData* pData = GetModify();
pData->m_FillColor.SetValue(pPattern, pValue, nValues);
int R, G, B;
- FX_BOOL ret = pData->m_FillColor.GetRGB(R, G, B);
+ bool ret = pData->m_FillColor.GetRGB(R, G, B);
if (pPattern->m_PatternType == 1 && ((CPDF_TilingPattern*)pPattern)->m_bColored && !ret) {
pData->m_FillRGB = 0x00BFBFBF;
return;
@@ -268,7 +268,7 @@ void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern, FX_FLOAT* pValue,
CPDF_ColorStateData* pData = GetModify();
pData->m_StrokeColor.SetValue(pPattern, pValue, nValues);
int R, G, B;
- FX_BOOL ret = pData->m_StrokeColor.GetRGB(R, G, B);
+ bool ret = pData->m_StrokeColor.GetRGB(R, G, B);
if (pPattern->m_PatternType == 1 && ((CPDF_TilingPattern*)pPattern)->m_bColored && !ret) {
pData->m_StrokeRGB = 0x00BFBFBF;
return;
@@ -295,7 +295,7 @@ CPDF_TextStateData::CPDF_TextStateData(const CPDF_TextStateData& src)
}
FXSYS_memcpy(this, &src, sizeof(CPDF_TextStateData));
if (m_pDocument && m_pFont) {
- m_pFont = m_pDocument->GetPageData()->GetFont(m_pFont->GetFontDict(), FALSE);
+ m_pFont = m_pDocument->GetPageData()->GetFont(m_pFont->GetFontDict(), false);
}
}
CPDF_TextStateData::~CPDF_TextStateData()
@@ -545,7 +545,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, CPDF_StreamContentParser
}
pGeneralState->SetBlendMode(mode);
if (pGeneralState->m_BlendType > FXDIB_BLEND_MULTIPLY) {
- pParser->GetObjectList()->m_bBackgroundAlphaNeeded = TRUE;
+ pParser->GetObjectList()->m_bBackgroundAlphaNeeded = true;
}
break;
}
@@ -631,12 +631,12 @@ CPDF_ContentMarkItem::~CPDF_ContentMarkItem()
((CPDF_Dictionary*)m_pParam)->Release();
}
}
-FX_BOOL CPDF_ContentMarkItem::HasMCID() const
+bool CPDF_ContentMarkItem::HasMCID() const
{
if (m_pParam && (m_ParamType == DirectDict || m_ParamType == PropertiesDict)) {
return ((CPDF_Dictionary *)m_pParam)->KeyExist(FX_BSTRC("MCID"));
}
- return FALSE;
+ return false;
}
CPDF_ContentMarkData::CPDF_ContentMarkData(const CPDF_ContentMarkData& src)
{
@@ -658,7 +658,7 @@ int CPDF_ContentMarkData::GetMCID() const
}
return -1;
}
-void CPDF_ContentMarkData::AddMark(const CFX_ByteString& name, CPDF_Dictionary* pDict, FX_BOOL bDirect)
+void CPDF_ContentMarkData::AddMark(const CFX_ByteString& name, CPDF_Dictionary* pDict, bool bDirect)
{
CPDF_ContentMarkItem& item = m_Marks.Add();
item.SetName(name);
@@ -676,23 +676,23 @@ void CPDF_ContentMarkData::DeleteLastMark()
}
m_Marks.RemoveAt(size - 1);
}
-FX_BOOL CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const
+bool CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const
{
if (m_pObject == NULL) {
- return FALSE;
+ return false;
}
for (int i = 0; i < m_pObject->CountItems(); i ++) {
CPDF_ContentMarkItem& item = m_pObject->GetItem(i);
if (item.GetName() == mark) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionary*& pDict) const
+bool CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionary*& pDict) const
{
if (m_pObject == NULL) {
- return FALSE;
+ return false;
}
for (int i = 0; i < m_pObject->CountItems(); i ++) {
CPDF_ContentMarkItem& item = m_pObject->GetItem(i);
@@ -702,8 +702,8 @@ FX_BOOL CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionar
item.GetParamType() == CPDF_ContentMarkItem::DirectDict) {
pDict = (CPDF_Dictionary*)item.GetParam();
}
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
index aabfd141d6..739a0bdf04 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
@@ -57,7 +57,7 @@ CPDF_Image* CPDF_Image::Clone()
CPDF_Image* pImage = new CPDF_Image(m_pDocument);
pImage->LoadImageF((CPDF_Stream*)((CPDF_Object*)m_pStream)->Clone(), m_bInline);
if (m_bInline) {
- CPDF_Dictionary *pInlineDict = (CPDF_Dictionary*)m_pInlineDict->Clone(TRUE);
+ CPDF_Dictionary *pInlineDict = (CPDF_Dictionary*)m_pInlineDict->Clone(true);
pImage->SetInlineDict(pInlineDict);
}
return pImage;
@@ -67,7 +67,7 @@ CPDF_Image::CPDF_Image(CPDF_Document* pDoc)
m_pDocument = pDoc;
m_pStream = NULL;
m_pOC = NULL;
- m_bInline = FALSE;
+ m_bInline = false;
m_pInlineDict = NULL;
m_pDIBSource = NULL;
m_pMask = NULL;
@@ -84,7 +84,7 @@ CPDF_Image::~CPDF_Image()
}
}
}
-FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline)
+bool CPDF_Image::LoadImageF(CPDF_Stream* pStream, bool bInline)
{
m_pStream = pStream;
if (m_bInline && m_pInlineDict) {
@@ -101,5 +101,5 @@ FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline)
m_bInterpolate = pDict->GetInteger(FX_BSTRC("Interpolate"));
m_Height = pDict->GetInteger(FX_BSTRC("Height"));
m_Width = pDict->GetInteger(FX_BSTRC("Width"));
- return TRUE;
+ return true;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 892e2153b7..b27f958d5e 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -9,7 +9,7 @@
#include "../../../include/fpdfapi/fpdf_serial.h"
#include "pageint.h"
-#define REQUIRE_PARAMS(count) if (m_ParamCount != count) { m_bAbort = TRUE; return; }
+#define REQUIRE_PARAMS(count) if (m_ParamCount != count) { m_bAbort = true; return; }
CPDF_StreamContentParser::CPDF_StreamContentParser(
CPDF_Document* pDocument,
@@ -30,7 +30,7 @@ CPDF_StreamContentParser::CPDF_StreamContentParser(
m_Level(level),
m_ParamStartPos(0),
m_ParamCount(0),
- m_bAbort(FALSE),
+ m_bAbort(false),
m_pCurStates(new CPDF_AllStates),
m_pLastTextObject(nullptr),
m_DefFontSize(0),
@@ -43,9 +43,9 @@ CPDF_StreamContentParser::CPDF_StreamContentParser(
m_pLastImage(nullptr),
m_pLastImageDict(nullptr),
m_pLastCloneImageDict(nullptr),
- m_bReleaseLastDict(TRUE),
- m_bColored(FALSE),
- m_bResourceMissing(FALSE)
+ m_bReleaseLastDict(true),
+ m_bColored(false),
+ m_bResourceMissing(false)
{
if (pmtContentToUser) {
m_mtContentToUser = *pmtContentToUser;
@@ -183,7 +183,7 @@ CPDF_Object* CPDF_StreamContentParser::GetObject(FX_DWORD index)
if (param.m_Type == 0) {
return param.m_pObject;
}
- ASSERT(FALSE);
+ ASSERT(false);
return NULL;
}
CFX_ByteString CPDF_StreamContentParser::GetString(FX_DWORD index)
@@ -226,7 +226,7 @@ FX_FLOAT CPDF_StreamContentParser::GetNumber16(FX_DWORD index)
{
return GetNumber(index);
}
-void CPDF_StreamContentParser::SetGraphicStates(CPDF_PageObject* pObj, FX_BOOL bColor, FX_BOOL bText, FX_BOOL bGraph)
+void CPDF_StreamContentParser::SetGraphicStates(CPDF_PageObject* pObj, bool bColor, bool bText, bool bGraph)
{
pObj->m_GeneralState = m_pCurStates->m_GeneralState;
pObj->m_ClipPath = m_pCurStates->m_ClipPath;
@@ -318,7 +318,7 @@ const CPDF_StreamContentParser::OpCode CPDF_StreamContentParser::g_OpCodes[] =
{FXBSTR_ID('w', 0, 0, 0), &CPDF_StreamContentParser::Handle_SetLineWidth},
{FXBSTR_ID('y', 0, 0, 0), &CPDF_StreamContentParser::Handle_CurveTo_13},
};
-FX_BOOL CPDF_StreamContentParser::OnOperator(const FX_CHAR* op)
+bool CPDF_StreamContentParser::OnOperator(const FX_CHAR* op)
{
int i = 0;
FX_DWORD opid = 0;
@@ -336,7 +336,7 @@ FX_BOOL CPDF_StreamContentParser::OnOperator(const FX_CHAR* op)
int compare = opid - g_OpCodes[middle].m_OpId;
if (compare == 0) {
(this->*g_OpCodes[middle].m_OpHandler)();
- return TRUE;
+ return true;
}
if (compare < 0) {
high = middle - 1;
@@ -352,14 +352,14 @@ void CPDF_StreamContentParser::Handle_CloseFillStrokePath()
return;
}
Handle_ClosePath();
- AddPathObject(FXFILL_WINDING, TRUE);
+ AddPathObject(FXFILL_WINDING, true);
}
void CPDF_StreamContentParser::Handle_FillStrokePath()
{
if (m_Options.m_bTextOnly) {
return;
}
- AddPathObject(FXFILL_WINDING, TRUE);
+ AddPathObject(FXFILL_WINDING, true);
}
void CPDF_StreamContentParser::Handle_CloseEOFillStrokePath()
{
@@ -367,14 +367,14 @@ void CPDF_StreamContentParser::Handle_CloseEOFillStrokePath()
return;
}
AddPathPoint(m_PathStartX, m_PathStartY, FXPT_LINETO | FXPT_CLOSEFIGURE);
- AddPathObject(FXFILL_ALTERNATE, TRUE);
+ AddPathObject(FXFILL_ALTERNATE, true);
}
void CPDF_StreamContentParser::Handle_EOFillStrokePath()
{
if (m_Options.m_bTextOnly) {
return;
}
- AddPathObject(FXFILL_ALTERNATE, TRUE);
+ AddPathObject(FXFILL_ALTERNATE, true);
}
void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary()
{
@@ -386,13 +386,13 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary()
if (pProperty == NULL) {
return;
}
- FX_BOOL bDirect = TRUE;
+ bool bDirect = true;
if (pProperty->GetType() == PDFOBJ_NAME) {
pProperty = FindResourceObj(FX_BSTRC("Properties"), pProperty->GetString());
if (pProperty == NULL) {
return;
}
- bDirect = FALSE;
+ bDirect = false;
}
if (pProperty->GetType() != PDFOBJ_DICTIONARY) {
return;
@@ -405,7 +405,7 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent()
return;
}
CFX_ByteString tag = GetString(0);
- m_CurContentMark.GetModify()->AddMark(tag, NULL, FALSE);
+ m_CurContentMark.GetModify()->AddMark(tag, NULL, false);
}
struct _FX_BSTR {
const FX_CHAR* m_Ptr;
@@ -622,20 +622,20 @@ void CPDF_StreamContentParser::Handle_SetCharWidth()
{
m_Type3Data[0] = GetNumber(1);
m_Type3Data[1] = GetNumber(0);
- m_bColored = TRUE;
+ m_bColored = true;
}
void CPDF_StreamContentParser::Handle_SetCachedDevice()
{
for (int i = 0; i < 6; i ++) {
m_Type3Data[i] = GetNumber(5 - i);
}
- m_bColored = FALSE;
+ m_bColored = false;
}
void CPDF_StreamContentParser::Handle_ExecuteXObject()
{
CFX_ByteString name = GetString(0);
if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() && m_pLastImage->GetStream()->GetObjNum()) {
- AddImage(NULL, m_pLastImage, FALSE);
+ AddImage(NULL, m_pLastImage, false);
return;
}
if (m_Options.m_bTextOnly) {
@@ -673,14 +673,14 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject()
}
}
}
- FX_BOOL bForm;
+ bool bForm;
if (m_pDocument->IsFormStream(((CPDF_Reference*)pRes)->GetRefObjNum(), bForm) && !bForm) {
return;
}
}
CPDF_Stream* pXObject = (CPDF_Stream*)FindResourceObj(FX_BSTRC("XObject"), name);
if (pXObject == NULL || pXObject->GetType() != PDFOBJ_STREAM) {
- m_bResourceMissing = TRUE;
+ m_bResourceMissing = true;
return;
}
CFX_ByteStringC type = pXObject->GetDict() ? pXObject->GetDict()->GetConstString(FX_BSTRC("Subtype")) : CFX_ByteStringC();
@@ -688,7 +688,7 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject()
if (m_Options.m_bTextOnly) {
return;
}
- CPDF_ImageObject* pObj = AddImage(pXObject, NULL, FALSE);
+ CPDF_ImageObject* pObj = AddImage(pXObject, NULL, false);
m_LastImageName = name;
m_pLastImage = pObj->m_pImage;
} else if (type == FX_BSTRC("Form")) {
@@ -719,10 +719,10 @@ void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream)
m_pCurStates.get(), m_Level + 1);
parser.m_pCurStates->m_CTM = form_matrix;
if (ClipPath.NotNull()) {
- parser.m_pCurStates->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING, TRUE);
+ parser.m_pCurStates->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING, true);
}
CPDF_StreamAcc stream;
- stream.LoadAllData(pStream, FALSE);
+ stream.LoadAllData(pStream, false);
if (stream.GetSize() == 0) {
return;
}
@@ -740,13 +740,13 @@ void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream)
status.m_TextState = m_pCurStates->m_TextState;
pFormObj->m_pForm->ParseContent(&status, NULL, NULL, &m_Options, m_Level + 1);
if (!m_pObjectList->m_bBackgroundAlphaNeeded && pFormObj->m_pForm->m_bBackgroundAlphaNeeded) {
- m_pObjectList->m_bBackgroundAlphaNeeded = TRUE;
+ m_pObjectList->m_bBackgroundAlphaNeeded = true;
}
pFormObj->CalcBoundingBox();
- SetGraphicStates(pFormObj, TRUE, TRUE, TRUE);
+ SetGraphicStates(pFormObj, true, true, true);
m_pObjectList->m_ObjectList.AddTail(pFormObj);
}
-CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, FX_BOOL bInline)
+CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, bool bInline)
{
if (pStream == NULL && pImage == NULL) {
return NULL;
@@ -763,7 +763,7 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream, CPDF_
pImageObj->m_pImage = new CPDF_Image(m_pDocument);
pImageObj->m_pImage->LoadImageF(pStream, bInline);
}
- SetGraphicStates(pImageObj, pImageObj->m_pImage->IsMask(), FALSE, FALSE);
+ SetGraphicStates(pImageObj, pImageObj->m_pImage->IsMask(), false, false);
pImageObj->m_Matrix = ImageMatrix;
pImageObj->CalcBoundingBox();
m_pObjectList->m_ObjectList.AddTail(pImageObj);
@@ -817,21 +817,21 @@ void CPDF_StreamContentParser::Handle_FillPath()
if (m_Options.m_bTextOnly) {
return;
}
- AddPathObject(FXFILL_WINDING, FALSE);
+ AddPathObject(FXFILL_WINDING, false);
}
void CPDF_StreamContentParser::Handle_FillPathOld()
{
if (m_Options.m_bTextOnly) {
return;
}
- AddPathObject(FXFILL_WINDING, FALSE);
+ AddPathObject(FXFILL_WINDING, false);
}
void CPDF_StreamContentParser::Handle_EOFillPath()
{
if (m_Options.m_bTextOnly) {
return;
}
- AddPathObject(FXFILL_ALTERNATE, FALSE);
+ AddPathObject(FXFILL_ALTERNATE, false);
}
void CPDF_StreamContentParser::Handle_SetGray_Fill()
{
@@ -850,7 +850,7 @@ void CPDF_StreamContentParser::Handle_SetExtendGraphState()
CFX_ByteString name = GetString(0);
CPDF_Dictionary* pGS = (CPDF_Dictionary*)FindResourceObj(FX_BSTRC("ExtGState"), name);
if (pGS == NULL || pGS->GetType() != PDFOBJ_DICTIONARY) {
- m_bResourceMissing = TRUE;
+ m_bResourceMissing = true;
return;
}
m_pCurStates->ProcessExtGS(pGS, this);
@@ -934,7 +934,7 @@ void CPDF_StreamContentParser::Handle_EndPath()
if (m_Options.m_bTextOnly) {
return;
}
- AddPathObject(0, FALSE);
+ AddPathObject(0, false);
}
void CPDF_StreamContentParser::Handle_SaveGraphState()
{
@@ -999,14 +999,14 @@ void CPDF_StreamContentParser::Handle_CloseStrokePath()
return;
}
Handle_ClosePath();
- AddPathObject(0, TRUE);
+ AddPathObject(0, true);
}
void CPDF_StreamContentParser::Handle_StrokePath()
{
if (m_Options.m_bTextOnly) {
return;
}
- AddPathObject(0, TRUE);
+ AddPathObject(0, true);
}
void CPDF_StreamContentParser::Handle_SetColor_Fill()
{
@@ -1060,7 +1060,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Fill()
}
}
if (nvalues != nargs) {
- CPDF_Pattern* pPattern = FindPattern(GetString(0), FALSE);
+ CPDF_Pattern* pPattern = FindPattern(GetString(0), false);
if (pPattern) {
m_pCurStates->m_ColorState.SetFillPattern(pPattern, values, nvalues);
}
@@ -1093,7 +1093,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Stroke()
}
}
if (nvalues != nargs) {
- CPDF_Pattern* pPattern = FindPattern(GetString(0), FALSE);
+ CPDF_Pattern* pPattern = FindPattern(GetString(0), false);
if (pPattern) {
m_pCurStates->m_ColorState.SetStrokePattern(pPattern, values, nvalues);
}
@@ -1111,7 +1111,7 @@ void CPDF_StreamContentParser::Handle_ShadeFill()
if (m_Options.m_bTextOnly) {
return;
}
- CPDF_Pattern* pPattern = FindPattern(GetString(0), TRUE);
+ CPDF_Pattern* pPattern = FindPattern(GetString(0), true);
if (pPattern == NULL) {
return;
}
@@ -1127,7 +1127,7 @@ void CPDF_StreamContentParser::Handle_ShadeFill()
}
CPDF_ShadingObject* pObj = new CPDF_ShadingObject;
pObj->m_pShading = pShading;
- SetGraphicStates(pObj, FALSE, FALSE, FALSE);
+ SetGraphicStates(pObj, false, false, false);
pObj->m_Matrix = m_pCurStates->m_CTM;
pObj->m_Matrix.Concat(m_mtContentToUser);
CFX_FloatRect bbox;
@@ -1206,7 +1206,7 @@ CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name)
{
CPDF_Dictionary* pFontDict = (CPDF_Dictionary*)FindResourceObj(FX_BSTRC("Font"), name);
if (pFontDict == NULL || pFontDict->GetType() != PDFOBJ_DICTIONARY) {
- m_bResourceMissing = TRUE;
+ m_bResourceMissing = true;
return CPDF_Font::GetStockFont(m_pDocument, FX_BSTRC("Helvetica"));
}
CPDF_Font* pFont = m_pDocument->LoadFont(pFontDict);
@@ -1238,17 +1238,17 @@ CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace(const CFX_ByteString&
}
CPDF_Object* pCSObj = FindResourceObj(FX_BSTRC("ColorSpace"), name);
if (pCSObj == NULL) {
- m_bResourceMissing = TRUE;
+ m_bResourceMissing = true;
return NULL;
}
return m_pDocument->LoadColorSpace(pCSObj);
}
-CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name, FX_BOOL bShading)
+CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name, bool bShading)
{
CPDF_Object* pPattern = FindResourceObj(bShading ? FX_BSTRC("Shading") : FX_BSTRC("Pattern"), name);
if (pPattern == NULL || (pPattern->GetType() != PDFOBJ_DICTIONARY &&
pPattern->GetType() != PDFOBJ_STREAM)) {
- m_bResourceMissing = TRUE;
+ m_bResourceMissing = true;
return NULL;
}
return m_pDocument->LoadPattern(pPattern, bShading, &m_pCurStates->m_ParentMatrix);
@@ -1287,7 +1287,7 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs, FX_FLOAT fIn
}
CPDF_TextObject* pText = new CPDF_TextObject;
m_pLastTextObject = pText;
- SetGraphicStates(pText, TRUE, TRUE, TRUE);
+ SetGraphicStates(pText, true, true, true);
if (textmode && textmode != 3 && textmode != 4 && textmode != 7) {
FX_FLOAT* pCTM = pText->m_TextState.GetModify()->m_CTM;
pCTM[0] = m_pCurStates->m_CTM.a;
@@ -1501,7 +1501,7 @@ void CPDF_StreamContentParser::AddPathPoint(FX_FLOAT x, FX_FLOAT y, int flag)
m_pPathPoints[m_PathPointCount - 1].m_PointX = x;
m_pPathPoints[m_PathPointCount - 1].m_PointY = y;
}
-void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke)
+void CPDF_StreamContentParser::AddPathObject(int FillType, bool bStroke)
{
int PathPointCount = m_PathPointCount, PathClipType = m_PathClipType;
m_PathPointCount = 0;
@@ -1510,7 +1510,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke)
if (PathPointCount && PathClipType) {
CPDF_Path path;
path.New()->AppendRect(0, 0, 0, 0);
- m_pCurStates->m_ClipPath.AppendPath(path, FXFILL_WINDING, TRUE);
+ m_pCurStates->m_ClipPath.AppendPath(path, FXFILL_WINDING, true);
}
return;
}
@@ -1529,7 +1529,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke)
pPathObj->m_FillType = FillType;
pPathObj->m_Path = Path;
pPathObj->m_Matrix = matrix;
- SetGraphicStates(pPathObj, TRUE, FALSE, TRUE);
+ SetGraphicStates(pPathObj, true, false, true);
pPathObj->CalcBoundingBox();
m_pObjectList->m_ObjectList.AddTail(pPathObj);
}
@@ -1538,13 +1538,13 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke)
Path.Transform(&matrix);
matrix.SetIdentity();
}
- m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE);
+ m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, true);
}
}
CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf)
{
CFX_ByteTextBuf buf;
- FX_BOOL bFirst = TRUE;
+ bool bFirst = true;
int code = 0;
const uint8_t* str = src_buf.GetBuffer();
FX_DWORD size = src_buf.GetSize();
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 37ffea9742..399a4c754c 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -18,18 +18,18 @@ const FX_CHAR* const _PDF_OpCharType =
"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"
"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"
"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII";
-FX_BOOL _PDF_HasInvalidOpChar(const FX_CHAR* op)
+bool _PDF_HasInvalidOpChar(const FX_CHAR* op)
{
if(!op) {
- return FALSE;
+ return false;
}
uint8_t ch;
while((ch = *op++)) {
if(_PDF_OpCharType[ch] == 'I') {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
class CPDF_StreamParserAutoClearer {
public:
@@ -60,7 +60,7 @@ FX_DWORD CPDF_StreamContentParser::Parse(const uint8_t* pData, FX_DWORD dwSize,
return m_pSyntax->GetPos();
case CPDF_StreamParser::Keyword:
if(!OnOperator((char*)syntax.GetWordBuf()) && _PDF_HasInvalidOpChar((char*)syntax.GetWordBuf())) {
- m_bAbort = TRUE;
+ m_bAbort = true;
}
if (m_bAbort) {
return m_pSyntax->GetPos();
@@ -143,7 +143,7 @@ void CPDF_StreamContentParser::Handle_BeginImage()
return;
}
pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image"));
- CPDF_ImageObject *pImgObj = AddImage(pStream, NULL, TRUE);
+ CPDF_ImageObject *pImgObj = AddImage(pStream, NULL, true);
if (!pImgObj) {
if (pStream) {
pStream->Release();
@@ -159,7 +159,7 @@ void CPDF_StreamContentParser::ParsePathObject()
int last_pos = m_pSyntax->GetPos();
while (1) {
CPDF_StreamParser::SyntaxType type = m_pSyntax->ParseNextElement();
- FX_BOOL bProcessed = TRUE;
+ bool bProcessed = true;
switch (type) {
case CPDF_StreamParser::EndOfData:
return;
@@ -198,7 +198,7 @@ void CPDF_StreamContentParser::ParsePathObject()
nParams = 0;
break;
default:
- bProcessed = FALSE;
+ bProcessed = false;
break;
}
} else if (len == 2) {
@@ -206,10 +206,10 @@ void CPDF_StreamContentParser::ParsePathObject()
AddPathRect(params[0], params[1], params[2], params[3]);
nParams = 0;
} else {
- bProcessed = FALSE;
+ bProcessed = false;
}
} else {
- bProcessed = FALSE;
+ bProcessed = false;
}
if (bProcessed) {
last_pos = m_pSyntax->GetPos();
@@ -220,14 +220,14 @@ void CPDF_StreamContentParser::ParsePathObject()
if (nParams == 6) {
break;
}
- FX_BOOL bInteger;
+ bool bInteger;
int value;
FX_atonum(CFX_ByteStringC(m_pSyntax->GetWordBuf(), m_pSyntax->GetWordSize()), bInteger, &value);
params[nParams++] = bInteger ? (FX_FLOAT)value : *(FX_FLOAT*)&value;
break;
}
default:
- bProcessed = FALSE;
+ bProcessed = false;
}
if (!bProcessed) {
m_pSyntax->SetPos(last_pos);
@@ -279,7 +279,7 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWOR
const CPDF_Dictionary* pParams);
FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size);
FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size);
-FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams,
+FX_DWORD FPDFAPI_FlateOrLZWDecode(bool bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams,
FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size);
FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, FX_DWORD limit,
int width, int height, CFX_ByteString& decoder,
@@ -296,10 +296,10 @@ FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, FX_DWORD limit,
return _HexDecode(src_buf, limit, dest_buf, dest_size);
}
if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) {
- return FPDFAPI_FlateOrLZWDecode(FALSE, src_buf, limit, pParam, dest_size, dest_buf, dest_size);
+ return FPDFAPI_FlateOrLZWDecode(false, src_buf, limit, pParam, dest_size, dest_buf, dest_size);
}
if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW")) {
- return FPDFAPI_FlateOrLZWDecode(TRUE, src_buf, limit, pParam, 0, dest_buf, dest_size);
+ return FPDFAPI_FlateOrLZWDecode(true, src_buf, limit, pParam, 0, dest_buf, dest_size);
}
if (decoder == FX_BSTRC("DCTDecode") || decoder == FX_BSTRC("DCT")) {
ICodec_ScanlineDecoder* pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder(
@@ -313,7 +313,7 @@ FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, FX_DWORD limit,
dest_buf = 0;
return (FX_DWORD) - 1;
}
-CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dictionary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode)
+CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dictionary* pDict, CPDF_Object* pCSObj, bool bDecode)
{
if (m_Pos == m_Size) {
return NULL;
@@ -447,7 +447,7 @@ CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement()
m_pLastObj = NULL;
}
m_WordSize = 0;
- FX_BOOL bIsNumber = TRUE;
+ bool bIsNumber = true;
if (m_Pos >= m_Size) {
return EndOfData;
}
@@ -485,7 +485,7 @@ CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement()
m_WordBuffer[m_WordSize++] = ch;
}
if (type != 'N') {
- bIsNumber = FALSE;
+ bIsNumber = false;
}
if (m_Size <= m_Pos) {
break;
@@ -506,7 +506,7 @@ CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement()
}
if (m_WordSize == 4) {
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_TRUE) {
- m_pLastObj = CPDF_Boolean::Create(TRUE);
+ m_pLastObj = CPDF_Boolean::Create(true);
return Others;
}
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_NULL) {
@@ -515,7 +515,7 @@ CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement()
}
} else if (m_WordSize == 5) {
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_FALS && m_WordBuffer[4] == 'e') {
- m_pLastObj = CPDF_Boolean::Create(FALSE);
+ m_pLastObj = CPDF_Boolean::Create(false);
return Others;
}
}
@@ -584,9 +584,9 @@ void CPDF_StreamParser::SkipPathObject()
}
}
}
-CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, FX_BOOL bInArray)
+CPDF_Object* CPDF_StreamParser::ReadNextObject(bool bAllowNestedArray, bool bInArray)
{
- FX_BOOL bIsNumber;
+ bool bIsNumber;
GetNextWord(bIsNumber);
if (m_WordSize == 0) {
return NULL;
@@ -604,7 +604,7 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, FX_BOO
}
if (first_char == '<') {
if (m_WordSize == 1) {
- return CPDF_String::Create(ReadHexString(), TRUE);
+ return CPDF_String::Create(ReadHexString(), true);
}
CPDF_Dictionary* pDict = CPDF_Dictionary::Create();
while (1) {
@@ -621,7 +621,7 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, FX_BOO
return NULL;
}
CFX_ByteString key = PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1));
- CPDF_Object* pObj = ReadNextObject(TRUE);
+ CPDF_Object* pObj = ReadNextObject(true);
if (pObj == NULL) {
if (pDict) {
pDict->Release();
@@ -642,7 +642,7 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, FX_BOO
}
CPDF_Array* pArray = CPDF_Array::Create();
while (1) {
- CPDF_Object* pObj = ReadNextObject(bAllowNestedArray, TRUE);
+ CPDF_Object* pObj = ReadNextObject(bAllowNestedArray, true);
if (pObj == NULL) {
if (m_WordSize == 0 || m_WordBuffer[0] == ']') {
return pArray;
@@ -657,22 +657,22 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, FX_BOO
}
if (m_WordSize == 4) {
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_TRUE) {
- return CPDF_Boolean::Create(TRUE);
+ return CPDF_Boolean::Create(true);
}
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_NULL) {
return CPDF_Null::Create();
}
} else if (m_WordSize == 5) {
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_FALS && m_WordBuffer[4] == 'e') {
- return CPDF_Boolean::Create(FALSE);
+ return CPDF_Boolean::Create(false);
}
}
return NULL;
}
-void CPDF_StreamParser::GetNextWord(FX_BOOL& bIsNumber)
+void CPDF_StreamParser::GetNextWord(bool& bIsNumber)
{
m_WordSize = 0;
- bIsNumber = TRUE;
+ bIsNumber = true;
if (m_Size <= m_Pos) {
return;
}
@@ -701,7 +701,7 @@ void CPDF_StreamParser::GetNextWord(FX_BOOL& bIsNumber)
type = PDF_CharType[ch];
}
if (type == 'D') {
- bIsNumber = FALSE;
+ bIsNumber = false;
m_WordBuffer[m_WordSize++] = ch;
if (ch == '/') {
while (1) {
@@ -746,7 +746,7 @@ void CPDF_StreamParser::GetNextWord(FX_BOOL& bIsNumber)
m_WordBuffer[m_WordSize++] = ch;
}
if (type != 'N') {
- bIsNumber = FALSE;
+ bIsNumber = false;
}
if (m_Size <= m_Pos) {
return;
@@ -862,7 +862,7 @@ CFX_ByteString CPDF_StreamParser::ReadHexString()
}
int ch = m_pBuf[m_Pos++];
CFX_ByteTextBuf buf;
- FX_BOOL bFirst = TRUE;
+ bool bFirst = true;
int code = 0;
while (1) {
if (ch == '>') {
@@ -947,7 +947,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions)
return;
}
m_pObjects = pPage;
- m_bForm = FALSE;
+ m_bForm = false;
if (pOptions) {
m_Options = *pOptions;
}
@@ -962,7 +962,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions)
if (pContent->GetType() == PDFOBJ_STREAM) {
m_nStreams = 0;
m_pSingleStream = new CPDF_StreamAcc;
- m_pSingleStream->LoadAllData((CPDF_Stream*)pContent, FALSE);
+ m_pSingleStream->LoadAllData((CPDF_Stream*)pContent, false);
} else if (pContent->GetType() == PDFOBJ_ARRAY) {
CPDF_Array* pArray = (CPDF_Array*)pContent;
m_nStreams = pArray->GetCount();
@@ -981,7 +981,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates,
{
m_pType3Char = pType3Char;
m_pObjects = pForm;
- m_bForm = TRUE;
+ m_bForm = true;
CFX_AffineMatrix form_matrix = pForm->m_pFormDict->GetMatrix(FX_BSTRC("Matrix"));
if (pGraphicStates) {
form_matrix.Concat(pGraphicStates->m_CTM);
@@ -1011,7 +1011,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates,
m_pParser->GetCurStates()->m_CTM = form_matrix;
m_pParser->GetCurStates()->m_ParentMatrix = form_matrix;
if (ClipPath.NotNull()) {
- m_pParser->GetCurStates()->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING, TRUE);
+ m_pParser->GetCurStates()->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING, true);
}
if (pForm->m_Transparency & PDFTRANS_GROUP) {
CPDF_GeneralStateData* pData = m_pParser->GetCurStates()->m_GeneralState.GetModify();
@@ -1023,9 +1023,9 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates,
m_nStreams = 0;
m_pSingleStream = new CPDF_StreamAcc;
if (pForm->m_pDocument) {
- m_pSingleStream->LoadAllData(pForm->m_pFormStream, FALSE);
+ m_pSingleStream->LoadAllData(pForm->m_pFormStream, false);
} else {
- m_pSingleStream->LoadAllData(pForm->m_pFormStream, FALSE);
+ m_pSingleStream->LoadAllData(pForm->m_pFormStream, false);
}
m_pData = (uint8_t*)m_pSingleStream->GetData();
m_Size = m_pSingleStream->GetSize();
@@ -1070,7 +1070,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause)
CPDF_Array* pContent = m_pObjects->m_pFormDict->GetArray(FX_BSTRC("Contents"));
m_pStreamArray[m_CurrentOffset] = new CPDF_StreamAcc;
CPDF_Stream* pStreamObj = (CPDF_Stream*)(pContent ? pContent->GetElementValue(m_CurrentOffset) : NULL);
- m_pStreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE);
+ m_pStreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, false);
m_CurrentOffset ++;
}
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
index 48b3a40495..8292d2d90e 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
@@ -8,7 +8,7 @@
#include "pageint.h"
CPDF_Pattern::CPDF_Pattern(const CFX_AffineMatrix* pParentMatrix) :
- m_pPatternObj(NULL), m_PatternType(PATTERN_TILING), m_pDocument(NULL), m_bForceClear(FALSE)
+ m_pPatternObj(NULL), m_PatternType(PATTERN_TILING), m_pDocument(NULL), m_bForceClear(false)
{
if (pParentMatrix) {
m_ParentMatrix = *pParentMatrix;
@@ -37,28 +37,28 @@ CPDF_TilingPattern::~CPDF_TilingPattern()
delete m_pForm;
m_pForm = NULL;
}
-FX_BOOL CPDF_TilingPattern::Load()
+bool CPDF_TilingPattern::Load()
{
if (m_pForm != NULL) {
- return TRUE;
+ return true;
}
CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
if (pDict == NULL) {
- return FALSE;
+ return false;
}
m_bColored = pDict->GetInteger(FX_BSTRC("PaintType")) == 1;
m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber(FX_BSTRC("XStep")));
m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber(FX_BSTRC("YStep")));
if (m_pPatternObj->GetType() != PDFOBJ_STREAM) {
- return FALSE;
+ return false;
}
CPDF_Stream* pStream = (CPDF_Stream*)m_pPatternObj;
m_pForm = new CPDF_Form(m_pDocument, NULL, pStream);
m_pForm->ParseContent(NULL, &m_ParentMatrix, NULL, NULL);
m_BBox = pDict->GetRect(FX_BSTRC("BBox"));
- return TRUE;
+ return true;
}
-CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, FX_BOOL bShading, const CFX_AffineMatrix* parentMatrix) : CPDF_Pattern(parentMatrix)
+CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, bool bShading, const CFX_AffineMatrix* parentMatrix) : CPDF_Pattern(parentMatrix)
{
m_PatternType = PATTERN_SHADING;
m_pPatternObj = bShading ? NULL : pPatternObj;
@@ -102,14 +102,14 @@ void CPDF_ShadingPattern::Clear()
m_pCountedCS = NULL;
m_nFuncs = 0;
}
-FX_BOOL CPDF_ShadingPattern::Load()
+bool CPDF_ShadingPattern::Load()
{
if (m_ShadingType != 0) {
- return TRUE;
+ return true;
}
CPDF_Dictionary* pShadingDict = m_pShadingObj ? m_pShadingObj->GetDict() : NULL;
if (pShadingDict == NULL) {
- return FALSE;
+ return false;
}
if (m_nFuncs) {
for (int i = 0; i < m_nFuncs; i ++)
@@ -133,7 +133,7 @@ FX_BOOL CPDF_ShadingPattern::Load()
}
CPDF_Object* pCSObj = pShadingDict->GetElementValue(FX_BSTRC("ColorSpace"));
if (pCSObj == NULL) {
- return FALSE;
+ return false;
}
CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData();
m_pCS = pDocPageData->GetColorSpace(pCSObj, NULL);
@@ -141,14 +141,14 @@ FX_BOOL CPDF_ShadingPattern::Load()
m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray());
}
m_ShadingType = pShadingDict->GetInteger(FX_BSTRC("ShadingType"));
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ShadingPattern::Reload()
+bool CPDF_ShadingPattern::Reload()
{
Clear();
return Load();
}
-FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFuncs, int nFuncs, CPDF_ColorSpace* pCS)
+bool CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFuncs, int nFuncs, CPDF_ColorSpace* pCS)
{
m_Stream.LoadAllData(pShadingStream);
m_BitStream.Init(m_Stream.GetData(), m_Stream.GetSize());
@@ -160,21 +160,21 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFunc
m_nCompBits = pDict->GetInteger(FX_BSTRC("BitsPerComponent"));
m_nFlagBits = pDict->GetInteger(FX_BSTRC("BitsPerFlag"));
if (!m_nCoordBits || !m_nCompBits) {
- return FALSE;
+ return false;
}
int nComps = pCS->CountComponents();
if (nComps > 8) {
- return FALSE;
+ return false;
}
m_nComps = nFuncs ? 1 : nComps;
if (((int)m_nComps < 0) || m_nComps > 8) {
- return FALSE;
+ return false;
}
m_CoordMax = m_nCoordBits == 32 ? -1 : (1 << m_nCoordBits) - 1;
m_CompMax = (1 << m_nCompBits) - 1;
CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode"));
if (pDecode == NULL || pDecode->GetCount() != 4 + m_nComps * 2) {
- return FALSE;
+ return false;
}
m_xmin = pDecode->GetNumber(0);
m_xmax = pDecode->GetNumber(1);
@@ -184,7 +184,7 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFunc
m_ColorMin[i] = pDecode->GetNumber(i * 2 + 4);
m_ColorMax[i] = pDecode->GetNumber(i * 2 + 5);
}
- return TRUE;
+ return true;
}
FX_DWORD CPDF_MeshStream::GetFlag()
{
@@ -231,18 +231,18 @@ FX_DWORD CPDF_MeshStream::GetVertex(CPDF_MeshVertex& vertex, CFX_AffineMatrix* p
m_BitStream.ByteAlign();
return flag;
}
-FX_BOOL CPDF_MeshStream::GetVertexRow(CPDF_MeshVertex* vertex, int count, CFX_AffineMatrix* pObject2Bitmap)
+bool CPDF_MeshStream::GetVertexRow(CPDF_MeshVertex* vertex, int count, CFX_AffineMatrix* pObject2Bitmap)
{
for (int i = 0; i < count; i ++) {
if (m_BitStream.IsEOF()) {
- return FALSE;
+ return false;
}
GetCoords(vertex[i].x, vertex[i].y);
pObject2Bitmap->Transform(vertex[i].x, vertex[i].y);
GetColor(vertex[i].r, vertex[i].g, vertex[i].b);
m_BitStream.ByteAlign();
}
- return TRUE;
+ return true;
}
CFX_FloatRect _GetShadingBBox(CPDF_Stream* pStream, int type, const CFX_AffineMatrix* pMatrix,
CPDF_Function** pFuncs, int nFuncs, CPDF_ColorSpace* pCS)
@@ -255,8 +255,8 @@ CFX_FloatRect _GetShadingBBox(CPDF_Stream* pStream, int type, const CFX_AffineMa
return CFX_FloatRect(0, 0, 0, 0);
}
CFX_FloatRect rect;
- FX_BOOL bStarted = FALSE;
- FX_BOOL bGouraud = type == 4 || type == 5;
+ bool bStarted = false;
+ bool bGouraud = type == 4 || type == 5;
int full_point_count = type == 7 ? 16 : (type == 6 ? 12 : 1);
int full_color_count = (type == 6 || type == 7) ? 4 : 1;
while (!stream.m_BitStream.IsEOF()) {
@@ -276,7 +276,7 @@ CFX_FloatRect _GetShadingBBox(CPDF_Stream* pStream, int type, const CFX_AffineMa
rect.UpdateRect(x, y);
} else {
rect.InitRect(x, y);
- bStarted = TRUE;
+ bStarted = true;
}
}
stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * color_count);
diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h
index cf1fe47c0d..8fe2555416 100644
--- a/core/src/fpdfapi/fpdf_page/pageint.h
+++ b/core/src/fpdfapi/fpdf_page/pageint.h
@@ -21,7 +21,7 @@ public:
CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize);
~CPDF_StreamParser();
- CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, CPDF_Dictionary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode);
+ CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, CPDF_Dictionary* pDict, CPDF_Object* pCSObj, bool bDecode);
typedef enum { EndOfData, Number, Keyword, Name, Others } SyntaxType;
SyntaxType ParseNextElement();
@@ -48,10 +48,10 @@ public:
m_Pos = pos;
}
- CPDF_Object* ReadNextObject(FX_BOOL bAllowNestedArray = FALSE, FX_BOOL bInArray = FALSE);
+ CPDF_Object* ReadNextObject(bool bAllowNestedArray = false, bool bInArray = false);
void SkipPathObject();
protected:
- void GetNextWord(FX_BOOL& bIsNumber);
+ void GetNextWord(bool& bIsNumber);
CFX_ByteString ReadString();
CFX_ByteString ReadHexString();
const uint8_t* m_pBuf;
@@ -105,7 +105,7 @@ typedef struct {
int m_Type;
union {
struct {
- FX_BOOL m_bInteger;
+ bool m_bInteger;
union {
int m_Integer;
FX_FLOAT m_Float;
@@ -137,10 +137,10 @@ public:
int level);
~CPDF_StreamContentParser();
- FX_BOOL ShouldAbort() const { return m_bAbort; }
+ bool ShouldAbort() const { return m_bAbort; }
CPDF_PageObjects* GetObjectList() const { return m_pObjectList; }
CPDF_AllStates* GetCurStates() const { return m_pCurStates.get(); }
- FX_BOOL IsColored() const { return m_bColored; }
+ bool IsColored() const { return m_bColored; }
const FX_FLOAT* GetType3Data() const { return m_Type3Data; }
void AddNumberParam(const FX_CHAR* str, int len);
@@ -156,7 +156,7 @@ public:
{
return (int32_t)(GetNumber(index));
}
- FX_BOOL OnOperator(const FX_CHAR* op);
+ bool OnOperator(const FX_CHAR* op);
void BigCaseCaller(int index);
FX_DWORD GetParsePos()
{
@@ -171,16 +171,16 @@ public:
void ParsePathObject();
void AddPathPoint(FX_FLOAT x, FX_FLOAT y, int flag);
void AddPathRect(FX_FLOAT x, FX_FLOAT y, FX_FLOAT w, FX_FLOAT h);
- void AddPathObject(int FillType, FX_BOOL bStroke);
- CPDF_ImageObject* AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, FX_BOOL bInline);
+ void AddPathObject(int FillType, bool bStroke);
+ CPDF_ImageObject* AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, bool bInline);
void AddDuplicateImage();
void AddForm(CPDF_Stream*);
- void SetGraphicStates(CPDF_PageObject* pObj, FX_BOOL bColor, FX_BOOL bText, FX_BOOL bGraph);
+ void SetGraphicStates(CPDF_PageObject* pObj, bool bColor, bool bText, bool bGraph);
void SaveStates(CPDF_AllStates*);
void RestoreStates(CPDF_AllStates*);
CPDF_Font* FindFont(const CFX_ByteString& name);
CPDF_ColorSpace* FindColorSpace(const CFX_ByteString& name);
- CPDF_Pattern* FindPattern(const CFX_ByteString& name, FX_BOOL bShading);
+ CPDF_Pattern* FindPattern(const CFX_ByteString& name, bool bShading);
CPDF_Object* FindResourceObj(const CFX_ByteStringC& type, const CFX_ByteString& name);
protected:
@@ -277,7 +277,7 @@ protected:
_ContentParam m_ParamBuf1[PARAM_BUF_SIZE];
FX_DWORD m_ParamStartPos;
FX_DWORD m_ParamCount;
- FX_BOOL m_bAbort;
+ bool m_bAbort;
CPDF_StreamParser* m_pSyntax;
nonstd::unique_ptr<CPDF_AllStates> m_pCurStates;
CPDF_ContentMark m_CurContentMark;
@@ -299,11 +299,11 @@ protected:
CFX_BinaryBuf m_LastImageData;
CPDF_Dictionary* m_pLastImageDict;
CPDF_Dictionary* m_pLastCloneImageDict;
- FX_BOOL m_bReleaseLastDict;
- FX_BOOL m_bSameLastDict;
- FX_BOOL m_bColored;
+ bool m_bReleaseLastDict;
+ bool m_bSameLastDict;
+ bool m_bColored;
FX_FLOAT m_Type3Data[6];
- FX_BOOL m_bResourceMissing;
+ bool m_bResourceMissing;
CFX_PtrArray m_StateStack;
};
class CPDF_ContentParser
@@ -325,7 +325,7 @@ protected:
void Clear();
ParseStatus m_Status;
CPDF_PageObjects* m_pObjects;
- FX_BOOL m_bForm;
+ bool m_bForm;
CPDF_ParseOptions m_Options;
CPDF_Type3Char* m_pType3Char;
int m_InternalStage;
@@ -357,22 +357,22 @@ class CPDF_DocPageData
explicit CPDF_DocPageData(CPDF_Document *pPDFDoc);
~CPDF_DocPageData();
- void Clear(FX_BOOL bRelease = FALSE);
- CPDF_Font* GetFont(CPDF_Dictionary* pFontDict, FX_BOOL findOnly);
+ void Clear(bool bRelease = false);
+ CPDF_Font* GetFont(CPDF_Dictionary* pFontDict, bool findOnly);
CPDF_Font* GetStandardFont(const CFX_ByteStringC& fontName, CPDF_FontEncoding* pEncoding);
void ReleaseFont(CPDF_Dictionary* pFontDict);
CPDF_ColorSpace* GetColorSpace(CPDF_Object* pCSObj, CPDF_Dictionary* pResources);
CPDF_ColorSpace* GetCopiedColorSpace(CPDF_Object* pCSObj);
void ReleaseColorSpace(CPDF_Object* pColorSpace);
- CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj, FX_BOOL bShading, const CFX_AffineMatrix* matrix);
+ CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj, bool bShading, const CFX_AffineMatrix* matrix);
void ReleasePattern(CPDF_Object* pPatternObj);
CPDF_Image* GetImage(CPDF_Object* pImageStream);
void ReleaseImage(CPDF_Object* pImageStream);
CPDF_IccProfile* GetIccProfile(CPDF_Stream* pIccProfileStream);
void ReleaseIccProfile(CPDF_IccProfile* pIccProfile);
CPDF_StreamAcc* GetFontFileStreamAcc(CPDF_Stream* pFontStream);
- void ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOOL bForce = FALSE);
- FX_BOOL IsForceClear() const {return m_bForceClear;}
+ void ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, bool bForce = false);
+ bool IsForceClear() const {return m_bForceClear;}
CPDF_CountedColorSpace* FindColorSpacePtr(CPDF_Object* pCSObj) const;
CPDF_CountedPattern* FindPatternPtr(CPDF_Object* pPatternObj) const;
@@ -391,7 +391,7 @@ class CPDF_DocPageData
CPDF_Document* const m_pPDFDoc;
CFX_MapByteStringToPtr m_HashProfileMap;
- FX_BOOL m_bForceClear;
+ bool m_bForceClear;
CPDF_ColorSpaceMap m_ColorSpaceMap;
CPDF_FontFileMap m_FontFileMap;
@@ -406,7 +406,7 @@ class CPDF_Function
public:
static CPDF_Function* Load(CPDF_Object* pFuncObj);
virtual ~CPDF_Function();
- FX_BOOL Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, int& nresults) const;
+ bool Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, int& nresults) const;
int CountInputs()
{
return m_nInputs;
@@ -420,9 +420,9 @@ protected:
int m_nInputs, m_nOutputs;
FX_FLOAT* m_pDomains;
FX_FLOAT* m_pRanges;
- FX_BOOL Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Init(CPDF_Object* pObj) = 0;
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0;
+ 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;
};
class CPDF_IccProfile
{
@@ -430,7 +430,7 @@ public:
CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize);
~CPDF_IccProfile();
int32_t GetComponents() const { return m_nSrcComponents; }
- FX_BOOL m_bsRGB;
+ bool m_bsRGB;
void* m_pTransform;
private:
int32_t m_nSrcComponents;
@@ -441,20 +441,20 @@ class CPDF_DeviceCS : public CPDF_ColorSpace
public:
CPDF_DeviceCS(CPDF_Document* pDoc, int family);
- FX_BOOL GetRGB(FX_FLOAT* pBuf,
+ bool GetRGB(FX_FLOAT* pBuf,
FX_FLOAT& R,
FX_FLOAT& G,
FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf,
+ bool SetRGB(FX_FLOAT* pBuf,
FX_FLOAT R,
FX_FLOAT G,
FX_FLOAT B) const override;
- FX_BOOL v_GetCMYK(FX_FLOAT* pBuf,
+ bool v_GetCMYK(FX_FLOAT* pBuf,
FX_FLOAT& c,
FX_FLOAT& m,
FX_FLOAT& y,
FX_FLOAT& k) const override;
- FX_BOOL v_SetCMYK(FX_FLOAT* pBuf,
+ bool v_SetCMYK(FX_FLOAT* pBuf,
FX_FLOAT c,
FX_FLOAT m,
FX_FLOAT y,
@@ -464,7 +464,7 @@ public:
int pixels,
int image_width,
int image_height,
- FX_BOOL bTransMask = FALSE) const override;
+ bool bTransMask = false) const override;
};
class CPDF_PatternCS : public CPDF_ColorSpace
@@ -476,8 +476,8 @@ public:
m_pCountedBaseCS(nullptr) {
}
~CPDF_PatternCS() override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf,
+ 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;