From 048d7f7c1e0c6c42679a5646ae9db5b7d98ed755 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 16 Aug 2018 16:20:08 +0000 Subject: Remove more optional args in core/ Change-Id: I6a2bd03e00ad4e3d57f6931c0c6cf4ae0c760afb Reviewed-on: https://pdfium-review.googlesource.com/40290 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- core/fpdfapi/parser/cpdf_document.cpp | 2 +- core/fpdfapi/parser/cpdf_document.h | 2 +- core/fpdfapi/render/cpdf_devicebuffer.cpp | 2 +- core/fpdfapi/render/cpdf_renderstatus.cpp | 23 +++++++++++++++-------- core/fxge/agg/fx_agg_driver.cpp | 2 +- core/fxge/dib/cfx_dibextractor.cpp | 2 +- core/fxge/dib/cfx_dibitmap.cpp | 4 ++++ core/fxge/dib/cfx_dibitmap.h | 20 +++++++++++--------- core/fxge/win32/fx_win32_dib.cpp | 2 +- 9 files changed, 36 insertions(+), 23 deletions(-) diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp index cda6bd5582..1dd801de69 100644 --- a/core/fpdfapi/parser/cpdf_document.cpp +++ b/core/fpdfapi/parser/cpdf_document.cpp @@ -434,7 +434,7 @@ int CPDF_Document::GetPageIndex(uint32_t objnum) { return -1; int start_index = 0; - int found_index = FindPageIndex(pPages, &skip_count, objnum, &start_index); + int found_index = FindPageIndex(pPages, &skip_count, objnum, &start_index, 0); // Corrupt page tree may yield out-of-range results. if (!pdfium::IndexInBounds(m_PageList, found_index)) diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h index 0c6ec79c72..1cbc5fcc42 100644 --- a/core/fpdfapi/parser/cpdf_document.h +++ b/core/fpdfapi/parser/cpdf_document.h @@ -133,7 +133,7 @@ class CPDF_Document : public Observable, uint32_t* skip_count, uint32_t objnum, int* index, - int level = 0) const; + int level) const; std::unique_ptr ParseIndirectObject(uint32_t objnum) override; void LoadDocInternal(); size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict); diff --git a/core/fpdfapi/render/cpdf_devicebuffer.cpp b/core/fpdfapi/render/cpdf_devicebuffer.cpp index def2c2c7ca..4c8da1c327 100644 --- a/core/fpdfapi/render/cpdf_devicebuffer.cpp +++ b/core/fpdfapi/render/cpdf_devicebuffer.cpp @@ -65,7 +65,7 @@ void CPDF_DeviceBuffer::OutputToDevice() { m_pBitmap->GetHeight()); m_pContext->GetBackground(pBuffer, m_pObject.Get(), nullptr, &m_Matrix); pBuffer->CompositeBitmap(0, 0, pBuffer->GetWidth(), pBuffer->GetHeight(), - m_pBitmap, 0, 0); + m_pBitmap, 0, 0, FXDIB_BLEND_NORMAL, nullptr, false); m_pDevice->StretchDIBits(pBuffer, m_Rect.left, m_Rect.top, m_Rect.Width(), m_Rect.Height()); } diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 76c5e87228..f8a2b5de75 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -2325,10 +2325,12 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, } else { if (pPattern->colored()) { pScreen->CompositeBitmap(start_x, start_y, width, height, - pPatternBitmap, 0, 0); + pPatternBitmap, 0, 0, FXDIB_BLEND_NORMAL, + nullptr, false); } else { pScreen->CompositeMask(start_x, start_y, width, height, - pPatternBitmap, fill_argb, 0, 0); + pPatternBitmap, fill_argb, 0, 0, + FXDIB_BLEND_NORMAL, nullptr, false, 0); } } } @@ -2447,15 +2449,18 @@ void CPDF_RenderStatus::CompositeDIBitmap( RetainPtr pForeBitmap = m_pDevice->GetBitmap(); pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(), - pForeBitmap, rect.left, rect.top); + pForeBitmap, rect.left, rect.top, + FXDIB_BLEND_NORMAL, nullptr, false); left = std::min(left, 0); top = std::min(top, 0); if (pDIBitmap->IsAlphaMask()) { pClone->CompositeMask(0, 0, pClone->GetWidth(), pClone->GetHeight(), - pDIBitmap, mask_argb, left, top, blend_mode); + pDIBitmap, mask_argb, left, top, blend_mode, + nullptr, false, 0); } else { pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(), - pDIBitmap, left, top, blend_mode); + pDIBitmap, left, top, blend_mode, nullptr, + false); } } else { pClone = pDIBitmap; @@ -2483,11 +2488,12 @@ void CPDF_RenderStatus::CompositeDIBitmap( if (pDIBitmap->IsAlphaMask()) { pBackdrop->CompositeMask(left - back_left, top - back_top, pDIBitmap->GetWidth(), pDIBitmap->GetHeight(), - pDIBitmap, mask_argb, 0, 0, blend_mode); + pDIBitmap, mask_argb, 0, 0, blend_mode, nullptr, + false, 0); } else { pBackdrop->CompositeBitmap(left - back_left, top - back_top, pDIBitmap->GetWidth(), pDIBitmap->GetHeight(), - pDIBitmap, 0, 0, blend_mode); + pDIBitmap, 0, 0, blend_mode, nullptr, false); } auto pBackdrop1 = pdfium::MakeRetain(); @@ -2495,7 +2501,8 @@ void CPDF_RenderStatus::CompositeDIBitmap( FXDIB_Rgb32); pBackdrop1->Clear((uint32_t)-1); pBackdrop1->CompositeBitmap(0, 0, pBackdrop->GetWidth(), - pBackdrop->GetHeight(), pBackdrop, 0, 0); + pBackdrop->GetHeight(), pBackdrop, 0, 0, + FXDIB_BLEND_NORMAL, nullptr, false); pBackdrop = std::move(pBackdrop1); m_pDevice->SetDIBits(pBackdrop, back_left, back_top); } diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 3d35e12e45..9166fbb0c8 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -1469,7 +1469,7 @@ bool CFX_AggDeviceDriver::GetDIBits(const RetainPtr& pBitmap, return true; pBack->CompositeBitmap(0, 0, pBack->GetWidth(), pBack->GetHeight(), - m_pBitmap, 0, 0); + m_pBitmap, 0, 0, FXDIB_BLEND_NORMAL, nullptr, false); } else { pBack = m_pBitmap->Clone(&rect); if (!pBack) diff --git a/core/fxge/dib/cfx_dibextractor.cpp b/core/fxge/dib/cfx_dibextractor.cpp index 13ad461cb1..9fe3114b1f 100644 --- a/core/fxge/dib/cfx_dibextractor.cpp +++ b/core/fxge/dib/cfx_dibextractor.cpp @@ -16,7 +16,7 @@ CFX_DIBExtractor::CFX_DIBExtractor(const RetainPtr& pSrc) { RetainPtr pOldSrc(pSrc); m_pBitmap = pdfium::MakeRetain(); if (!m_pBitmap->Create(pOldSrc->GetWidth(), pOldSrc->GetHeight(), - pOldSrc->GetFormat(), pOldSrc->GetBuffer())) { + pOldSrc->GetFormat(), pOldSrc->GetBuffer(), 0)) { m_pBitmap.Reset(); return; } diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp index 3d642c2e76..2c99bd16e0 100644 --- a/core/fxge/dib/cfx_dibitmap.cpp +++ b/core/fxge/dib/cfx_dibitmap.cpp @@ -30,6 +30,10 @@ CFX_DIBitmap::CFX_DIBitmap() { #endif } +bool CFX_DIBitmap::Create(int width, int height, FXDIB_Format format) { + return Create(width, height, format, nullptr, 0); +} + bool CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, diff --git a/core/fxge/dib/cfx_dibitmap.h b/core/fxge/dib/cfx_dibitmap.h index 008a549bac..d9afee6800 100644 --- a/core/fxge/dib/cfx_dibitmap.h +++ b/core/fxge/dib/cfx_dibitmap.h @@ -18,11 +18,13 @@ class CFX_DIBitmap : public CFX_DIBSource { template friend RetainPtr pdfium::MakeRetain(Args&&... args); + bool Create(int width, int height, FXDIB_Format format); + bool Create(int width, int height, FXDIB_Format format, - uint8_t* pBuffer = nullptr, - uint32_t pitch = 0); + uint8_t* pBuffer, + uint32_t pitch); bool Copy(const RetainPtr& pSrc); @@ -67,9 +69,9 @@ class CFX_DIBitmap : public CFX_DIBSource { const RetainPtr& pSrcBitmap, int src_left, int src_top, - int blend_type = FXDIB_BLEND_NORMAL, - const CFX_ClipRgn* pClipRgn = nullptr, - bool bRgbByteOrder = false); + int blend_type, + const CFX_ClipRgn* pClipRgn, + bool bRgbByteOrder); bool CompositeMask(int dest_left, int dest_top, @@ -79,10 +81,10 @@ class CFX_DIBitmap : public CFX_DIBSource { uint32_t color, int src_left, int src_top, - int blend_type = FXDIB_BLEND_NORMAL, - const CFX_ClipRgn* pClipRgn = nullptr, - bool bRgbByteOrder = false, - int alpha_flag = 0); + int blend_type, + const CFX_ClipRgn* pClipRgn, + bool bRgbByteOrder, + int alpha_flag); bool CompositeRect(int dest_left, int dest_top, diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp index b6bed7a987..23cc633f6b 100644 --- a/core/fxge/win32/fx_win32_dib.cpp +++ b/core/fxge/win32/fx_win32_dib.cpp @@ -187,7 +187,7 @@ RetainPtr CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) { } CFX_WindowsDIB::CFX_WindowsDIB(HDC hDC, int width, int height) { - Create(width, height, FXDIB_Rgb, (uint8_t*)1); + Create(width, height, FXDIB_Rgb, (uint8_t*)1, 0); BITMAPINFOHEADER bmih; memset(&bmih, 0, sizeof bmih); bmih.biSize = sizeof bmih; -- cgit v1.2.3