diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-07-27 12:08:12 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-07-27 12:08:12 -0700 |
commit | 8d2aae7ee320da3a8ffe01c57e38b3f98443257d (patch) | |
tree | e694c6f82ec72fa46e6172b4475996b30d3f6a3a /core/src/fpdfapi/fpdf_page | |
parent | ff46aaf499edcf153ee2f57c7016587aa96dcfa0 (diff) | |
download | pdfium-8d2aae7ee320da3a8ffe01c57e38b3f98443257d.tar.xz |
Revert "FX Bool considered harmful, part 3"
This reverts commit ff46aaf499edcf153ee2f57c7016587aa96dcfa0.
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1255293002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page.cpp | 30 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 316 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp | 28 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp | 138 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp | 44 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp | 8 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 98 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 78 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp | 50 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/pageint.h | 70 |
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 729e96c312..f404352318 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, bool bAutoMerge) +void CPDF_PageObject::AppendClipPath(CPDF_Path path, int type, FX_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(); - bool bVertWriting = false; + FX_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; - bool bVertWriting = false; + FX_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(); - bool bVertWriting = false; + FX_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(); - bool bVertWriting = false; + FX_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(); - bool bVertWriting = false; + FX_BOOL bVertWriting = FALSE; CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); if (pCIDFont) { bVertWriting = pCIDFont->IsVertWriting(); @@ -720,7 +720,7 @@ void CPDF_FormObject::CalcBoundingBox() m_Right = form_rect.right; m_Top = form_rect.top; } -CPDF_PageObjects::CPDF_PageObjects(bool bReleaseMembers) +CPDF_PageObjects::CPDF_PageObjects(FX_BOOL bReleaseMembers) : m_pFormDict(nullptr), m_pFormStream(nullptr), m_pDocument(nullptr), @@ -728,7 +728,7 @@ CPDF_PageObjects::CPDF_PageObjects(bool bReleaseMembers) m_pResources(nullptr), m_Transparency(0), m_ObjectList(128), - m_bBackgroundAlphaNeeded(false), + m_bBackgroundAlphaNeeded(FALSE), m_bReleaseMembers(bReleaseMembers), m_pParser(nullptr), m_ParseState(CONTENT_NOT_PARSED) @@ -856,7 +856,7 @@ CPDF_Page::CPDF_Page() { m_pPageRender = NULL; } -void CPDF_Page::Load(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, bool bPageCache) +void CPDF_Page::Load(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, FX_BOOL bPageCache) { m_pDocument = (CPDF_Document*)pDocument; m_pFormDict = pPageDict; @@ -923,7 +923,7 @@ void CPDF_Page::Load(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, bool m_Transparency = PDFTRANS_ISOLATED; LoadTransInfo(); } -void CPDF_Page::StartParse(CPDF_ParseOptions* pOptions, bool bReParse) +void CPDF_Page::StartParse(CPDF_ParseOptions* pOptions, FX_BOOL bReParse) { if (bReParse) { ClearCacheObjects(); @@ -935,7 +935,7 @@ void CPDF_Page::StartParse(CPDF_ParseOptions* pOptions, bool bReParse) m_pParser->Start(this, pOptions); m_ParseState = CONTENT_PARSING; } -void CPDF_Page::ParseContent(CPDF_ParseOptions* pOptions, bool bReParse) +void CPDF_Page::ParseContent(CPDF_ParseOptions* pOptions, FX_BOOL bReParse) { StartParse(pOptions, bReParse); ContinueParse(NULL); @@ -1068,8 +1068,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 b1c8837326..198054ef7e 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)) { } -bool CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const +FX_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 @@ bool CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B } else { ASSERT(m_Family == PDFCS_PATTERN); R = G = B = 0; - return false; + return FALSE; } - return true; + return TRUE; } -bool CPDF_DeviceCS::v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const +FX_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; } -bool CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const +FX_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; } -bool CPDF_DeviceCS::v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k) const +FX_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, bool bTransMask) const +void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_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) { } - 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; + 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; void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, - int image_height, bool bTransMask = false) const override; + int image_height, FX_BOOL bTransMask = FALSE) const override; private: FX_FLOAT m_WhitePoint[3]; @@ -286,7 +286,7 @@ private: FX_FLOAT m_Gamma; }; -bool CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) +FX_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 @@ bool CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) if (m_Gamma == 0) { m_Gamma = 1.0f; } - return true; + return TRUE; } -bool CPDF_CalGray::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const +FX_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; } -bool CPDF_CalGray::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const +FX_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, bool bTransMask) const +void CPDF_CalGray::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_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) { } - 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; + 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; void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, - int image_height, bool bTransMask = false) const override; + int image_height, FX_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]; - bool m_bGamma; - bool m_bMatrix; + FX_BOOL m_bGamma; + FX_BOOL m_bMatrix; }; -bool CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) +FX_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 @@ 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; } -bool CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const +FX_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 @@ bool CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) 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; } -bool CPDF_CalRGB::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const +FX_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, bool bTransMask) const +void CPDF_CalRGB::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_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; - 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; + 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; void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, - int image_height, bool bTransMask = false) const; + int image_height, FX_BOOL bTransMask = FALSE) const; FX_FLOAT m_WhitePoint[3]; FX_FLOAT m_BlackPoint[3]; FX_FLOAT m_Ranges[4]; }; -bool CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) +FX_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 @@ 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, } } } -bool CPDF_LabCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const +FX_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 @@ bool CPDF_LabCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) c Z = 1.0889f * N * N * N; } XYZ_to_sRGB(X, Y, Z, R, G, B); - return true; + return TRUE; } -bool CPDF_LabCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const +FX_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, bool bTransMask) const +void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_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; - 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; + 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; void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, - int image_height, bool bTransMask = false) const override; + int image_height, FX_BOOL bTransMask = FALSE) const override; CPDF_ColorSpace* m_pAlterCS; CPDF_IccProfile* m_pProfile; uint8_t* m_pCache; FX_FLOAT* m_pRanges; - bool m_bOwn; + FX_BOOL m_bOwn; }; CPDF_ICCBasedCS::~CPDF_ICCBasedCS() @@ -594,15 +594,15 @@ CPDF_ICCBasedCS::~CPDF_ICCBasedCS() } } -bool CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) +FX_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 @@ 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 @@ 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 @@ bool CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) m_pRanges[i] = 0; } } - return true; + return TRUE; } -bool CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const +FX_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 @@ bool CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& } else { R = G = B = 0.0f; } - return true; + return TRUE; } FX_FLOAT rgb[3]; pIccModule->SetComponents(m_nComponents); @@ -686,31 +686,31 @@ bool CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& R = rgb[0]; G = rgb[1]; B = rgb[2]; - return true; + return TRUE; } -bool CPDF_ICCBasedCS::v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const +FX_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; } -bool CPDF_ICCBasedCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const +FX_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(bool bEnabled) +void CPDF_ICCBasedCS::EnableStdConversion(FX_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, bool bTransMask) const +void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const { if (m_pProfile->m_bsRGB) { ReverseRGB(pDestBuf, pSrcBuf, pixels); @@ -765,10 +765,10 @@ public: } ~CPDF_IndexedCS() 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; + 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; CPDF_ColorSpace* GetBaseCS() const override; - void EnableStdConversion(bool bEnabled) override; + void EnableStdConversion(FX_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()); } } -bool CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) +FX_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 @@ 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; } -bool CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const +FX_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 @@ bool CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& 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(bool bEnabled) +void CPDF_IndexedCS::EnableStdConversion(FX_BOOL bEnabled) { CPDF_ColorSpace::EnableStdConversion(bEnabled); if (m_pBaseCS) { @@ -871,39 +871,39 @@ CPDF_PatternCS::~CPDF_PatternCS() m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray()); } } -bool CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) +FX_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; } -bool CPDF_PatternCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const +FX_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; - 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; + 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; 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; } -bool CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) +FX_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 @@ 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 @@ bool CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) m_pFunc = NULL; } } - return true; + return TRUE; } -bool CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const +FX_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 @@ bool CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOA 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(bool bEnabled) +void CPDF_SeparationCS::EnableStdConversion(FX_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; - 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; + 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; 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; } -bool CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) +FX_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; } -bool CPDF_DeviceNCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const +FX_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(bool bEnabled) +void CPDF_DeviceNCS::EnableStdConversion(FX_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; } -bool CPDF_ColorSpace::sRGB() const +FX_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; } -bool CPDF_ColorSpace::GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const +FX_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; } -bool CPDF_ColorSpace::SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k) const +FX_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, bool bTransMask) const +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 { 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(bool bEnabled) +void CPDF_ColorSpace::EnableStdConversion(FX_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); } } } -bool CPDF_Color::GetRGB(int& R, int& G, int& B) const +FX_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; } -bool CPDF_Color::IsEqual(const CPDF_Color& other) const +FX_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 568863a89b..05233a12a4 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, bool bShading, const CFX_AffineMatrix* matrix) +CPDF_Pattern* CPDF_Document::LoadPattern(CPDF_Object* pPatternObj, FX_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(bool bForceRelease) +void CPDF_DocPageData::Clear(FX_BOOL bForceRelease) { m_bForceClear = bForceRelease; @@ -235,7 +235,7 @@ void CPDF_DocPageData::Clear(bool bForceRelease) } } -CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict, bool findOnly) +CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict, FX_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, bool bShading, const CFX_AffineMatrix* matrix) +CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj, FX_BOOL bShading, const CFX_AffineMatrix* matrix) { if (!pPatternObj) return nullptr; @@ -455,7 +455,7 @@ CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj, bool bShadi 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, bool bForce) +void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_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 a92219d268..c961f8b20f 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(); - bool Parse(CPDF_SimpleParser& parser); - bool Execute(CPDF_PSEngine* pEngine); + FX_BOOL Parse(CPDF_SimpleParser& parser); + FX_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(); - bool Parse(const FX_CHAR* string, int size); - bool Execute() + FX_BOOL Parse(const FX_CHAR* string, int size); + FX_BOOL Execute() { return m_MainProc.Execute(this); } - bool DoOperator(PDF_PSOP op); + FX_BOOL DoOperator(PDF_PSOP op); void Reset() { m_StackCount = 0; @@ -73,7 +73,7 @@ CPDF_PSProc::~CPDF_PSProc() } } } -bool CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) +FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) { int size = m_Operators.GetSize(); for (int i = 0; i < size; i ++) { @@ -85,7 +85,7 @@ 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 @@ 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 @@ 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} }; -bool CPDF_PSEngine::Parse(const FX_CHAR* string, int size) +FX_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); } -bool CPDF_PSProc::Parse(CPDF_SimpleParser& parser) +FX_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 @@ bool CPDF_PSProc::Parse(CPDF_SimpleParser& parser) } } #define PI 3.1415926535897932384626433832795f -bool CPDF_PSEngine::DoOperator(PDF_PSOP op) +FX_BOOL CPDF_PSEngine::DoOperator(PDF_PSOP op) { int i1, i2; FX_FLOAT d1, d2; @@ -418,7 +418,7 @@ 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 bool v_Init(CPDF_Object* pObj); - virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const; + virtual FX_BOOL v_Init(CPDF_Object* pObj); + virtual FX_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); } } -bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj) +FX_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 @@ 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 @@ 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 @@ bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj) m_pDecodeInfo[i].decode_max = m_pRanges[i * 2 + 1]; } } - return true; + return TRUE; } -bool CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const +FX_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 @@ 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 @@ 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 @@ 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 bool v_Init(CPDF_Object* pObj); - virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const; + virtual FX_BOOL v_Init(CPDF_Object* pObj); + virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const; CPDF_PSEngine m_PS; }; -bool CPDF_PSFunc::v_Init(CPDF_Object* pObj) +FX_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()); } -bool CPDF_PSFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const +FX_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 @@ 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 bool v_Init(CPDF_Object* pObj); - virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const; + virtual FX_BOOL v_Init(CPDF_Object* pObj); + virtual FX_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); } } -bool CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) +FX_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 @@ 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; } -bool CPDF_ExpIntFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const +FX_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 bool v_Init(CPDF_Object* pObj); - virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const; + virtual FX_BOOL v_Init(CPDF_Object* pObj); + virtual FX_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); } } -bool CPDF_StitchFunc::v_Init(CPDF_Object* pObj) +FX_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 @@ 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 @@ 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 @@ 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; } -bool CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const +FX_BOOL CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const { FX_FLOAT input = inputs[0]; int i; @@ -783,12 +783,12 @@ 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; } } -bool CPDF_Function::Init(CPDF_Object* pObj) +FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) { CPDF_Dictionary* pDict; if (pObj->GetType() == PDFOBJ_STREAM) { @@ -847,11 +847,11 @@ 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 @@ 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 @@ 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; } -bool CPDF_Function::Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, int& nresults) const +FX_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 @@ bool CPDF_Function::Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, int& } } } - 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 3264be42c6..b4d030e679 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; - bool bStarted = false; + FX_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; - bool bLayerStarted = false; + FX_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, bool bAutoMerge) +void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, FX_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; - bool ret = pData->m_FillColor.GetRGB(R, G, B); + FX_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; - bool ret = pData->m_StrokeColor.GetRGB(R, G, B); + FX_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(); } } -bool CPDF_ContentMarkItem::HasMCID() const +FX_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, bool bDirect) +void CPDF_ContentMarkData::AddMark(const CFX_ByteString& name, CPDF_Dictionary* pDict, FX_BOOL bDirect) { CPDF_ContentMarkItem& item = m_Marks.Add(); item.SetName(name); @@ -676,23 +676,23 @@ void CPDF_ContentMarkData::DeleteLastMark() } m_Marks.RemoveAt(size - 1); } -bool CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const +FX_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; } -bool CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionary*& pDict) const +FX_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 @@ bool CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionary*& 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 739a0bdf04..aabfd141d6 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() } } } -bool CPDF_Image::LoadImageF(CPDF_Stream* pStream, bool bInline) +FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline) { m_pStream = pStream; if (m_bInline && m_pInlineDict) { @@ -101,5 +101,5 @@ bool CPDF_Image::LoadImageF(CPDF_Stream* pStream, 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 b27f958d5e..892e2153b7 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, bool bColor, bool bText, bool bGraph) +void CPDF_StreamContentParser::SetGraphicStates(CPDF_PageObject* pObj, FX_BOOL bColor, FX_BOOL bText, FX_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}, }; -bool CPDF_StreamContentParser::OnOperator(const FX_CHAR* op) +FX_BOOL CPDF_StreamContentParser::OnOperator(const FX_CHAR* op) { int i = 0; FX_DWORD opid = 0; @@ -336,7 +336,7 @@ 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; } - bool bDirect = true; + FX_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() } } } - bool bForm; + FX_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, bool bInline) +CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, FX_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, bool bShading) +CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name, FX_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, bool bStroke) +void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke) { int PathPointCount = m_PathPointCount, PathClipType = m_PathClipType; m_PathPointCount = 0; @@ -1510,7 +1510,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, 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, 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, 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; - bool bFirst = true; + FX_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 ca5e9fe529..b2cfce73d9 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"; -bool _PDF_HasInvalidOpChar(const FX_CHAR* op) +FX_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(); - bool bProcessed = true; + FX_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; } - bool bInteger; + FX_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(bool bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams, +FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_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, bool bDecode) +CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dictionary* pDict, CPDF_Object* pCSObj, FX_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; - bool bIsNumber = true; + FX_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(bool bAllowNestedArray, bool bInArray) +CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, FX_BOOL bInArray) { - bool bIsNumber; + FX_BOOL bIsNumber; GetNextWord(bIsNumber); if (m_WordSize == 0) { return NULL; @@ -604,7 +604,7 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(bool bAllowNestedArray, bool bInA } 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(bool bAllowNestedArray, bool bInA 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(bool bAllowNestedArray, bool bInA } 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(bool bAllowNestedArray, bool bInA } 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(bool& bIsNumber) +void CPDF_StreamParser::GetNextWord(FX_BOOL& bIsNumber) { m_WordSize = 0; - bIsNumber = true; + bIsNumber = TRUE; if (m_Size <= m_Pos) { return; } @@ -701,7 +701,7 @@ void CPDF_StreamParser::GetNextWord(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(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; - bool bFirst = true; + FX_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 8292d2d90e..48b3a40495 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; } -bool CPDF_TilingPattern::Load() +FX_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, bool bShading, const CFX_AffineMatrix* parentMatrix) : CPDF_Pattern(parentMatrix) +CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, FX_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; } -bool CPDF_ShadingPattern::Load() +FX_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 @@ 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 @@ bool CPDF_ShadingPattern::Load() m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray()); } m_ShadingType = pShadingDict->GetInteger(FX_BSTRC("ShadingType")); - return true; + return TRUE; } -bool CPDF_ShadingPattern::Reload() +FX_BOOL CPDF_ShadingPattern::Reload() { Clear(); return Load(); } -bool CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFuncs, int nFuncs, CPDF_ColorSpace* pCS) +FX_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 @@ bool CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFuncs, 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 @@ bool CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFuncs, 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; } -bool CPDF_MeshStream::GetVertexRow(CPDF_MeshVertex* vertex, int count, CFX_AffineMatrix* pObject2Bitmap) +FX_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; - bool bStarted = false; - bool bGouraud = type == 4 || type == 5; + FX_BOOL bStarted = FALSE; + FX_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 021b33a421..8cd393cf32 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, bool bDecode); + CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, CPDF_Dictionary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode); typedef enum { EndOfData, Number, Keyword, Name, Others } SyntaxType; SyntaxType ParseNextElement(); @@ -48,10 +48,10 @@ public: m_Pos = pos; } - CPDF_Object* ReadNextObject(bool bAllowNestedArray = false, bool bInArray = false); + CPDF_Object* ReadNextObject(FX_BOOL bAllowNestedArray = FALSE, FX_BOOL bInArray = FALSE); void SkipPathObject(); protected: - void GetNextWord(bool& bIsNumber); + void GetNextWord(FX_BOOL& bIsNumber); CFX_ByteString ReadString(); CFX_ByteString ReadHexString(); const uint8_t* m_pBuf; @@ -105,7 +105,7 @@ typedef struct { int m_Type; union { struct { - bool m_bInteger; + FX_BOOL m_bInteger; union { int m_Integer; FX_FLOAT m_Float; @@ -137,10 +137,10 @@ public: int level); ~CPDF_StreamContentParser(); - bool ShouldAbort() const { return m_bAbort; } + FX_BOOL ShouldAbort() const { return m_bAbort; } CPDF_PageObjects* GetObjectList() const { return m_pObjectList; } CPDF_AllStates* GetCurStates() const { return m_pCurStates.get(); } - bool IsColored() const { return m_bColored; } + FX_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)); } - bool OnOperator(const FX_CHAR* op); + FX_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, bool bStroke); - CPDF_ImageObject* AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, bool bInline); + void AddPathObject(int FillType, FX_BOOL bStroke); + CPDF_ImageObject* AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, FX_BOOL bInline); void AddDuplicateImage(); void AddForm(CPDF_Stream*); - void SetGraphicStates(CPDF_PageObject* pObj, bool bColor, bool bText, bool bGraph); + void SetGraphicStates(CPDF_PageObject* pObj, FX_BOOL bColor, FX_BOOL bText, FX_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, bool bShading); + CPDF_Pattern* FindPattern(const CFX_ByteString& name, FX_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; - bool m_bAbort; + FX_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; - bool m_bReleaseLastDict; - bool m_bSameLastDict; - bool m_bColored; + FX_BOOL m_bReleaseLastDict; + FX_BOOL m_bSameLastDict; + FX_BOOL m_bColored; FX_FLOAT m_Type3Data[6]; - bool m_bResourceMissing; + FX_BOOL m_bResourceMissing; CFX_PtrArray m_StateStack; }; class CPDF_ContentParser @@ -331,7 +331,7 @@ protected: void Clear(); ParseStatus m_Status; CPDF_PageObjects* m_pObjects; - bool m_bForm; + FX_BOOL m_bForm; CPDF_ParseOptions m_Options; CPDF_Type3Char* m_pType3Char; int m_InternalStage; @@ -363,22 +363,22 @@ class CPDF_DocPageData explicit CPDF_DocPageData(CPDF_Document *pPDFDoc); ~CPDF_DocPageData(); - void Clear(bool bRelease = false); - CPDF_Font* GetFont(CPDF_Dictionary* pFontDict, bool findOnly); + void Clear(FX_BOOL bRelease = FALSE); + CPDF_Font* GetFont(CPDF_Dictionary* pFontDict, FX_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, bool bShading, const CFX_AffineMatrix* matrix); + CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj, FX_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, bool bForce = false); - bool IsForceClear() const {return m_bForceClear;} + void ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOOL bForce = FALSE); + FX_BOOL IsForceClear() const {return m_bForceClear;} CPDF_CountedColorSpace* FindColorSpacePtr(CPDF_Object* pCSObj) const; CPDF_CountedPattern* FindPatternPtr(CPDF_Object* pPatternObj) const; @@ -397,7 +397,7 @@ class CPDF_DocPageData CPDF_Document* const m_pPDFDoc; CFX_MapByteStringToPtr m_HashProfileMap; - bool m_bForceClear; + FX_BOOL m_bForceClear; CPDF_ColorSpaceMap m_ColorSpaceMap; CPDF_FontFileMap m_FontFileMap; @@ -412,7 +412,7 @@ class CPDF_Function public: static CPDF_Function* Load(CPDF_Object* pFuncObj); virtual ~CPDF_Function(); - bool Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, int& nresults) const; + FX_BOOL Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, int& nresults) const; int CountInputs() { return m_nInputs; @@ -426,9 +426,9 @@ protected: int m_nInputs, m_nOutputs; FX_FLOAT* m_pDomains; FX_FLOAT* m_pRanges; - 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; + 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; }; class CPDF_IccProfile { @@ -436,7 +436,7 @@ public: CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize); ~CPDF_IccProfile(); int32_t GetComponents() const { return m_nSrcComponents; } - bool m_bsRGB; + FX_BOOL m_bsRGB; void* m_pTransform; private: int32_t m_nSrcComponents; @@ -447,20 +447,20 @@ class CPDF_DeviceCS : public CPDF_ColorSpace public: CPDF_DeviceCS(CPDF_Document* pDoc, int family); - bool GetRGB(FX_FLOAT* pBuf, + FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override; - bool SetRGB(FX_FLOAT* pBuf, + FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override; - bool v_GetCMYK(FX_FLOAT* pBuf, + FX_BOOL v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const override; - bool v_SetCMYK(FX_FLOAT* pBuf, + FX_BOOL v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, @@ -470,7 +470,7 @@ public: int pixels, int image_width, int image_height, - bool bTransMask = false) const override; + FX_BOOL bTransMask = FALSE) const override; }; class CPDF_PatternCS : public CPDF_ColorSpace @@ -482,8 +482,8 @@ public: m_pCountedBaseCS(nullptr) { } ~CPDF_PatternCS() override; - bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; - bool GetRGB(FX_FLOAT* pBuf, + 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; |