diff options
author | tsepez <tsepez@chromium.org> | 2016-11-02 15:17:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-02 15:17:30 -0700 |
commit | 12f3e4a58f05850b93af35619cb04f0231d86acc (patch) | |
tree | 9851d8e46e5c168f5d148864caa2eebf814529dd /core/fpdfapi/render | |
parent | 3b3ce1a242f8445848d3f23d6c35ba01d7c645f4 (diff) | |
download | pdfium-12f3e4a58f05850b93af35619cb04f0231d86acc.tar.xz |
Remove FX_BOOL from core
Review-Url: https://codereview.chromium.org/2477443002
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r-- | core/fpdfapi/render/cpdf_pagerendercache.h | 22 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_textrenderer.h | 46 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_type3cache.cpp | 18 | ||||
-rw-r--r-- | core/fpdfapi/render/fpdf_render.cpp | 196 | ||||
-rw-r--r-- | core/fpdfapi/render/fpdf_render_cache.cpp | 60 | ||||
-rw-r--r-- | core/fpdfapi/render/fpdf_render_image.cpp | 166 | ||||
-rw-r--r-- | core/fpdfapi/render/fpdf_render_loadimage.cpp | 160 | ||||
-rw-r--r-- | core/fpdfapi/render/fpdf_render_pattern.cpp | 48 | ||||
-rw-r--r-- | core/fpdfapi/render/fpdf_render_text.cpp | 106 | ||||
-rw-r--r-- | core/fpdfapi/render/render_int.h | 324 |
10 files changed, 571 insertions, 575 deletions
diff --git a/core/fpdfapi/render/cpdf_pagerendercache.h b/core/fpdfapi/render/cpdf_pagerendercache.h index 37d092062d..0156416d47 100644 --- a/core/fpdfapi/render/cpdf_pagerendercache.h +++ b/core/fpdfapi/render/cpdf_pagerendercache.h @@ -33,9 +33,9 @@ class CPDF_PageRenderCache { CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, uint32_t& MatteColor, - FX_BOOL bStdCS = FALSE, + bool bStdCS = false, uint32_t GroupFamily = 0, - FX_BOOL bLoadMask = FALSE, + bool bLoadMask = false, CPDF_RenderStatus* pRenderStatus = nullptr, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); @@ -47,15 +47,15 @@ class CPDF_PageRenderCache { return m_pCurImageCacheEntry; } - FX_BOOL StartGetCachedBitmap(CPDF_Stream* pStream, - FX_BOOL bStdCS = FALSE, - uint32_t GroupFamily = 0, - FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = nullptr, - int32_t downsampleWidth = 0, - int32_t downsampleHeight = 0); + bool StartGetCachedBitmap(CPDF_Stream* pStream, + bool bStdCS = false, + uint32_t GroupFamily = 0, + bool bLoadMask = false, + CPDF_RenderStatus* pRenderStatus = nullptr, + int32_t downsampleWidth = 0, + int32_t downsampleHeight = 0); - FX_BOOL Continue(IFX_Pause* pPause); + bool Continue(IFX_Pause* pPause); protected: friend class CPDF_Page; @@ -65,7 +65,7 @@ class CPDF_PageRenderCache { std::map<CPDF_Stream*, CPDF_ImageCacheEntry*> m_ImageCache; uint32_t m_nTimeCount; uint32_t m_nCacheSize; - FX_BOOL m_bCurFindCache; + bool m_bCurFindCache; }; #endif // CORE_FPDFAPI_RENDER_CPDF_PAGERENDERCACHE_H_ diff --git a/core/fpdfapi/render/cpdf_textrenderer.h b/core/fpdfapi/render/cpdf_textrenderer.h index a179fd7c8c..82cc2cf8e6 100644 --- a/core/fpdfapi/render/cpdf_textrenderer.h +++ b/core/fpdfapi/render/cpdf_textrenderer.h @@ -32,29 +32,29 @@ class CPDF_TextRenderer { const CFX_GraphStateData* pGraphState, const CPDF_RenderOptions* pOptions); - static FX_BOOL DrawTextPath(CFX_RenderDevice* pDevice, - int nChars, - uint32_t* pCharCodes, - FX_FLOAT* pCharPos, - CPDF_Font* pFont, - FX_FLOAT font_size, - const CFX_Matrix* pText2User, - const CFX_Matrix* pUser2Device, - const CFX_GraphStateData* pGraphState, - FX_ARGB fill_argb, - FX_ARGB stroke_argb, - CFX_PathData* pClippingPath, - int nFlag); - - static FX_BOOL DrawNormalText(CFX_RenderDevice* pDevice, - int nChars, - uint32_t* pCharCodes, - FX_FLOAT* pCharPos, - CPDF_Font* pFont, - FX_FLOAT font_size, - const CFX_Matrix* pText2Device, - FX_ARGB fill_argb, - const CPDF_RenderOptions* pOptions); + static bool DrawTextPath(CFX_RenderDevice* pDevice, + int nChars, + uint32_t* pCharCodes, + FX_FLOAT* pCharPos, + CPDF_Font* pFont, + FX_FLOAT font_size, + const CFX_Matrix* pText2User, + const CFX_Matrix* pUser2Device, + const CFX_GraphStateData* pGraphState, + FX_ARGB fill_argb, + FX_ARGB stroke_argb, + CFX_PathData* pClippingPath, + int nFlag); + + static bool DrawNormalText(CFX_RenderDevice* pDevice, + int nChars, + uint32_t* pCharCodes, + FX_FLOAT* pCharPos, + CPDF_Font* pFont, + FX_FLOAT font_size, + const CFX_Matrix* pText2Device, + FX_ARGB fill_argb, + const CPDF_RenderOptions* pOptions); }; #endif // CORE_FPDFAPI_RENDER_CPDF_TEXTRENDERER_H_ diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp index 7fe552108d..ba92142dbf 100644 --- a/core/fpdfapi/render/cpdf_type3cache.cpp +++ b/core/fpdfapi/render/cpdf_type3cache.cpp @@ -34,24 +34,24 @@ void CPDF_UniqueKeyGen::Generate(int count, ...) { m_KeyLen = count * sizeof(uint32_t); } -FX_BOOL IsScanLine1bpp(uint8_t* pBuf, int width) { +bool IsScanLine1bpp(uint8_t* pBuf, int width) { int size = width / 8; for (int i = 0; i < size; i++) { if (pBuf[i]) - return TRUE; + return true; } return (width % 8) && (pBuf[width / 8] & (0xff << (8 - width % 8))); } -FX_BOOL IsScanLine8bpp(uint8_t* pBuf, int width) { +bool IsScanLine8bpp(uint8_t* pBuf, int width) { for (int i = 0; i < width; i++) { if (pBuf[i] > 0x40) - return TRUE; + return true; } - return FALSE; + return false; } -int DetectFirstLastScan(const CFX_DIBitmap* pBitmap, FX_BOOL bFirst) { +int DetectFirstLastScan(const CFX_DIBitmap* pBitmap, bool bFirst) { int height = pBitmap->GetHeight(); int pitch = pBitmap->GetPitch(); int width = pBitmap->GetWidth(); @@ -131,12 +131,12 @@ CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, int top = 0; if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 && FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) { - int top_line = DetectFirstLastScan(pBitmap, TRUE); - int bottom_line = DetectFirstLastScan(pBitmap, FALSE); + int top_line = DetectFirstLastScan(pBitmap, true); + int bottom_line = DetectFirstLastScan(pBitmap, false); if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) { FX_FLOAT top_y = image_matrix.d + image_matrix.f; FX_FLOAT bottom_y = image_matrix.f; - FX_BOOL bFlipped = top_y > bottom_y; + bool bFlipped = top_y > bottom_y; if (bFlipped) { FX_FLOAT temp = top_y; top_y = bottom_y; diff --git a/core/fpdfapi/render/fpdf_render.cpp b/core/fpdfapi/render/fpdf_render.cpp index 4dcad15949..a431aa9486 100644 --- a/core/fpdfapi/render/fpdf_render.cpp +++ b/core/fpdfapi/render/fpdf_render.cpp @@ -40,10 +40,10 @@ CPDF_DocRenderData::CPDF_DocRenderData(CPDF_Document* pPDFDoc) : m_pPDFDoc(pPDFDoc) {} CPDF_DocRenderData::~CPDF_DocRenderData() { - Clear(TRUE); + Clear(true); } -void CPDF_DocRenderData::Clear(FX_BOOL bRelease) { +void CPDF_DocRenderData::Clear(bool bRelease) { for (auto it = m_Type3FaceMap.begin(); it != m_Type3FaceMap.end();) { auto curr_it = it++; CPDF_CountedObject<CPDF_Type3Cache>* cache = curr_it->second; @@ -146,38 +146,38 @@ CPDF_RenderStatus::CPDF_RenderStatus() : m_pFormResource(nullptr), m_pPageResource(nullptr), m_pContext(nullptr), - m_bStopped(FALSE), + m_bStopped(false), m_pDevice(nullptr), m_pCurObj(nullptr), m_pStopObj(nullptr), m_HalftoneLimit(0), - m_bPrint(FALSE), + m_bPrint(false), m_Transparency(0), - m_bDropObjects(FALSE), - m_bStdCS(FALSE), + m_bDropObjects(false), + m_bStdCS(false), m_GroupFamily(0), - m_bLoadMask(FALSE), + m_bLoadMask(false), m_pType3Char(nullptr), m_T3FillColor(0), m_curBlend(FXDIB_BLEND_NORMAL) {} CPDF_RenderStatus::~CPDF_RenderStatus() {} -FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext, - CFX_RenderDevice* pDevice, - const CFX_Matrix* pDeviceMatrix, - const CPDF_PageObject* pStopObj, - const CPDF_RenderStatus* pParentState, - const CPDF_GraphicStates* pInitialStates, - const CPDF_RenderOptions* pOptions, - int transparency, - FX_BOOL bDropObjects, - CPDF_Dictionary* pFormResource, - FX_BOOL bStdCS, - CPDF_Type3Char* pType3Char, - FX_ARGB fill_color, - uint32_t GroupFamily, - FX_BOOL bLoadMask) { +bool CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext, + CFX_RenderDevice* pDevice, + const CFX_Matrix* pDeviceMatrix, + const CPDF_PageObject* pStopObj, + const CPDF_RenderStatus* pParentState, + const CPDF_GraphicStates* pInitialStates, + const CPDF_RenderOptions* pOptions, + int transparency, + bool bDropObjects, + CPDF_Dictionary* pFormResource, + bool bStdCS, + CPDF_Type3Char* pType3Char, + FX_ARGB fill_color, + uint32_t GroupFamily, + bool bLoadMask) { m_pContext = pContext; m_pDevice = pDevice; m_bPrint = m_pDevice->GetDeviceClass() != FXDC_DISPLAY; @@ -217,7 +217,7 @@ FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext, } m_pImageRenderer.reset(); m_Transparency = transparency; - return TRUE; + return true; } void CPDF_RenderStatus::RenderObjectList( const CPDF_PageObjectHolder* pObjectHolder, @@ -232,7 +232,7 @@ void CPDF_RenderStatus::RenderObjectList( for (const auto& pCurObj : *pObjectHolder->GetPageObjectList()) { if (pCurObj.get() == m_pStopObj) { - m_bStopped = TRUE; + m_bStopped = true; return; } if (!pCurObj) @@ -278,48 +278,48 @@ void CPDF_RenderStatus::RenderSingleObject(CPDF_PageObject* pObj, #endif } -FX_BOOL CPDF_RenderStatus::ContinueSingleObject(CPDF_PageObject* pObj, - const CFX_Matrix* pObj2Device, - IFX_Pause* pPause) { +bool CPDF_RenderStatus::ContinueSingleObject(CPDF_PageObject* pObj, + const CFX_Matrix* pObj2Device, + IFX_Pause* pPause) { if (m_pImageRenderer) { if (m_pImageRenderer->Continue(pPause)) - return TRUE; + return true; if (!m_pImageRenderer->m_Result) DrawObjWithBackground(pObj, pObj2Device); m_pImageRenderer.reset(); - return FALSE; + return false; } m_pCurObj = pObj; if (m_Options.m_pOCContext && pObj->m_ContentMark && !m_Options.m_pOCContext->CheckObjectVisible(pObj)) { - return FALSE; + return false; } ProcessClipPath(pObj->m_ClipPath, pObj2Device); if (ProcessTransparency(pObj, pObj2Device)) - return FALSE; + return false; if (pObj->IsImage()) { m_pImageRenderer.reset(new CPDF_ImageRenderer); - if (!m_pImageRenderer->Start(this, pObj, pObj2Device, FALSE)) { + if (!m_pImageRenderer->Start(this, pObj, pObj2Device, false)) { if (!m_pImageRenderer->m_Result) DrawObjWithBackground(pObj, pObj2Device); m_pImageRenderer.reset(); - return FALSE; + return false; } return ContinueSingleObject(pObj, pObj2Device, pPause); } ProcessObjectNoClip(pObj, pObj2Device); - return FALSE; + return false; } -FX_BOOL CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, - const CFX_Matrix* pObj2Device, - FX_BOOL bLogical, - FX_RECT& rect) const { +bool CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, + const CFX_Matrix* pObj2Device, + bool bLogical, + FX_RECT& rect) const { rect = pObj->GetBBox(pObj2Device); FX_RECT rtClip = m_pDevice->GetClipBox(); if (!bLogical) { @@ -344,7 +344,7 @@ void CPDF_RenderStatus::ProcessObjectNoClip(CPDF_PageObject* pObj, #if defined _SKIA_SUPPORT_ DebugVerifyDeviceIsPreMultiplied(); #endif - FX_BOOL bRet = FALSE; + bool bRet = false; switch (pObj->GetType()) { case CPDF_PageObject::TEXT: bRet = ProcessText(pObj->AsText(), pObj2Device, nullptr); @@ -369,9 +369,9 @@ void CPDF_RenderStatus::ProcessObjectNoClip(CPDF_PageObject* pObj, #endif } -FX_BOOL CPDF_RenderStatus::DrawObjWithBlend(CPDF_PageObject* pObj, - const CFX_Matrix* pObj2Device) { - FX_BOOL bRet = FALSE; +bool CPDF_RenderStatus::DrawObjWithBlend(CPDF_PageObject* pObj, + const CFX_Matrix* pObj2Device) { + bool bRet = false; switch (pObj->GetType()) { case CPDF_PageObject::PATH: bRet = ProcessPath(pObj->AsPath(), pObj2Device); @@ -396,7 +396,7 @@ void CPDF_RenderStatus::GetScaledMatrix(CFX_Matrix& matrix) const { void CPDF_RenderStatus::DrawObjWithBackground(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device) { FX_RECT rect; - if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) { + if (GetObjectClippedRect(pObj, pObj2Device, false, rect)) { return; } int res = 300; @@ -426,15 +426,15 @@ void CPDF_RenderStatus::DrawObjWithBackground(CPDF_PageObject* pObj, buffer.OutputToDevice(); } -FX_BOOL CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj, - const CFX_Matrix* pObj2Device) { +bool CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj, + const CFX_Matrix* pObj2Device) { #if defined _SKIA_SUPPORT_ DebugVerifyDeviceIsPreMultiplied(); #endif CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDictFor("OC"); if (pOC && m_Options.m_pOCContext && !m_Options.m_pOCContext->CheckOCGVisible(pOC)) { - return TRUE; + return true; } CFX_Matrix matrix = pFormObj->m_FormMatrix; matrix.Concat(*pObj2Device); @@ -445,7 +445,7 @@ FX_BOOL CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj, CPDF_RenderStatus status; status.Initialize(m_pContext, m_pDevice, nullptr, m_pStopObj, this, pFormObj, &m_Options, m_Transparency, m_bDropObjects, pResources, - FALSE); + false); status.m_curBlend = m_curBlend; m_pDevice->SaveState(); status.RenderObjectList(pFormObj->m_pForm.get(), &matrix); @@ -454,33 +454,33 @@ FX_BOOL CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj, #if defined _SKIA_SUPPORT_ DebugVerifyDeviceIsPreMultiplied(); #endif - return TRUE; + return true; } -FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix) { +bool IsAvailableMatrix(const CFX_Matrix& matrix) { if (matrix.a == 0 || matrix.d == 0) { return matrix.b != 0 && matrix.c != 0; } if (matrix.b == 0 || matrix.c == 0) { return matrix.a != 0 && matrix.d != 0; } - return TRUE; + return true; } -FX_BOOL CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj, - const CFX_Matrix* pObj2Device) { +bool CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj, + const CFX_Matrix* pObj2Device) { int FillType = pPathObj->m_FillType; - FX_BOOL bStroke = pPathObj->m_bStroke; + bool bStroke = pPathObj->m_bStroke; ProcessPathPattern(pPathObj, pObj2Device, FillType, bStroke); if (FillType == 0 && !bStroke) - return TRUE; + return true; uint32_t fill_argb = FillType ? GetFillArgb(pPathObj) : 0; uint32_t stroke_argb = bStroke ? GetStrokeArgb(pPathObj) : 0; CFX_Matrix path_matrix = pPathObj->m_Matrix; path_matrix.Concat(*pObj2Device); if (!IsAvailableMatrix(path_matrix)) - return TRUE; + return true; if (FillType && (m_Options.m_Flags & RENDER_RECT_AA)) FillType |= FXFILL_RECT_AA; @@ -513,7 +513,7 @@ CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const { } FX_ARGB CPDF_RenderStatus::GetFillArgb(CPDF_PageObject* pObj, - FX_BOOL bType3) const { + bool bType3) const { const CPDF_ColorState* pColorState = &pObj->m_ColorState; if (m_pType3Char && !bType3 && (!m_pType3Char->m_bColored || @@ -652,9 +652,9 @@ void CPDF_RenderStatus::DrawClipPath(CPDF_ClipPath ClipPath, fill_mode); } } -FX_BOOL CPDF_RenderStatus::SelectClipPath(const CPDF_PathObject* pPathObj, - const CFX_Matrix* pObj2Device, - FX_BOOL bStroke) { +bool CPDF_RenderStatus::SelectClipPath(const CPDF_PathObject* pPathObj, + const CFX_Matrix* pObj2Device, + bool bStroke) { CFX_Matrix path_matrix = pPathObj->m_Matrix; path_matrix.Concat(*pObj2Device); if (bStroke) { @@ -671,14 +671,14 @@ FX_BOOL CPDF_RenderStatus::SelectClipPath(const CPDF_PathObject* pPathObj, return m_pDevice->SetClip_PathFill(pPathObj->m_Path.GetObject(), &path_matrix, fill_mode); } -FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, - const CFX_Matrix* pObj2Device) { +bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, + const CFX_Matrix* pObj2Device) { #if defined _SKIA_SUPPORT_ DebugVerifyDeviceIsPreMultiplied(); #endif int blend_type = pPageObj->m_GeneralState.GetBlendType(); if (blend_type == FXDIB_BLEND_UNSUPPORTED) - return TRUE; + return true; CPDF_Dictionary* pSMaskDict = ToDictionary(pPageObj->m_GeneralState.GetSoftMask()); @@ -691,7 +691,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, CPDF_Dictionary* pFormResource = nullptr; FX_FLOAT group_alpha = 1.0f; int Transparency = m_Transparency; - FX_BOOL bGroupTransparent = FALSE; + bool bGroupTransparent = false; if (pPageObj->IsForm()) { const CPDF_FormObject* pFormObj = pPageObj->AsForm(); group_alpha = pFormObj->m_GeneralState.GetFillAlpha(); @@ -735,11 +735,11 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, } if (!pSMaskDict && group_alpha == 1.0f && blend_type == FXDIB_BLEND_NORMAL && !bTextClip && !bGroupTransparent) { - return FALSE; + return false; } bool isolated = !!(Transparency & PDFTRANS_ISOLATED); if (m_bPrint) { - FX_BOOL bRet = FALSE; + bool bRet = false; int rendCaps = m_pDevice->GetRenderCaps(); if (!((Transparency & PDFTRANS_ISOLATED) || pSMaskDict || bTextClip) && (rendCaps & FXRC_BLEND_MODE)) { @@ -751,12 +751,12 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, if (!bRet) { DrawObjWithBackground(pPageObj, pObj2Device); } - return TRUE; + return true; } FX_RECT rect = pPageObj->GetBBox(pObj2Device); rect.Intersect(m_pDevice->GetClipBox()); if (rect.IsEmpty()) { - return TRUE; + return true; } CFX_Matrix deviceCTM = m_pDevice->GetCTM(); FX_FLOAT scaleX = FXSYS_fabs(deviceCTM.a); @@ -768,11 +768,11 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, if (!isolated && (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) { oriDevice.reset(new CFX_DIBitmap); if (!m_pDevice->CreateCompatibleBitmap(oriDevice.get(), width, height)) - return TRUE; + return true; m_pDevice->GetDIBits(oriDevice.get(), rect.left, rect.top); } if (!bitmap_device.Create(width, height, FXDIB_Argb, oriDevice.get())) - return TRUE; + return true; CFX_DIBitmap* bitmap = bitmap_device.GetBitmap(); bitmap->Clear(0); CFX_Matrix new_matrix = *pObj2Device; @@ -782,7 +782,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, if (bTextClip) { pTextMask.reset(new CFX_DIBitmap); if (!pTextMask->Create(width, height, FXDIB_8bppMask)) - return TRUE; + return true; pTextMask->Clear(0); CFX_FxgeDevice text_device; @@ -804,7 +804,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, CPDF_RenderStatus bitmap_render; bitmap_render.Initialize(m_pContext, &bitmap_device, nullptr, m_pStopObj, nullptr, nullptr, &m_Options, 0, m_bDropObjects, - pFormResource, TRUE); + pFormResource, true); bitmap_render.ProcessObjectNoClip(pPageObj, &new_matrix); m_bStopped = bitmap_render.m_bStopped; if (pSMaskDict) { @@ -836,14 +836,14 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, #if defined _SKIA_SUPPORT_ DebugVerifyDeviceIsPreMultiplied(); #endif - return TRUE; + return true; } CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj, const FX_RECT& rect, int& left, int& top, - FX_BOOL bBackAlphaRequired) { + bool bBackAlphaRequired) { FX_RECT bbox = rect; bbox.Intersect(m_pDevice->GetClipBox()); left = bbox.left; @@ -862,7 +862,7 @@ CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj, if (!pBackdrop->GetBuffer()) return nullptr; - FX_BOOL bNeedDraw; + bool bNeedDraw; if (pBackdrop->HasAlpha()) bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT); else @@ -896,7 +896,7 @@ void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer, } CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates( const CPDF_GraphicStates* pSrcStates, - FX_BOOL bStroke) { + bool bStroke) { if (!pSrcStates) return nullptr; @@ -954,7 +954,7 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, CPDF_RenderStatus status; status.Initialize(this, pDevice, pLastMatrix, pStopObj, nullptr, nullptr, pOptions, pLayer->m_pObjectHolder->m_Transparency, - FALSE, nullptr); + false, nullptr); status.RenderObjectList(pLayer->m_pObjectHolder, &FinalMatrix); if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize); @@ -967,7 +967,7 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, CPDF_RenderStatus status; status.Initialize(this, pDevice, nullptr, pStopObj, nullptr, nullptr, pOptions, pLayer->m_pObjectHolder->m_Transparency, - FALSE, nullptr); + false, nullptr); status.RenderObjectList(pLayer->m_pObjectHolder, &pLayer->m_Matrix); if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize); @@ -1019,7 +1019,7 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) { m_pRenderStatus.reset(new CPDF_RenderStatus()); m_pRenderStatus->Initialize( m_pContext, m_pDevice, nullptr, nullptr, nullptr, nullptr, m_pOptions, - m_pCurrentLayer->m_pObjectHolder->m_Transparency, FALSE, nullptr); + m_pCurrentLayer->m_pObjectHolder->m_Transparency, false, nullptr); m_pDevice->SaveState(); m_ClipRect = CFX_FloatRect(m_pDevice->GetClipBox()); CFX_Matrix device2object; @@ -1092,10 +1092,10 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) { } std::unique_ptr<CPDF_Function> pFuncs[3]; - FX_BOOL bUniTransfer = TRUE; - FX_BOOL bIdentity = TRUE; + bool bUniTransfer = true; + bool bIdentity = true; if (CPDF_Array* pArray = pObj->AsArray()) { - bUniTransfer = FALSE; + bUniTransfer = false; if (pArray->GetCount() < 3) return nullptr; @@ -1125,7 +1125,7 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) { pFuncs[0]->Call(&input, 1, output, noutput); int o = FXSYS_round(output[0] * 255); if (o != v) - bIdentity = FALSE; + bIdentity = false; for (int i = 0; i < 3; ++i) { pTransfer->m_Samples[i * 256 + v] = o; } @@ -1135,7 +1135,7 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) { pFuncs[i]->Call(&input, 1, output, noutput); int o = FXSYS_round(output[0] * 255); if (o != v) - bIdentity = FALSE; + bIdentity = false; pTransfer->m_Samples[i * 256 + v] = o; } else { pTransfer->m_Samples[i * 256 + v] = v; @@ -1159,11 +1159,11 @@ CPDF_DeviceBuffer::CPDF_DeviceBuffer() CPDF_DeviceBuffer::~CPDF_DeviceBuffer() {} -FX_BOOL CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, - CFX_RenderDevice* pDevice, - FX_RECT* pRect, - const CPDF_PageObject* pObj, - int max_dpi) { +bool CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, + CFX_RenderDevice* pDevice, + FX_RECT* pRect, + const CPDF_PageObject* pObj, + int max_dpi) { m_pDevice = pDevice; m_pContext = pContext; m_Rect = *pRect; @@ -1194,7 +1194,7 @@ FX_BOOL CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, FX_RECT bitmap_rect = rect.GetOuterRect(); m_pBitmap.reset(new CFX_DIBitmap); m_pBitmap->Create(bitmap_rect.Width(), bitmap_rect.Height(), FXDIB_Argb); - return TRUE; + return true; } void CPDF_DeviceBuffer::OutputToDevice() { if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) { @@ -1221,15 +1221,15 @@ CPDF_ScaledRenderBuffer::CPDF_ScaledRenderBuffer() {} CPDF_ScaledRenderBuffer::~CPDF_ScaledRenderBuffer() {} #define _FPDFAPI_IMAGESIZE_LIMIT_ (30 * 1024 * 1024) -FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, - CFX_RenderDevice* pDevice, - const FX_RECT& pRect, - const CPDF_PageObject* pObj, - const CPDF_RenderOptions* pOptions, - int max_dpi) { +bool CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, + CFX_RenderDevice* pDevice, + const FX_RECT& pRect, + const CPDF_PageObject* pObj, + const CPDF_RenderOptions* pOptions, + int max_dpi) { m_pDevice = pDevice; if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) { - return TRUE; + return true; } m_pContext = pContext; m_Rect = pRect; @@ -1264,7 +1264,7 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, int32_t iHeight = bitmap_rect.Height(); int32_t iPitch = (iWidth * bpp + 31) / 32 * 4; if (iWidth * iHeight < 1) - return FALSE; + return false; if (iPitch * iHeight <= _FPDFAPI_IMAGESIZE_LIMIT_ && m_pBitmapDevice->Create(iWidth, iHeight, dibFormat, nullptr)) { @@ -1274,7 +1274,7 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, } m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions, &m_Matrix); - return TRUE; + return true; } void CPDF_ScaledRenderBuffer::OutputToDevice() { if (m_pBitmapDevice) { diff --git a/core/fpdfapi/render/fpdf_render_cache.cpp b/core/fpdfapi/render/fpdf_render_cache.cpp index 67dd953752..2f342f0689 100644 --- a/core/fpdfapi/render/fpdf_render_cache.cpp +++ b/core/fpdfapi/render/fpdf_render_cache.cpp @@ -28,7 +28,7 @@ CPDF_PageRenderCache::CPDF_PageRenderCache(CPDF_Page* pPage) m_pCurImageCacheEntry(nullptr), m_nTimeCount(0), m_nCacheSize(0), - m_bCurFindCache(FALSE) {} + m_bCurFindCache(false) {} CPDF_PageRenderCache::~CPDF_PageRenderCache() { for (const auto& it : m_ImageCache) @@ -86,22 +86,22 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, uint32_t& MatteColor, - FX_BOOL bStdCS, + bool bStdCS, uint32_t GroupFamily, - FX_BOOL bLoadMask, + bool bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t downsampleWidth, int32_t downsampleHeight) { CPDF_ImageCacheEntry* pEntry; const auto it = m_ImageCache.find(pStream); - FX_BOOL bFound = it != m_ImageCache.end(); + bool bFound = it != m_ImageCache.end(); if (bFound) pEntry = it->second; else pEntry = new CPDF_ImageCacheEntry(m_pPage->m_pDocument, pStream); m_nTimeCount++; - FX_BOOL bAlreadyCached = pEntry->GetCachedBitmap( + bool bAlreadyCached = pEntry->GetCachedBitmap( pBitmap, pMask, MatteColor, m_pPage->m_pPageResources, bStdCS, GroupFamily, bLoadMask, pRenderStatus, downsampleWidth, downsampleHeight); @@ -111,11 +111,11 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, if (!bAlreadyCached) m_nCacheSize += pEntry->EstimateSize(); } -FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap( +bool CPDF_PageRenderCache::StartGetCachedBitmap( CPDF_Stream* pStream, - FX_BOOL bStdCS, + bool bStdCS, uint32_t GroupFamily, - FX_BOOL bLoadMask, + bool bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t downsampleWidth, int32_t downsampleHeight) { @@ -131,7 +131,7 @@ FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap( pRenderStatus->m_pFormResource, m_pPage->m_pPageResources, bStdCS, GroupFamily, bLoadMask, pRenderStatus, downsampleWidth, downsampleHeight); if (ret == 2) - return TRUE; + return true; m_nTimeCount++; if (!m_bCurFindCache) @@ -140,18 +140,18 @@ FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap( if (!ret) m_nCacheSize += m_pCurImageCacheEntry->EstimateSize(); - return FALSE; + return false; } -FX_BOOL CPDF_PageRenderCache::Continue(IFX_Pause* pPause) { +bool CPDF_PageRenderCache::Continue(IFX_Pause* pPause) { int ret = m_pCurImageCacheEntry->Continue(pPause); if (ret == 2) - return TRUE; + return true; m_nTimeCount++; if (!m_bCurFindCache) m_ImageCache[m_pCurImageCacheEntry->GetStream()] = m_pCurImageCacheEntry; if (!ret) m_nCacheSize += m_pCurImageCacheEntry->EstimateSize(); - return FALSE; + return false; } void CPDF_PageRenderCache::ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap) { @@ -200,24 +200,24 @@ static uint32_t FPDF_ImageCache_EstimateImageSize(const CFX_DIBSource* pDIB) { (uint32_t)pDIB->GetPaletteSize() * 4 : 0; } -FX_BOOL CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap, - CFX_DIBSource*& pMask, - uint32_t& MatteColor, - CPDF_Dictionary* pPageResources, - FX_BOOL bStdCS, - uint32_t GroupFamily, - FX_BOOL bLoadMask, - CPDF_RenderStatus* pRenderStatus, - int32_t downsampleWidth, - int32_t downsampleHeight) { +bool CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap, + CFX_DIBSource*& pMask, + uint32_t& MatteColor, + CPDF_Dictionary* pPageResources, + bool bStdCS, + uint32_t GroupFamily, + bool bLoadMask, + CPDF_RenderStatus* pRenderStatus, + int32_t downsampleWidth, + int32_t downsampleHeight) { if (m_pCachedBitmap) { pBitmap = m_pCachedBitmap; pMask = m_pCachedMask; MatteColor = m_MatteColor; - return TRUE; + return true; } if (!pRenderStatus) { - return FALSE; + return false; } CPDF_RenderContext* pContext = pRenderStatus->GetContext(); CPDF_PageRenderCache* pPageRenderCache = pContext->GetPageCache(); @@ -229,7 +229,7 @@ FX_BOOL CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap, GroupFamily, bLoadMask)) { delete pSrc; pBitmap = nullptr; - return FALSE; + return false; } m_MatteColor = MatteColor; if (pSrc->GetPitch() * pSrc->GetHeight() < FPDF_HUGE_IMAGE_SIZE) { @@ -246,7 +246,7 @@ FX_BOOL CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap, pBitmap = m_pCachedBitmap; pMask = m_pCachedMask; CalcSize(); - return FALSE; + return false; } CFX_DIBSource* CPDF_ImageCacheEntry::DetachBitmap() { CFX_DIBSource* pDIBSource = m_pCurBitmap; @@ -260,9 +260,9 @@ CFX_DIBSource* CPDF_ImageCacheEntry::DetachMask() { } int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, - FX_BOOL bStdCS, + bool bStdCS, uint32_t GroupFamily, - FX_BOOL bLoadMask, + bool bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t downsampleWidth, int32_t downsampleHeight) { @@ -278,7 +278,7 @@ int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, m_pCurBitmap = new CPDF_DIBSource; int ret = ((CPDF_DIBSource*)m_pCurBitmap) - ->StartLoadDIBSource(m_pDocument, m_pStream, TRUE, pFormResources, + ->StartLoadDIBSource(m_pDocument, m_pStream, true, pFormResources, pPageResources, bStdCS, GroupFamily, bLoadMask); if (ret == 2) { return ret; diff --git a/core/fpdfapi/render/fpdf_render_image.cpp b/core/fpdfapi/render/fpdf_render_image.cpp index 049eff30c0..1133f67a9a 100644 --- a/core/fpdfapi/render/fpdf_render_image.cpp +++ b/core/fpdfapi/render/fpdf_render_image.cpp @@ -34,8 +34,8 @@ #include "core/fxge/skia/fx_skia_device.h" #endif -FX_BOOL CPDF_RenderStatus::ProcessImage(CPDF_ImageObject* pImageObj, - const CFX_Matrix* pObj2Device) { +bool CPDF_RenderStatus::ProcessImage(CPDF_ImageObject* pImageObj, + const CFX_Matrix* pObj2Device) { CPDF_ImageRenderer render; if (render.Start(this, pImageObj, pObj2Device, m_bStdCS, m_curBlend)) { render.Continue(nullptr); @@ -100,9 +100,9 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, top + pDIBitmap->GetHeight()); rect.Intersect(m_pDevice->GetClipBox()); CFX_DIBitmap* pClone = nullptr; - FX_BOOL bClone = FALSE; + bool bClone = false; if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) { - bClone = TRUE; + bClone = true; pClone = m_pDevice->GetBackDrop()->Clone(&rect); CFX_DIBitmap* pForeBitmap = m_pDevice->GetBitmap(); pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(), @@ -171,7 +171,7 @@ FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF rgb) const { } CFX_DIBSource* CPDF_TransferFunc::TranslateImage(const CFX_DIBSource* pSrc, - FX_BOOL bAutoDropSrc) { + bool bAutoDropSrc) { CPDF_DIBTransferFunc* pDest = new CPDF_DIBTransferFunc(this); pDest->LoadSrc(pSrc, bAutoDropSrc); return pDest; @@ -204,7 +204,7 @@ CPDF_DIBTransferFunc::CPDF_DIBTransferFunc( void CPDF_DIBTransferFunc::TranslateScanline( const uint8_t* src_buf, std::vector<uint8_t>* dest_buf) const { - FX_BOOL bSkip = FALSE; + bool bSkip = false; switch (m_pSrc->GetFormat()) { case FXDIB_1bppRgb: { int r0 = m_RampR[0]; @@ -284,7 +284,7 @@ void CPDF_DIBTransferFunc::TranslateScanline( break; } case FXDIB_Rgb32: - bSkip = TRUE; + bSkip = true; case FXDIB_Argb: { int index = 0; for (int i = 0; i < m_Width; i++) { @@ -348,11 +348,11 @@ void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf, CPDF_ImageRenderer::CPDF_ImageRenderer() { m_pRenderStatus = nullptr; m_pImageObject = nullptr; - m_Result = TRUE; + m_Result = true; m_Status = 0; m_DeviceHandle = nullptr; - m_bStdCS = FALSE; - m_bPatternColor = FALSE; + m_bStdCS = false; + m_bPatternColor = false; m_BlendType = FXDIB_BLEND_NORMAL; m_pPattern = nullptr; m_pObj2Device = nullptr; @@ -364,11 +364,11 @@ CPDF_ImageRenderer::~CPDF_ImageRenderer() { } } -FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource() { +bool CPDF_ImageRenderer::StartLoadDIBSource() { CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect(); FX_RECT image_rect = image_rect_f.GetOuterRect(); if (!image_rect.Valid()) - return FALSE; + return false; int dest_width = image_rect.Width(); int dest_height = image_rect.Height(); @@ -385,15 +385,15 @@ FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource() { dest_height)) { if (m_LoadHandle) { m_Status = 4; - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { +bool CPDF_ImageRenderer::StartRenderDIBSource() { if (!m_Loader.m_pBitmap) - return FALSE; + return false; m_BitmapAlpha = FXSYS_round(255 * m_pImageObject->m_GeneralState.GetFillAlpha()); @@ -416,18 +416,18 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { if (m_Loader.m_bCached && m_Loader.m_pMask) { m_Loader.m_pMask = m_Loader.m_pMask->Clone(); } - m_Loader.m_bCached = FALSE; + m_Loader.m_bCached = false; } } m_FillArgb = 0; - m_bPatternColor = FALSE; + m_bPatternColor = false; m_pPattern = nullptr; if (m_pDIBSource->IsAlphaMask()) { const CPDF_Color* pColor = m_pImageObject->m_ColorState.GetFillColor(); if (pColor && pColor->IsPattern()) { m_pPattern = pColor->GetPattern(); if (m_pPattern) { - m_bPatternColor = TRUE; + m_bPatternColor = true; } } m_FillArgb = m_pRenderStatus->GetFillArgb(m_pImageObject); @@ -507,11 +507,11 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { return StartDIBSource(); } -FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, - CPDF_PageObject* pObj, - const CFX_Matrix* pObj2Device, - FX_BOOL bStdCS, - int blendType) { +bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, + CPDF_PageObject* pObj, + const CFX_Matrix* pObj2Device, + bool bStdCS, + int blendType) { m_pRenderStatus = pStatus; m_bStdCS = bStdCS; m_pImageObject = pObj->AsImage(); @@ -520,24 +520,24 @@ FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, CPDF_Dictionary* pOC = m_pImageObject->GetImage()->GetOC(); if (pOC && m_pRenderStatus->m_Options.m_pOCContext && !m_pRenderStatus->m_Options.m_pOCContext->CheckOCGVisible(pOC)) { - return FALSE; + return false; } m_ImageMatrix = m_pImageObject->m_Matrix; m_ImageMatrix.Concat(*pObj2Device); if (StartLoadDIBSource()) { - return TRUE; + return true; } return StartRenderDIBSource(); } -FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, - const CFX_DIBSource* pDIBSource, - FX_ARGB bitmap_argb, - int bitmap_alpha, - const CFX_Matrix* pImage2Device, - uint32_t flags, - FX_BOOL bStdCS, - int blendType) { +bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, + const CFX_DIBSource* pDIBSource, + FX_ARGB bitmap_argb, + int bitmap_alpha, + const CFX_Matrix* pImage2Device, + uint32_t flags, + bool bStdCS, + int blendType) { m_pRenderStatus = pStatus; m_pDIBSource = pDIBSource; m_FillArgb = bitmap_argb; @@ -549,16 +549,16 @@ FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, return StartDIBSource(); } -FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { +bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { if (m_pRenderStatus->m_bPrint && !(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) { - m_Result = FALSE; - return FALSE; + m_Result = false; + return false; } FX_RECT rect = m_ImageMatrix.GetUnitRect().GetOuterRect(); rect.Intersect(m_pRenderStatus->m_pDevice->GetClipBox()); if (rect.IsEmpty()) { - return FALSE; + return false; } CFX_Matrix new_matrix = m_ImageMatrix; new_matrix.TranslateI(-rect.left, -rect.top); @@ -566,7 +566,7 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { int height = rect.Height(); CFX_FxgeDevice bitmap_device1; if (!bitmap_device1.Create(rect.Width(), rect.Height(), FXDIB_Rgb32, nullptr)) - return TRUE; + return true; bitmap_device1.GetBitmap()->Clear(0xffffff); { @@ -574,32 +574,32 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, nullptr, nullptr, nullptr, nullptr, &m_pRenderStatus->m_Options, 0, - m_pRenderStatus->m_bDropObjects, nullptr, TRUE); + m_pRenderStatus->m_bDropObjects, nullptr, true); CFX_Matrix patternDevice = *pObj2Device; patternDevice.Translate((FX_FLOAT)-rect.left, (FX_FLOAT)-rect.top); if (CPDF_TilingPattern* pTilingPattern = m_pPattern->AsTilingPattern()) { bitmap_render.DrawTilingPattern(pTilingPattern, m_pImageObject, - &patternDevice, FALSE); + &patternDevice, false); } else if (CPDF_ShadingPattern* pShadingPattern = m_pPattern->AsShadingPattern()) { bitmap_render.DrawShadingPattern(pShadingPattern, m_pImageObject, - &patternDevice, FALSE); + &patternDevice, false); } } { CFX_FxgeDevice bitmap_device2; if (!bitmap_device2.Create(rect.Width(), rect.Height(), FXDIB_8bppRgb, nullptr)) { - return TRUE; + return true; } bitmap_device2.GetBitmap()->Clear(0); CPDF_RenderStatus bitmap_render; bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, nullptr, nullptr, nullptr, nullptr, nullptr, 0, - m_pRenderStatus->m_bDropObjects, nullptr, TRUE); + m_pRenderStatus->m_bDropObjects, nullptr, true); CPDF_ImageRenderer image_render; if (image_render.Start(&bitmap_render, m_pDIBSource, 0xffffffff, 255, - &new_matrix, m_Flags, TRUE)) { + &new_matrix, m_Flags, true)) { image_render.Continue(nullptr); } if (m_Loader.m_MatteColor != 0xffffffff) { @@ -647,19 +647,19 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { } m_pRenderStatus->m_pDevice->SetDIBitsWithBlend( bitmap_device1.GetBitmap(), rect.left, rect.top, m_BlendType); - return FALSE; + return false; } -FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() { +bool CPDF_ImageRenderer::DrawMaskedImage() { if (m_pRenderStatus->m_bPrint && !(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) { - m_Result = FALSE; - return FALSE; + m_Result = false; + return false; } FX_RECT rect = m_ImageMatrix.GetUnitRect().GetOuterRect(); rect.Intersect(m_pRenderStatus->m_pDevice->GetClipBox()); if (rect.IsEmpty()) { - return FALSE; + return false; } CFX_Matrix new_matrix = m_ImageMatrix; new_matrix.TranslateI(-rect.left, -rect.top); @@ -667,7 +667,7 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() { int height = rect.Height(); CFX_FxgeDevice bitmap_device1; if (!bitmap_device1.Create(width, height, FXDIB_Rgb32, nullptr)) - return TRUE; + return true; #if defined _SKIA_SUPPORT_ bitmap_device1.Clear(0xffffff); @@ -678,17 +678,17 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() { CPDF_RenderStatus bitmap_render; bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, nullptr, nullptr, nullptr, nullptr, nullptr, 0, - m_pRenderStatus->m_bDropObjects, nullptr, TRUE); + m_pRenderStatus->m_bDropObjects, nullptr, true); CPDF_ImageRenderer image_render; if (image_render.Start(&bitmap_render, m_pDIBSource, 0, 255, &new_matrix, - m_Flags, TRUE)) { + m_Flags, true)) { image_render.Continue(nullptr); } } { CFX_FxgeDevice bitmap_device2; if (!bitmap_device2.Create(width, height, FXDIB_8bppRgb, nullptr)) - return TRUE; + return true; #if defined _SKIA_SUPPORT_ bitmap_device2.Clear(0); @@ -698,10 +698,10 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() { CPDF_RenderStatus bitmap_render; bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, nullptr, nullptr, nullptr, nullptr, nullptr, 0, - m_pRenderStatus->m_bDropObjects, nullptr, TRUE); + m_pRenderStatus->m_bDropObjects, nullptr, true); CPDF_ImageRenderer image_render; if (image_render.Start(&bitmap_render, m_Loader.m_pMask, 0xffffffff, 255, - &new_matrix, m_Flags, TRUE)) { + &new_matrix, m_Flags, true)) { image_render.Continue(nullptr); } if (m_Loader.m_MatteColor != 0xffffffff) { @@ -758,17 +758,17 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() { m_pRenderStatus->m_pDevice->SetDIBitsWithBlend( bitmap_device1.GetBitmap(), rect.left, rect.top, m_BlendType); #endif // _SKIA_SUPPORT_ - return FALSE; + return false; } -FX_BOOL CPDF_ImageRenderer::StartDIBSource() { +bool CPDF_ImageRenderer::StartDIBSource() { if (!(m_Flags & RENDER_FORCE_DOWNSAMPLE) && m_pDIBSource->GetBPP() > 1) { FX_SAFE_SIZE_T image_size = m_pDIBSource->GetBPP(); image_size /= 8; image_size *= m_pDIBSource->GetWidth(); image_size *= m_pDIBSource->GetHeight(); if (!image_size.IsValid()) { - return FALSE; + return false; } if (image_size.ValueOrDie() > FPDF_HUGE_IMAGE_SIZE && @@ -785,9 +785,9 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() { m_DeviceHandle, m_BlendType)) { if (m_DeviceHandle) { m_Status = 3; - return TRUE; + return true; } - return FALSE; + return false; } #else if (m_pRenderStatus->m_pDevice->StartDIBitsWithBlend( @@ -795,9 +795,9 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() { m_DeviceHandle, m_BlendType)) { if (m_DeviceHandle) { m_Status = 3; - return TRUE; + return true; } - return FALSE; + return false; } #endif CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect(); @@ -808,8 +808,8 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() { (FXSYS_fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) { if (m_pRenderStatus->m_bPrint && !(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) { - m_Result = FALSE; - return FALSE; + m_Result = false; + return false; } FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox(); clip_box.Intersect(image_rect); @@ -817,7 +817,7 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() { m_pTransformer.reset(new CFX_ImageTransformer(m_pDIBSource, &m_ImageMatrix, m_Flags, &clip_box)); m_pTransformer->Start(); - return TRUE; + return true; } if (m_ImageMatrix.a < 0) dest_width = -dest_width; @@ -831,7 +831,7 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() { if (m_pRenderStatus->m_pDevice->StretchDIBitsWithFlagsAndBlend( m_pDIBSource, dest_left, dest_top, dest_width, dest_height, m_Flags, m_BlendType)) { - return FALSE; + return false; } } if (m_pDIBSource->IsAlphaMask()) { @@ -840,13 +840,13 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() { if (m_pRenderStatus->m_pDevice->StretchBitMaskWithFlags( m_pDIBSource, dest_left, dest_top, dest_width, dest_height, m_FillArgb, m_Flags)) { - return FALSE; + return false; } } if (m_pRenderStatus->m_bPrint && !(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) { - m_Result = FALSE; - return TRUE; + m_Result = false; + return true; } FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox(); @@ -860,12 +860,12 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() { if (pStretched) { m_pRenderStatus->CompositeDIBitmap(pStretched.get(), dest_rect.left, dest_rect.top, m_FillArgb, m_BitmapAlpha, - m_BlendType, FALSE); + m_BlendType, false); } - return FALSE; + return false; } -FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha() { +bool CPDF_ImageRenderer::StartBitmapAlpha() { if (m_pDIBSource->IsOpaqueImage()) { CFX_PathData path; path.AppendRect(0, 0, 1, 1); @@ -884,7 +884,7 @@ FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha() { std::unique_ptr<CFX_DIBitmap> pTransformed( pAlphaMask->TransformTo(&m_ImageMatrix, left, top)); if (!pTransformed) - return TRUE; + return true; m_pRenderStatus->m_pDevice->SetBitMask( pTransformed.get(), left, top, @@ -906,17 +906,17 @@ FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha() { delete pAlphaMask; } } - return FALSE; + return false; } -FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause) { +bool CPDF_ImageRenderer::Continue(IFX_Pause* pPause) { if (m_Status == 2) { if (m_pTransformer->Continue(pPause)) - return TRUE; + return true; std::unique_ptr<CFX_DIBitmap> pBitmap(m_pTransformer->DetachBitmap()); if (!pBitmap) - return FALSE; + return false; if (pBitmap->IsAlphaMask()) { if (m_BitmapAlpha != 255) @@ -931,19 +931,19 @@ FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause) { pBitmap.get(), m_pTransformer->result().left, m_pTransformer->result().top, m_BlendType); } - return FALSE; + return false; } if (m_Status == 3) return m_pRenderStatus->m_pDevice->ContinueDIBits(m_DeviceHandle, pPause); if (m_Status == 4) { if (m_Loader.Continue(m_LoadHandle.get(), pPause)) - return TRUE; + return true; if (StartRenderDIBSource()) return Continue(pPause); } - return FALSE; + return false; } CCodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder( @@ -978,7 +978,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, form.ParseContent(nullptr, nullptr, nullptr); CFX_FxgeDevice bitmap_device; - FX_BOOL bLuminosity = pSMaskDict->GetStringFor("S") != "Alpha"; + bool bLuminosity = pSMaskDict->GetStringFor("S") != "Alpha"; int width = pClipRect->right - pClipRect->left; int height = pClipRect->bottom - pClipRect->top; FXDIB_Format format; @@ -1042,7 +1042,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, options.m_ColorMode = bLuminosity ? RENDER_COLOR_NORMAL : RENDER_COLOR_ALPHA; CPDF_RenderStatus status; status.Initialize(m_pContext, &bitmap_device, nullptr, nullptr, nullptr, - nullptr, &options, 0, m_bDropObjects, pFormResource, TRUE, + nullptr, &options, 0, m_bDropObjects, pFormResource, true, nullptr, 0, color_space_family, bLuminosity); status.RenderObjectList(&form, &matrix); std::unique_ptr<CFX_DIBitmap> pMask(new CFX_DIBitmap); diff --git a/core/fpdfapi/render/fpdf_render_loadimage.cpp b/core/fpdfapi/render/fpdf_render_loadimage.cpp index 553481db60..c3fe99018c 100644 --- a/core/fpdfapi/render/fpdf_render_loadimage.cpp +++ b/core/fpdfapi/render/fpdf_render_loadimage.cpp @@ -102,13 +102,13 @@ CPDF_DIBSource::CPDF_DIBSource() m_nComponents(0), m_GroupFamily(0), m_MatteColor(0), - m_bLoadMask(FALSE), - m_bDefaultDecode(TRUE), - m_bImageMask(FALSE), - m_bDoBpcCheck(TRUE), - m_bColorKey(FALSE), - m_bHasMask(FALSE), - m_bStdCS(FALSE), + m_bLoadMask(false), + m_bDefaultDecode(true), + m_bImageMask(false), + m_bDoBpcCheck(true), + m_bColorKey(false), + m_bHasMask(false), + m_bStdCS(false), m_pCompData(nullptr), m_pLineBuf(nullptr), m_pMaskedLine(nullptr), @@ -137,51 +137,51 @@ void CPDF_DIBSource::ReleaseBitmap(CFX_DIBitmap* pBitmap) const { } } -FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, - const CPDF_Stream* pStream, - CPDF_DIBSource** ppMask, - uint32_t* pMatteColor, - CPDF_Dictionary* pFormResources, - CPDF_Dictionary* pPageResources, - FX_BOOL bStdCS, - uint32_t GroupFamily, - FX_BOOL bLoadMask) { +bool CPDF_DIBSource::Load(CPDF_Document* pDoc, + const CPDF_Stream* pStream, + CPDF_DIBSource** ppMask, + uint32_t* pMatteColor, + CPDF_Dictionary* pFormResources, + CPDF_Dictionary* pPageResources, + bool bStdCS, + uint32_t GroupFamily, + bool bLoadMask) { if (!pStream) { - return FALSE; + return false; } m_pDocument = pDoc; m_pDict = pStream->GetDict(); if (!m_pDict) { - return FALSE; + return false; } m_pStream = pStream; m_Width = m_pDict->GetIntegerFor("Width"); m_Height = m_pDict->GetIntegerFor("Height"); if (m_Width <= 0 || m_Height <= 0 || m_Width > kMaxImageDimension || m_Height > kMaxImageDimension) { - return FALSE; + return false; } m_GroupFamily = GroupFamily; m_bLoadMask = bLoadMask; if (!LoadColorInfo(m_pStream->IsInline() ? pFormResources : nullptr, pPageResources)) { - return FALSE; + return false; } if (m_bDoBpcCheck && (m_bpc == 0 || m_nComponents == 0)) { - return FALSE; + return false; } FX_SAFE_UINT32 src_size = CalculatePitch8(m_bpc, m_nComponents, m_Width) * m_Height; if (!src_size.IsValid()) { - return FALSE; + return false; } m_pStreamAcc.reset(new CPDF_StreamAcc); - m_pStreamAcc->LoadAllData(pStream, FALSE, src_size.ValueOrDie(), TRUE); + m_pStreamAcc->LoadAllData(pStream, false, src_size.ValueOrDie(), true); if (m_pStreamAcc->GetSize() == 0 || !m_pStreamAcc->GetData()) { - return FALSE; + return false; } if (!CreateDecoder()) { - return FALSE; + return false; } if (m_bImageMask) { m_bpp = 1; @@ -197,11 +197,11 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, } FX_SAFE_UINT32 pitch = CalculatePitch32(m_bpp, m_Width); if (!pitch.IsValid()) { - return FALSE; + return false; } m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie()); if (m_pColorSpace && bStdCS) { - m_pColorSpace->EnableStdConversion(TRUE); + m_pColorSpace->EnableStdConversion(true); } LoadPalette(); if (m_bColorKey) { @@ -209,7 +209,7 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, m_AlphaFlag = 2; pitch = CalculatePitch32(m_bpp, m_Width); if (!pitch.IsValid()) { - return FALSE; + return false; } m_pMaskedLine = FX_Alloc(uint8_t, pitch.ValueOrDie()); } @@ -218,9 +218,9 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, *ppMask = LoadMask(*pMatteColor); } if (m_pColorSpace && bStdCS) { - m_pColorSpace->EnableStdConversion(FALSE); + m_pColorSpace->EnableStdConversion(false); } - return TRUE; + return true; } int CPDF_DIBSource::ContinueToLoadMask() { @@ -245,7 +245,7 @@ int CPDF_DIBSource::ContinueToLoadMask() { } m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie()); if (m_pColorSpace && m_bStdCS) { - m_pColorSpace->EnableStdConversion(TRUE); + m_pColorSpace->EnableStdConversion(true); } LoadPalette(); if (m_bColorKey) { @@ -263,12 +263,12 @@ int CPDF_DIBSource::ContinueToLoadMask() { int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Stream* pStream, - FX_BOOL bHasMask, + bool bHasMask, CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, - FX_BOOL bStdCS, + bool bStdCS, uint32_t GroupFamily, - FX_BOOL bLoadMask) { + bool bLoadMask) { if (!pStream) { return 0; } @@ -298,7 +298,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, return 0; } m_pStreamAcc.reset(new CPDF_StreamAcc); - m_pStreamAcc->LoadAllData(pStream, FALSE, src_size.ValueOrDie(), TRUE); + m_pStreamAcc->LoadAllData(pStream, false, src_size.ValueOrDie(), true); if (m_pStreamAcc->GetSize() == 0 || !m_pStreamAcc->GetData()) { return 0; } @@ -325,7 +325,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, return ret; } if (m_pColorSpace && m_bStdCS) { - m_pColorSpace->EnableStdConversion(FALSE); + m_pColorSpace->EnableStdConversion(false); } return ret; } @@ -345,7 +345,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) { m_pStreamAcc->GetImageParam()->GetStreamFor("JBIG2Globals"); if (pGlobals) { m_pGlobalStream.reset(new CPDF_StreamAcc); - m_pGlobalStream->LoadAllData(pGlobals, FALSE); + m_pGlobalStream->LoadAllData(pGlobals, false); } } ret = pJbig2Module->StartDecode( @@ -370,7 +370,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) { return ret1; } if (m_pColorSpace && m_bStdCS) { - m_pColorSpace->EnableStdConversion(FALSE); + m_pColorSpace->EnableStdConversion(false); } return ret1; } @@ -393,7 +393,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) { return ret1; } if (m_pColorSpace && m_bStdCS) { - m_pColorSpace->EnableStdConversion(FALSE); + m_pColorSpace->EnableStdConversion(false); } return ret1; } @@ -407,7 +407,7 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, const CPDF_Dictionary* pPageResources) { m_bpc_orig = m_pDict->GetIntegerFor("BitsPerComponent"); if (m_pDict->GetIntegerFor("ImageMask")) - m_bImageMask = TRUE; + m_bImageMask = true; if (m_bImageMask || !m_pDict->KeyExist("ColorSpace")) { if (!m_bImageMask) { @@ -421,12 +421,12 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, } if (filter == "JPXDecode") { - m_bDoBpcCheck = FALSE; + m_bDoBpcCheck = false; return true; } } } - m_bImageMask = TRUE; + m_bImageMask = true; m_bpc = m_nComponents = 1; CPDF_Array* pDecode = m_pDict->GetArrayFor("Decode"); m_bDefaultDecode = !pDecode || !pDecode->GetIntegerAt(0); @@ -462,8 +462,8 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, return !!m_pCompData; } -DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, - FX_BOOL& bColorKey) { +DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(bool& bDefaultDecode, + bool& bColorKey) { if (!m_pColorSpace) { return nullptr; } @@ -483,7 +483,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, def_max = max_data; } if (def_min != pCompData[i].m_DecodeMin || def_max != max) { - bDefaultDecode = FALSE; + bDefaultDecode = false; } } } else { @@ -512,7 +512,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, pCompData[i].m_ColorKeyMax = std::min(max_num, max_data); } } - bColorKey = TRUE; + bColorKey = true; } } return pCompData; @@ -635,18 +635,18 @@ void CPDF_DIBSource::LoadJpxBitmap() { if (static_cast<int>(width) < m_Width || static_cast<int>(height) < m_Height) return; - FX_BOOL bSwapRGB = FALSE; + bool bSwapRGB = false; if (m_pColorSpace) { if (components != m_pColorSpace->CountComponents()) return; if (m_pColorSpace == CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB)) { - bSwapRGB = TRUE; + bSwapRGB = true; m_pColorSpace = nullptr; } } else { if (components == 3) { - bSwapRGB = TRUE; + bSwapRGB = true; } else if (components == 4) { m_pColorSpace = CPDF_ColorSpace::GetStockCS(PDFCS_DEVICECMYK); } @@ -755,7 +755,7 @@ int CPDF_DIBSource::ContinueLoadMaskDIB(IFX_Pause* pPause) { return ret; } if (m_pColorSpace && m_bStdCS) { - m_pColorSpace->EnableStdConversion(FALSE); + m_pColorSpace->EnableStdConversion(false); } if (!ret) { delete m_pMask; @@ -774,7 +774,7 @@ CPDF_DIBSource* CPDF_DIBSource::DetachMask() { CPDF_DIBSource* CPDF_DIBSource::LoadMaskDIB(CPDF_Stream* pMask) { CPDF_DIBSource* pMaskSource = new CPDF_DIBSource; if (!pMaskSource->Load(m_pDocument, pMask, nullptr, nullptr, nullptr, nullptr, - TRUE)) { + true)) { delete pMaskSource; return nullptr; } @@ -783,8 +783,8 @@ CPDF_DIBSource* CPDF_DIBSource::LoadMaskDIB(CPDF_Stream* pMask) { int CPDF_DIBSource::StartLoadMaskDIB() { m_pMask = new CPDF_DIBSource; - int ret = m_pMask->StartLoadDIBSource(m_pDocument, m_pMaskStream, FALSE, - nullptr, nullptr, TRUE); + int ret = m_pMask->StartLoadDIBSource(m_pDocument, m_pMaskStream, false, + nullptr, nullptr, true); if (ret == 2) { if (m_Status == 0) m_Status = 2; @@ -1152,7 +1152,7 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const { return pSrcLine; } -FX_BOOL CPDF_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const { +bool CPDF_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const { return m_pDecoder && m_pDecoder->SkipToScanline(line, pPause); } @@ -1160,7 +1160,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, - FX_BOOL bFlipX, + bool bFlipX, int clip_left, int clip_width) const { if (line < 0 || !dest_scan || dest_bpp <= 0 || dest_width <= 0 || @@ -1221,7 +1221,7 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp, const uint8_t* pSrcLine, uint8_t* dest_scan, int dest_width, - FX_BOOL bFlipX, + bool bFlipX, int clip_left, int clip_width) const { uint32_t set_argb = (uint32_t)-1; @@ -1300,7 +1300,7 @@ void CPDF_DIBSource::DownSampleScanline8Bit(int orig_Bpp, const uint8_t* pSrcLine, uint8_t* dest_scan, int dest_width, - FX_BOOL bFlipX, + bool bFlipX, int clip_left, int clip_width) const { if (m_bpc < 8) { @@ -1366,7 +1366,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, const uint8_t* pSrcLine, uint8_t* dest_scan, int dest_width, - FX_BOOL bFlipX, + bool bFlipX, int clip_left, int clip_width) const { // last_src_x used to store the last seen src_x position which should be @@ -1411,7 +1411,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, if (m_pColorSpace) { uint8_t color[4]; - const FX_BOOL bTransMask = TransMask(); + const bool bTransMask = TransMask(); if (m_bDefaultDecode) { m_pColorSpace->TranslateImageLine(color, pSrcPixel, 1, 0, 0, bTransMask); @@ -1462,7 +1462,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, } } -FX_BOOL CPDF_DIBSource::TransMask() const { +bool CPDF_DIBSource::TransMask() const { return m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && m_Family == PDFCS_DEVICECMYK; } @@ -1475,21 +1475,21 @@ CPDF_ImageLoaderHandle::CPDF_ImageLoaderHandle() { CPDF_ImageLoaderHandle::~CPDF_ImageLoaderHandle() {} -FX_BOOL CPDF_ImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, - const CPDF_ImageObject* pImage, - CPDF_PageRenderCache* pCache, - FX_BOOL bStdCS, - uint32_t GroupFamily, - FX_BOOL bLoadMask, - CPDF_RenderStatus* pRenderStatus, - int32_t nDownsampleWidth, - int32_t nDownsampleHeight) { +bool CPDF_ImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, + const CPDF_ImageObject* pImage, + CPDF_PageRenderCache* pCache, + bool bStdCS, + uint32_t GroupFamily, + bool bLoadMask, + CPDF_RenderStatus* pRenderStatus, + int32_t nDownsampleWidth, + int32_t nDownsampleHeight) { m_pImageLoader = pImageLoader; m_pCache = pCache; m_pImage = const_cast<CPDF_ImageObject*>(pImage); m_nDownsampleWidth = nDownsampleWidth; m_nDownsampleHeight = nDownsampleHeight; - FX_BOOL ret; + bool ret; if (pCache) { ret = pCache->StartGetCachedBitmap( m_pImage->GetImage()->GetStream(), bStdCS, GroupFamily, bLoadMask, @@ -1504,9 +1504,9 @@ FX_BOOL CPDF_ImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, return ret; } -FX_BOOL CPDF_ImageLoaderHandle::Continue(IFX_Pause* pPause) { - FX_BOOL ret = m_pCache ? m_pCache->Continue(pPause) - : m_pImage->GetImage()->Continue(pPause); +bool CPDF_ImageLoaderHandle::Continue(IFX_Pause* pPause) { + bool ret = m_pCache ? m_pCache->Continue(pPause) + : m_pImage->GetImage()->Continue(pPause); if (!ret) HandleFailure(); return ret; @@ -1515,26 +1515,26 @@ FX_BOOL CPDF_ImageLoaderHandle::Continue(IFX_Pause* pPause) { void CPDF_ImageLoaderHandle::HandleFailure() { if (m_pCache) { CPDF_ImageCacheEntry* entry = m_pCache->GetCurImageCacheEntry(); - m_pImageLoader->m_bCached = TRUE; + m_pImageLoader->m_bCached = true; m_pImageLoader->m_pBitmap = entry->DetachBitmap(); m_pImageLoader->m_pMask = entry->DetachMask(); m_pImageLoader->m_MatteColor = entry->m_MatteColor; } else { CPDF_Image* pImage = m_pImage->GetImage(); - m_pImageLoader->m_bCached = FALSE; + m_pImageLoader->m_bCached = false; m_pImageLoader->m_pBitmap = pImage->DetachBitmap(); m_pImageLoader->m_pMask = pImage->DetachMask(); m_pImageLoader->m_MatteColor = pImage->m_MatteColor; } } -FX_BOOL CPDF_ImageLoader::Start( +bool CPDF_ImageLoader::Start( const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, std::unique_ptr<CPDF_ImageLoaderHandle>* pLoadHandle, - FX_BOOL bStdCS, + bool bStdCS, uint32_t GroupFamily, - FX_BOOL bLoadMask, + bool bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nDownsampleHeight) { @@ -1546,8 +1546,8 @@ FX_BOOL CPDF_ImageLoader::Start( pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight); } -FX_BOOL CPDF_ImageLoader::Continue(CPDF_ImageLoaderHandle* LoadHandle, - IFX_Pause* pPause) { +bool CPDF_ImageLoader::Continue(CPDF_ImageLoaderHandle* LoadHandle, + IFX_Pause* pPause) { return LoadHandle->Continue(pPause); } diff --git a/core/fpdfapi/render/fpdf_render_pattern.cpp b/core/fpdfapi/render/fpdf_render_pattern.cpp index 5238550bf5..695c4d91d9 100644 --- a/core/fpdfapi/render/fpdf_render_pattern.cpp +++ b/core/fpdfapi/render/fpdf_render_pattern.cpp @@ -61,8 +61,8 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap, t_min = pArray->GetNumberAt(0); t_max = pArray->GetNumberAt(1); } - FX_BOOL bStartExtend = FALSE; - FX_BOOL bEndExtend = FALSE; + bool bStartExtend = false; + bool bEndExtend = false; pArray = pDict->GetArrayFor("Extend"); if (pArray) { bStartExtend = !!pArray->GetIntegerAt(0); @@ -148,8 +148,8 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap, t_min = pArray->GetNumberAt(0); t_max = pArray->GetNumberAt(1); } - FX_BOOL bStartExtend = FALSE; - FX_BOOL bEndExtend = FALSE; + bool bStartExtend = false; + bool bEndExtend = false; pArray = pDict->GetArrayFor("Extend"); if (pArray) { bStartExtend = !!pArray->GetIntegerAt(0); @@ -183,12 +183,12 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap, int width = pBitmap->GetWidth(); int height = pBitmap->GetHeight(); int pitch = pBitmap->GetPitch(); - FX_BOOL bDecreasing = FALSE; + bool bDecreasing = false; if (start_r > end_r) { int length = (int)FXSYS_sqrt((((start_x - end_x) * (start_x - end_x)) + ((start_y - end_y) * (start_y - end_y)))); if (length < start_r - end_r) { - bDecreasing = TRUE; + bDecreasing = true; } } for (int row = 0; row < height; row++) { @@ -315,17 +315,17 @@ bool GetScanlineIntersect(int y, FX_FLOAT y2, FX_FLOAT* x) { if (y1 == y2) - return FALSE; + return false; if (y1 < y2) { if (y < y1 || y > y2) - return FALSE; + return false; } else { if (y < y2 || y > y1) - return FALSE; + return false; } *x = x1 + ((x2 - x1) * (y - y1) / (y2 - y1)); - return TRUE; + return true; } void DrawGouraud(CFX_DIBitmap* pBitmap, @@ -650,8 +650,8 @@ struct CPDF_PatchDrawer { Coon_Bezier C2, Coon_Bezier D1, Coon_Bezier D2) { - FX_BOOL bSmall = C1.Distance() < 2 && C2.Distance() < 2 && - D1.Distance() < 2 && D2.Distance() < 2; + bool bSmall = C1.Distance() < 2 && C2.Distance() < 2 && D1.Distance() < 2 && + D2.Distance() < 2; Coon_Color div_colors[4]; int d_bottom = 0; int d_left = 0; @@ -850,7 +850,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, CFX_Matrix* pMatrix, FX_RECT& clip_rect, int alpha, - FX_BOOL bAlphaMode) { + bool bAlphaMode) { const auto& funcs = pPattern->GetFuncs(); CPDF_Dictionary* pDict = pPattern->GetShadingObject()->GetDict(); CPDF_ColorSpace* pColorSpace = pPattern->GetCS(); @@ -942,7 +942,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern, const CPDF_PageObject* pPageObj, const CFX_Matrix* pObj2Device, - FX_BOOL bStroke) { + bool bStroke) { if (!pattern->Load()) return; @@ -958,7 +958,7 @@ void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern, return; } FX_RECT rect; - if (GetObjectClippedRect(pPageObj, pObj2Device, FALSE, rect)) { + if (GetObjectClippedRect(pPageObj, pObj2Device, false, rect)) { m_pDevice->RestoreState(false); return; } @@ -991,7 +991,7 @@ void CPDF_RenderStatus::ProcessShading(const CPDF_ShadingObject* pShadingObj, void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_PageObject* pPageObj, const CFX_Matrix* pObj2Device, - FX_BOOL bStroke) { + bool bStroke) { if (!pPattern->Load()) { return; } @@ -1019,12 +1019,12 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CFX_Matrix mtPattern2Device = *pPattern->pattern_to_form(); mtPattern2Device.Concat(*pObj2Device); GetScaledMatrix(mtPattern2Device); - FX_BOOL bAligned = FALSE; + bool bAligned = false; if (pPattern->bbox().left == 0 && pPattern->bbox().bottom == 0 && pPattern->bbox().right == pPattern->x_step() && pPattern->bbox().top == pPattern->y_step() && (mtPattern2Device.IsScaled() || mtPattern2Device.Is90Rotated())) { - bAligned = TRUE; + bAligned = true; } CFX_FloatRect cell_bbox = pPattern->bbox(); mtPattern2Device.TransformRect(cell_bbox); @@ -1180,14 +1180,14 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, } } CompositeDIBitmap(&screen, clip_box.left, clip_box.top, 0, 255, - FXDIB_BLEND_NORMAL, FALSE); + FXDIB_BLEND_NORMAL, false); m_pDevice->RestoreState(false); } void CPDF_RenderStatus::DrawPathWithPattern(CPDF_PathObject* pPathObj, const CFX_Matrix* pObj2Device, const CPDF_Color* pColor, - FX_BOOL bStroke) { + bool bStroke) { CPDF_Pattern* pattern = pColor->GetPattern(); if (!pattern) return; @@ -1201,19 +1201,19 @@ void CPDF_RenderStatus::DrawPathWithPattern(CPDF_PathObject* pPathObj, void CPDF_RenderStatus::ProcessPathPattern(CPDF_PathObject* pPathObj, const CFX_Matrix* pObj2Device, int& filltype, - FX_BOOL& bStroke) { + bool& bStroke) { if (filltype) { const CPDF_Color& FillColor = *pPathObj->m_ColorState.GetFillColor(); if (FillColor.IsPattern()) { - DrawPathWithPattern(pPathObj, pObj2Device, &FillColor, FALSE); + DrawPathWithPattern(pPathObj, pObj2Device, &FillColor, false); filltype = 0; } } if (bStroke) { const CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); if (StrokeColor.IsPattern()) { - DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); - bStroke = FALSE; + DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, true); + bStroke = false; } } } diff --git a/core/fpdfapi/render/fpdf_render_text.cpp b/core/fpdfapi/render/fpdf_render_text.cpp index 7d29f5c87f..86fac2d90f 100644 --- a/core/fpdfapi/render/fpdf_render_text.cpp +++ b/core/fpdfapi/render/fpdf_render_text.cpp @@ -31,15 +31,15 @@ #include "core/fxge/cfx_renderdevice.h" #include "third_party/base/numerics/safe_math.h" -FX_BOOL CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj, - const CFX_Matrix* pObj2Device, - CFX_PathData* pClippingPath) { +bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj, + const CFX_Matrix* pObj2Device, + CFX_PathData* pClippingPath) { if (textobj->m_nChars == 0) - return TRUE; + return true; const TextRenderingMode text_render_mode = textobj->m_TextState.GetTextMode(); if (text_render_mode == TextRenderingMode::MODE_INVISIBLE) - return TRUE; + return true; CPDF_Font* pFont = textobj->m_TextState.GetFont(); if (pFont->IsType3Font()) @@ -74,7 +74,7 @@ FX_BOOL CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj, // realize it. Fall through. ASSERT(false); case TextRenderingMode::MODE_CLIP: - return TRUE; + return true; } } FX_ARGB stroke_argb = 0; @@ -97,13 +97,13 @@ FX_BOOL CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj, CFX_Matrix text_matrix; textobj->GetTextMatrix(&text_matrix); if (!IsAvailableMatrix(text_matrix)) - return TRUE; + return true; FX_FLOAT font_size = textobj->m_TextState.GetFontSize(); if (bPattern) { DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size, &text_matrix, bFill, bStroke); - return TRUE; + return true; } if (bClip || bStroke) { const CFX_Matrix* pDeviceMatrix = pObj2Device; @@ -168,12 +168,12 @@ class CPDF_RefType3Cache { }; // TODO(npm): Font fallback for type 3 fonts? (Completely separate code!!) -FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, - const CFX_Matrix* pObj2Device) { +bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, + const CFX_Matrix* pObj2Device) { CPDF_Type3Font* pType3Font = textobj->m_TextState.GetFont()->AsType3Font(); for (int i = 0; i < m_Type3FontCache.GetSize(); ++i) { if (m_Type3FontCache.GetAt(i) == pType3Font) - return TRUE; + return true; } CFX_Matrix dCTM = m_pDevice->GetCTM(); @@ -184,14 +184,14 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, CFX_Matrix char_matrix = pType3Font->GetFontMatrix(); FX_FLOAT font_size = textobj->m_TextState.GetFontSize(); char_matrix.Scale(font_size, font_size); - FX_ARGB fill_argb = GetFillArgb(textobj, TRUE); + FX_ARGB fill_argb = GetFillArgb(textobj, true); int fill_alpha = FXARGB_A(fill_argb); int device_class = m_pDevice->GetDeviceClass(); std::vector<FXTEXT_GLYPHPOS> glyphs; if (device_class == FXDC_DISPLAY) glyphs.resize(textobj->m_nChars); else if (fill_alpha < 255) - return FALSE; + return false; CPDF_RefType3Cache refTypeCache(pType3Font); uint32_t* pChars = textobj->m_pCharCodes; @@ -225,7 +225,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, } glyphs.clear(); } - CPDF_GraphicStates* pStates = CloneObjStates(textobj, FALSE); + CPDF_GraphicStates* pStates = CloneObjStates(textobj, false); CPDF_RenderOptions Options = m_Options; Options.m_Flags |= RENDER_FORCE_HALFTONE | RENDER_RECT_AA; Options.m_Flags &= ~RENDER_FORCE_DOWNSAMPLE; @@ -239,7 +239,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, status.Initialize(m_pContext, m_pDevice, nullptr, nullptr, this, pStates, &Options, pType3Char->m_pForm->m_Transparency, m_bDropObjects, - pFormResource, FALSE, pType3Char, fill_argb); + pFormResource, false, pType3Char, fill_argb); status.m_Type3FontCache.Append(m_Type3FontCache); status.m_Type3FontCache.Add(pType3Font); m_pDevice->SaveState(); @@ -253,14 +253,14 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, if (!bitmap_device.Create((int)(rect.Width() * sa), (int)(rect.Height() * sd), FXDIB_Argb, nullptr)) { - return TRUE; + return true; } bitmap_device.GetBitmap()->Clear(0); CPDF_RenderStatus status; status.Initialize(m_pContext, &bitmap_device, nullptr, nullptr, this, pStates, &Options, pType3Char->m_pForm->m_Transparency, m_bDropObjects, - pFormResource, FALSE, pType3Char, fill_argb); + pFormResource, false, pType3Char, fill_argb); status.m_Type3FontCache.Append(m_Type3FontCache); status.m_Type3FontCache.Add(pType3Font); matrix.TranslateI(-rect.left, -rect.top); @@ -292,23 +292,23 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, image_matrix.Concat(matrix); CPDF_ImageRenderer renderer; if (renderer.Start(this, pType3Char->m_pBitmap.get(), fill_argb, 255, - &image_matrix, 0, FALSE)) { + &image_matrix, 0, false)) { renderer.Continue(nullptr); } if (!renderer.m_Result) - return FALSE; + return false; } } } if (glyphs.empty()) - return TRUE; + return true; FX_RECT rect = FXGE_GetGlyphsBBox(glyphs, 0, sa, sd); CFX_DIBitmap bitmap; if (!bitmap.Create(static_cast<int>(rect.Width() * sa), static_cast<int>(rect.Height() * sd), FXDIB_8bppMask)) { - return TRUE; + return true; } bitmap.Clear(0); for (const FXTEXT_GLYPHPOS& glyph : glyphs) { @@ -333,10 +333,10 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, glyph.m_pGlyph->m_Bitmap.GetWidth(), glyph.m_pGlyph->m_Bitmap.GetHeight(), &glyph.m_pGlyph->m_Bitmap, fill_argb, 0, 0, - FXDIB_BLEND_NORMAL, nullptr, FALSE, 0, nullptr); + FXDIB_BLEND_NORMAL, nullptr, false, 0, nullptr); } m_pDevice->SetBitMask(&bitmap, rect.left, rect.top, fill_argb); - return TRUE; + return true; } class CPDF_CharPosList { @@ -368,7 +368,7 @@ void CPDF_CharPosList::Load(int nChars, m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, nChars); m_nChars = 0; CPDF_CIDFont* pCIDFont = pFont->AsCIDFont(); - FX_BOOL bVertWriting = pCIDFont && pCIDFont->IsVertWriting(); + bool bVertWriting = pCIDFont && pCIDFont->IsVertWriting(); for (int iChar = 0; iChar < nChars; iChar++) { uint32_t CharCode = nChars == 1 ? (uint32_t)(uintptr_t)pCharCodes : pCharCodes[iChar]; @@ -400,7 +400,7 @@ void CPDF_CharPosList::Load(int nChars, } charpos.m_OriginX = iChar ? pCharPos[iChar - 1] : 0; charpos.m_OriginY = 0; - charpos.m_bGlyphAdjust = FALSE; + charpos.m_bGlyphAdjust = false; if (!pCIDFont) { continue; } @@ -423,29 +423,29 @@ void CPDF_CharPosList::Load(int nChars, pCIDFont->CIDTransformToFloat(pTransform[4]) * FontSize; charpos.m_OriginY += pCIDFont->CIDTransformToFloat(pTransform[5]) * FontSize; - charpos.m_bGlyphAdjust = TRUE; + charpos.m_bGlyphAdjust = true; } } } // static -FX_BOOL CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice, - int nChars, - uint32_t* pCharCodes, - FX_FLOAT* pCharPos, - CPDF_Font* pFont, - FX_FLOAT font_size, - const CFX_Matrix* pText2User, - const CFX_Matrix* pUser2Device, - const CFX_GraphStateData* pGraphState, - FX_ARGB fill_argb, - FX_ARGB stroke_argb, - CFX_PathData* pClippingPath, - int nFlag) { +bool CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice, + int nChars, + uint32_t* pCharCodes, + FX_FLOAT* pCharPos, + CPDF_Font* pFont, + FX_FLOAT font_size, + const CFX_Matrix* pText2User, + const CFX_Matrix* pUser2Device, + const CFX_GraphStateData* pGraphState, + FX_ARGB fill_argb, + FX_ARGB stroke_argb, + CFX_PathData* pClippingPath, + int nFlag) { CPDF_CharPosList CharPosList; CharPosList.Load(nChars, pCharCodes, pCharPos, pFont, font_size); if (CharPosList.m_nChars == 0) - return TRUE; + return true; bool bDraw = true; int32_t fontPosition = CharPosList.m_pCharPos[0].m_FallbackFontPosition; uint32_t startIndex = 0; @@ -535,19 +535,19 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, } // static -FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice, - int nChars, - uint32_t* pCharCodes, - FX_FLOAT* pCharPos, - CPDF_Font* pFont, - FX_FLOAT font_size, - const CFX_Matrix* pText2Device, - FX_ARGB fill_argb, - const CPDF_RenderOptions* pOptions) { +bool CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice, + int nChars, + uint32_t* pCharCodes, + FX_FLOAT* pCharPos, + CPDF_Font* pFont, + FX_FLOAT font_size, + const CFX_Matrix* pText2Device, + FX_ARGB fill_argb, + const CPDF_RenderOptions* pOptions) { CPDF_CharPosList CharPosList; CharPosList.Load(nChars, pCharCodes, pCharPos, pFont, font_size); if (CharPosList.m_nChars == 0) - return TRUE; + return true; int FXGE_flags = 0; if (pOptions) { uint32_t dwFlags = pOptions->m_Flags; @@ -609,13 +609,13 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj, CPDF_Font* pFont, FX_FLOAT font_size, const CFX_Matrix* pTextMatrix, - FX_BOOL bFill, - FX_BOOL bStroke) { + bool bFill, + bool bStroke) { if (!bStroke) { CPDF_PathObject path; std::vector<std::unique_ptr<CPDF_TextObject>> pCopy; pCopy.push_back(std::unique_ptr<CPDF_TextObject>(textobj->Clone())); - path.m_bStroke = FALSE; + path.m_bStroke = false; path.m_FillType = FXFILL_WINDING; path.m_ClipPath.AppendTexts(&pCopy); path.m_ColorState = textobj->m_ColorState; diff --git a/core/fpdfapi/render/render_int.h b/core/fpdfapi/render/render_int.h index 9c5a7e919b..e6090e8ebe 100644 --- a/core/fpdfapi/render/render_int.h +++ b/core/fpdfapi/render/render_int.h @@ -49,18 +49,17 @@ class CPDF_Type3Glyphs; class CPDF_Type3Char; class CPDF_Type3Font; -FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix); +bool IsAvailableMatrix(const CFX_Matrix& matrix); class CPDF_TransferFunc { public: explicit CPDF_TransferFunc(CPDF_Document* pDoc); FX_COLORREF TranslateColor(FX_COLORREF src) const; - CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, - FX_BOOL bAutoDropSrc); + CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, bool bAutoDropSrc); CPDF_Document* const m_pPDFDoc; - FX_BOOL m_bIdentity; + bool m_bIdentity; uint8_t m_Samples[256 * 3]; }; @@ -70,7 +69,7 @@ class CPDF_DocRenderData { ~CPDF_DocRenderData(); CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObj); - void Clear(FX_BOOL bRelease = FALSE); + void Clear(bool bRelease = false); void ReleaseCachedType3(CPDF_Type3Font* pFont); void ReleaseTransferFunc(CPDF_Object* pObj); @@ -90,27 +89,27 @@ class CPDF_RenderStatus { CPDF_RenderStatus(); ~CPDF_RenderStatus(); - FX_BOOL Initialize(class CPDF_RenderContext* pContext, - CFX_RenderDevice* pDevice, - const CFX_Matrix* pDeviceMatrix, - const CPDF_PageObject* pStopObj, - const CPDF_RenderStatus* pParentStatus, - const CPDF_GraphicStates* pInitialStates, - const CPDF_RenderOptions* pOptions, - int transparency, - FX_BOOL bDropObjects, - CPDF_Dictionary* pFormResource = nullptr, - FX_BOOL bStdCS = FALSE, - CPDF_Type3Char* pType3Char = nullptr, - FX_ARGB fill_color = 0, - uint32_t GroupFamily = 0, - FX_BOOL bLoadMask = FALSE); + bool Initialize(class CPDF_RenderContext* pContext, + CFX_RenderDevice* pDevice, + const CFX_Matrix* pDeviceMatrix, + const CPDF_PageObject* pStopObj, + const CPDF_RenderStatus* pParentStatus, + const CPDF_GraphicStates* pInitialStates, + const CPDF_RenderOptions* pOptions, + int transparency, + bool bDropObjects, + CPDF_Dictionary* pFormResource = nullptr, + bool bStdCS = false, + CPDF_Type3Char* pType3Char = nullptr, + FX_ARGB fill_color = 0, + uint32_t GroupFamily = 0, + bool bLoadMask = false); void RenderObjectList(const CPDF_PageObjectHolder* pObjectHolder, const CFX_Matrix* pObj2Device); void RenderSingleObject(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device); - FX_BOOL ContinueSingleObject(CPDF_PageObject* pObj, - const CFX_Matrix* pObj2Device, - IFX_Pause* pPause); + bool ContinueSingleObject(CPDF_PageObject* pObj, + const CFX_Matrix* pObj2Device, + IFX_Pause* pPause); CPDF_RenderContext* GetContext() { return m_pContext; } #if defined _SKIA_SUPPORT_ @@ -128,46 +127,44 @@ class CPDF_RenderStatus { void ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_Matrix* pObj2Device); void DrawClipPath(CPDF_ClipPath ClipPath, const CFX_Matrix* pObj2Device); - FX_BOOL ProcessTransparency(CPDF_PageObject* PageObj, - const CFX_Matrix* pObj2Device); + bool ProcessTransparency(CPDF_PageObject* PageObj, + const CFX_Matrix* pObj2Device); void ProcessObjectNoClip(CPDF_PageObject* PageObj, const CFX_Matrix* pObj2Device); void DrawObjWithBackground(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device); - FX_BOOL DrawObjWithBlend(CPDF_PageObject* pObj, - const CFX_Matrix* pObj2Device); - FX_BOOL ProcessPath(CPDF_PathObject* pPathObj, const CFX_Matrix* pObj2Device); + bool DrawObjWithBlend(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device); + bool ProcessPath(CPDF_PathObject* pPathObj, const CFX_Matrix* pObj2Device); void ProcessPathPattern(CPDF_PathObject* pPathObj, const CFX_Matrix* pObj2Device, int& filltype, - FX_BOOL& bStroke); + bool& bStroke); void DrawPathWithPattern(CPDF_PathObject* pPathObj, const CFX_Matrix* pObj2Device, const CPDF_Color* pColor, - FX_BOOL bStroke); + bool bStroke); void DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_PageObject* pPageObj, const CFX_Matrix* pObj2Device, - FX_BOOL bStroke); + bool bStroke); void DrawShadingPattern(CPDF_ShadingPattern* pPattern, const CPDF_PageObject* pPageObj, const CFX_Matrix* pObj2Device, - FX_BOOL bStroke); - FX_BOOL SelectClipPath(const CPDF_PathObject* pPathObj, - const CFX_Matrix* pObj2Device, - FX_BOOL bStroke); - FX_BOOL ProcessImage(CPDF_ImageObject* pImageObj, - const CFX_Matrix* pObj2Device); - FX_BOOL OutputBitmapAlpha(CPDF_ImageObject* pImageObj, - const CFX_Matrix* pImage2Device); - FX_BOOL OutputImage(CPDF_ImageObject* pImageObj, - const CFX_Matrix* pImage2Device); - FX_BOOL OutputDIBSource(const CFX_DIBSource* pOutputBitmap, - FX_ARGB fill_argb, - int bitmap_alpha, - const CFX_Matrix* pImage2Device, - CPDF_ImageCacheEntry* pImageCache, - uint32_t flags); + bool bStroke); + bool SelectClipPath(const CPDF_PathObject* pPathObj, + const CFX_Matrix* pObj2Device, + bool bStroke); + bool ProcessImage(CPDF_ImageObject* pImageObj, const CFX_Matrix* pObj2Device); + bool OutputBitmapAlpha(CPDF_ImageObject* pImageObj, + const CFX_Matrix* pImage2Device); + bool OutputImage(CPDF_ImageObject* pImageObj, + const CFX_Matrix* pImage2Device); + bool OutputDIBSource(const CFX_DIBSource* pOutputBitmap, + FX_ARGB fill_argb, + int bitmap_alpha, + const CFX_Matrix* pImage2Device, + CPDF_ImageCacheEntry* pImageCache, + uint32_t flags); void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int left, int top, @@ -181,47 +178,47 @@ class CPDF_RenderStatus { CFX_Matrix* pMatrix, FX_RECT& clip_rect, int alpha, - FX_BOOL bAlphaMode); - FX_BOOL ProcessType3Text(CPDF_TextObject* textobj, - const CFX_Matrix* pObj2Device); - FX_BOOL ProcessText(CPDF_TextObject* textobj, - const CFX_Matrix* pObj2Device, - CFX_PathData* pClippingPath); + bool bAlphaMode); + bool ProcessType3Text(CPDF_TextObject* textobj, + const CFX_Matrix* pObj2Device); + bool ProcessText(CPDF_TextObject* textobj, + const CFX_Matrix* pObj2Device, + CFX_PathData* pClippingPath); void DrawTextPathWithPattern(const CPDF_TextObject* textobj, const CFX_Matrix* pObj2Device, CPDF_Font* pFont, FX_FLOAT font_size, const CFX_Matrix* pTextMatrix, - FX_BOOL bFill, - FX_BOOL bStroke); - FX_BOOL ProcessForm(const CPDF_FormObject* pFormObj, - const CFX_Matrix* pObj2Device); + bool bFill, + bool bStroke); + bool ProcessForm(const CPDF_FormObject* pFormObj, + const CFX_Matrix* pObj2Device); CFX_DIBitmap* GetBackdrop(const CPDF_PageObject* pObj, const FX_RECT& rect, int& left, int& top, - FX_BOOL bBackAlphaRequired); + bool bBackAlphaRequired); CFX_DIBitmap* LoadSMask(CPDF_Dictionary* pSMaskDict, FX_RECT* pClipRect, const CFX_Matrix* pMatrix); void Init(CPDF_RenderContext* pParent); static class CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); static CPDF_GraphicStates* CloneObjStates(const CPDF_GraphicStates* pPathObj, - FX_BOOL bStroke); + bool bStroke); CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObject) const; - FX_ARGB GetFillArgb(CPDF_PageObject* pObj, FX_BOOL bType3 = FALSE) const; + FX_ARGB GetFillArgb(CPDF_PageObject* pObj, bool bType3 = false) const; FX_ARGB GetStrokeArgb(CPDF_PageObject* pObj) const; - FX_BOOL GetObjectClippedRect(const CPDF_PageObject* pObj, - const CFX_Matrix* pObj2Device, - FX_BOOL bLogical, - FX_RECT& rect) const; + bool GetObjectClippedRect(const CPDF_PageObject* pObj, + const CFX_Matrix* pObj2Device, + bool bLogical, + FX_RECT& rect) const; void GetScaledMatrix(CFX_Matrix& matrix) const; static const int kRenderMaxRecursionDepth = 64; static int s_CurrentRecursionDepth; CPDF_RenderContext* m_pContext; - FX_BOOL m_bStopped; + bool m_bStopped; CFX_RenderDevice* m_pDevice; CFX_Matrix m_DeviceMatrix; CPDF_ClipPath m_LastClipPath; @@ -230,12 +227,12 @@ class CPDF_RenderStatus { CPDF_GraphicStates m_InitialStates; int m_HalftoneLimit; std::unique_ptr<CPDF_ImageRenderer> m_pImageRenderer; - FX_BOOL m_bPrint; + bool m_bPrint; int m_Transparency; - FX_BOOL m_bDropObjects; - FX_BOOL m_bStdCS; + bool m_bDropObjects; + bool m_bStdCS; uint32_t m_GroupFamily; - FX_BOOL m_bLoadMask; + bool m_bLoadMask; CPDF_Type3Char* m_pType3Char; FX_ARGB m_T3FillColor; int m_curBlend; @@ -247,26 +244,26 @@ class CPDF_ImageLoader { : m_pBitmap(nullptr), m_pMask(nullptr), m_MatteColor(0), - m_bCached(FALSE), + m_bCached(false), m_nDownsampleWidth(0), m_nDownsampleHeight(0) {} ~CPDF_ImageLoader(); - FX_BOOL Start(const CPDF_ImageObject* pImage, - CPDF_PageRenderCache* pCache, - std::unique_ptr<CPDF_ImageLoaderHandle>* pLoadHandle, - FX_BOOL bStdCS = FALSE, - uint32_t GroupFamily = 0, - FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = nullptr, - int32_t nDownsampleWidth = 0, - int32_t nDownsampleHeight = 0); - FX_BOOL Continue(CPDF_ImageLoaderHandle* LoadHandle, IFX_Pause* pPause); + bool Start(const CPDF_ImageObject* pImage, + CPDF_PageRenderCache* pCache, + std::unique_ptr<CPDF_ImageLoaderHandle>* pLoadHandle, + bool bStdCS = false, + uint32_t GroupFamily = 0, + bool bLoadMask = false, + CPDF_RenderStatus* pRenderStatus = nullptr, + int32_t nDownsampleWidth = 0, + int32_t nDownsampleHeight = 0); + bool Continue(CPDF_ImageLoaderHandle* LoadHandle, IFX_Pause* pPause); CFX_DIBSource* m_pBitmap; CFX_DIBSource* m_pMask; uint32_t m_MatteColor; - FX_BOOL m_bCached; + bool m_bCached; protected: int32_t m_nDownsampleWidth; @@ -278,16 +275,16 @@ class CPDF_ImageLoaderHandle { CPDF_ImageLoaderHandle(); ~CPDF_ImageLoaderHandle(); - FX_BOOL Start(CPDF_ImageLoader* pImageLoader, - const CPDF_ImageObject* pImage, - CPDF_PageRenderCache* pCache, - FX_BOOL bStdCS = FALSE, - uint32_t GroupFamily = 0, - FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = nullptr, - int32_t nDownsampleWidth = 0, - int32_t nDownsampleHeight = 0); - FX_BOOL Continue(IFX_Pause* pPause); + bool Start(CPDF_ImageLoader* pImageLoader, + const CPDF_ImageObject* pImage, + CPDF_PageRenderCache* pCache, + bool bStdCS = false, + uint32_t GroupFamily = 0, + bool bLoadMask = false, + CPDF_RenderStatus* pRenderStatus = nullptr, + int32_t nDownsampleWidth = 0, + int32_t nDownsampleHeight = 0); + bool Continue(IFX_Pause* pPause); protected: void HandleFailure(); @@ -304,31 +301,31 @@ class CPDF_ImageRenderer { CPDF_ImageRenderer(); ~CPDF_ImageRenderer(); - FX_BOOL Start(CPDF_RenderStatus* pStatus, - CPDF_PageObject* pObj, - const CFX_Matrix* pObj2Device, - FX_BOOL bStdCS, - int blendType = FXDIB_BLEND_NORMAL); - FX_BOOL Continue(IFX_Pause* pPause); + bool Start(CPDF_RenderStatus* pStatus, + CPDF_PageObject* pObj, + const CFX_Matrix* pObj2Device, + bool bStdCS, + int blendType = FXDIB_BLEND_NORMAL); + bool Continue(IFX_Pause* pPause); - FX_BOOL Start(CPDF_RenderStatus* pStatus, - const CFX_DIBSource* pDIBSource, - FX_ARGB bitmap_argb, - int bitmap_alpha, - const CFX_Matrix* pImage2Device, - uint32_t flags, - FX_BOOL bStdCS, - int blendType = FXDIB_BLEND_NORMAL); + bool Start(CPDF_RenderStatus* pStatus, + const CFX_DIBSource* pDIBSource, + FX_ARGB bitmap_argb, + int bitmap_alpha, + const CFX_Matrix* pImage2Device, + uint32_t flags, + bool bStdCS, + int blendType = FXDIB_BLEND_NORMAL); - FX_BOOL m_Result; + bool m_Result; protected: - FX_BOOL StartBitmapAlpha(); - FX_BOOL StartDIBSource(); - FX_BOOL StartRenderDIBSource(); - FX_BOOL StartLoadDIBSource(); - FX_BOOL DrawMaskedImage(); - FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device); + bool StartBitmapAlpha(); + bool StartDIBSource(); + bool StartRenderDIBSource(); + bool StartLoadDIBSource(); + bool DrawMaskedImage(); + bool DrawPatternImage(const CFX_Matrix* pObj2Device); CPDF_RenderStatus* m_pRenderStatus; CPDF_ImageObject* m_pImageObject; @@ -339,14 +336,14 @@ class CPDF_ImageRenderer { const CFX_DIBSource* m_pDIBSource; std::unique_ptr<CFX_DIBitmap> m_pClone; int m_BitmapAlpha; - FX_BOOL m_bPatternColor; + bool m_bPatternColor; CPDF_Pattern* m_pPattern; FX_ARGB m_FillArgb; uint32_t m_Flags; std::unique_ptr<CFX_ImageTransformer> m_pTransformer; void* m_DeviceHandle; std::unique_ptr<CPDF_ImageLoaderHandle> m_LoadHandle; - FX_BOOL m_bStdCS; + bool m_bStdCS; int m_BlendType; }; @@ -355,12 +352,12 @@ class CPDF_ScaledRenderBuffer { CPDF_ScaledRenderBuffer(); ~CPDF_ScaledRenderBuffer(); - FX_BOOL Initialize(CPDF_RenderContext* pContext, - CFX_RenderDevice* pDevice, - const FX_RECT& pRect, - const CPDF_PageObject* pObj, - const CPDF_RenderOptions* pOptions = nullptr, - int max_dpi = 0); + bool Initialize(CPDF_RenderContext* pContext, + CFX_RenderDevice* pDevice, + const FX_RECT& pRect, + const CPDF_PageObject* pObj, + const CPDF_RenderOptions* pOptions = nullptr, + int max_dpi = 0); CFX_RenderDevice* GetDevice() { return m_pBitmapDevice ? m_pBitmapDevice.get() : m_pDevice; } @@ -380,11 +377,11 @@ class CPDF_DeviceBuffer { public: CPDF_DeviceBuffer(); ~CPDF_DeviceBuffer(); - FX_BOOL Initialize(CPDF_RenderContext* pContext, - CFX_RenderDevice* pDevice, - FX_RECT* pRect, - const CPDF_PageObject* pObj, - int max_dpi = 0); + bool Initialize(CPDF_RenderContext* pContext, + CFX_RenderDevice* pDevice, + FX_RECT* pRect, + const CPDF_PageObject* pObj, + int max_dpi = 0); void OutputToDevice(); CFX_DIBitmap* GetBitmap() const { return m_pBitmap.get(); } const CFX_Matrix* GetMatrix() const { return &m_Matrix; } @@ -404,16 +401,16 @@ class CPDF_ImageCacheEntry { ~CPDF_ImageCacheEntry(); void Reset(const CFX_DIBitmap* pBitmap); - FX_BOOL GetCachedBitmap(CFX_DIBSource*& pBitmap, - CFX_DIBSource*& pMask, - uint32_t& MatteColor, - CPDF_Dictionary* pPageResources, - FX_BOOL bStdCS = FALSE, - uint32_t GroupFamily = 0, - FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = nullptr, - int32_t downsampleWidth = 0, - int32_t downsampleHeight = 0); + bool GetCachedBitmap(CFX_DIBSource*& pBitmap, + CFX_DIBSource*& pMask, + uint32_t& MatteColor, + CPDF_Dictionary* pPageResources, + bool bStdCS = false, + uint32_t GroupFamily = 0, + bool bLoadMask = false, + CPDF_RenderStatus* pRenderStatus = nullptr, + int32_t downsampleWidth = 0, + int32_t downsampleHeight = 0); uint32_t EstimateSize() const { return m_dwCacheSize; } uint32_t GetTimeCount() const { return m_dwTimeCount; } CPDF_Stream* GetStream() const { return m_pStream; } @@ -423,9 +420,9 @@ class CPDF_ImageCacheEntry { public: int StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, - FX_BOOL bStdCS = FALSE, + bool bStdCS = false, uint32_t GroupFamily = 0, - FX_BOOL bLoadMask = FALSE, + bool bLoadMask = false, CPDF_RenderStatus* pRenderStatus = nullptr, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); @@ -459,25 +456,25 @@ class CPDF_DIBSource : public CFX_DIBSource { CPDF_DIBSource(); ~CPDF_DIBSource() override; - FX_BOOL Load(CPDF_Document* pDoc, - const CPDF_Stream* pStream, - CPDF_DIBSource** ppMask, - uint32_t* pMatteColor, - CPDF_Dictionary* pFormResources, - CPDF_Dictionary* pPageResources, - FX_BOOL bStdCS = FALSE, - uint32_t GroupFamily = 0, - FX_BOOL bLoadMask = FALSE); + bool Load(CPDF_Document* pDoc, + const CPDF_Stream* pStream, + CPDF_DIBSource** ppMask, + uint32_t* pMatteColor, + CPDF_Dictionary* pFormResources, + CPDF_Dictionary* pPageResources, + bool bStdCS = false, + uint32_t GroupFamily = 0, + bool bLoadMask = false); // CFX_DIBSource - FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const override; + bool SkipToScanline(int line, IFX_Pause* pPause) const override; uint8_t* GetBuffer() const override; const uint8_t* GetScanline(int line) const override; void DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, - FX_BOOL bFlipX, + bool bFlipX, int clip_left, int clip_width) const override; @@ -487,12 +484,12 @@ class CPDF_DIBSource : public CFX_DIBSource { int StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Stream* pStream, - FX_BOOL bHasMask, + bool bHasMask, CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, - FX_BOOL bStdCS = FALSE, + bool bStdCS = false, uint32_t GroupFamily = 0, - FX_BOOL bLoadMask = FALSE); + bool bLoadMask = false); int ContinueLoadDIBSource(IFX_Pause* pPause); int StratLoadMask(); int StartLoadMaskDIB(); @@ -503,8 +500,7 @@ class CPDF_DIBSource : public CFX_DIBSource { private: bool LoadColorInfo(const CPDF_Dictionary* pFormResources, const CPDF_Dictionary* pPageResources); - DIB_COMP_DATA* GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, - FX_BOOL& bColorKey); + DIB_COMP_DATA* GetDecodeAndMaskArray(bool& bDefaultDecode, bool& bColorKey); CPDF_DIBSource* LoadMask(uint32_t& MatteColor); CPDF_DIBSource* LoadMaskDIB(CPDF_Stream* pMask); void LoadJpxBitmap(); @@ -519,7 +515,7 @@ class CPDF_DIBSource : public CFX_DIBSource { const uint8_t* pSrcLine, uint8_t* dest_scan, int dest_width, - FX_BOOL bFlipX, + bool bFlipX, int clip_left, int clip_width) const; void DownSampleScanline8Bit(int orig_Bpp, @@ -528,7 +524,7 @@ class CPDF_DIBSource : public CFX_DIBSource { const uint8_t* pSrcLine, uint8_t* dest_scan, int dest_width, - FX_BOOL bFlipX, + bool bFlipX, int clip_left, int clip_width) const; void DownSampleScanline32Bit(int orig_Bpp, @@ -537,10 +533,10 @@ class CPDF_DIBSource : public CFX_DIBSource { const uint8_t* pSrcLine, uint8_t* dest_scan, int dest_width, - FX_BOOL bFlipX, + bool bFlipX, int clip_left, int clip_width) const; - FX_BOOL TransMask() const; + bool TransMask() const; CPDF_Document* m_pDocument; const CPDF_Stream* m_pStream; @@ -553,13 +549,13 @@ class CPDF_DIBSource : public CFX_DIBSource { uint32_t m_nComponents; uint32_t m_GroupFamily; uint32_t m_MatteColor; - FX_BOOL m_bLoadMask; - FX_BOOL m_bDefaultDecode; - FX_BOOL m_bImageMask; - FX_BOOL m_bDoBpcCheck; - FX_BOOL m_bColorKey; - FX_BOOL m_bHasMask; - FX_BOOL m_bStdCS; + bool m_bLoadMask; + bool m_bDefaultDecode; + bool m_bImageMask; + bool m_bDoBpcCheck; + bool m_bColorKey; + bool m_bHasMask; + bool m_bStdCS; DIB_COMP_DATA* m_pCompData; uint8_t* m_pLineBuf; uint8_t* m_pMaskedLine; |