diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-08-24 21:55:46 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-24 21:55:46 +0000 |
commit | e6ff2ebfaa19421c8d932f4d275548156ae2e13c (patch) | |
tree | a549775ce9d4e999f8a23542524adba8c5ca42ea | |
parent | 16d18d935d055b74e05f615c0325318a329a7fe1 (diff) | |
download | pdfium-e6ff2ebfaa19421c8d932f4d275548156ae2e13c.tar.xz |
Rename CFX_DIBSource to CFX_DIBBase.
It is not a source from which you can get CFX_DIBs, but rather a
base class from which all DIBs inherit.
Do the same thing for the CPDF_DIBSource wrapper class.
Mechanical change apart from adding a one-line comment in cfx_dibbase.h
Change-Id: Id2bde87813ca301d9fafc55ce08d703dfc6a7184
Reviewed-on: https://pdfium-review.googlesource.com/41352
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
62 files changed, 488 insertions, 496 deletions
@@ -660,8 +660,8 @@ jumbo_static_library("fpdfapi") { "core/fpdfapi/render/cpdf_charposlist.h", "core/fpdfapi/render/cpdf_devicebuffer.cpp", "core/fpdfapi/render/cpdf_devicebuffer.h", - "core/fpdfapi/render/cpdf_dibsource.cpp", - "core/fpdfapi/render/cpdf_dibsource.h", + "core/fpdfapi/render/cpdf_dibbase.cpp", + "core/fpdfapi/render/cpdf_dibbase.h", "core/fpdfapi/render/cpdf_dibtransferfunc.cpp", "core/fpdfapi/render/cpdf_dibtransferfunc.h", "core/fpdfapi/render/cpdf_docrenderdata.cpp", @@ -1050,12 +1050,12 @@ jumbo_static_library("fxge") { "core/fxge/dib/cfx_bitmapcomposer.h", "core/fxge/dib/cfx_bitmapstorer.cpp", "core/fxge/dib/cfx_bitmapstorer.h", + "core/fxge/dib/cfx_dibbase.cpp", + "core/fxge/dib/cfx_dibbase.h", "core/fxge/dib/cfx_dibextractor.cpp", "core/fxge/dib/cfx_dibextractor.h", "core/fxge/dib/cfx_dibitmap.cpp", "core/fxge/dib/cfx_dibitmap.h", - "core/fxge/dib/cfx_dibsource.cpp", - "core/fxge/dib/cfx_dibsource.h", "core/fxge/dib/cfx_filtereddib.cpp", "core/fxge/dib/cfx_filtereddib.h", "core/fxge/dib/cfx_imagerenderer.cpp", diff --git a/core/fpdfapi/font/cpdf_type3char.cpp b/core/fpdfapi/font/cpdf_type3char.cpp index 8a89582b00..a04e83c468 100644 --- a/core/fpdfapi/font/cpdf_type3char.cpp +++ b/core/fpdfapi/font/cpdf_type3char.cpp @@ -49,15 +49,15 @@ bool CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext) { m_ImageMatrix = pPageObj->AsImage()->matrix(); { - // |pSource| actually gets assigned a CPDF_DIBSource, which has pointers + // |pSource| actually gets assigned a CPDF_DIBBase, which has pointers // into objects owned by |m_pForm|. Make sure it is out of scope before // clearing the form. - RetainPtr<CFX_DIBSource> pSource = - pPageObj->AsImage()->GetImage()->LoadDIBSource(); + RetainPtr<CFX_DIBBase> pSource = + pPageObj->AsImage()->GetImage()->LoadDIBBase(); - // Clone() is non-virtual, and can't be overloaded by CPDF_DIBSource to + // Clone() is non-virtual, and can't be overloaded by CPDF_DIBBase to // return a clone of the subclass as one would typically expect from a - // such a method. Instead, it only clones the CFX_DIBSource, none of whose + // such a method. Instead, it only clones the CFX_DIBBase, none of whose // members point to objects owned by the form. As a result, |m_pBitmap| // may outlive |m_pForm|. if (pSource) diff --git a/core/fpdfapi/page/cpdf_generalstate.cpp b/core/fpdfapi/page/cpdf_generalstate.cpp index 2657578ab7..ea912736fe 100644 --- a/core/fpdfapi/page/cpdf_generalstate.cpp +++ b/core/fpdfapi/page/cpdf_generalstate.cpp @@ -8,7 +8,7 @@ #include "constants/transparency.h" #include "core/fpdfapi/parser/cpdf_document.h" -#include "core/fpdfapi/render/cpdf_dibsource.h" +#include "core/fpdfapi/render/cpdf_dibbase.h" #include "core/fpdfapi/render/cpdf_docrenderdata.h" #include "core/fpdfapi/render/cpdf_transferfunc.h" diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp index a1be407dfe..b1c2fc9e82 100644 --- a/core/fpdfapi/page/cpdf_image.cpp +++ b/core/fpdfapi/page/cpdf_image.cpp @@ -23,7 +23,7 @@ #include "core/fpdfapi/parser/cpdf_reference.h" #include "core/fpdfapi/parser/cpdf_stream.h" #include "core/fpdfapi/parser/cpdf_string.h" -#include "core/fpdfapi/render/cpdf_dibsource.h" +#include "core/fpdfapi/render/cpdf_dibbase.h" #include "core/fpdfapi/render/cpdf_pagerendercache.h" #include "core/fxcodec/codec/ccodec_jpegmodule.h" #include "core/fxcrt/fx_stream.h" @@ -329,43 +329,43 @@ void CPDF_Image::ResetCache(CPDF_Page* pPage, pPage->GetRenderCache()->ResetBitmap(pHolder, pBitmap); } -RetainPtr<CFX_DIBSource> CPDF_Image::LoadDIBSource() const { - auto source = pdfium::MakeRetain<CPDF_DIBSource>(); +RetainPtr<CFX_DIBBase> CPDF_Image::LoadDIBBase() const { + auto source = pdfium::MakeRetain<CPDF_DIBBase>(); if (!source->Load(m_pDocument.Get(), m_pStream.Get())) return nullptr; if (!source->IsJBigImage()) return source; - CPDF_DIBSource::LoadState ret = CPDF_DIBSource::LoadState::kContinue; - while (ret == CPDF_DIBSource::LoadState::kContinue) - ret = source->ContinueLoadDIBSource(nullptr); - return ret == CPDF_DIBSource::LoadState::kSuccess ? source : nullptr; + CPDF_DIBBase::LoadState ret = CPDF_DIBBase::LoadState::kContinue; + while (ret == CPDF_DIBBase::LoadState::kContinue) + ret = source->ContinueLoadDIBBase(nullptr); + return ret == CPDF_DIBBase::LoadState::kSuccess ? source : nullptr; } -RetainPtr<CFX_DIBSource> CPDF_Image::DetachBitmap() { - return std::move(m_pDIBSource); +RetainPtr<CFX_DIBBase> CPDF_Image::DetachBitmap() { + return std::move(m_pDIBBase); } -RetainPtr<CFX_DIBSource> CPDF_Image::DetachMask() { +RetainPtr<CFX_DIBBase> CPDF_Image::DetachMask() { return std::move(m_pMask); } -bool CPDF_Image::StartLoadDIBSource(const CPDF_Dictionary* pFormResource, - CPDF_Dictionary* pPageResource, - bool bStdCS, - uint32_t GroupFamily, - bool bLoadMask) { - auto source = pdfium::MakeRetain<CPDF_DIBSource>(); - CPDF_DIBSource::LoadState ret = source->StartLoadDIBSource( +bool CPDF_Image::StartLoadDIBBase(const CPDF_Dictionary* pFormResource, + CPDF_Dictionary* pPageResource, + bool bStdCS, + uint32_t GroupFamily, + bool bLoadMask) { + auto source = pdfium::MakeRetain<CPDF_DIBBase>(); + CPDF_DIBBase::LoadState ret = source->StartLoadDIBBase( m_pDocument.Get(), m_pStream.Get(), true, pFormResource, pPageResource, bStdCS, GroupFamily, bLoadMask); - if (ret == CPDF_DIBSource::LoadState::kFail) { - m_pDIBSource.Reset(); + if (ret == CPDF_DIBBase::LoadState::kFail) { + m_pDIBBase.Reset(); return false; } - m_pDIBSource = source; - if (ret == CPDF_DIBSource::LoadState::kContinue) + m_pDIBBase = source; + if (ret == CPDF_DIBBase::LoadState::kContinue) return true; m_pMask = source->DetachMask(); @@ -374,16 +374,16 @@ bool CPDF_Image::StartLoadDIBSource(const CPDF_Dictionary* pFormResource, } bool CPDF_Image::Continue(PauseIndicatorIface* pPause) { - RetainPtr<CPDF_DIBSource> pSource = m_pDIBSource.As<CPDF_DIBSource>(); - CPDF_DIBSource::LoadState ret = pSource->ContinueLoadDIBSource(pPause); - if (ret == CPDF_DIBSource::LoadState::kContinue) + RetainPtr<CPDF_DIBBase> pSource = m_pDIBBase.As<CPDF_DIBBase>(); + CPDF_DIBBase::LoadState ret = pSource->ContinueLoadDIBBase(pPause); + if (ret == CPDF_DIBBase::LoadState::kContinue) return true; - if (ret == CPDF_DIBSource::LoadState::kSuccess) { + if (ret == CPDF_DIBBase::LoadState::kSuccess) { m_pMask = pSource->DetachMask(); m_MatteColor = pSource->GetMatteColor(); } else { - m_pDIBSource.Reset(); + m_pDIBBase.Reset(); } return false; } diff --git a/core/fpdfapi/page/cpdf_image.h b/core/fpdfapi/page/cpdf_image.h index e6c6d18986..4306109199 100644 --- a/core/fpdfapi/page/cpdf_image.h +++ b/core/fpdfapi/page/cpdf_image.h @@ -15,7 +15,7 @@ #include "core/fxcrt/retain_ptr.h" #include "core/fxcrt/unowned_ptr.h" -class CFX_DIBSource; +class CFX_DIBBase; class CFX_DIBitmap; class CPDF_Document; class CPDF_Page; @@ -41,7 +41,7 @@ class CPDF_Image : public Retainable { bool IsMask() const { return m_bIsMask; } bool IsInterpol() const { return m_bInterpolate; } - RetainPtr<CFX_DIBSource> LoadDIBSource() const; + RetainPtr<CFX_DIBBase> LoadDIBBase() const; void SetImage(const RetainPtr<CFX_DIBitmap>& pDIBitmap); void SetJpegImage(const RetainPtr<IFX_SeekableReadStream>& pFile); @@ -50,20 +50,20 @@ class CPDF_Image : public Retainable { void ResetCache(CPDF_Page* pPage, const RetainPtr<CFX_DIBitmap>& pDIBitmap); // Returns whether to Continue() or not. - bool StartLoadDIBSource(const CPDF_Dictionary* pFormResource, - CPDF_Dictionary* pPageResource, - bool bStdCS, - uint32_t GroupFamily, - bool bLoadMask); + bool StartLoadDIBBase(const CPDF_Dictionary* pFormResource, + CPDF_Dictionary* pPageResource, + bool bStdCS, + uint32_t GroupFamily, + bool bLoadMask); // Returns whether to Continue() or not. bool Continue(PauseIndicatorIface* pPause); - RetainPtr<CFX_DIBSource> DetachBitmap(); - RetainPtr<CFX_DIBSource> DetachMask(); + RetainPtr<CFX_DIBBase> DetachBitmap(); + RetainPtr<CFX_DIBBase> DetachMask(); - RetainPtr<CFX_DIBSource> m_pDIBSource; - RetainPtr<CFX_DIBSource> m_pMask; + RetainPtr<CFX_DIBBase> m_pDIBBase; + RetainPtr<CFX_DIBBase> m_pMask; uint32_t m_MatteColor = 0; private: diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp index 63556de250..7119e7649a 100644 --- a/core/fpdfapi/parser/cpdf_document.cpp +++ b/core/fpdfapi/parser/cpdf_document.cpp @@ -26,7 +26,7 @@ #include "core/fpdfapi/parser/cpdf_reference.h" #include "core/fpdfapi/parser/cpdf_stream.h" #include "core/fpdfapi/parser/cpdf_string.h" -#include "core/fpdfapi/render/cpdf_dibsource.h" +#include "core/fpdfapi/render/cpdf_dibbase.h" #include "core/fpdfapi/render/cpdf_docrenderdata.h" #include "core/fxcodec/JBig2_DocumentContext.h" #include "core/fxcrt/fx_codepage.h" diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibbase.cpp index 0c69852354..9aa1ab40a6 100644 --- a/core/fpdfapi/render/cpdf_dibsource.cpp +++ b/core/fpdfapi/render/cpdf_dibbase.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/render/cpdf_dibsource.h" +#include "core/fpdfapi/render/cpdf_dibbase.h" #include <algorithm> #include <memory> @@ -101,9 +101,9 @@ class JpxBitMapContext { } // namespace -CPDF_DIBSource::CPDF_DIBSource() {} +CPDF_DIBBase::CPDF_DIBBase() {} -CPDF_DIBSource::~CPDF_DIBSource() { +CPDF_DIBBase::~CPDF_DIBBase() { if (m_pColorSpace && m_pDocument) { auto* pPageData = m_pDocument->GetPageData(); if (pPageData) { @@ -113,7 +113,7 @@ CPDF_DIBSource::~CPDF_DIBSource() { } } -bool CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream) { +bool CPDF_DIBBase::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream) { if (!pStream) return false; @@ -181,7 +181,7 @@ bool CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream) { return true; } -bool CPDF_DIBSource::ContinueToLoadMask() { +bool CPDF_DIBBase::ContinueToLoadMask() { if (m_bImageMask) { m_bpp = 1; m_bpc = 1; @@ -218,7 +218,7 @@ bool CPDF_DIBSource::ContinueToLoadMask() { return true; } -CPDF_DIBSource::LoadState CPDF_DIBSource::StartLoadDIBSource( +CPDF_DIBBase::LoadState CPDF_DIBBase::StartLoadDIBBase( CPDF_Document* pDoc, const CPDF_Stream* pStream, bool bHasMask, @@ -280,7 +280,7 @@ CPDF_DIBSource::LoadState CPDF_DIBSource::StartLoadDIBSource( return LoadState::kSuccess; } -CPDF_DIBSource::LoadState CPDF_DIBSource::ContinueLoadDIBSource( +CPDF_DIBBase::LoadState CPDF_DIBBase::ContinueLoadDIBBase( PauseIndicatorIface* pPause) { if (m_Status == LoadState::kContinue) return ContinueLoadMaskDIB(pPause); @@ -335,8 +335,8 @@ CPDF_DIBSource::LoadState CPDF_DIBSource::ContinueLoadDIBSource( return iContinueStatus; } -bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, - const CPDF_Dictionary* pPageResources) { +bool CPDF_DIBBase::LoadColorInfo(const CPDF_Dictionary* pFormResources, + const CPDF_Dictionary* pPageResources) { m_bpc_orig = m_pDict->GetIntegerFor("BitsPerComponent"); if (m_pDict->GetIntegerFor("ImageMask")) m_bImageMask = true; @@ -392,8 +392,8 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, return GetDecodeAndMaskArray(&m_bDefaultDecode, &m_bColorKey); } -bool CPDF_DIBSource::GetDecodeAndMaskArray(bool* bDefaultDecode, - bool* bColorKey) { +bool CPDF_DIBBase::GetDecodeAndMaskArray(bool* bDefaultDecode, + bool* bColorKey) { if (!m_pColorSpace) return false; @@ -446,7 +446,7 @@ bool CPDF_DIBSource::GetDecodeAndMaskArray(bool* bDefaultDecode, return true; } -CPDF_DIBSource::LoadState CPDF_DIBSource::CreateDecoder() { +CPDF_DIBBase::LoadState CPDF_DIBBase::CreateDecoder() { ByteString decoder = m_pStreamAcc->GetImageDecoder(); if (decoder.IsEmpty()) return LoadState::kSuccess; @@ -503,9 +503,9 @@ CPDF_DIBSource::LoadState CPDF_DIBSource::CreateDecoder() { return LoadState::kSuccess; } -bool CPDF_DIBSource::CreateDCTDecoder(const uint8_t* src_data, - uint32_t src_size, - const CPDF_Dictionary* pParams) { +bool CPDF_DIBBase::CreateDCTDecoder(const uint8_t* src_data, + uint32_t src_size, + const CPDF_Dictionary* pParams) { CCodec_JpegModule* pJpegModule = CPDF_ModuleMgr::Get()->GetJpegModule(); m_pDecoder = pJpegModule->CreateDecoder( src_data, src_size, m_Width, m_Height, m_nComponents, @@ -574,7 +574,7 @@ bool CPDF_DIBSource::CreateDCTDecoder(const uint8_t* src_data, return true; } -RetainPtr<CFX_DIBitmap> CPDF_DIBSource::LoadJpxBitmap() { +RetainPtr<CFX_DIBitmap> CPDF_DIBBase::LoadJpxBitmap() { CCodec_JpxModule* pJpxModule = CPDF_ModuleMgr::Get()->GetJpxModule(); auto context = pdfium::MakeUnique<JpxBitMapContext>(pJpxModule); context->set_decoder(pJpxModule->CreateDecoder( @@ -651,7 +651,7 @@ RetainPtr<CFX_DIBitmap> CPDF_DIBSource::LoadJpxBitmap() { return pCachedBitmap; } -CPDF_DIBSource::LoadState CPDF_DIBSource::StartLoadMask() { +CPDF_DIBBase::LoadState CPDF_DIBBase::StartLoadMask() { m_MatteColor = 0XFFFFFFFF; m_pMaskStream = m_pDict->GetStreamFor("SMask"); if (!m_pMaskStream) { @@ -676,12 +676,12 @@ CPDF_DIBSource::LoadState CPDF_DIBSource::StartLoadMask() { return StartLoadMaskDIB(); } -CPDF_DIBSource::LoadState CPDF_DIBSource::ContinueLoadMaskDIB( +CPDF_DIBBase::LoadState CPDF_DIBBase::ContinueLoadMaskDIB( PauseIndicatorIface* pPause) { if (!m_pMask) return LoadState::kSuccess; - LoadState ret = m_pMask->ContinueLoadDIBSource(pPause); + LoadState ret = m_pMask->ContinueLoadDIBBase(pPause); if (ret == LoadState::kContinue) return LoadState::kContinue; @@ -695,19 +695,19 @@ CPDF_DIBSource::LoadState CPDF_DIBSource::ContinueLoadMaskDIB( return LoadState::kSuccess; } -RetainPtr<CPDF_DIBSource> CPDF_DIBSource::DetachMask() { +RetainPtr<CPDF_DIBBase> CPDF_DIBBase::DetachMask() { return std::move(m_pMask); } -bool CPDF_DIBSource::IsJBigImage() const { +bool CPDF_DIBBase::IsJBigImage() const { return m_pStreamAcc->GetImageDecoder() == "JBIG2Decode"; } -CPDF_DIBSource::LoadState CPDF_DIBSource::StartLoadMaskDIB() { - m_pMask = pdfium::MakeRetain<CPDF_DIBSource>(); +CPDF_DIBBase::LoadState CPDF_DIBBase::StartLoadMaskDIB() { + m_pMask = pdfium::MakeRetain<CPDF_DIBBase>(); LoadState ret = - m_pMask->StartLoadDIBSource(m_pDocument.Get(), m_pMaskStream.Get(), false, - nullptr, nullptr, true, 0, false); + m_pMask->StartLoadDIBBase(m_pDocument.Get(), m_pMaskStream.Get(), false, + nullptr, nullptr, true, 0, false); if (ret == LoadState::kContinue) { if (m_Status == LoadState::kFail) m_Status = LoadState::kContinue; @@ -718,7 +718,7 @@ CPDF_DIBSource::LoadState CPDF_DIBSource::StartLoadMaskDIB() { return LoadState::kSuccess; } -void CPDF_DIBSource::LoadPalette() { +void CPDF_DIBBase::LoadPalette() { if (!m_pColorSpace || m_Family == PDFCS_PATTERN) return; @@ -791,7 +791,7 @@ void CPDF_DIBSource::LoadPalette() { } } -void CPDF_DIBSource::ValidateDictParam() { +void CPDF_DIBBase::ValidateDictParam() { m_bpc = m_bpc_orig; const CPDF_Object* pFilter = m_pDict->GetDirectObjectFor("Filter"); if (pFilter) { @@ -824,8 +824,8 @@ void CPDF_DIBSource::ValidateDictParam() { m_bpc = 0; } -void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan, - const uint8_t* src_scan) const { +void CPDF_DIBBase::TranslateScanline24bpp(uint8_t* dest_scan, + const uint8_t* src_scan) const { if (m_bpc == 0) return; @@ -873,7 +873,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan, } } -bool CPDF_DIBSource::TranslateScanline24bppDefaultDecode( +bool CPDF_DIBBase::TranslateScanline24bppDefaultDecode( uint8_t* dest_scan, const uint8_t* src_scan) const { if (!m_bDefaultDecode) @@ -935,11 +935,11 @@ bool CPDF_DIBSource::TranslateScanline24bppDefaultDecode( return true; } -uint8_t* CPDF_DIBSource::GetBuffer() const { +uint8_t* CPDF_DIBBase::GetBuffer() const { return m_pCachedBitmap ? m_pCachedBitmap->GetBuffer() : nullptr; } -const uint8_t* CPDF_DIBSource::GetScanline(int line) const { +const uint8_t* CPDF_DIBBase::GetScanline(int line) const { if (m_bpc == 0) return nullptr; @@ -1058,18 +1058,17 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const { return m_pMaskedLine.get(); } -bool CPDF_DIBSource::SkipToScanline(int line, - PauseIndicatorIface* pPause) const { +bool CPDF_DIBBase::SkipToScanline(int line, PauseIndicatorIface* pPause) const { return m_pDecoder && m_pDecoder->SkipToScanline(line, pPause); } -void CPDF_DIBSource::DownSampleScanline(int line, - uint8_t* dest_scan, - int dest_bpp, - int dest_width, - bool bFlipX, - int clip_left, - int clip_width) const { +void CPDF_DIBBase::DownSampleScanline(int line, + uint8_t* dest_scan, + int dest_bpp, + int dest_width, + bool bFlipX, + int clip_left, + int clip_width) const { if (line < 0 || !dest_scan || dest_bpp <= 0 || dest_width <= 0 || clip_left < 0 || clip_width <= 0) { return; @@ -1122,15 +1121,15 @@ void CPDF_DIBSource::DownSampleScanline(int line, } } -void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp, - int dest_Bpp, - uint32_t src_width, - const uint8_t* pSrcLine, - uint8_t* dest_scan, - int dest_width, - bool bFlipX, - int clip_left, - int clip_width) const { +void CPDF_DIBBase::DownSampleScanline1Bit(int orig_Bpp, + int dest_Bpp, + uint32_t src_width, + const uint8_t* pSrcLine, + uint8_t* dest_scan, + int dest_width, + bool bFlipX, + int clip_left, + int clip_width) const { if (m_bColorKey && !m_bImageMask) { uint32_t reset_argb = m_pPalette ? m_pPalette.get()[0] : 0xFF000000; uint32_t set_argb = m_pPalette ? m_pPalette.get()[1] : 0xFFFFFFFF; @@ -1181,15 +1180,15 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp, } } -void CPDF_DIBSource::DownSampleScanline8Bit(int orig_Bpp, - int dest_Bpp, - uint32_t src_width, - const uint8_t* pSrcLine, - uint8_t* dest_scan, - int dest_width, - bool bFlipX, - int clip_left, - int clip_width) const { +void CPDF_DIBBase::DownSampleScanline8Bit(int orig_Bpp, + int dest_Bpp, + uint32_t src_width, + const uint8_t* pSrcLine, + uint8_t* dest_scan, + int dest_width, + bool bFlipX, + int clip_left, + int clip_width) const { if (m_bpc < 8) { uint64_t src_bit_pos = 0; for (uint32_t col = 0; col < src_width; col++) { @@ -1246,15 +1245,15 @@ void CPDF_DIBSource::DownSampleScanline8Bit(int orig_Bpp, } } -void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, - int dest_Bpp, - uint32_t src_width, - const uint8_t* pSrcLine, - uint8_t* dest_scan, - int dest_width, - bool bFlipX, - int clip_left, - int clip_width) const { +void CPDF_DIBBase::DownSampleScanline32Bit(int orig_Bpp, + int dest_Bpp, + uint32_t src_width, + const uint8_t* pSrcLine, + uint8_t* dest_scan, + int dest_width, + bool bFlipX, + int clip_left, + int clip_width) const { // last_src_x used to store the last seen src_x position which should be // in [0, src_width). Set the initial value to be an invalid src_x value. uint32_t last_src_x = src_width; @@ -1344,7 +1343,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, } } -bool CPDF_DIBSource::TransMask() const { +bool CPDF_DIBBase::TransMask() const { return m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && m_Family == PDFCS_DEVICECMYK; } diff --git a/core/fpdfapi/render/cpdf_dibsource.h b/core/fpdfapi/render/cpdf_dibbase.h index 597390cd18..a1008470b6 100644 --- a/core/fpdfapi/render/cpdf_dibsource.h +++ b/core/fpdfapi/render/cpdf_dibbase.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef CORE_FPDFAPI_RENDER_CPDF_DIBSOURCE_H_ -#define CORE_FPDFAPI_RENDER_CPDF_DIBSOURCE_H_ +#ifndef CORE_FPDFAPI_RENDER_CPDF_DIBBASE_H_ +#define CORE_FPDFAPI_RENDER_CPDF_DIBBASE_H_ #include <map> #include <memory> @@ -21,7 +21,7 @@ #include "core/fxcrt/retain_ptr.h" #include "core/fxcrt/unowned_ptr.h" #include "core/fxge/cfx_defaultrenderdevice.h" -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" class CCodec_Jbig2Context; class CCodec_ScanlineDecoder; @@ -39,7 +39,7 @@ struct DIB_COMP_DATA { #define FPDF_HUGE_IMAGE_SIZE 60000000 -class CPDF_DIBSource : public CFX_DIBSource { +class CPDF_DIBBase : public CFX_DIBBase { public: enum class LoadState : uint8_t { kFail, kSuccess, kContinue }; @@ -48,7 +48,7 @@ class CPDF_DIBSource : public CFX_DIBSource { bool Load(CPDF_Document* pDoc, const CPDF_Stream* pStream); - // CFX_DIBSource + // CFX_DIBBase bool SkipToScanline(int line, PauseIndicatorIface* pPause) const override; uint8_t* GetBuffer() const override; const uint8_t* GetScanline(int line) const override; @@ -63,22 +63,22 @@ class CPDF_DIBSource : public CFX_DIBSource { const CPDF_ColorSpace* GetColorSpace() const { return m_pColorSpace.Get(); } uint32_t GetMatteColor() const { return m_MatteColor; } - LoadState StartLoadDIBSource(CPDF_Document* pDoc, - const CPDF_Stream* pStream, - bool bHasMask, - const CPDF_Dictionary* pFormResources, - CPDF_Dictionary* pPageResources, - bool bStdCS, - uint32_t GroupFamily, - bool bLoadMask); - LoadState ContinueLoadDIBSource(PauseIndicatorIface* pPause); - RetainPtr<CPDF_DIBSource> DetachMask(); + LoadState StartLoadDIBBase(CPDF_Document* pDoc, + const CPDF_Stream* pStream, + bool bHasMask, + const CPDF_Dictionary* pFormResources, + CPDF_Dictionary* pPageResources, + bool bStdCS, + uint32_t GroupFamily, + bool bLoadMask); + LoadState ContinueLoadDIBBase(PauseIndicatorIface* pPause); + RetainPtr<CPDF_DIBBase> DetachMask(); bool IsJBigImage() const; private: - CPDF_DIBSource(); - ~CPDF_DIBSource() override; + CPDF_DIBBase(); + ~CPDF_DIBBase() override; LoadState StartLoadMask(); LoadState StartLoadMaskDIB(); @@ -149,7 +149,7 @@ class CPDF_DIBSource : public CFX_DIBSource { std::unique_ptr<uint8_t, FxFreeDeleter> m_pLineBuf; std::unique_ptr<uint8_t, FxFreeDeleter> m_pMaskedLine; RetainPtr<CFX_DIBitmap> m_pCachedBitmap; - RetainPtr<CPDF_DIBSource> m_pMask; + RetainPtr<CPDF_DIBBase> m_pMask; RetainPtr<CPDF_StreamAcc> m_pGlobalStream; std::unique_ptr<CCodec_ScanlineDecoder> m_pDecoder; @@ -160,4 +160,4 @@ class CPDF_DIBSource : public CFX_DIBSource { LoadState m_Status = LoadState::kFail; }; -#endif // CORE_FPDFAPI_RENDER_CPDF_DIBSOURCE_H_ +#endif // CORE_FPDFAPI_RENDER_CPDF_DIBBASE_H_ diff --git a/core/fpdfapi/render/cpdf_docrenderdata.cpp b/core/fpdfapi/render/cpdf_docrenderdata.cpp index 568bf76e97..c86eb9b147 100644 --- a/core/fpdfapi/render/cpdf_docrenderdata.cpp +++ b/core/fpdfapi/render/cpdf_docrenderdata.cpp @@ -12,7 +12,7 @@ #include "core/fpdfapi/page/cpdf_function.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_document.h" -#include "core/fpdfapi/render/cpdf_dibsource.h" +#include "core/fpdfapi/render/cpdf_dibbase.h" #include "core/fpdfapi/render/cpdf_transferfunc.h" #include "core/fpdfapi/render/cpdf_type3cache.h" diff --git a/core/fpdfapi/render/cpdf_imagecacheentry.cpp b/core/fpdfapi/render/cpdf_imagecacheentry.cpp index 615a44d869..681c39e624 100644 --- a/core/fpdfapi/render/cpdf_imagecacheentry.cpp +++ b/core/fpdfapi/render/cpdf_imagecacheentry.cpp @@ -13,7 +13,7 @@ #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_document.h" #include "core/fpdfapi/parser/cpdf_stream.h" -#include "core/fpdfapi/render/cpdf_dibsource.h" +#include "core/fpdfapi/render/cpdf_dibbase.h" #include "core/fpdfapi/render/cpdf_pagerendercache.h" #include "core/fpdfapi/render/cpdf_rendercontext.h" #include "core/fpdfapi/render/cpdf_renderstatus.h" @@ -37,22 +37,22 @@ void CPDF_ImageCacheEntry::Reset(const RetainPtr<CFX_DIBitmap>& pBitmap) { } static uint32_t FPDF_ImageCache_EstimateImageSize( - const RetainPtr<CFX_DIBSource>& pDIB) { + const RetainPtr<CFX_DIBBase>& pDIB) { return pDIB && pDIB->GetBuffer() ? (uint32_t)pDIB->GetHeight() * pDIB->GetPitch() + (uint32_t)pDIB->GetPaletteSize() * 4 : 0; } -RetainPtr<CFX_DIBSource> CPDF_ImageCacheEntry::DetachBitmap() { +RetainPtr<CFX_DIBBase> CPDF_ImageCacheEntry::DetachBitmap() { return std::move(m_pCurBitmap); } -RetainPtr<CFX_DIBSource> CPDF_ImageCacheEntry::DetachMask() { +RetainPtr<CFX_DIBBase> CPDF_ImageCacheEntry::DetachMask() { return std::move(m_pCurMask); } -CPDF_DIBSource::LoadState CPDF_ImageCacheEntry::StartGetCachedBitmap( +CPDF_DIBBase::LoadState CPDF_ImageCacheEntry::StartGetCachedBitmap( const CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, bool bStdCS, @@ -64,32 +64,32 @@ CPDF_DIBSource::LoadState CPDF_ImageCacheEntry::StartGetCachedBitmap( if (m_pCachedBitmap) { m_pCurBitmap = m_pCachedBitmap; m_pCurMask = m_pCachedMask; - return CPDF_DIBSource::LoadState::kSuccess; + return CPDF_DIBBase::LoadState::kSuccess; } - m_pCurBitmap = pdfium::MakeRetain<CPDF_DIBSource>(); - CPDF_DIBSource::LoadState ret = - m_pCurBitmap.As<CPDF_DIBSource>()->StartLoadDIBSource( + m_pCurBitmap = pdfium::MakeRetain<CPDF_DIBBase>(); + CPDF_DIBBase::LoadState ret = + m_pCurBitmap.As<CPDF_DIBBase>()->StartLoadDIBBase( m_pDocument.Get(), m_pImage->GetStream(), true, pFormResources, pPageResources, bStdCS, GroupFamily, bLoadMask); - if (ret == CPDF_DIBSource::LoadState::kContinue) - return CPDF_DIBSource::LoadState::kContinue; + if (ret == CPDF_DIBBase::LoadState::kContinue) + return CPDF_DIBBase::LoadState::kContinue; - if (ret == CPDF_DIBSource::LoadState::kSuccess) + if (ret == CPDF_DIBBase::LoadState::kSuccess) ContinueGetCachedBitmap(pRenderStatus); else m_pCurBitmap.Reset(); - return CPDF_DIBSource::LoadState::kFail; + return CPDF_DIBBase::LoadState::kFail; } bool CPDF_ImageCacheEntry::Continue(PauseIndicatorIface* pPause, CPDF_RenderStatus* pRenderStatus) { - CPDF_DIBSource::LoadState ret = - m_pCurBitmap.As<CPDF_DIBSource>()->ContinueLoadDIBSource(pPause); - if (ret == CPDF_DIBSource::LoadState::kContinue) + CPDF_DIBBase::LoadState ret = + m_pCurBitmap.As<CPDF_DIBBase>()->ContinueLoadDIBBase(pPause); + if (ret == CPDF_DIBBase::LoadState::kContinue) return true; - if (ret == CPDF_DIBSource::LoadState::kSuccess) + if (ret == CPDF_DIBBase::LoadState::kSuccess) ContinueGetCachedBitmap(pRenderStatus); else m_pCurBitmap.Reset(); @@ -98,8 +98,8 @@ bool CPDF_ImageCacheEntry::Continue(PauseIndicatorIface* pPause, void CPDF_ImageCacheEntry::ContinueGetCachedBitmap( CPDF_RenderStatus* pRenderStatus) { - m_MatteColor = m_pCurBitmap.As<CPDF_DIBSource>()->GetMatteColor(); - m_pCurMask = m_pCurBitmap.As<CPDF_DIBSource>()->DetachMask(); + m_MatteColor = m_pCurBitmap.As<CPDF_DIBBase>()->GetMatteColor(); + m_pCurMask = m_pCurBitmap.As<CPDF_DIBBase>()->DetachMask(); CPDF_RenderContext* pContext = pRenderStatus->GetContext(); CPDF_PageRenderCache* pPageRenderCache = pContext->GetPageCache(); m_dwTimeCount = pPageRenderCache->GetTimeCount(); diff --git a/core/fpdfapi/render/cpdf_imagecacheentry.h b/core/fpdfapi/render/cpdf_imagecacheentry.h index df13c4b3f8..8a4f919e8d 100644 --- a/core/fpdfapi/render/cpdf_imagecacheentry.h +++ b/core/fpdfapi/render/cpdf_imagecacheentry.h @@ -9,7 +9,7 @@ #include <memory> -#include "core/fpdfapi/render/cpdf_dibsource.h" +#include "core/fpdfapi/render/cpdf_dibbase.h" #include "core/fxcrt/fx_system.h" #include "core/fxcrt/retain_ptr.h" #include "core/fxcrt/unowned_ptr.h" @@ -32,7 +32,7 @@ class CPDF_ImageCacheEntry { uint32_t GetTimeCount() const { return m_dwTimeCount; } CPDF_Image* GetImage() const { return m_pImage.Get(); } - CPDF_DIBSource::LoadState StartGetCachedBitmap( + CPDF_DIBBase::LoadState StartGetCachedBitmap( const CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, bool bStdCS, @@ -43,8 +43,8 @@ class CPDF_ImageCacheEntry { // Returns whether to Continue() or not. bool Continue(PauseIndicatorIface* pPause, CPDF_RenderStatus* pRenderStatus); - RetainPtr<CFX_DIBSource> DetachBitmap(); - RetainPtr<CFX_DIBSource> DetachMask(); + RetainPtr<CFX_DIBBase> DetachBitmap(); + RetainPtr<CFX_DIBBase> DetachMask(); int m_dwTimeCount; uint32_t m_MatteColor; @@ -55,10 +55,10 @@ class CPDF_ImageCacheEntry { UnownedPtr<CPDF_Document> const m_pDocument; RetainPtr<CPDF_Image> const m_pImage; - RetainPtr<CFX_DIBSource> m_pCurBitmap; - RetainPtr<CFX_DIBSource> m_pCurMask; - RetainPtr<CFX_DIBSource> m_pCachedBitmap; - RetainPtr<CFX_DIBSource> m_pCachedMask; + RetainPtr<CFX_DIBBase> m_pCurBitmap; + RetainPtr<CFX_DIBBase> m_pCurMask; + RetainPtr<CFX_DIBBase> m_pCachedBitmap; + RetainPtr<CFX_DIBBase> m_pCachedMask; uint32_t m_dwCacheSize; }; diff --git a/core/fpdfapi/render/cpdf_imageloader.cpp b/core/fpdfapi/render/cpdf_imageloader.cpp index f3a626350b..157bc48d1b 100644 --- a/core/fpdfapi/render/cpdf_imageloader.cpp +++ b/core/fpdfapi/render/cpdf_imageloader.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/page/cpdf_image.h" #include "core/fpdfapi/page/cpdf_imageobject.h" -#include "core/fpdfapi/render/cpdf_dibsource.h" +#include "core/fpdfapi/render/cpdf_dibbase.h" #include "core/fpdfapi/render/cpdf_imagecacheentry.h" #include "core/fpdfapi/render/cpdf_pagerendercache.h" #include "core/fpdfapi/render/cpdf_renderstatus.h" @@ -34,7 +34,7 @@ bool CPDF_ImageLoader::Start(CPDF_ImageObject* pImage, ret = pCache->StartGetCachedBitmap(m_pImageObject->GetImage(), bStdCS, GroupFamily, bLoadMask, pRenderStatus); } else { - ret = m_pImageObject->GetImage()->StartLoadDIBSource( + ret = m_pImageObject->GetImage()->StartLoadDIBBase( pRenderStatus->GetFormResource(), pRenderStatus->GetPageResource(), bStdCS, GroupFamily, bLoadMask); } diff --git a/core/fpdfapi/render/cpdf_imageloader.h b/core/fpdfapi/render/cpdf_imageloader.h index 629609df48..de29d0e2a9 100644 --- a/core/fpdfapi/render/cpdf_imageloader.h +++ b/core/fpdfapi/render/cpdf_imageloader.h @@ -31,8 +31,8 @@ class CPDF_ImageLoader { CPDF_RenderStatus* pRenderStatus); bool Continue(PauseIndicatorIface* pPause, CPDF_RenderStatus* pRenderStatus); - RetainPtr<CFX_DIBSource> m_pBitmap; - RetainPtr<CFX_DIBSource> m_pMask; + RetainPtr<CFX_DIBBase> m_pBitmap; + RetainPtr<CFX_DIBBase> m_pMask; uint32_t m_MatteColor; bool m_bCached; diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp index 9f14e8470c..33aca42ee1 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.cpp +++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp @@ -19,7 +19,7 @@ #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_document.h" -#include "core/fpdfapi/render/cpdf_dibsource.h" +#include "core/fpdfapi/render/cpdf_dibbase.h" #include "core/fpdfapi/render/cpdf_pagerendercache.h" #include "core/fpdfapi/render/cpdf_rendercontext.h" #include "core/fpdfapi/render/cpdf_renderstatus.h" @@ -29,8 +29,8 @@ #include "core/fxcrt/maybe_owned.h" #include "core/fxge/cfx_defaultrenderdevice.h" #include "core/fxge/cfx_pathdata.h" +#include "core/fxge/dib/cfx_dibbase.h" #include "core/fxge/dib/cfx_dibitmap.h" -#include "core/fxge/dib/cfx_dibsource.h" #include "core/fxge/dib/cfx_imagestretcher.h" #include "core/fxge/dib/cfx_imagetransformer.h" #include "third_party/base/ptr_util.h" @@ -53,7 +53,7 @@ CPDF_ImageRenderer::CPDF_ImageRenderer() CPDF_ImageRenderer::~CPDF_ImageRenderer() {} -bool CPDF_ImageRenderer::StartLoadDIBSource() { +bool CPDF_ImageRenderer::StartLoadDIBBase() { CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect(); FX_RECT image_rect = image_rect_f.GetOuterRect(); if (!image_rect.Valid()) @@ -69,13 +69,13 @@ bool CPDF_ImageRenderer::StartLoadDIBSource() { return false; } -bool CPDF_ImageRenderer::StartRenderDIBSource() { +bool CPDF_ImageRenderer::StartRenderDIBBase() { if (!m_Loader.m_pBitmap) return false; CPDF_GeneralState& state = m_pImageObject->m_GeneralState; m_BitmapAlpha = FXSYS_round(255 * state.GetFillAlpha()); - m_pDIBSource = m_Loader.m_pBitmap; + m_pDIBBase = m_Loader.m_pBitmap; if (m_pRenderStatus->GetRenderOptions().ColorModeIs( CPDF_RenderOptions::kAlpha) && !m_Loader.m_pMask) { @@ -86,7 +86,7 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() { state.SetTransferFunc(m_pRenderStatus->GetTransferFunc(state.GetTR())); if (state.GetTransferFunc() && !state.GetTransferFunc()->GetIdentity()) { - m_pDIBSource = m_Loader.m_pBitmap = + m_pDIBBase = m_Loader.m_pBitmap = state.GetTransferFunc()->TranslateImage(m_Loader.m_pBitmap); if (m_Loader.m_bCached && m_Loader.m_pMask) m_Loader.m_pMask = m_Loader.m_pMask->Clone(nullptr); @@ -96,7 +96,7 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() { m_FillArgb = 0; m_bPatternColor = false; m_pPattern = nullptr; - if (m_pDIBSource->IsAlphaMask()) { + if (m_pDIBBase->IsAlphaMask()) { const CPDF_Color* pColor = m_pImageObject->m_ColorState.GetFillColor(); if (pColor && pColor->IsPattern()) { m_pPattern = pColor->GetPattern(); @@ -106,12 +106,12 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() { m_FillArgb = m_pRenderStatus->GetFillArgb(m_pImageObject.Get()); } else if (m_pRenderStatus->GetRenderOptions().ColorModeIs( CPDF_RenderOptions::kGray)) { - RetainPtr<CFX_DIBitmap> pClone = m_pDIBSource->Clone(nullptr); + RetainPtr<CFX_DIBitmap> pClone = m_pDIBBase->Clone(nullptr); if (!pClone) return false; pClone->ConvertColorScale(0xffffff, 0); - m_pDIBSource = pClone; + m_pDIBBase = pClone; } m_Flags = 0; if (m_pRenderStatus->GetRenderOptions().HasFlag(RENDER_FORCE_DOWNSAMPLE)) @@ -136,7 +136,7 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() { if (m_BitmapAlpha != 255 || !state.HasRef() || !state.GetFillOP() || state.GetOPMode() != 0 || state.GetBlendType() != FXDIB_BLEND_NORMAL || state.GetStrokeAlpha() != 1.0f || state.GetFillAlpha() != 1.0f) { - return StartDIBSource(); + return StartDIBBase(); } CPDF_Document* pDocument = nullptr; CPDF_Page* pPage = nullptr; @@ -154,14 +154,14 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() { CPDF_ColorSpace* pColorSpace = pDocument->LoadColorSpace(pCSObj, pPageResources); if (!pColorSpace) - return StartDIBSource(); + return StartDIBBase(); int format = pColorSpace->GetFamily(); if (format == PDFCS_DEVICECMYK || format == PDFCS_SEPARATION || format == PDFCS_DEVICEN) { m_BlendType = FXDIB_BLEND_DARKEN; } pDocument->GetPageData()->ReleaseColorSpace(pCSObj); - return StartDIBSource(); + return StartDIBBase(); } bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, @@ -183,13 +183,13 @@ bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, } m_ImageMatrix = m_pImageObject->matrix(); m_ImageMatrix.Concat(*pObj2Device); - if (StartLoadDIBSource()) + if (StartLoadDIBBase()) return true; - return StartRenderDIBSource(); + return StartRenderDIBBase(); } bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, - const RetainPtr<CFX_DIBSource>& pDIBSource, + const RetainPtr<CFX_DIBBase>& pDIBBase, FX_ARGB bitmap_argb, int bitmap_alpha, const CFX_Matrix* pImage2Device, @@ -197,14 +197,14 @@ bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, bool bStdCS, int blendType) { m_pRenderStatus = pStatus; - m_pDIBSource = pDIBSource; + m_pDIBBase = pDIBBase; m_FillArgb = bitmap_argb; m_BitmapAlpha = bitmap_alpha; m_ImageMatrix = *pImage2Device; m_Flags = flags; m_bStdCS = bStdCS; m_BlendType = blendType; - return StartDIBSource(); + return StartDIBBase(); } bool CPDF_ImageRenderer::NotDrawing() const { @@ -228,7 +228,7 @@ CFX_Matrix CPDF_ImageRenderer::GetDrawMatrix(const FX_RECT& rect) const { void CPDF_ImageRenderer::CalculateDrawImage( CFX_DefaultRenderDevice* pBitmapDevice1, CFX_DefaultRenderDevice* pBitmapDevice2, - const RetainPtr<CFX_DIBSource>& pDIBSource, + const RetainPtr<CFX_DIBBase>& pDIBBase, CFX_Matrix* pNewMatrix, const FX_RECT& rect) const { CPDF_RenderStatus bitmap_render(m_pRenderStatus->GetContext(), @@ -238,8 +238,8 @@ void CPDF_ImageRenderer::CalculateDrawImage( bitmap_render.Initialize(nullptr, nullptr); CPDF_ImageRenderer image_render; - if (image_render.Start(&bitmap_render, pDIBSource, 0xffffffff, 255, - pNewMatrix, m_Flags, true, FXDIB_BLEND_NORMAL)) { + if (image_render.Start(&bitmap_render, pDIBBase, 0xffffffff, 255, pNewMatrix, + m_Flags, true, FXDIB_BLEND_NORMAL)) { image_render.Continue(nullptr); } if (m_Loader.m_MatteColor == 0xffffffff) @@ -309,8 +309,8 @@ bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { return true; } bitmap_device2.GetBitmap()->Clear(0); - CalculateDrawImage(&bitmap_device1, &bitmap_device2, m_pDIBSource, - &new_matrix, rect); + CalculateDrawImage(&bitmap_device1, &bitmap_device2, m_pDIBBase, &new_matrix, + rect); bitmap_device2.GetBitmap()->ConvertFormat(FXDIB_8bppMask); bitmap_device1.GetBitmap()->MultiplyAlpha(bitmap_device2.GetBitmap()); bitmap_device1.GetBitmap()->MultiplyAlpha(255); @@ -345,7 +345,7 @@ bool CPDF_ImageRenderer::DrawMaskedImage() { bitmap_render.SetStdCS(true); bitmap_render.Initialize(nullptr, nullptr); CPDF_ImageRenderer image_render; - if (image_render.Start(&bitmap_render, m_pDIBSource, 0, 255, &new_matrix, + if (image_render.Start(&bitmap_render, m_pDIBBase, 0, 255, &new_matrix, m_Flags, true, FXDIB_BLEND_NORMAL)) { image_render.Continue(nullptr); } @@ -376,12 +376,12 @@ bool CPDF_ImageRenderer::DrawMaskedImage() { return false; } -bool CPDF_ImageRenderer::StartDIBSource() { - if (!(m_Flags & RENDER_FORCE_DOWNSAMPLE) && m_pDIBSource->GetBPP() > 1) { - FX_SAFE_SIZE_T image_size = m_pDIBSource->GetBPP(); +bool CPDF_ImageRenderer::StartDIBBase() { + if (!(m_Flags & RENDER_FORCE_DOWNSAMPLE) && m_pDIBBase->GetBPP() > 1) { + FX_SAFE_SIZE_T image_size = m_pDIBBase->GetBPP(); image_size /= 8; - image_size *= m_pDIBSource->GetWidth(); - image_size *= m_pDIBSource->GetHeight(); + image_size *= m_pDIBBase->GetWidth(); + image_size *= m_pDIBBase->GetHeight(); if (!image_size.IsValid()) return false; @@ -391,8 +391,8 @@ bool CPDF_ImageRenderer::StartDIBSource() { } } #ifdef _SKIA_SUPPORT_ - RetainPtr<CFX_DIBitmap> premultiplied = m_pDIBSource->Clone(nullptr); - if (m_pDIBSource->HasAlpha()) + RetainPtr<CFX_DIBitmap> premultiplied = m_pDIBBase->Clone(nullptr); + if (m_pDIBBase->HasAlpha()) CFX_SkiaDeviceDriver::PreMultiply(premultiplied); if (m_pRenderStatus->GetRenderDevice()->StartDIBitsWithBlend( premultiplied, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags, @@ -405,7 +405,7 @@ bool CPDF_ImageRenderer::StartDIBSource() { } #else if (m_pRenderStatus->GetRenderDevice()->StartDIBitsWithBlend( - m_pDIBSource, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags, + m_pDIBBase, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags, &m_DeviceHandle, m_BlendType)) { if (m_DeviceHandle) { m_Status = 3; @@ -429,7 +429,7 @@ bool CPDF_ImageRenderer::StartDIBSource() { clip_box.Intersect(image_rect); m_Status = 2; m_pTransformer = pdfium::MakeUnique<CFX_ImageTransformer>( - m_pDIBSource, &m_ImageMatrix, m_Flags, &clip_box); + m_pDIBBase, &m_ImageMatrix, m_Flags, &clip_box); return true; } if (m_ImageMatrix.a < 0) @@ -440,18 +440,18 @@ bool CPDF_ImageRenderer::StartDIBSource() { int dest_left = dest_width > 0 ? image_rect.left : image_rect.right; int dest_top = dest_height > 0 ? image_rect.top : image_rect.bottom; - if (m_pDIBSource->IsOpaqueImage() && m_BitmapAlpha == 255) { + if (m_pDIBBase->IsOpaqueImage() && m_BitmapAlpha == 255) { if (m_pRenderStatus->GetRenderDevice()->StretchDIBitsWithFlagsAndBlend( - m_pDIBSource, dest_left, dest_top, dest_width, dest_height, m_Flags, + m_pDIBBase, dest_left, dest_top, dest_width, dest_height, m_Flags, m_BlendType)) { return false; } } - if (m_pDIBSource->IsAlphaMask()) { + if (m_pDIBBase->IsAlphaMask()) { if (m_BitmapAlpha != 255) m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha); if (m_pRenderStatus->GetRenderDevice()->StretchBitMaskWithFlags( - m_pDIBSource, dest_left, dest_top, dest_width, dest_height, + m_pDIBBase, dest_left, dest_top, dest_width, dest_height, m_FillArgb, m_Flags)) { return false; } @@ -468,7 +468,7 @@ bool CPDF_ImageRenderer::StartDIBSource() { dest_rect.left - image_rect.left, dest_rect.top - image_rect.top, dest_rect.right - image_rect.left, dest_rect.bottom - image_rect.top); RetainPtr<CFX_DIBitmap> pStretched = - m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip); + m_pDIBBase->StretchTo(dest_width, dest_height, m_Flags, &dest_clip); if (pStretched) { m_pRenderStatus->CompositeDIBitmap(pStretched, dest_rect.left, dest_rect.top, m_FillArgb, m_BitmapAlpha, @@ -478,7 +478,7 @@ bool CPDF_ImageRenderer::StartDIBSource() { } bool CPDF_ImageRenderer::StartBitmapAlpha() { - if (m_pDIBSource->IsOpaqueImage()) { + if (m_pDIBBase->IsOpaqueImage()) { CFX_PathData path; path.AppendRect(0, 0, 1, 1); path.Transform(&m_ImageMatrix); @@ -488,11 +488,11 @@ bool CPDF_ImageRenderer::StartBitmapAlpha() { fill_color, 0, FXFILL_WINDING); return false; } - RetainPtr<CFX_DIBSource> pAlphaMask; - if (m_pDIBSource->IsAlphaMask()) - pAlphaMask = m_pDIBSource; + RetainPtr<CFX_DIBBase> pAlphaMask; + if (m_pDIBBase->IsAlphaMask()) + pAlphaMask = m_pDIBBase; else - pAlphaMask = m_pDIBSource->CloneAlphaMask(); + pAlphaMask = m_pDIBBase->CloneAlphaMask(); if (fabs(m_ImageMatrix.b) >= 0.5f || fabs(m_ImageMatrix.c) >= 0.5f) { int left; @@ -554,7 +554,7 @@ bool CPDF_ImageRenderer::Continue(PauseIndicatorIface* pPause) { if (m_Loader.Continue(pPause, m_pRenderStatus.Get())) return true; - if (StartRenderDIBSource()) + if (StartRenderDIBBase()) return Continue(pPause); } return false; diff --git a/core/fpdfapi/render/cpdf_imagerenderer.h b/core/fpdfapi/render/cpdf_imagerenderer.h index e6c6d0c1b8..c6ccb0c86d 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.h +++ b/core/fpdfapi/render/cpdf_imagerenderer.h @@ -15,7 +15,7 @@ #include "core/fxge/dib/cfx_imagerenderer.h" class CFX_DIBitmap; -class CFX_DIBSource; +class CFX_DIBBase; class CFX_DefaultRenderDevice; class CFX_ImageTransformer; class CPDF_ImageObject; @@ -35,7 +35,7 @@ class CPDF_ImageRenderer { int blendType); bool Start(CPDF_RenderStatus* pStatus, - const RetainPtr<CFX_DIBSource>& pDIBSource, + const RetainPtr<CFX_DIBBase>& pDIBBase, FX_ARGB bitmap_argb, int bitmap_alpha, const CFX_Matrix* pImage2Device, @@ -48,9 +48,9 @@ class CPDF_ImageRenderer { private: bool StartBitmapAlpha(); - bool StartDIBSource(); - bool StartRenderDIBSource(); - bool StartLoadDIBSource(); + bool StartDIBBase(); + bool StartRenderDIBBase(); + bool StartLoadDIBBase(); bool DrawMaskedImage(); bool DrawPatternImage(const CFX_Matrix* pObj2Device); bool NotDrawing() const; @@ -58,7 +58,7 @@ class CPDF_ImageRenderer { CFX_Matrix GetDrawMatrix(const FX_RECT& rect) const; void CalculateDrawImage(CFX_DefaultRenderDevice* bitmap_device1, CFX_DefaultRenderDevice* bitmap_device2, - const RetainPtr<CFX_DIBSource>& pDIBSource, + const RetainPtr<CFX_DIBBase>& pDIBBase, CFX_Matrix* pNewMatrix, const FX_RECT& rect) const; void HandleFilters(); @@ -69,7 +69,7 @@ class CPDF_ImageRenderer { UnownedPtr<const CFX_Matrix> m_pObj2Device; CFX_Matrix m_ImageMatrix; CPDF_ImageLoader m_Loader; - RetainPtr<CFX_DIBSource> m_pDIBSource; + RetainPtr<CFX_DIBBase> m_pDIBBase; int m_BitmapAlpha; bool m_bPatternColor; UnownedPtr<CPDF_Pattern> m_pPattern; diff --git a/core/fpdfapi/render/cpdf_pagerendercache.cpp b/core/fpdfapi/render/cpdf_pagerendercache.cpp index 1358943454..61602d36f0 100644 --- a/core/fpdfapi/render/cpdf_pagerendercache.cpp +++ b/core/fpdfapi/render/cpdf_pagerendercache.cpp @@ -94,17 +94,17 @@ bool CPDF_PageRenderCache::StartGetCachedBitmap( m_pCurImageCacheEntry = new CPDF_ImageCacheEntry(m_pPage->GetDocument(), pImage); } - CPDF_DIBSource::LoadState ret = m_pCurImageCacheEntry->StartGetCachedBitmap( + CPDF_DIBBase::LoadState ret = m_pCurImageCacheEntry->StartGetCachedBitmap( pRenderStatus->GetFormResource(), m_pPage->m_pPageResources.Get(), bStdCS, GroupFamily, bLoadMask, pRenderStatus); - if (ret == CPDF_DIBSource::LoadState::kContinue) + if (ret == CPDF_DIBBase::LoadState::kContinue) return true; m_nTimeCount++; if (!m_bCurFindCache) m_ImageCache[pStream] = m_pCurImageCacheEntry; - if (ret == CPDF_DIBSource::LoadState::kFail) + if (ret == CPDF_DIBBase::LoadState::kFail) m_nCacheSize += m_pCurImageCacheEntry->EstimateSize(); return false; diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 2cbe495ce4..9965cbb945 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -37,7 +37,7 @@ #include "core/fpdfapi/parser/cpdf_document.h" #include "core/fpdfapi/render/cpdf_charposlist.h" #include "core/fpdfapi/render/cpdf_devicebuffer.h" -#include "core/fpdfapi/render/cpdf_dibsource.h" +#include "core/fpdfapi/render/cpdf_dibbase.h" #include "core/fpdfapi/render/cpdf_docrenderdata.h" #include "core/fpdfapi/render/cpdf_imagerenderer.h" #include "core/fpdfapi/render/cpdf_pagerendercache.h" @@ -1582,7 +1582,7 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, if (pSMaskDict) { CFX_Matrix smask_matrix = *pPageObj->m_GeneralState.GetSMaskMatrix(); smask_matrix.Concat(*pObj2Device); - RetainPtr<CFX_DIBSource> pSMaskSource = + RetainPtr<CFX_DIBBase> pSMaskSource = LoadSMask(pSMaskDict, &rect, &smask_matrix); if (pSMaskSource) bitmap->MultiplyAlpha(pSMaskSource); diff --git a/core/fpdfapi/render/cpdf_transferfunc.cpp b/core/fpdfapi/render/cpdf_transferfunc.cpp index 25717437d3..f67f508e8e 100644 --- a/core/fpdfapi/render/cpdf_transferfunc.cpp +++ b/core/fpdfapi/render/cpdf_transferfunc.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/parser/cpdf_document.h" #include "core/fpdfapi/render/cpdf_dibtransferfunc.h" -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" CPDF_TransferFunc::CPDF_TransferFunc(CPDF_Document* pDoc) : m_pPDFDoc(pDoc) {} @@ -20,8 +20,8 @@ FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF colorref) const { m_Samples[FXSYS_GetRValue(colorref)]); } -RetainPtr<CFX_DIBSource> CPDF_TransferFunc::TranslateImage( - const RetainPtr<CFX_DIBSource>& pSrc) { +RetainPtr<CFX_DIBBase> CPDF_TransferFunc::TranslateImage( + const RetainPtr<CFX_DIBBase>& pSrc) { RetainPtr<CPDF_TransferFunc> pHolder(this); auto pDest = pdfium::MakeRetain<CPDF_DIBTransferFunc>(pHolder); pDest->LoadSrc(pSrc); diff --git a/core/fpdfapi/render/cpdf_transferfunc.h b/core/fpdfapi/render/cpdf_transferfunc.h index dfc186ec6c..e8964727c6 100644 --- a/core/fpdfapi/render/cpdf_transferfunc.h +++ b/core/fpdfapi/render/cpdf_transferfunc.h @@ -12,7 +12,7 @@ #include "core/fxge/fx_dib.h" class CPDF_Document; -class CFX_DIBSource; +class CFX_DIBBase; class CPDF_TransferFunc : public Retainable { public: @@ -20,7 +20,7 @@ class CPDF_TransferFunc : public Retainable { friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); FX_COLORREF TranslateColor(FX_COLORREF colorref) const; - RetainPtr<CFX_DIBSource> TranslateImage(const RetainPtr<CFX_DIBSource>& pSrc); + RetainPtr<CFX_DIBBase> TranslateImage(const RetainPtr<CFX_DIBBase>& pSrc); const CPDF_Document* GetDocument() const { return m_pPDFDoc.Get(); } diff --git a/core/fxcodec/codec/ccodec_jpegmodule.h b/core/fxcodec/codec/ccodec_jpegmodule.h index 06cd2242c2..d990ee938f 100644 --- a/core/fxcodec/codec/ccodec_jpegmodule.h +++ b/core/fxcodec/codec/ccodec_jpegmodule.h @@ -14,7 +14,7 @@ #include "core/fxcrt/retain_ptr.h" class CCodec_ScanlineDecoder; -class CFX_DIBSource; +class CFX_DIBBase; #ifdef PDF_ENABLE_XFA class CFX_DIBAttribute; @@ -58,7 +58,7 @@ class CCodec_JpegModule { uint32_t GetAvailInput(Context* pContext, uint8_t** avail_buf_ptr); #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ - static bool JpegEncode(const RetainPtr<CFX_DIBSource>& pSource, + static bool JpegEncode(const RetainPtr<CFX_DIBBase>& pSource, uint8_t** dest_buf, size_t* dest_size); #endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp index f0b8d66d3a..4c37465386 100644 --- a/core/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/fxcodec/codec/fx_codec_jpeg.cpp @@ -13,7 +13,7 @@ #include "core/fxcodec/codec/ccodec_scanlinedecoder.h" #include "core/fxcodec/fx_codec.h" #include "core/fxcrt/fx_safe_types.h" -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" #include "core/fxge/fx_dib.h" #include "third_party/base/logging.h" #include "third_party/base/ptr_util.h" @@ -493,7 +493,7 @@ uint32_t CCodec_JpegModule::GetAvailInput(Context* pContext, #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ #define JPEG_BLOCK_SIZE 1048576 -bool CCodec_JpegModule::JpegEncode(const RetainPtr<CFX_DIBSource>& pSource, +bool CCodec_JpegModule::JpegEncode(const RetainPtr<CFX_DIBBase>& pSource, uint8_t** dest_buf, size_t* dest_size) { struct jpeg_error_mgr jerr; diff --git a/core/fxcodec/fx_codec.h b/core/fxcodec/fx_codec.h index 1eaf846fd7..0a0c08afc3 100644 --- a/core/fxcodec/fx_codec.h +++ b/core/fxcodec/fx_codec.h @@ -43,7 +43,7 @@ class CCodec_IccModule; class CCodec_Jbig2Module; class CCodec_JpegModule; class CCodec_JpxModule; -class CFX_DIBSource; +class CFX_DIBBase; class CJPX_Decoder; class CPDF_ColorSpace; class CPDF_StreamAcc; diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 9166fbb0c8..063f36d600 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -144,7 +144,7 @@ void RgbByteOrderTransferBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap, int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { if (!pBitmap) @@ -1491,7 +1491,7 @@ RetainPtr<CFX_DIBitmap> CFX_AggDeviceDriver::GetBackDrop() { return m_pBackdropBitmap; } -bool CFX_AggDeviceDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, +bool CFX_AggDeviceDriver::SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t argb, const FX_RECT* pSrcRect, int left, @@ -1511,7 +1511,7 @@ bool CFX_AggDeviceDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, pSrcRect->top, blend_type, m_pClipRgn.get(), m_bRgbByteOrder); } -bool CFX_AggDeviceDriver::StretchDIBits(const RetainPtr<CFX_DIBSource>& pSource, +bool CFX_AggDeviceDriver::StretchDIBits(const RetainPtr<CFX_DIBBase>& pSource, uint32_t argb, int dest_left, int dest_top, @@ -1545,7 +1545,7 @@ bool CFX_AggDeviceDriver::StretchDIBits(const RetainPtr<CFX_DIBSource>& pSource, } bool CFX_AggDeviceDriver::StartDIBits( - const RetainPtr<CFX_DIBSource>& pSource, + const RetainPtr<CFX_DIBBase>& pSource, int bitmap_alpha, uint32_t argb, const CFX_Matrix* pMatrix, diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h index b59cec004c..167b211746 100644 --- a/core/fxge/agg/fx_agg_driver.h +++ b/core/fxge/agg/fx_agg_driver.h @@ -67,13 +67,13 @@ class CFX_AggDeviceDriver : public RenderDeviceDriverIface { int left, int top) override; RetainPtr<CFX_DIBitmap> GetBackDrop() override; - bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -82,7 +82,7 @@ class CFX_AggDeviceDriver : public RenderDeviceDriverIface { const FX_RECT* pClipRect, uint32_t flags, int blend_type) override; - bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, diff --git a/core/fxge/cfx_defaultrenderdevice.h b/core/fxge/cfx_defaultrenderdevice.h index 6510e41f6f..07e3cc57c9 100644 --- a/core/fxge/cfx_defaultrenderdevice.h +++ b/core/fxge/cfx_defaultrenderdevice.h @@ -31,8 +31,8 @@ class CFX_DefaultRenderDevice : public CFX_RenderDevice { void Clear(uint32_t color); SkPictureRecorder* CreateRecorder(int size_x, int size_y); void DebugVerifyBitmapIsPreMultiplied() const override; - bool SetBitsWithMask(const RetainPtr<CFX_DIBSource>& pBitmap, - const RetainPtr<CFX_DIBSource>& pMask, + bool SetBitsWithMask(const RetainPtr<CFX_DIBBase>& pBitmap, + const RetainPtr<CFX_DIBBase>& pMask, int left, int top, int bitmap_alpha, diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp index 16d723721f..ab57391401 100644 --- a/core/fxge/cfx_renderdevice.cpp +++ b/core/fxge/cfx_renderdevice.cpp @@ -722,11 +722,10 @@ RetainPtr<CFX_DIBitmap> CFX_RenderDevice::GetBackDrop() { return m_pDeviceDriver->GetBackDrop(); } -bool CFX_RenderDevice::SetDIBitsWithBlend( - const RetainPtr<CFX_DIBSource>& pBitmap, - int left, - int top, - int blend_mode) { +bool CFX_RenderDevice::SetDIBitsWithBlend(const RetainPtr<CFX_DIBBase>& pBitmap, + int left, + int top, + int blend_mode) { ASSERT(!pBitmap->IsAlphaMask()); FX_RECT dest_rect(left, top, left + pBitmap->GetWidth(), top + pBitmap->GetHeight()); @@ -767,7 +766,7 @@ bool CFX_RenderDevice::SetDIBitsWithBlend( } bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend( - const RetainPtr<CFX_DIBSource>& pBitmap, + const RetainPtr<CFX_DIBBase>& pBitmap, int left, int top, int dest_width, @@ -782,7 +781,7 @@ bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend( dest_height, &clip_box, flags, blend_mode); } -bool CFX_RenderDevice::SetBitMask(const RetainPtr<CFX_DIBSource>& pBitmap, +bool CFX_RenderDevice::SetBitMask(const RetainPtr<CFX_DIBBase>& pBitmap, int left, int top, uint32_t argb) { @@ -791,7 +790,7 @@ bool CFX_RenderDevice::SetBitMask(const RetainPtr<CFX_DIBSource>& pBitmap, FXDIB_BLEND_NORMAL); } -bool CFX_RenderDevice::StretchBitMask(const RetainPtr<CFX_DIBSource>& pBitmap, +bool CFX_RenderDevice::StretchBitMask(const RetainPtr<CFX_DIBBase>& pBitmap, int left, int top, int dest_width, @@ -802,7 +801,7 @@ bool CFX_RenderDevice::StretchBitMask(const RetainPtr<CFX_DIBSource>& pBitmap, } bool CFX_RenderDevice::StretchBitMaskWithFlags( - const RetainPtr<CFX_DIBSource>& pBitmap, + const RetainPtr<CFX_DIBBase>& pBitmap, int left, int top, int dest_width, @@ -818,7 +817,7 @@ bool CFX_RenderDevice::StretchBitMaskWithFlags( } bool CFX_RenderDevice::StartDIBitsWithBlend( - const RetainPtr<CFX_DIBSource>& pBitmap, + const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t argb, const CFX_Matrix* pMatrix, @@ -839,8 +838,8 @@ void CFX_RenderDevice::DebugVerifyBitmapIsPreMultiplied() const { SkASSERT(0); } -bool CFX_RenderDevice::SetBitsWithMask(const RetainPtr<CFX_DIBSource>& pBitmap, - const RetainPtr<CFX_DIBSource>& pMask, +bool CFX_RenderDevice::SetBitsWithMask(const RetainPtr<CFX_DIBBase>& pBitmap, + const RetainPtr<CFX_DIBBase>& pMask, int left, int top, int bitmap_alpha, diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h index 1d6fe48170..f0d78989be 100644 --- a/core/fxge/cfx_renderdevice.h +++ b/core/fxge/cfx_renderdevice.h @@ -153,14 +153,14 @@ class CFX_RenderDevice { RetainPtr<CFX_DIBitmap> GetBackDrop(); bool GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap, int left, int top); - bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, int left, int top) { + bool SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int left, int top) { return SetDIBitsWithBlend(pBitmap, left, top, FXDIB_BLEND_NORMAL); } - bool SetDIBitsWithBlend(const RetainPtr<CFX_DIBSource>& pBitmap, + bool SetDIBitsWithBlend(const RetainPtr<CFX_DIBBase>& pBitmap, int left, int top, int blend_type); - bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int left, int top, int dest_width, @@ -168,31 +168,31 @@ class CFX_RenderDevice { return StretchDIBitsWithFlagsAndBlend(pBitmap, left, top, dest_width, dest_height, 0, FXDIB_BLEND_NORMAL); } - bool StretchDIBitsWithFlagsAndBlend(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchDIBitsWithFlagsAndBlend(const RetainPtr<CFX_DIBBase>& pBitmap, int left, int top, int dest_width, int dest_height, uint32_t flags, int blend_type); - bool SetBitMask(const RetainPtr<CFX_DIBSource>& pBitmap, + bool SetBitMask(const RetainPtr<CFX_DIBBase>& pBitmap, int left, int top, uint32_t color); - bool StretchBitMask(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchBitMask(const RetainPtr<CFX_DIBBase>& pBitmap, int left, int top, int dest_width, int dest_height, uint32_t color); - bool StretchBitMaskWithFlags(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchBitMaskWithFlags(const RetainPtr<CFX_DIBBase>& pBitmap, int left, int top, int dest_width, int dest_height, uint32_t color, uint32_t flags); - bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -201,7 +201,7 @@ class CFX_RenderDevice { return StartDIBitsWithBlend(pBitmap, bitmap_alpha, color, pMatrix, flags, handle, FXDIB_BLEND_NORMAL); } - bool StartDIBitsWithBlend(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StartDIBitsWithBlend(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -266,8 +266,8 @@ class CFX_RenderDevice { #ifdef _SKIA_SUPPORT_ virtual void DebugVerifyBitmapIsPreMultiplied() const; - virtual bool SetBitsWithMask(const RetainPtr<CFX_DIBSource>& pBitmap, - const RetainPtr<CFX_DIBSource>& pMask, + virtual bool SetBitsWithMask(const RetainPtr<CFX_DIBBase>& pBitmap, + const RetainPtr<CFX_DIBBase>& pMask, int left, int top, int bitmap_alpha, diff --git a/core/fxge/dib/cfx_dibsource.cpp b/core/fxge/dib/cfx_dibbase.cpp index 4608b51802..79150ba616 100644 --- a/core/fxge/dib/cfx_dibsource.cpp +++ b/core/fxge/dib/cfx_dibbase.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" #include <algorithm> #include <memory> @@ -49,7 +49,7 @@ void Obtain_Pal(std::pair<uint32_t, uint32_t>* luts, class CFX_Palette { public: - explicit CFX_Palette(const RetainPtr<CFX_DIBSource>& pBitmap); + explicit CFX_Palette(const RetainPtr<CFX_DIBBase>& pBitmap); ~CFX_Palette(); const uint32_t* GetPalette() { return m_Palette.data(); } @@ -64,7 +64,7 @@ class CFX_Palette { int m_lut; }; -CFX_Palette::CFX_Palette(const RetainPtr<CFX_DIBSource>& pBitmap) +CFX_Palette::CFX_Palette(const RetainPtr<CFX_DIBBase>& pBitmap) : m_Palette(256), m_Luts(4096), m_lut(0) { int bpp = pBitmap->GetBPP() / 8; int width = pBitmap->GetWidth(); @@ -102,7 +102,7 @@ void ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { static constexpr uint8_t kSetGray = 0xff; @@ -123,7 +123,7 @@ void ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { for (int row = 0; row < height; ++row) { @@ -137,7 +137,7 @@ void ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { uint32_t* src_plt = pSrcBitmap->GetPalette(); @@ -182,7 +182,7 @@ void ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { uint32_t* src_plt = pSrcBitmap->GetPalette(); @@ -216,7 +216,7 @@ void ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { int Bpp = pSrcBitmap->GetBPP() / 8; @@ -255,7 +255,7 @@ void ConvertBuffer_IndexCopy(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { if (pSrcBitmap->GetBPP() == 1) { @@ -286,7 +286,7 @@ void ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top, uint32_t* dst_plt) { @@ -313,7 +313,7 @@ void ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top, uint32_t* dst_plt) { @@ -372,7 +372,7 @@ void ConvertBuffer_1bppMask2Rgb(FXDIB_Format dest_format, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { int comps = GetCompsFromFormat(dest_format); @@ -401,7 +401,7 @@ void ConvertBuffer_8bppMask2Rgb(FXDIB_Format dest_format, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { int comps = GetCompsFromFormat(dest_format); @@ -424,7 +424,7 @@ void ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dest_format, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { int comps = GetCompsFromFormat(dest_format); @@ -475,7 +475,7 @@ void ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dest_format, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { int comps = GetCompsFromFormat(dest_format); @@ -518,7 +518,7 @@ void ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { for (int row = 0; row < height; ++row) { @@ -533,7 +533,7 @@ void ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { for (int row = 0; row < height; ++row) { @@ -553,7 +553,7 @@ void ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { int comps = pSrcBitmap->GetBPP() / 8; @@ -575,7 +575,7 @@ void ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { for (int row = 0; row < height; ++row) { @@ -596,7 +596,7 @@ bool ConvertBuffer_8bppMask(int bpp, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { switch (bpp) { @@ -634,7 +634,7 @@ bool ConvertBuffer_Rgb(int bpp, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { switch (bpp) { @@ -676,7 +676,7 @@ bool ConvertBuffer_Argb(int bpp, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { switch (bpp) { @@ -715,21 +715,20 @@ bool ConvertBuffer_Argb(int bpp, } // namespace -CFX_DIBSource::CFX_DIBSource() +CFX_DIBBase::CFX_DIBBase() : m_Width(0), m_Height(0), m_bpp(0), m_AlphaFlag(0), m_Pitch(0) {} -CFX_DIBSource::~CFX_DIBSource() {} +CFX_DIBBase::~CFX_DIBBase() {} -uint8_t* CFX_DIBSource::GetBuffer() const { +uint8_t* CFX_DIBBase::GetBuffer() const { return nullptr; } -bool CFX_DIBSource::SkipToScanline(int line, - PauseIndicatorIface* pPause) const { +bool CFX_DIBBase::SkipToScanline(int line, PauseIndicatorIface* pPause) const { return false; } -RetainPtr<CFX_DIBitmap> CFX_DIBSource::Clone(const FX_RECT* pClip) const { +RetainPtr<CFX_DIBitmap> CFX_DIBBase::Clone(const FX_RECT* pClip) const { FX_RECT rect(0, 0, m_Width, m_Height); if (pClip) { rect.Intersect(*pClip); @@ -770,7 +769,7 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::Clone(const FX_RECT* pClip) const { return pNewBitmap; } -void CFX_DIBSource::BuildPalette() { +void CFX_DIBBase::BuildPalette() { if (m_pPalette) return; @@ -795,7 +794,7 @@ void CFX_DIBSource::BuildPalette() { } } -bool CFX_DIBSource::BuildAlphaMask() { +bool CFX_DIBBase::BuildAlphaMask() { if (m_pAlphaMask) return true; @@ -809,7 +808,7 @@ bool CFX_DIBSource::BuildAlphaMask() { return true; } -uint32_t CFX_DIBSource::GetPaletteArgb(int index) const { +uint32_t CFX_DIBBase::GetPaletteArgb(int index) const { ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask()); if (m_pPalette) return m_pPalette.get()[index]; @@ -826,7 +825,7 @@ uint32_t CFX_DIBSource::GetPaletteArgb(int index) const { return index * 0x10101 | 0xff000000; } -void CFX_DIBSource::SetPaletteArgb(int index, uint32_t color) { +void CFX_DIBBase::SetPaletteArgb(int index, uint32_t color) { ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask()); if (!m_pPalette) { BuildPalette(); @@ -834,7 +833,7 @@ void CFX_DIBSource::SetPaletteArgb(int index, uint32_t color) { m_pPalette.get()[index] = color; } -int CFX_DIBSource::FindPalette(uint32_t color) const { +int CFX_DIBBase::FindPalette(uint32_t color) const { ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask()); if (!m_pPalette) { if (IsCmykImage()) { @@ -856,15 +855,15 @@ int CFX_DIBSource::FindPalette(uint32_t color) const { return -1; } -void CFX_DIBSource::GetOverlapRect(int& dest_left, - int& dest_top, - int& width, - int& height, - int src_width, - int src_height, - int& src_left, - int& src_top, - const CFX_ClipRgn* pClipRgn) { +void CFX_DIBBase::GetOverlapRect(int& dest_left, + int& dest_top, + int& width, + int& height, + int src_width, + int src_height, + int& src_left, + int& src_top, + const CFX_ClipRgn* pClipRgn) { if (width == 0 || height == 0) return; @@ -893,7 +892,7 @@ void CFX_DIBSource::GetOverlapRect(int& dest_left, height = dest_rect.bottom - dest_rect.top; } -void CFX_DIBSource::SetPalette(const uint32_t* pSrc) { +void CFX_DIBBase::SetPalette(const uint32_t* pSrc) { static const uint32_t kPaletteSize = 256; if (!pSrc || GetBPP() > 8) { m_pPalette.reset(); @@ -906,7 +905,7 @@ void CFX_DIBSource::SetPalette(const uint32_t* pSrc) { memcpy(m_pPalette.get(), pSrc, pal_size * sizeof(uint32_t)); } -void CFX_DIBSource::GetPalette(uint32_t* pal, int alpha) const { +void CFX_DIBBase::GetPalette(uint32_t* pal, int alpha) const { ASSERT(GetBPP() <= 8 && !IsCmykImage()); if (GetBPP() == 1) { pal[0] = ((m_pPalette ? m_pPalette.get()[0] : 0xff000000) & 0xffffff) | @@ -924,7 +923,7 @@ void CFX_DIBSource::GetPalette(uint32_t* pal, int alpha) const { } } -RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneAlphaMask() const { +RetainPtr<CFX_DIBitmap> CFX_DIBBase::CloneAlphaMask() const { ASSERT(GetFormat() == FXDIB_Argb); FX_RECT rect(0, 0, m_Width, m_Height); auto pMask = pdfium::MakeRetain<CFX_DIBitmap>(); @@ -942,8 +941,8 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneAlphaMask() const { return pMask; } -bool CFX_DIBSource::SetAlphaMask(const RetainPtr<CFX_DIBSource>& pAlphaMask, - const FX_RECT* pClip) { +bool CFX_DIBBase::SetAlphaMask(const RetainPtr<CFX_DIBBase>& pAlphaMask, + const FX_RECT* pClip) { if (!HasAlpha() || GetFormat() == FXDIB_Argb) return false; @@ -970,8 +969,7 @@ bool CFX_DIBSource::SetAlphaMask(const RetainPtr<CFX_DIBSource>& pAlphaMask, return true; } -RetainPtr<CFX_DIBitmap> CFX_DIBSource::FlipImage(bool bXFlip, - bool bYFlip) const { +RetainPtr<CFX_DIBitmap> CFX_DIBBase::FlipImage(bool bXFlip, bool bYFlip) const { auto pFlipped = pdfium::MakeRetain<CFX_DIBitmap>(); if (!pFlipped->Create(m_Width, m_Height, GetFormat())) return nullptr; @@ -1042,7 +1040,7 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::FlipImage(bool bXFlip, return pFlipped; } -RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneConvert(FXDIB_Format dest_format) { +RetainPtr<CFX_DIBitmap> CFX_DIBBase::CloneConvert(FXDIB_Format dest_format) { if (dest_format == GetFormat()) return Clone(nullptr); @@ -1068,7 +1066,7 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneConvert(FXDIB_Format dest_format) { return nullptr; } - RetainPtr<CFX_DIBSource> holder(this); + RetainPtr<CFX_DIBBase> holder(this); std::unique_ptr<uint32_t, FxFreeDeleter> pal_8bpp; if (!ConvertBuffer(dest_format, pClone->GetBuffer(), pClone->GetPitch(), m_Width, m_Height, holder, 0, 0, &pal_8bpp)) { @@ -1080,7 +1078,7 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneConvert(FXDIB_Format dest_format) { return pClone; } -RetainPtr<CFX_DIBitmap> CFX_DIBSource::SwapXY(bool bXFlip, bool bYFlip) const { +RetainPtr<CFX_DIBitmap> CFX_DIBBase::SwapXY(bool bXFlip, bool bYFlip) const { FX_RECT dest_clip(0, 0, m_Height, m_Width); if (dest_clip.IsEmpty()) return nullptr; @@ -1170,11 +1168,10 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::SwapXY(bool bXFlip, bool bYFlip) const { return pTransBitmap; } -RetainPtr<CFX_DIBitmap> CFX_DIBSource::TransformTo( - const CFX_Matrix* pDestMatrix, - int* result_left, - int* result_top) { - RetainPtr<CFX_DIBSource> holder(this); +RetainPtr<CFX_DIBitmap> CFX_DIBBase::TransformTo(const CFX_Matrix* pDestMatrix, + int* result_left, + int* result_top) { + RetainPtr<CFX_DIBBase> holder(this); CFX_ImageTransformer transformer(holder, pDestMatrix, 0, nullptr); transformer.Continue(nullptr); *result_left = transformer.result().left; @@ -1182,11 +1179,11 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::TransformTo( return transformer.DetachBitmap(); } -RetainPtr<CFX_DIBitmap> CFX_DIBSource::StretchTo(int dest_width, - int dest_height, - uint32_t flags, - const FX_RECT* pClip) { - RetainPtr<CFX_DIBSource> holder(this); +RetainPtr<CFX_DIBitmap> CFX_DIBBase::StretchTo(int dest_width, + int dest_height, + uint32_t flags, + const FX_RECT* pClip) { + RetainPtr<CFX_DIBBase> holder(this); FX_RECT clip_rect(0, 0, abs(dest_width), abs(dest_height)); if (pClip) clip_rect.Intersect(*pClip); @@ -1207,13 +1204,13 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::StretchTo(int dest_width, } // static -bool CFX_DIBSource::ConvertBuffer( +bool CFX_DIBBase::ConvertBuffer( FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top, std::unique_ptr<uint32_t, FxFreeDeleter>* p_pal) { diff --git a/core/fxge/dib/cfx_dibsource.h b/core/fxge/dib/cfx_dibbase.h index 064dbe2055..ef35fc86e7 100644 --- a/core/fxge/dib/cfx_dibsource.h +++ b/core/fxge/dib/cfx_dibbase.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef CORE_FXGE_DIB_CFX_DIBSOURCE_H_ -#define CORE_FXGE_DIB_CFX_DIBSOURCE_H_ +#ifndef CORE_FXGE_DIB_CFX_DIBBASE_H_ +#define CORE_FXGE_DIB_CFX_DIBBASE_H_ #include <memory> @@ -29,9 +29,10 @@ class CFX_ClipRgn; class CFX_DIBitmap; class PauseIndicatorIface; -class CFX_DIBSource : public Retainable { +// Base class for all Device-Indepenent Bitmaps. +class CFX_DIBBase : public Retainable { public: - ~CFX_DIBSource() override; + ~CFX_DIBBase() override; virtual uint8_t* GetBuffer() const; virtual const uint8_t* GetScanline(int line) const = 0; @@ -90,7 +91,7 @@ class CFX_DIBSource : public Retainable { RetainPtr<CFX_DIBitmap> CloneAlphaMask() const; // Copies into internally-owned mask. - bool SetAlphaMask(const RetainPtr<CFX_DIBSource>& pAlphaMask, + bool SetAlphaMask(const RetainPtr<CFX_DIBBase>& pAlphaMask, const FX_RECT* pClip); void GetOverlapRect(int& dest_left, @@ -110,14 +111,14 @@ class CFX_DIBSource : public Retainable { RetainPtr<CFX_DIBitmap> m_pAlphaMask; protected: - CFX_DIBSource(); + CFX_DIBBase(); static bool ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top, std::unique_ptr<uint32_t, FxFreeDeleter>* pal); @@ -136,4 +137,4 @@ class CFX_DIBSource : public Retainable { std::unique_ptr<uint32_t, FxFreeDeleter> m_pPalette; }; -#endif // CORE_FXGE_DIB_CFX_DIBSOURCE_H_ +#endif // CORE_FXGE_DIB_CFX_DIBBASE_H_ diff --git a/core/fxge/dib/cfx_dibextractor.cpp b/core/fxge/dib/cfx_dibextractor.cpp index 9fe3114b1f..8211dc725a 100644 --- a/core/fxge/dib/cfx_dibextractor.cpp +++ b/core/fxge/dib/cfx_dibextractor.cpp @@ -6,14 +6,14 @@ #include "core/fxge/dib/cfx_dibextractor.h" -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" -CFX_DIBExtractor::CFX_DIBExtractor(const RetainPtr<CFX_DIBSource>& pSrc) { +CFX_DIBExtractor::CFX_DIBExtractor(const RetainPtr<CFX_DIBBase>& pSrc) { if (!pSrc->GetBuffer()) { m_pBitmap = pSrc->Clone(nullptr); return; } - RetainPtr<CFX_DIBSource> pOldSrc(pSrc); + RetainPtr<CFX_DIBBase> pOldSrc(pSrc); m_pBitmap = pdfium::MakeRetain<CFX_DIBitmap>(); if (!m_pBitmap->Create(pOldSrc->GetWidth(), pOldSrc->GetHeight(), pOldSrc->GetFormat(), pOldSrc->GetBuffer(), 0)) { diff --git a/core/fxge/dib/cfx_dibextractor.h b/core/fxge/dib/cfx_dibextractor.h index b6c27a7bd7..cd97f20aac 100644 --- a/core/fxge/dib/cfx_dibextractor.h +++ b/core/fxge/dib/cfx_dibextractor.h @@ -10,11 +10,11 @@ #include "core/fxcrt/retain_ptr.h" #include "core/fxge/dib/cfx_dibitmap.h" -class CFX_DIBSource; +class CFX_DIBBase; class CFX_DIBExtractor { public: - explicit CFX_DIBExtractor(const RetainPtr<CFX_DIBSource>& pSrc); + explicit CFX_DIBExtractor(const RetainPtr<CFX_DIBBase>& pSrc); ~CFX_DIBExtractor(); RetainPtr<CFX_DIBitmap> GetBitmap() { return m_pBitmap; } diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp index 2c99bd16e0..89cfbb68d3 100644 --- a/core/fxge/dib/cfx_dibitmap.cpp +++ b/core/fxge/dib/cfx_dibitmap.cpp @@ -85,7 +85,7 @@ bool CFX_DIBitmap::Create(int width, return false; } -bool CFX_DIBitmap::Copy(const RetainPtr<CFX_DIBSource>& pSrc) { +bool CFX_DIBitmap::Copy(const RetainPtr<CFX_DIBBase>& pSrc) { if (m_pBuffer) return false; @@ -188,7 +188,7 @@ bool CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { if (!m_pBuffer) @@ -223,7 +223,7 @@ bool CFX_DIBitmap::TransferWithUnequalFormats( int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { if (m_pPalette) @@ -247,7 +247,7 @@ void CFX_DIBitmap::TransferWithMultipleBPP( int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { int Bpp = GetBPP() / 8; @@ -265,7 +265,7 @@ void CFX_DIBitmap::TransferEqualFormatsOneBPP( int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { for (int row = 0; row < height; ++row) { @@ -283,12 +283,12 @@ void CFX_DIBitmap::TransferEqualFormatsOneBPP( } bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, FXDIB_Channel srcChannel) { if (!m_pBuffer) return false; - RetainPtr<CFX_DIBSource> pSrcClone = pSrcBitmap; + RetainPtr<CFX_DIBBase> pSrcClone = pSrcBitmap; int srcOffset; if (srcChannel == FXDIB_Alpha) { if (!pSrcBitmap->HasAlpha() && !pSrcBitmap->IsAlphaMask()) @@ -348,7 +348,7 @@ bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, destOffset = kChannelOffset[destChannel]; } if (srcChannel == FXDIB_Alpha && pSrcClone->m_pAlphaMask) { - RetainPtr<CFX_DIBSource> pAlphaMask = pSrcClone->m_pAlphaMask; + RetainPtr<CFX_DIBBase> pAlphaMask = pSrcClone->m_pAlphaMask; if (pSrcClone->GetWidth() != m_Width || pSrcClone->GetHeight() != m_Height) { if (pAlphaMask) { @@ -446,7 +446,7 @@ bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) { return true; } -bool CFX_DIBitmap::MultiplyAlpha(const RetainPtr<CFX_DIBSource>& pSrcBitmap) { +bool CFX_DIBitmap::MultiplyAlpha(const RetainPtr<CFX_DIBBase>& pSrcBitmap) { if (!m_pBuffer) return false; @@ -881,7 +881,7 @@ bool CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top, int blend_type, @@ -952,7 +952,7 @@ bool CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pMask, + const RetainPtr<CFX_DIBBase>& pMask, uint32_t color, int src_left, int src_top, @@ -1266,7 +1266,7 @@ bool CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) { } } bool ret = false; - RetainPtr<CFX_DIBSource> holder(this); + RetainPtr<CFX_DIBBase> holder(this); std::unique_ptr<uint32_t, FxFreeDeleter> pal_8bpp; ret = ConvertBuffer(dest_format, dest_buf.get(), dest_pitch, m_Width, m_Height, holder, 0, 0, &pal_8bpp); diff --git a/core/fxge/dib/cfx_dibitmap.h b/core/fxge/dib/cfx_dibitmap.h index d9afee6800..dc6720ed96 100644 --- a/core/fxge/dib/cfx_dibitmap.h +++ b/core/fxge/dib/cfx_dibitmap.h @@ -10,10 +10,10 @@ #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/maybe_owned.h" #include "core/fxcrt/retain_ptr.h" -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" #include "third_party/base/stl_util.h" -class CFX_DIBitmap : public CFX_DIBSource { +class CFX_DIBitmap : public CFX_DIBBase { public: template <typename T, typename... Args> friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); @@ -26,9 +26,9 @@ class CFX_DIBitmap : public CFX_DIBSource { uint8_t* pBuffer, uint32_t pitch); - bool Copy(const RetainPtr<CFX_DIBSource>& pSrc); + bool Copy(const RetainPtr<CFX_DIBBase>& pSrc); - // CFX_DIBSource + // CFX_DIBBase uint8_t* GetBuffer() const override; const uint8_t* GetScanline(int line) const override; void DownSampleScanline(int line, @@ -47,18 +47,18 @@ class CFX_DIBitmap : public CFX_DIBSource { void SetPixel(int x, int y, uint32_t color); bool LoadChannel(FXDIB_Channel destChannel, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, FXDIB_Channel srcChannel); bool LoadChannel(FXDIB_Channel destChannel, int value); bool MultiplyAlpha(int alpha); - bool MultiplyAlpha(const RetainPtr<CFX_DIBSource>& pAlphaMask); + bool MultiplyAlpha(const RetainPtr<CFX_DIBBase>& pAlphaMask); bool TransferBitmap(int dest_left, int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top); @@ -66,7 +66,7 @@ class CFX_DIBitmap : public CFX_DIBSource { int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top, int blend_type, @@ -77,7 +77,7 @@ class CFX_DIBitmap : public CFX_DIBSource { int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pMask, + const RetainPtr<CFX_DIBBase>& pMask, uint32_t color, int src_left, int src_top, @@ -130,21 +130,21 @@ class CFX_DIBitmap : public CFX_DIBSource { int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top); void TransferWithMultipleBPP(int dest_left, int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top); void TransferEqualFormatsOneBPP(int dest_left, int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top); }; diff --git a/core/fxge/dib/cfx_filtereddib.cpp b/core/fxge/dib/cfx_filtereddib.cpp index 1d5ed6200c..297a099a4c 100644 --- a/core/fxge/dib/cfx_filtereddib.cpp +++ b/core/fxge/dib/cfx_filtereddib.cpp @@ -12,7 +12,7 @@ CFX_FilteredDIB::CFX_FilteredDIB() {} CFX_FilteredDIB::~CFX_FilteredDIB() {} -void CFX_FilteredDIB::LoadSrc(const RetainPtr<CFX_DIBSource>& pSrc) { +void CFX_FilteredDIB::LoadSrc(const RetainPtr<CFX_DIBBase>& pSrc) { m_pSrc = pSrc; m_Width = pSrc->GetWidth(); m_Height = pSrc->GetHeight(); diff --git a/core/fxge/dib/cfx_filtereddib.h b/core/fxge/dib/cfx_filtereddib.h index 9c1efa544d..ec32a787c4 100644 --- a/core/fxge/dib/cfx_filtereddib.h +++ b/core/fxge/dib/cfx_filtereddib.h @@ -10,9 +10,9 @@ #include <vector> #include "core/fxcrt/retain_ptr.h" -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" -class CFX_FilteredDIB : public CFX_DIBSource { +class CFX_FilteredDIB : public CFX_DIBBase { public: template <typename T, typename... Args> friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); @@ -26,13 +26,13 @@ class CFX_FilteredDIB : public CFX_DIBSource { int pixels, int Bpp) const = 0; - void LoadSrc(const RetainPtr<CFX_DIBSource>& pSrc); + void LoadSrc(const RetainPtr<CFX_DIBBase>& pSrc); protected: CFX_FilteredDIB(); ~CFX_FilteredDIB() override; - // CFX_DIBSource + // CFX_DIBBase const uint8_t* GetScanline(int line) const override; void DownSampleScanline(int line, uint8_t* dest_scan, @@ -42,7 +42,7 @@ class CFX_FilteredDIB : public CFX_DIBSource { int clip_left, int clip_width) const override; - RetainPtr<CFX_DIBSource> m_pSrc; + RetainPtr<CFX_DIBBase> m_pSrc; mutable std::vector<uint8_t> m_Scanline; }; diff --git a/core/fxge/dib/cfx_imagerenderer.cpp b/core/fxge/dib/cfx_imagerenderer.cpp index a196068a2e..64c484f24d 100644 --- a/core/fxge/dib/cfx_imagerenderer.cpp +++ b/core/fxge/dib/cfx_imagerenderer.cpp @@ -15,7 +15,7 @@ CFX_ImageRenderer::CFX_ImageRenderer(const RetainPtr<CFX_DIBitmap>& pDevice, const CFX_ClipRgn* pClipRgn, - const RetainPtr<CFX_DIBSource>& pSource, + const RetainPtr<CFX_DIBBase>& pSource, int bitmap_alpha, uint32_t mask_color, const CFX_Matrix* pMatrix, diff --git a/core/fxge/dib/cfx_imagerenderer.h b/core/fxge/dib/cfx_imagerenderer.h index 14eaf56ff8..905ff8c25d 100644 --- a/core/fxge/dib/cfx_imagerenderer.h +++ b/core/fxge/dib/cfx_imagerenderer.h @@ -13,8 +13,8 @@ #include "core/fxcrt/retain_ptr.h" #include "core/fxcrt/unowned_ptr.h" #include "core/fxge/dib/cfx_bitmapcomposer.h" +#include "core/fxge/dib/cfx_dibbase.h" #include "core/fxge/dib/cfx_dibitmap.h" -#include "core/fxge/dib/cfx_dibsource.h" #include "core/fxge/fx_dib.h" #include "third_party/base/stl_util.h" @@ -25,7 +25,7 @@ class CFX_ImageRenderer { public: CFX_ImageRenderer(const RetainPtr<CFX_DIBitmap>& pDevice, const CFX_ClipRgn* pClipRgn, - const RetainPtr<CFX_DIBSource>& pSource, + const RetainPtr<CFX_DIBBase>& pSource, int bitmap_alpha, uint32_t mask_color, const CFX_Matrix* pMatrix, diff --git a/core/fxge/dib/cfx_imagestretcher.cpp b/core/fxge/dib/cfx_imagestretcher.cpp index 1c54e3fdd0..809d3b12dd 100644 --- a/core/fxge/dib/cfx_imagestretcher.cpp +++ b/core/fxge/dib/cfx_imagestretcher.cpp @@ -9,8 +9,8 @@ #include <climits> #include <tuple> +#include "core/fxge/dib/cfx_dibbase.h" #include "core/fxge/dib/cfx_dibitmap.h" -#include "core/fxge/dib/cfx_dibsource.h" #include "core/fxge/dib/cstretchengine.h" #include "core/fxge/fx_dib.h" #include "third_party/base/ptr_util.h" @@ -23,7 +23,7 @@ bool SourceSizeWithinLimit(int width, int height) { return !height || width < kMaxProgressiveStretchPixels / height; } -FXDIB_Format GetStretchedFormat(const CFX_DIBSource& src) { +FXDIB_Format GetStretchedFormat(const CFX_DIBBase& src) { FXDIB_Format format = src.GetFormat(); if (format == FXDIB_1bppMask) return FXDIB_8bppMask; @@ -43,7 +43,7 @@ std::tuple<int, int, int, int> CmykDecode(const uint32_t cmyk) { } // namespace CFX_ImageStretcher::CFX_ImageStretcher(ScanlineComposerIface* pDest, - const RetainPtr<CFX_DIBSource>& pSource, + const RetainPtr<CFX_DIBBase>& pSource, int dest_width, int dest_height, const FX_RECT& bitmap_rect, diff --git a/core/fxge/dib/cfx_imagestretcher.h b/core/fxge/dib/cfx_imagestretcher.h index 113372571b..8e866620fd 100644 --- a/core/fxge/dib/cfx_imagestretcher.h +++ b/core/fxge/dib/cfx_imagestretcher.h @@ -16,13 +16,13 @@ #include "core/fxge/dib/scanlinecomposer_iface.h" #include "core/fxge/fx_dib.h" -class CFX_DIBSource; +class CFX_DIBBase; class PauseIndicatorIface; class CFX_ImageStretcher { public: CFX_ImageStretcher(ScanlineComposerIface* pDest, - const RetainPtr<CFX_DIBSource>& pSource, + const RetainPtr<CFX_DIBBase>& pSource, int dest_width, int dest_height, const FX_RECT& bitmap_rect, @@ -32,7 +32,7 @@ class CFX_ImageStretcher { bool Start(); bool Continue(PauseIndicatorIface* pPause); - RetainPtr<CFX_DIBSource> source() { return m_pSource; } + RetainPtr<CFX_DIBBase> source() { return m_pSource; } private: bool StartQuickStretch(); @@ -41,7 +41,7 @@ class CFX_ImageStretcher { bool ContinueStretch(PauseIndicatorIface* pPause); UnownedPtr<ScanlineComposerIface> const m_pDest; - RetainPtr<CFX_DIBSource> m_pSource; + RetainPtr<CFX_DIBBase> m_pSource; std::unique_ptr<CStretchEngine> m_pStretchEngine; std::unique_ptr<uint8_t, FxFreeDeleter> m_pScanline; std::unique_ptr<uint8_t, FxFreeDeleter> m_pMaskScanline; diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp index c41ac2bdf2..0042462c89 100644 --- a/core/fxge/dib/cfx_imagetransformer.cpp +++ b/core/fxge/dib/cfx_imagetransformer.cpp @@ -99,7 +99,7 @@ void bicubic_get_pos_weight(int pos_pixel[], v_w[3] = SDP_Table[512 - res_y]; } -FXDIB_Format GetTransformedFormat(const RetainPtr<CFX_DIBSource>& pDrc) { +FXDIB_Format GetTransformedFormat(const RetainPtr<CFX_DIBBase>& pDrc) { if (pDrc->IsAlphaMask()) return FXDIB_8bppMask; @@ -200,7 +200,7 @@ class CFX_BilinearMatrix : public CPDF_FixedMatrix { } // namespace -CFX_ImageTransformer::CFX_ImageTransformer(const RetainPtr<CFX_DIBSource>& pSrc, +CFX_ImageTransformer::CFX_ImageTransformer(const RetainPtr<CFX_DIBBase>& pSrc, const CFX_Matrix* pMatrix, int flags, const FX_RECT* pClip) diff --git a/core/fxge/dib/cfx_imagetransformer.h b/core/fxge/dib/cfx_imagetransformer.h index a5b8841611..61fe1e1ba1 100644 --- a/core/fxge/dib/cfx_imagetransformer.h +++ b/core/fxge/dib/cfx_imagetransformer.h @@ -13,14 +13,14 @@ #include "core/fxcrt/retain_ptr.h" #include "core/fxcrt/unowned_ptr.h" #include "core/fxge/dib/cfx_bitmapstorer.h" +#include "core/fxge/dib/cfx_dibbase.h" #include "core/fxge/dib/cfx_dibitmap.h" -#include "core/fxge/dib/cfx_dibsource.h" class CFX_ImageStretcher; class CFX_ImageTransformer { public: - CFX_ImageTransformer(const RetainPtr<CFX_DIBSource>& pSrc, + CFX_ImageTransformer(const RetainPtr<CFX_DIBBase>& pSrc, const CFX_Matrix* pMatrix, int flags, const FX_RECT* pClip); @@ -98,7 +98,7 @@ class CFX_ImageTransformer { int increment, std::function<void(const DownSampleData&, uint8_t*)> func); - const RetainPtr<CFX_DIBSource> m_pSrc; + const RetainPtr<CFX_DIBBase> m_pSrc; UnownedPtr<const CFX_Matrix> const m_pMatrix; const FX_RECT* const m_pClip; FX_RECT m_StretchClip; diff --git a/core/fxge/dib/cfx_scanlinecompositor.h b/core/fxge/dib/cfx_scanlinecompositor.h index 75ab578128..1c373f036b 100644 --- a/core/fxge/dib/cfx_scanlinecompositor.h +++ b/core/fxge/dib/cfx_scanlinecompositor.h @@ -9,7 +9,7 @@ #include <memory> -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" class CFX_ScanlineCompositor { public: diff --git a/core/fxge/dib/cstretchengine.cpp b/core/fxge/dib/cstretchengine.cpp index ad9a356f34..41a843de66 100644 --- a/core/fxge/dib/cstretchengine.cpp +++ b/core/fxge/dib/cstretchengine.cpp @@ -10,8 +10,8 @@ #include <utility> #include "core/fxcrt/pauseindicator_iface.h" +#include "core/fxge/dib/cfx_dibbase.h" #include "core/fxge/dib/cfx_dibitmap.h" -#include "core/fxge/dib/cfx_dibsource.h" #include "core/fxge/dib/scanlinecomposer_iface.h" #include "core/fxge/fx_dib.h" @@ -227,7 +227,7 @@ CStretchEngine::CStretchEngine(ScanlineComposerIface* pDestBitmap, int dest_width, int dest_height, const FX_RECT& clip_rect, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int flags) : m_DestFormat(dest_format), m_DestBpp(GetBppFromFormat(dest_format)), diff --git a/core/fxge/dib/cstretchengine.h b/core/fxge/dib/cstretchengine.h index c9f11d6006..db7a2be56d 100644 --- a/core/fxge/dib/cstretchengine.h +++ b/core/fxge/dib/cstretchengine.h @@ -24,7 +24,7 @@ class CStretchEngine { int dest_width, int dest_height, const FX_RECT& clip_rect, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int flags); ~CStretchEngine(); @@ -80,7 +80,7 @@ class CStretchEngine { const int m_DestBpp; const int m_SrcBpp; const int m_bHasAlpha; - RetainPtr<CFX_DIBSource> const m_pSource; + RetainPtr<CFX_DIBBase> const m_pSource; const uint32_t* m_pSrcPalette; const int m_SrcWidth; const int m_SrcHeight; diff --git a/core/fxge/dib/cstretchengine_unittest.cpp b/core/fxge/dib/cstretchengine_unittest.cpp index 2c7e0342de..8169cae328 100644 --- a/core/fxge/dib/cstretchengine_unittest.cpp +++ b/core/fxge/dib/cstretchengine_unittest.cpp @@ -10,7 +10,7 @@ #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_number.h" #include "core/fpdfapi/parser/cpdf_stream.h" -#include "core/fpdfapi/render/cpdf_dibsource.h" +#include "core/fpdfapi/render/cpdf_dibbase.h" #include "core/fxcrt/fx_memory.h" #include "core/fxge/fx_dib.h" #include "testing/gtest/include/gtest/gtest.h" @@ -24,7 +24,7 @@ TEST(CStretchEngine, OverflowInCtor) { dict_obj->SetNewFor<CPDF_Number>("Height", 12500); std::unique_ptr<CPDF_Stream> stream = pdfium::MakeUnique<CPDF_Stream>(nullptr, 0, std::move(dict_obj)); - auto dib_source = pdfium::MakeRetain<CPDF_DIBSource>(); + auto dib_source = pdfium::MakeRetain<CPDF_DIBBase>(); dib_source->Load(nullptr, stream.get()); CStretchEngine engine(nullptr, FXDIB_8bppRgb, 500, 500, clip_rect, dib_source, 0); diff --git a/core/fxge/fx_dib.h b/core/fxge/fx_dib.h index 3475e5c4bd..7d8ca5fd72 100644 --- a/core/fxge/fx_dib.h +++ b/core/fxge/fx_dib.h @@ -45,7 +45,7 @@ using FX_COLORREF = uint32_t; using FX_CMYK = uint32_t; class CFX_ClipRgn; -class CFX_DIBSource; +class CFX_DIBBase; class CStretchEngine; extern const int16_t SDP_Table[513]; diff --git a/core/fxge/renderdevicedriver_iface.cpp b/core/fxge/renderdevicedriver_iface.cpp index 7023e021bd..646851ff45 100644 --- a/core/fxge/renderdevicedriver_iface.cpp +++ b/core/fxge/renderdevicedriver_iface.cpp @@ -81,8 +81,8 @@ bool RenderDeviceDriverIface::DrawShading(const CPDF_ShadingPattern* pPattern, } bool RenderDeviceDriverIface::SetBitsWithMask( - const RetainPtr<CFX_DIBSource>& pBitmap, - const RetainPtr<CFX_DIBSource>& pMask, + const RetainPtr<CFX_DIBBase>& pBitmap, + const RetainPtr<CFX_DIBBase>& pMask, int left, int top, int bitmap_alpha, diff --git a/core/fxge/renderdevicedriver_iface.h b/core/fxge/renderdevicedriver_iface.h index a0c148d117..62287abe62 100644 --- a/core/fxge/renderdevicedriver_iface.h +++ b/core/fxge/renderdevicedriver_iface.h @@ -14,7 +14,7 @@ #include "core/fxcrt/retain_ptr.h" class CFX_DIBitmap; -class CFX_DIBSource; +class CFX_DIBBase; class CFX_Font; class CFX_GraphStateData; class CFX_ImageRenderer; @@ -63,13 +63,13 @@ class RenderDeviceDriverIface { int left, int top); virtual RetainPtr<CFX_DIBitmap> GetBackDrop(); - virtual bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + virtual bool SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int dest_left, int dest_top, int blend_type) = 0; - virtual bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + virtual bool StretchDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -78,7 +78,7 @@ class RenderDeviceDriverIface { const FX_RECT* pClipRect, uint32_t flags, int blend_type) = 0; - virtual bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + virtual bool StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -100,8 +100,8 @@ class RenderDeviceDriverIface { const FX_RECT& clip_rect, int alpha, bool bAlphaMode); - virtual bool SetBitsWithMask(const RetainPtr<CFX_DIBSource>& pBitmap, - const RetainPtr<CFX_DIBSource>& pMask, + virtual bool SetBitsWithMask(const RetainPtr<CFX_DIBBase>& pBitmap, + const RetainPtr<CFX_DIBBase>& pMask, int left, int top, int bitmap_alpha, diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 0b96cdca5f..db181003ed 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -60,7 +60,7 @@ void RgbByteOrderTransferBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap, int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { if (!pBitmap) @@ -566,7 +566,7 @@ void SetBitmapPaint(bool isAlphaMask, paint->setAlpha(bitmap_alpha); } -bool Upsample(const RetainPtr<CFX_DIBSource>& pSource, +bool Upsample(const RetainPtr<CFX_DIBBase>& pSource, std::unique_ptr<uint8_t, FxFreeDeleter>& dst8Storage, std::unique_ptr<uint32_t, FxFreeDeleter>& dst32Storage, SkBitmap* skBitmap, @@ -2256,7 +2256,7 @@ RetainPtr<CFX_DIBitmap> CFX_SkiaDeviceDriver::GetBackDrop() { return m_pBackdropBitmap; } -bool CFX_SkiaDeviceDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, +bool CFX_SkiaDeviceDriver::SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t argb, const FX_RECT* pSrcRect, int left, @@ -2286,16 +2286,15 @@ bool CFX_SkiaDeviceDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, #endif // _SKIA_SUPPORT_PATHS_ } -bool CFX_SkiaDeviceDriver::StretchDIBits( - const RetainPtr<CFX_DIBSource>& pSource, - uint32_t argb, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - uint32_t flags, - int blend_type) { +bool CFX_SkiaDeviceDriver::StretchDIBits(const RetainPtr<CFX_DIBBase>& pSource, + uint32_t argb, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + uint32_t flags, + int blend_type) { #ifdef _SKIA_SUPPORT_ m_pCache->FlushForDraw(); if (!m_pBitmap->GetBuffer()) @@ -2339,7 +2338,7 @@ bool CFX_SkiaDeviceDriver::StretchDIBits( } bool CFX_SkiaDeviceDriver::StartDIBits( - const RetainPtr<CFX_DIBSource>& pSource, + const RetainPtr<CFX_DIBBase>& pSource, int bitmap_alpha, uint32_t argb, const CFX_Matrix* pMatrix, @@ -2472,8 +2471,8 @@ void CFX_DIBitmap::UnPreMultiply() { #ifdef _SKIA_SUPPORT_ bool CFX_SkiaDeviceDriver::DrawBitsWithMask( - const RetainPtr<CFX_DIBSource>& pSource, - const RetainPtr<CFX_DIBSource>& pMask, + const RetainPtr<CFX_DIBBase>& pSource, + const RetainPtr<CFX_DIBBase>& pMask, int bitmap_alpha, const CFX_Matrix* pMatrix, int blend_type) { @@ -2513,8 +2512,8 @@ bool CFX_SkiaDeviceDriver::DrawBitsWithMask( } bool CFX_SkiaDeviceDriver::SetBitsWithMask( - const RetainPtr<CFX_DIBSource>& pBitmap, - const RetainPtr<CFX_DIBSource>& pMask, + const RetainPtr<CFX_DIBBase>& pBitmap, + const RetainPtr<CFX_DIBBase>& pMask, int dest_left, int dest_top, int bitmap_alpha, @@ -2614,8 +2613,8 @@ void CFX_DefaultRenderDevice::DebugVerifyBitmapIsPreMultiplied() const { } bool CFX_DefaultRenderDevice::SetBitsWithMask( - const RetainPtr<CFX_DIBSource>& pBitmap, - const RetainPtr<CFX_DIBSource>& pMask, + const RetainPtr<CFX_DIBBase>& pBitmap, + const RetainPtr<CFX_DIBBase>& pMask, int left, int top, int bitmap_alpha, @@ -2629,7 +2628,7 @@ bool CFX_DefaultRenderDevice::SetBitsWithMask( } #endif // _SKIA_SUPPORT_ -void CFX_DIBSource::DebugVerifyBitmapIsPreMultiplied(void* opt) const { +void CFX_DIBBase::DebugVerifyBitmapIsPreMultiplied(void* opt) const { #ifdef SK_DEBUG SkASSERT(32 == GetBPP()); const uint32_t* buffer = (const uint32_t*)(opt ? opt : GetBuffer()); diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h index 692199f6bb..ce6ca6b000 100644 --- a/core/fxge/skia/fx_skia_device.h +++ b/core/fxge/skia/fx_skia_device.h @@ -83,15 +83,15 @@ class CFX_SkiaDeviceDriver : public RenderDeviceDriverIface { RetainPtr<CFX_DIBitmap> GetBackDrop() override; - bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int dest_left, int dest_top, int blend_type) override; #ifdef _SKIA_SUPPORT_ - bool SetBitsWithMask(const RetainPtr<CFX_DIBSource>& pBitmap, - const RetainPtr<CFX_DIBSource>& pMask, + bool SetBitsWithMask(const RetainPtr<CFX_DIBBase>& pBitmap, + const RetainPtr<CFX_DIBBase>& pMask, int dest_left, int dest_top, int bitmap_alpha, @@ -102,7 +102,7 @@ class CFX_SkiaDeviceDriver : public RenderDeviceDriverIface { void SetClipMask(const FX_RECT& clipBox, const SkPath& skClipPath); #endif - bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -112,7 +112,7 @@ class CFX_SkiaDeviceDriver : public RenderDeviceDriverIface { uint32_t flags, int blend_type) override; - bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -123,8 +123,8 @@ class CFX_SkiaDeviceDriver : public RenderDeviceDriverIface { bool ContinueDIBits(CFX_ImageRenderer* handle, PauseIndicatorIface* pPause) override; - bool DrawBitsWithMask(const RetainPtr<CFX_DIBSource>& pBitmap, - const RetainPtr<CFX_DIBSource>& pMask, + bool DrawBitsWithMask(const RetainPtr<CFX_DIBBase>& pBitmap, + const RetainPtr<CFX_DIBBase>& pMask, int bitmap_alpha, const CFX_Matrix* pMatrix, int blend_type); diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index 036cb43577..f5970a3ad1 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -337,7 +337,7 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) { WriteToStream(&buf); } -bool CFX_PSRenderer::SetDIBits(const RetainPtr<CFX_DIBSource>& pSource, +bool CFX_PSRenderer::SetDIBits(const RetainPtr<CFX_DIBBase>& pSource, uint32_t color, int left, int top) { @@ -348,7 +348,7 @@ bool CFX_PSRenderer::SetDIBits(const RetainPtr<CFX_DIBSource>& pSource, return DrawDIBits(pSource, color, &matrix, 0); } -bool CFX_PSRenderer::StretchDIBits(const RetainPtr<CFX_DIBSource>& pSource, +bool CFX_PSRenderer::StretchDIBits(const RetainPtr<CFX_DIBBase>& pSource, uint32_t color, int dest_left, int dest_top, @@ -361,7 +361,7 @@ bool CFX_PSRenderer::StretchDIBits(const RetainPtr<CFX_DIBSource>& pSource, return DrawDIBits(pSource, color, &matrix, flags); } -bool CFX_PSRenderer::DrawDIBits(const RetainPtr<CFX_DIBSource>& pSource, +bool CFX_PSRenderer::DrawDIBits(const RetainPtr<CFX_DIBBase>& pSource, uint32_t color, const CFX_Matrix* pMatrix, uint32_t flags) { @@ -423,7 +423,7 @@ bool CFX_PSRenderer::DrawDIBits(const RetainPtr<CFX_DIBSource>& pSource, output_buf.release(); } else { CFX_DIBExtractor source_extractor(pSource); - RetainPtr<CFX_DIBSource> pConverted = source_extractor.GetBitmap(); + RetainPtr<CFX_DIBBase> pConverted = source_extractor.GetBitmap(); if (!pConverted) return false; switch (pSource->GetFormat()) { diff --git a/core/fxge/win32/cfx_psrenderer.h b/core/fxge/win32/cfx_psrenderer.h index 4116dd4a51..e54c2f8744 100644 --- a/core/fxge/win32/cfx_psrenderer.h +++ b/core/fxge/win32/cfx_psrenderer.h @@ -16,7 +16,7 @@ #include "core/fxcrt/retain_ptr.h" #include "core/fxge/cfx_graphstatedata.h" -class CFX_DIBSource; +class CFX_DIBBase; class CFX_FaceCache; class CFX_Font; class CFX_FontCache; @@ -52,18 +52,18 @@ class CFX_PSRenderer { uint32_t fill_color, uint32_t stroke_color, int fill_mode); - bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, int dest_left, int dest_top); - bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, uint32_t flags); - bool DrawDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool DrawDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, const CFX_Matrix* pMatrix, uint32_t flags); diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index ed03101ecd..c8f049704f 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -1187,7 +1187,7 @@ bool CGdiDisplayDriver::GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap, return ret; } -bool CGdiDisplayDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pSource, +bool CGdiDisplayDriver::SetDIBits(const RetainPtr<CFX_DIBBase>& pSource, uint32_t color, const FX_RECT* pSrcRect, int left, @@ -1235,7 +1235,7 @@ bool CGdiDisplayDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pSource, } bool CGdiDisplayDriver::UseFoxitStretchEngine( - const RetainPtr<CFX_DIBSource>& pSource, + const RetainPtr<CFX_DIBBase>& pSource, uint32_t color, int dest_left, int dest_top, @@ -1261,7 +1261,7 @@ bool CGdiDisplayDriver::UseFoxitStretchEngine( pClipRect->top, FXDIB_BLEND_NORMAL); } -bool CGdiDisplayDriver::StretchDIBits(const RetainPtr<CFX_DIBSource>& pSource, +bool CGdiDisplayDriver::StretchDIBits(const RetainPtr<CFX_DIBBase>& pSource, uint32_t color, int dest_left, int dest_top, @@ -1328,7 +1328,7 @@ bool CGdiDisplayDriver::StretchDIBits(const RetainPtr<CFX_DIBSource>& pSource, dest_height, flags); } -bool CGdiDisplayDriver::StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, +bool CGdiDisplayDriver::StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp index 1e2b2d4e9a..83a1627087 100644 --- a/core/fxge/win32/fx_win32_print.cpp +++ b/core/fxge/win32/fx_win32_print.cpp @@ -69,7 +69,7 @@ int CGdiPrinterDriver::GetDeviceCaps(int caps_id) const { return CGdiDeviceDriver::GetDeviceCaps(caps_id); } -bool CGdiPrinterDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pSource, +bool CGdiPrinterDriver::SetDIBits(const RetainPtr<CFX_DIBBase>& pSource, uint32_t color, const FX_RECT* pSrcRect, int left, @@ -96,7 +96,7 @@ bool CGdiPrinterDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pSource, return GDI_SetDIBits(pBitmap, pSrcRect, left, top); } -bool CGdiPrinterDriver::StretchDIBits(const RetainPtr<CFX_DIBSource>& pSource, +bool CGdiPrinterDriver::StretchDIBits(const RetainPtr<CFX_DIBBase>& pSource, uint32_t color, int dest_left, int dest_top, @@ -159,7 +159,7 @@ bool CGdiPrinterDriver::StretchDIBits(const RetainPtr<CFX_DIBSource>& pSource, dest_height, flags); } -bool CGdiPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBSource>& pSource, +bool CGdiPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBBase>& pSource, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -454,7 +454,7 @@ bool CPSPrinterDriver::GetClipBox(FX_RECT* pRect) { return true; } -bool CPSPrinterDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, +bool CPSPrinterDriver::SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, @@ -465,7 +465,7 @@ bool CPSPrinterDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, return m_PSRenderer.SetDIBits(pBitmap, color, left, top); } -bool CPSPrinterDriver::StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, +bool CPSPrinterDriver::StretchDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -480,7 +480,7 @@ bool CPSPrinterDriver::StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, dest_width, dest_height, flags); } -bool CPSPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, +bool CPSPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -565,7 +565,7 @@ bool CTextOnlyPrinterDriver::DrawPath(const CFX_PathData* pPathData, return false; } -bool CTextOnlyPrinterDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, +bool CTextOnlyPrinterDriver::SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, @@ -583,7 +583,7 @@ bool CTextOnlyPrinterDriver::GetClipBox(FX_RECT* pRect) { } bool CTextOnlyPrinterDriver::StretchDIBits( - const RetainPtr<CFX_DIBSource>& pBitmap, + const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -596,7 +596,7 @@ bool CTextOnlyPrinterDriver::StretchDIBits( } bool CTextOnlyPrinterDriver::StartDIBits( - const RetainPtr<CFX_DIBSource>& pBitmap, + const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h index fe0e7f3ba9..76a1d8800e 100644 --- a/core/fxge/win32/win32_int.h +++ b/core/fxge/win32/win32_int.h @@ -197,13 +197,13 @@ class CGdiDisplayDriver : public CGdiDeviceDriver { bool GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap, int left, int top) override; - bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -212,14 +212,14 @@ class CGdiDisplayDriver : public CGdiDeviceDriver { const FX_RECT* pClipRect, uint32_t flags, int blend_type) override; - bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, uint32_t render_flags, std::unique_ptr<CFX_ImageRenderer>* handle, int blend_type) override; - bool UseFoxitStretchEngine(const RetainPtr<CFX_DIBSource>& pSource, + bool UseFoxitStretchEngine(const RetainPtr<CFX_DIBBase>& pSource, uint32_t color, int dest_left, int dest_top, @@ -236,13 +236,13 @@ class CGdiPrinterDriver : public CGdiDeviceDriver { protected: int GetDeviceCaps(int caps_id) const override; - bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -251,7 +251,7 @@ class CGdiPrinterDriver : public CGdiDeviceDriver { const FX_RECT* pClipRect, uint32_t flags, int blend_type) override; - bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -295,13 +295,13 @@ class CPSPrinterDriver : public RenderDeviceDriverIface { int fill_mode, int blend_type) override; bool GetClipBox(FX_RECT* pRect) override; - bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -310,7 +310,7 @@ class CPSPrinterDriver : public RenderDeviceDriverIface { const FX_RECT* pClipRect, uint32_t flags, int blend_type) override; - bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -358,13 +358,13 @@ class CTextOnlyPrinterDriver : public RenderDeviceDriverIface { int fill_mode, int blend_type) override; bool GetClipBox(FX_RECT* pRect) override; - bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -373,7 +373,7 @@ class CTextOnlyPrinterDriver : public RenderDeviceDriverIface { const FX_RECT* pClipRect, uint32_t flags, int blend_type) override; - bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, + bool StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, diff --git a/fpdfsdk/fpdf_editimg.cpp b/fpdfsdk/fpdf_editimg.cpp index 8235a8c25f..3709da7d2e 100644 --- a/fpdfsdk/fpdf_editimg.cpp +++ b/fpdfsdk/fpdf_editimg.cpp @@ -14,7 +14,7 @@ #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_name.h" #include "core/fpdfapi/parser/cpdf_stream_acc.h" -#include "core/fpdfapi/render/cpdf_dibsource.h" +#include "core/fpdfapi/render/cpdf_dibbase.h" #include "fpdfsdk/cpdfsdk_customaccess.h" #include "fpdfsdk/cpdfsdk_helpers.h" #include "third_party/base/ptr_util.h" @@ -170,7 +170,7 @@ FPDFImageObj_GetBitmap(FPDF_PAGEOBJECT image_object) { if (!pImg) return nullptr; - RetainPtr<CFX_DIBSource> pSource = pImg->LoadDIBSource(); + RetainPtr<CFX_DIBBase> pSource = pImg->LoadDIBBase(); if (!pSource) return nullptr; @@ -313,11 +313,11 @@ FPDFImageObj_GetImageMetadata(FPDF_PAGEOBJECT image_object, if (!pPage || !pPage->GetDocument() || !pImg->GetStream()) return true; - auto pSource = pdfium::MakeRetain<CPDF_DIBSource>(); - CPDF_DIBSource::LoadState ret = pSource->StartLoadDIBSource( + auto pSource = pdfium::MakeRetain<CPDF_DIBBase>(); + CPDF_DIBBase::LoadState ret = pSource->StartLoadDIBBase( pPage->GetDocument(), pImg->GetStream(), false, nullptr, pPage->m_pPageResources.Get(), false, 0, false); - if (ret == CPDF_DIBSource::LoadState::kFail) + if (ret == CPDF_DIBBase::LoadState::kFail) return true; metadata->bits_per_pixel = pSource->GetBPP(); diff --git a/xfa/fxfa/cxfa_ffdoc.h b/xfa/fxfa/cxfa_ffdoc.h index 88becb4071..50888b8bde 100644 --- a/xfa/fxfa/cxfa_ffdoc.h +++ b/xfa/fxfa/cxfa_ffdoc.h @@ -29,12 +29,12 @@ class CXFA_FFDocView; struct FX_IMAGEDIB_AND_DPI { FX_IMAGEDIB_AND_DPI(); FX_IMAGEDIB_AND_DPI(const FX_IMAGEDIB_AND_DPI& that); - FX_IMAGEDIB_AND_DPI(const RetainPtr<CFX_DIBSource>& pDib, + FX_IMAGEDIB_AND_DPI(const RetainPtr<CFX_DIBBase>& pDib, int32_t xDpi, int32_t yDpi); ~FX_IMAGEDIB_AND_DPI(); - RetainPtr<CFX_DIBSource> pDibSource; + RetainPtr<CFX_DIBBase> pDibSource; int32_t iImageXDpi; int32_t iImageYDpi; }; @@ -44,7 +44,7 @@ inline FX_IMAGEDIB_AND_DPI::FX_IMAGEDIB_AND_DPI( const FX_IMAGEDIB_AND_DPI& that) = default; inline FX_IMAGEDIB_AND_DPI::FX_IMAGEDIB_AND_DPI( - const RetainPtr<CFX_DIBSource>& pDib, + const RetainPtr<CFX_DIBBase>& pDib, int32_t xDpi, int32_t yDpi) : pDibSource(pDib), iImageXDpi(xDpi), iImageYDpi(yDpi) {} diff --git a/xfa/fxfa/cxfa_imagerenderer.cpp b/xfa/fxfa/cxfa_imagerenderer.cpp index f90ea64a93..9f65eaa07c 100644 --- a/xfa/fxfa/cxfa_imagerenderer.cpp +++ b/xfa/fxfa/cxfa_imagerenderer.cpp @@ -7,23 +7,20 @@ #include "xfa/fxfa/cxfa_imagerenderer.h" #include "core/fxge/cfx_renderdevice.h" -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" #include "core/fxge/dib/cfx_imagerenderer.h" #include "core/fxge/dib/cfx_imagetransformer.h" #include "third_party/base/ptr_util.h" -CXFA_ImageRenderer::CXFA_ImageRenderer( - CFX_RenderDevice* pDevice, - const RetainPtr<CFX_DIBSource>& pDIBSource, - const CFX_Matrix* pImage2Device) - : m_pDevice(pDevice), - m_ImageMatrix(*pImage2Device), - m_pDIBSource(pDIBSource) {} +CXFA_ImageRenderer::CXFA_ImageRenderer(CFX_RenderDevice* pDevice, + const RetainPtr<CFX_DIBBase>& pDIBBase, + const CFX_Matrix* pImage2Device) + : m_pDevice(pDevice), m_ImageMatrix(*pImage2Device), m_pDIBBase(pDIBBase) {} CXFA_ImageRenderer::~CXFA_ImageRenderer() {} bool CXFA_ImageRenderer::Start() { - if (m_pDevice->StartDIBitsWithBlend(m_pDIBSource, 255, 0, &m_ImageMatrix, + if (m_pDevice->StartDIBitsWithBlend(m_pDIBBase, 255, 0, &m_ImageMatrix, FXDIB_INTERPOL, &m_DeviceHandle, FXDIB_BLEND_NORMAL)) { if (m_DeviceHandle) { @@ -38,11 +35,11 @@ bool CXFA_ImageRenderer::Start() { int dest_height = image_rect.Height(); if ((fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) || (fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) { - RetainPtr<CFX_DIBSource> pDib = m_pDIBSource; - if (m_pDIBSource->HasAlpha() && + RetainPtr<CFX_DIBBase> pDib = m_pDIBBase; + if (m_pDIBBase->HasAlpha() && !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE) && !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) { - m_pCloneConvert = m_pDIBSource->CloneConvert(FXDIB_Rgb); + m_pCloneConvert = m_pDIBBase->CloneConvert(FXDIB_Rgb); if (!m_pCloneConvert) return false; @@ -62,15 +59,15 @@ bool CXFA_ImageRenderer::Start() { int dest_left, dest_top; dest_left = dest_width > 0 ? image_rect.left : image_rect.right; dest_top = dest_height > 0 ? image_rect.top : image_rect.bottom; - if (m_pDIBSource->IsOpaqueImage()) { + if (m_pDIBBase->IsOpaqueImage()) { if (m_pDevice->StretchDIBitsWithFlagsAndBlend( - m_pDIBSource, dest_left, dest_top, dest_width, dest_height, + m_pDIBBase, dest_left, dest_top, dest_width, dest_height, FXDIB_INTERPOL, FXDIB_BLEND_NORMAL)) { return false; } } - if (m_pDIBSource->IsAlphaMask()) { - if (m_pDevice->StretchBitMaskWithFlags(m_pDIBSource, dest_left, dest_top, + if (m_pDIBBase->IsAlphaMask()) { + if (m_pDevice->StretchBitMaskWithFlags(m_pDIBBase, dest_left, dest_top, dest_width, dest_height, 0, FXDIB_INTERPOL)) { return false; @@ -83,7 +80,7 @@ bool CXFA_ImageRenderer::Start() { FX_RECT dest_clip( dest_rect.left - image_rect.left, dest_rect.top - image_rect.top, dest_rect.right - image_rect.left, dest_rect.bottom - image_rect.top); - RetainPtr<CFX_DIBitmap> pStretched = m_pDIBSource->StretchTo( + RetainPtr<CFX_DIBitmap> pStretched = m_pDIBBase->StretchTo( dest_width, dest_height, FXDIB_INTERPOL, &dest_clip); if (pStretched) CompositeDIBitmap(pStretched, dest_rect.left, dest_rect.top); diff --git a/xfa/fxfa/cxfa_imagerenderer.h b/xfa/fxfa/cxfa_imagerenderer.h index 236c3ccc5a..0b727c9ab4 100644 --- a/xfa/fxfa/cxfa_imagerenderer.h +++ b/xfa/fxfa/cxfa_imagerenderer.h @@ -15,7 +15,7 @@ #include "core/fxge/fx_dib.h" class CFX_RenderDevice; -class CFX_DIBSource; +class CFX_DIBBase; class CFX_DIBitmap; class CFX_ImageTransformer; class CFX_ImageRenderer; @@ -23,7 +23,7 @@ class CFX_ImageRenderer; class CXFA_ImageRenderer { public: CXFA_ImageRenderer(CFX_RenderDevice* pDevice, - const RetainPtr<CFX_DIBSource>& pDIBSource, + const RetainPtr<CFX_DIBBase>& pDIBBase, const CFX_Matrix* pImage2Device); ~CXFA_ImageRenderer(); @@ -38,7 +38,7 @@ class CXFA_ImageRenderer { UnownedPtr<CFX_RenderDevice> m_pDevice; int m_Status = 0; CFX_Matrix m_ImageMatrix; - RetainPtr<CFX_DIBSource> m_pDIBSource; + RetainPtr<CFX_DIBBase> m_pDIBBase; RetainPtr<CFX_DIBitmap> m_pCloneConvert; std::unique_ptr<CFX_ImageTransformer> m_pTransformer; std::unique_ptr<CFX_ImageRenderer> m_DeviceHandle; diff --git a/xfa/fxfa/fxfa.h b/xfa/fxfa/fxfa.h index 254d99f924..9030e87c8e 100644 --- a/xfa/fxfa/fxfa.h +++ b/xfa/fxfa/fxfa.h @@ -12,7 +12,7 @@ #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/retain_ptr.h" -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" #include "core/fxge/fx_dib.h" #include "xfa/fxfa/fxfa_basic.h" diff --git a/xfa/fxgraphics/cxfa_graphics.cpp b/xfa/fxgraphics/cxfa_graphics.cpp index 47e4b6b98f..628bd44268 100644 --- a/xfa/fxgraphics/cxfa_graphics.cpp +++ b/xfa/fxgraphics/cxfa_graphics.cpp @@ -412,7 +412,7 @@ void CXFA_Graphics::FillPathWithShading(const CXFA_GEPath* path, } } -void CXFA_Graphics::SetDIBitsWithMatrix(const RetainPtr<CFX_DIBSource>& source, +void CXFA_Graphics::SetDIBitsWithMatrix(const RetainPtr<CFX_DIBBase>& source, const CFX_Matrix& matrix) { if (matrix.IsIdentity()) { m_renderDevice->SetDIBits(source, 0, 0); diff --git a/xfa/fxgraphics/cxfa_graphics.h b/xfa/fxgraphics/cxfa_graphics.h index 3eba53123e..3c9b269ea5 100644 --- a/xfa/fxgraphics/cxfa_graphics.h +++ b/xfa/fxgraphics/cxfa_graphics.h @@ -87,7 +87,7 @@ class CXFA_Graphics { FX_FillMode fillMode, const CFX_Matrix& matrix); - void SetDIBitsWithMatrix(const RetainPtr<CFX_DIBSource>& source, + void SetDIBitsWithMatrix(const RetainPtr<CFX_DIBBase>& source, const CFX_Matrix& matrix); CFX_RenderDevice* const m_renderDevice; // Not owned. |