From 0b95042db2e6dab5876abd12ce485fff0a8e08fe Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 21 Sep 2017 15:49:49 -0400 Subject: Rename CFX_RetainPtr to RetainPtr This CL renames CFX_RetainPtr to RetainPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I8798a9f79cb0840d3f037e8d04937cedd742914e Reviewed-on: https://pdfium-review.googlesource.com/14616 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- core/fpdfapi/render/cpdf_devicebuffer.h | 6 +-- core/fpdfapi/render/cpdf_dibsource.cpp | 2 +- core/fpdfapi/render/cpdf_dibsource.h | 14 +++---- core/fpdfapi/render/cpdf_dibtransferfunc.cpp | 2 +- core/fpdfapi/render/cpdf_dibtransferfunc.h | 6 +-- core/fpdfapi/render/cpdf_docrenderdata.cpp | 4 +- core/fpdfapi/render/cpdf_docrenderdata.h | 8 ++-- core/fpdfapi/render/cpdf_imagecacheentry.cpp | 13 +++--- core/fpdfapi/render/cpdf_imagecacheentry.h | 20 +++++----- core/fpdfapi/render/cpdf_imageloader.cpp | 2 +- core/fpdfapi/render/cpdf_imageloader.h | 6 +-- core/fpdfapi/render/cpdf_imagerenderer.cpp | 14 +++---- core/fpdfapi/render/cpdf_imagerenderer.h | 8 ++-- core/fpdfapi/render/cpdf_pagerendercache.cpp | 7 ++-- core/fpdfapi/render/cpdf_pagerendercache.h | 8 ++-- core/fpdfapi/render/cpdf_rendercontext.cpp | 9 ++--- core/fpdfapi/render/cpdf_rendercontext.h | 4 +- core/fpdfapi/render/cpdf_renderoptions.h | 4 +- core/fpdfapi/render/cpdf_renderstatus.cpp | 60 ++++++++++++++-------------- core/fpdfapi/render/cpdf_renderstatus.h | 22 +++++----- core/fpdfapi/render/cpdf_transferfunc.cpp | 6 +-- core/fpdfapi/render/cpdf_transferfunc.h | 9 ++--- core/fpdfapi/render/cpdf_type3cache.cpp | 7 ++-- core/fpdfapi/render/cpdf_type3cache.h | 6 +-- 24 files changed, 121 insertions(+), 126 deletions(-) (limited to 'core/fpdfapi/render') diff --git a/core/fpdfapi/render/cpdf_devicebuffer.h b/core/fpdfapi/render/cpdf_devicebuffer.h index bfab27503b..2146c9761f 100644 --- a/core/fpdfapi/render/cpdf_devicebuffer.h +++ b/core/fpdfapi/render/cpdf_devicebuffer.h @@ -9,9 +9,9 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_coordinates.h" +#include "core/fxcrt/retain_ptr.h" class CFX_DIBitmap; class CFX_RenderDevice; @@ -29,14 +29,14 @@ class CPDF_DeviceBuffer { const CPDF_PageObject* pObj, int max_dpi); void OutputToDevice(); - CFX_RetainPtr GetBitmap() const { return m_pBitmap; } + RetainPtr GetBitmap() const { return m_pBitmap; } const CFX_Matrix* GetMatrix() const { return &m_Matrix; } private: CFX_UnownedPtr m_pDevice; CFX_UnownedPtr m_pContext; CFX_UnownedPtr m_pObject; - CFX_RetainPtr m_pBitmap; + RetainPtr m_pBitmap; FX_RECT m_Rect; CFX_Matrix m_Matrix; }; diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp index c6a5632055..5104f7b618 100644 --- a/core/fpdfapi/render/cpdf_dibsource.cpp +++ b/core/fpdfapi/render/cpdf_dibsource.cpp @@ -752,7 +752,7 @@ int CPDF_DIBSource::ContinueLoadMaskDIB(IFX_PauseIndicator* pPause) { return 1; } -CFX_RetainPtr CPDF_DIBSource::DetachMask() { +RetainPtr CPDF_DIBSource::DetachMask() { return std::move(m_pMask); } diff --git a/core/fpdfapi/render/cpdf_dibsource.h b/core/fpdfapi/render/cpdf_dibsource.h index f6883ed263..08c4afe862 100644 --- a/core/fpdfapi/render/cpdf_dibsource.h +++ b/core/fpdfapi/render/cpdf_dibsource.h @@ -18,8 +18,8 @@ #include "core/fpdfapi/render/cpdf_imageloader.h" #include "core/fpdfapi/render/cpdf_rendercontext.h" #include "core/fpdfapi/render/cpdf_renderoptions.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/cfx_defaultrenderdevice.h" #include "core/fxge/cfx_renderdevice.h" @@ -42,7 +42,7 @@ typedef struct { class CPDF_DIBSource : public CFX_DIBSource { public: template - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr pdfium::MakeRetain(Args&&... args); ~CPDF_DIBSource() override; @@ -76,7 +76,7 @@ class CPDF_DIBSource : public CFX_DIBSource { int StartLoadMaskDIB(); int ContinueLoadMaskDIB(IFX_PauseIndicator* pPause); int ContinueToLoadMask(); - CFX_RetainPtr DetachMask(); + RetainPtr DetachMask(); private: CPDF_DIBSource(); @@ -125,7 +125,7 @@ class CPDF_DIBSource : public CFX_DIBSource { CFX_UnownedPtr m_pDocument; CFX_UnownedPtr m_pStream; CFX_UnownedPtr m_pDict; - CFX_RetainPtr m_pStreamAcc; + RetainPtr m_pStreamAcc; CPDF_ColorSpace* m_pColorSpace; uint32_t m_Family; uint32_t m_bpc; @@ -143,9 +143,9 @@ class CPDF_DIBSource : public CFX_DIBSource { DIB_COMP_DATA* m_pCompData; uint8_t* m_pLineBuf; uint8_t* m_pMaskedLine; - CFX_RetainPtr m_pCachedBitmap; - CFX_RetainPtr m_pMask; - CFX_RetainPtr m_pGlobalStream; + RetainPtr m_pCachedBitmap; + RetainPtr m_pMask; + RetainPtr m_pGlobalStream; std::unique_ptr m_pDecoder; std::unique_ptr m_pJbig2Context; CFX_UnownedPtr m_pMaskStream; diff --git a/core/fpdfapi/render/cpdf_dibtransferfunc.cpp b/core/fpdfapi/render/cpdf_dibtransferfunc.cpp index 6ba148e15c..be2c9f30bb 100644 --- a/core/fpdfapi/render/cpdf_dibtransferfunc.cpp +++ b/core/fpdfapi/render/cpdf_dibtransferfunc.cpp @@ -12,7 +12,7 @@ #include "core/fpdfapi/render/cpdf_transferfunc.h" CPDF_DIBTransferFunc::CPDF_DIBTransferFunc( - const CFX_RetainPtr& pTransferFunc) + const RetainPtr& pTransferFunc) : m_pTransferFunc(pTransferFunc) { m_RampR = pTransferFunc->m_Samples; m_RampG = &pTransferFunc->m_Samples[256]; diff --git a/core/fpdfapi/render/cpdf_dibtransferfunc.h b/core/fpdfapi/render/cpdf_dibtransferfunc.h index b22ae9c775..442811b97e 100644 --- a/core/fpdfapi/render/cpdf_dibtransferfunc.h +++ b/core/fpdfapi/render/cpdf_dibtransferfunc.h @@ -17,7 +17,7 @@ class CPDF_TransferFunc; class CPDF_DIBTransferFunc : public CFX_FilteredDIB { public: template - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr pdfium::MakeRetain(Args&&... args); ~CPDF_DIBTransferFunc() override; @@ -33,12 +33,12 @@ class CPDF_DIBTransferFunc : public CFX_FilteredDIB { private: explicit CPDF_DIBTransferFunc( - const CFX_RetainPtr& pTransferFunc); + const RetainPtr& pTransferFunc); const uint8_t* m_RampR; const uint8_t* m_RampG; const uint8_t* m_RampB; - CFX_RetainPtr m_pTransferFunc; + RetainPtr m_pTransferFunc; }; #endif // CORE_FPDFAPI_RENDER_CPDF_DIBTRANSFERFUNC_H_ diff --git a/core/fpdfapi/render/cpdf_docrenderdata.cpp b/core/fpdfapi/render/cpdf_docrenderdata.cpp index bf277f03f8..3b16013bc5 100644 --- a/core/fpdfapi/render/cpdf_docrenderdata.cpp +++ b/core/fpdfapi/render/cpdf_docrenderdata.cpp @@ -44,7 +44,7 @@ void CPDF_DocRenderData::Clear(bool bRelease) { } } -CFX_RetainPtr CPDF_DocRenderData::GetCachedType3( +RetainPtr CPDF_DocRenderData::GetCachedType3( CPDF_Type3Font* pFont) { auto it = m_Type3FaceMap.find(pFont); if (it != m_Type3FaceMap.end()) @@ -61,7 +61,7 @@ void CPDF_DocRenderData::MaybePurgeCachedType3(CPDF_Type3Font* pFont) { m_Type3FaceMap.erase(it); } -CFX_RetainPtr CPDF_DocRenderData::GetTransferFunc( +RetainPtr CPDF_DocRenderData::GetTransferFunc( CPDF_Object* pObj) { if (!pObj) return nullptr; diff --git a/core/fpdfapi/render/cpdf_docrenderdata.h b/core/fpdfapi/render/cpdf_docrenderdata.h index 949a079126..efc4741e5e 100644 --- a/core/fpdfapi/render/cpdf_docrenderdata.h +++ b/core/fpdfapi/render/cpdf_docrenderdata.h @@ -25,18 +25,18 @@ class CPDF_DocRenderData { explicit CPDF_DocRenderData(CPDF_Document* pPDFDoc); ~CPDF_DocRenderData(); - CFX_RetainPtr GetCachedType3(CPDF_Type3Font* pFont); + RetainPtr GetCachedType3(CPDF_Type3Font* pFont); void MaybePurgeCachedType3(CPDF_Type3Font* pFont); - CFX_RetainPtr GetTransferFunc(CPDF_Object* pObj); + RetainPtr GetTransferFunc(CPDF_Object* pObj); void MaybePurgeTransferFunc(CPDF_Object* pOb); void Clear(bool bRelease); private: CFX_UnownedPtr m_pPDFDoc; - std::map> m_Type3FaceMap; - std::map> m_TransferFuncMap; + std::map> m_Type3FaceMap; + std::map> m_TransferFuncMap; }; #endif // CORE_FPDFAPI_RENDER_CPDF_DOCRENDERDATA_H_ diff --git a/core/fpdfapi/render/cpdf_imagecacheentry.cpp b/core/fpdfapi/render/cpdf_imagecacheentry.cpp index 4f98b96726..666839b0f2 100644 --- a/core/fpdfapi/render/cpdf_imagecacheentry.cpp +++ b/core/fpdfapi/render/cpdf_imagecacheentry.cpp @@ -18,9 +18,8 @@ #include "core/fpdfapi/render/cpdf_rendercontext.h" #include "core/fpdfapi/render/cpdf_renderstatus.h" -CPDF_ImageCacheEntry::CPDF_ImageCacheEntry( - CPDF_Document* pDoc, - const CFX_RetainPtr& pImage) +CPDF_ImageCacheEntry::CPDF_ImageCacheEntry(CPDF_Document* pDoc, + const RetainPtr& pImage) : m_dwTimeCount(0), m_MatteColor(0), m_pDocument(pDoc), @@ -29,7 +28,7 @@ CPDF_ImageCacheEntry::CPDF_ImageCacheEntry( CPDF_ImageCacheEntry::~CPDF_ImageCacheEntry() {} -void CPDF_ImageCacheEntry::Reset(const CFX_RetainPtr& pBitmap) { +void CPDF_ImageCacheEntry::Reset(const RetainPtr& pBitmap) { m_pCachedBitmap.Reset(); if (pBitmap) m_pCachedBitmap = pBitmap->Clone(nullptr); @@ -37,18 +36,18 @@ void CPDF_ImageCacheEntry::Reset(const CFX_RetainPtr& pBitmap) { } static uint32_t FPDF_ImageCache_EstimateImageSize( - const CFX_RetainPtr& pDIB) { + const RetainPtr& pDIB) { return pDIB && pDIB->GetBuffer() ? (uint32_t)pDIB->GetHeight() * pDIB->GetPitch() + (uint32_t)pDIB->GetPaletteSize() * 4 : 0; } -CFX_RetainPtr CPDF_ImageCacheEntry::DetachBitmap() { +RetainPtr CPDF_ImageCacheEntry::DetachBitmap() { return std::move(m_pCurBitmap); } -CFX_RetainPtr CPDF_ImageCacheEntry::DetachMask() { +RetainPtr CPDF_ImageCacheEntry::DetachMask() { return std::move(m_pCurMask); } diff --git a/core/fpdfapi/render/cpdf_imagecacheentry.h b/core/fpdfapi/render/cpdf_imagecacheentry.h index 176b2818d9..111050f60c 100644 --- a/core/fpdfapi/render/cpdf_imagecacheentry.h +++ b/core/fpdfapi/render/cpdf_imagecacheentry.h @@ -9,9 +9,9 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" class CFX_DIBSource; class CFX_DIBitmap; @@ -24,10 +24,10 @@ class IFX_PauseIndicator; class CPDF_ImageCacheEntry { public: CPDF_ImageCacheEntry(CPDF_Document* pDoc, - const CFX_RetainPtr& pImage); + const RetainPtr& pImage); ~CPDF_ImageCacheEntry(); - void Reset(const CFX_RetainPtr& pBitmap); + void Reset(const RetainPtr& pBitmap); uint32_t EstimateSize() const { return m_dwCacheSize; } uint32_t GetTimeCount() const { return m_dwTimeCount; } CPDF_Image* GetImage() const { return m_pImage.Get(); } @@ -38,8 +38,8 @@ class CPDF_ImageCacheEntry { bool bLoadMask, CPDF_RenderStatus* pRenderStatus); int Continue(IFX_PauseIndicator* pPause, CPDF_RenderStatus* pRenderStatus); - CFX_RetainPtr DetachBitmap(); - CFX_RetainPtr DetachMask(); + RetainPtr DetachBitmap(); + RetainPtr DetachMask(); int m_dwTimeCount; uint32_t m_MatteColor; @@ -49,11 +49,11 @@ class CPDF_ImageCacheEntry { void CalcSize(); CFX_UnownedPtr const m_pDocument; - CFX_RetainPtr const m_pImage; - CFX_RetainPtr m_pCurBitmap; - CFX_RetainPtr m_pCurMask; - CFX_RetainPtr m_pCachedBitmap; - CFX_RetainPtr m_pCachedMask; + RetainPtr const m_pImage; + RetainPtr m_pCurBitmap; + RetainPtr m_pCurMask; + RetainPtr m_pCachedBitmap; + RetainPtr m_pCachedMask; uint32_t m_dwCacheSize; }; diff --git a/core/fpdfapi/render/cpdf_imageloader.cpp b/core/fpdfapi/render/cpdf_imageloader.cpp index f195b89dfc..19eb875946 100644 --- a/core/fpdfapi/render/cpdf_imageloader.cpp +++ b/core/fpdfapi/render/cpdf_imageloader.cpp @@ -61,7 +61,7 @@ void CPDF_ImageLoader::HandleFailure() { m_MatteColor = entry->m_MatteColor; return; } - CFX_RetainPtr pImage = m_pImageObject->GetImage(); + RetainPtr pImage = m_pImageObject->GetImage(); m_bCached = false; m_pBitmap = pImage->DetachBitmap(); m_pMask = pImage->DetachMask(); diff --git a/core/fpdfapi/render/cpdf_imageloader.h b/core/fpdfapi/render/cpdf_imageloader.h index 69577c3a18..2fc0670dff 100644 --- a/core/fpdfapi/render/cpdf_imageloader.h +++ b/core/fpdfapi/render/cpdf_imageloader.h @@ -9,8 +9,8 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/fx_dib.h" class CPDF_ImageObject; @@ -31,8 +31,8 @@ class CPDF_ImageLoader { CPDF_RenderStatus* pRenderStatus); bool Continue(IFX_PauseIndicator* pPause, CPDF_RenderStatus* pRenderStatus); - CFX_RetainPtr m_pBitmap; - CFX_RetainPtr m_pMask; + RetainPtr m_pBitmap; + RetainPtr 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 e9f1752d57..2fa0beba47 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.cpp +++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp @@ -184,7 +184,7 @@ bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, } bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, - const CFX_RetainPtr& pDIBSource, + const RetainPtr& pDIBSource, FX_ARGB bitmap_argb, int bitmap_alpha, const CFX_Matrix* pImage2Device, @@ -222,7 +222,7 @@ CFX_Matrix CPDF_ImageRenderer::GetDrawMatrix(const FX_RECT& rect) const { void CPDF_ImageRenderer::CalculateDrawImage( CFX_DefaultRenderDevice* pBitmapDevice1, CFX_DefaultRenderDevice* pBitmapDevice2, - const CFX_RetainPtr& pDIBSource, + const RetainPtr& pDIBSource, CFX_Matrix* pNewMatrix, const FX_RECT& rect) const { CPDF_RenderStatus bitmap_render; @@ -380,7 +380,7 @@ bool CPDF_ImageRenderer::StartDIBSource() { } } #ifdef _SKIA_SUPPORT_ - CFX_RetainPtr premultiplied = m_pDIBSource->Clone(nullptr); + RetainPtr premultiplied = m_pDIBSource->Clone(nullptr); if (m_pDIBSource->HasAlpha()) CFX_SkiaDeviceDriver::PreMultiply(premultiplied); if (m_pRenderStatus->m_pDevice->StartDIBitsWithBlend( @@ -456,7 +456,7 @@ bool CPDF_ImageRenderer::StartDIBSource() { 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); - CFX_RetainPtr pStretched = + RetainPtr pStretched = m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip); if (pStretched) { m_pRenderStatus->CompositeDIBitmap(pStretched, dest_rect.left, @@ -477,7 +477,7 @@ bool CPDF_ImageRenderer::StartBitmapAlpha() { FXFILL_WINDING); return false; } - CFX_RetainPtr pAlphaMask; + RetainPtr pAlphaMask; if (m_pDIBSource->IsAlphaMask()) pAlphaMask = m_pDIBSource; else @@ -486,7 +486,7 @@ bool CPDF_ImageRenderer::StartBitmapAlpha() { if (fabs(m_ImageMatrix.b) >= 0.5f || fabs(m_ImageMatrix.c) >= 0.5f) { int left; int top; - CFX_RetainPtr pTransformed = + RetainPtr pTransformed = pAlphaMask->TransformTo(&m_ImageMatrix, &left, &top); if (!pTransformed) return true; @@ -515,7 +515,7 @@ bool CPDF_ImageRenderer::Continue(IFX_PauseIndicator* pPause) { if (m_pTransformer->Continue(pPause)) return true; - CFX_RetainPtr pBitmap = m_pTransformer->DetachBitmap(); + RetainPtr pBitmap = m_pTransformer->DetachBitmap(); if (!pBitmap) return false; diff --git a/core/fpdfapi/render/cpdf_imagerenderer.h b/core/fpdfapi/render/cpdf_imagerenderer.h index 332cbf515c..0d59a4e7cb 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.h +++ b/core/fpdfapi/render/cpdf_imagerenderer.h @@ -35,7 +35,7 @@ class CPDF_ImageRenderer { int blendType); bool Start(CPDF_RenderStatus* pStatus, - const CFX_RetainPtr& pDIBSource, + const RetainPtr& pDIBSource, FX_ARGB bitmap_argb, int bitmap_alpha, const CFX_Matrix* pImage2Device, @@ -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 CFX_RetainPtr& pDIBSource, + const RetainPtr& pDIBSource, CFX_Matrix* pNewMatrix, const FX_RECT& rect) const; void HandleFilters(); @@ -69,8 +69,8 @@ class CPDF_ImageRenderer { CFX_UnownedPtr m_pObj2Device; CFX_Matrix m_ImageMatrix; CPDF_ImageLoader m_Loader; - CFX_RetainPtr m_pDIBSource; - CFX_RetainPtr m_pClone; + RetainPtr m_pDIBSource; + RetainPtr m_pClone; int m_BitmapAlpha; bool m_bPatternColor; CFX_UnownedPtr m_pPattern; diff --git a/core/fpdfapi/render/cpdf_pagerendercache.cpp b/core/fpdfapi/render/cpdf_pagerendercache.cpp index ca5b620316..42205ebe63 100644 --- a/core/fpdfapi/render/cpdf_pagerendercache.cpp +++ b/core/fpdfapi/render/cpdf_pagerendercache.cpp @@ -80,7 +80,7 @@ void CPDF_PageRenderCache::ClearImageCacheEntry(CPDF_Stream* pStream) { } bool CPDF_PageRenderCache::StartGetCachedBitmap( - const CFX_RetainPtr& pImage, + const RetainPtr& pImage, bool bStdCS, uint32_t GroupFamily, bool bLoadMask, @@ -126,9 +126,8 @@ bool CPDF_PageRenderCache::Continue(IFX_PauseIndicator* pPause, return false; } -void CPDF_PageRenderCache::ResetBitmap( - const CFX_RetainPtr& pImage, - const CFX_RetainPtr& pBitmap) { +void CPDF_PageRenderCache::ResetBitmap(const RetainPtr& pImage, + const RetainPtr& pBitmap) { CPDF_ImageCacheEntry* pEntry; CPDF_Stream* pStream = pImage->GetStream(); const auto it = m_ImageCache.find(pStream); diff --git a/core/fpdfapi/render/cpdf_pagerendercache.h b/core/fpdfapi/render/cpdf_pagerendercache.h index 0a315b74ed..76898ab258 100644 --- a/core/fpdfapi/render/cpdf_pagerendercache.h +++ b/core/fpdfapi/render/cpdf_pagerendercache.h @@ -9,9 +9,9 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" class CFX_DIBitmap; class CPDF_Image; @@ -28,14 +28,14 @@ class CPDF_PageRenderCache { void CacheOptimization(int32_t dwLimitCacheSize); uint32_t GetTimeCount() const { return m_nTimeCount; } - void ResetBitmap(const CFX_RetainPtr& pImage, - const CFX_RetainPtr& pBitmap); + void ResetBitmap(const RetainPtr& pImage, + const RetainPtr& pBitmap); CPDF_Page* GetPage() const { return m_pPage.Get(); } CPDF_ImageCacheEntry* GetCurImageCacheEntry() const { return m_pCurImageCacheEntry; } - bool StartGetCachedBitmap(const CFX_RetainPtr& pImage, + bool StartGetCachedBitmap(const RetainPtr& pImage, bool bStdCS, uint32_t GroupFamily, bool bLoadMask, diff --git a/core/fpdfapi/render/cpdf_rendercontext.cpp b/core/fpdfapi/render/cpdf_rendercontext.cpp index dec513276d..3c08295480 100644 --- a/core/fpdfapi/render/cpdf_rendercontext.cpp +++ b/core/fpdfapi/render/cpdf_rendercontext.cpp @@ -30,11 +30,10 @@ CPDF_RenderContext::CPDF_RenderContext(CPDF_Document* pDoc, CPDF_RenderContext::~CPDF_RenderContext() {} -void CPDF_RenderContext::GetBackground( - const CFX_RetainPtr& pBuffer, - const CPDF_PageObject* pObj, - const CPDF_RenderOptions* pOptions, - CFX_Matrix* pFinalMatrix) { +void CPDF_RenderContext::GetBackground(const RetainPtr& pBuffer, + const CPDF_PageObject* pObj, + const CPDF_RenderOptions* pOptions, + CFX_Matrix* pFinalMatrix) { CFX_DefaultRenderDevice device; device.Attach(pBuffer, false, nullptr, false); diff --git a/core/fpdfapi/render/cpdf_rendercontext.h b/core/fpdfapi/render/cpdf_rendercontext.h index feb71871b1..8806a78622 100644 --- a/core/fpdfapi/render/cpdf_rendercontext.h +++ b/core/fpdfapi/render/cpdf_rendercontext.h @@ -9,9 +9,9 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_coordinates.h" +#include "core/fxcrt/retain_ptr.h" class CPDF_Dictionary; class CPDF_Document; @@ -52,7 +52,7 @@ class CPDF_RenderContext { const CPDF_RenderOptions* pOptions, const CFX_Matrix* pFinalMatrix); - void GetBackground(const CFX_RetainPtr& pBuffer, + void GetBackground(const RetainPtr& pBuffer, const CPDF_PageObject* pObj, const CPDF_RenderOptions* pOptions, CFX_Matrix* pFinalMatrix); diff --git a/core/fpdfapi/render/cpdf_renderoptions.h b/core/fpdfapi/render/cpdf_renderoptions.h index aa48b4e5dc..1f6afc30e2 100644 --- a/core/fpdfapi/render/cpdf_renderoptions.h +++ b/core/fpdfapi/render/cpdf_renderoptions.h @@ -8,8 +8,8 @@ #define CORE_FPDFAPI_RENDER_CPDF_RENDEROPTIONS_H_ #include "core/fpdfdoc/cpdf_occontext.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/fx_dib.h" #define RENDER_CLEARTYPE 0x00000001 @@ -44,7 +44,7 @@ class CPDF_RenderOptions { uint32_t m_Flags; uint32_t m_dwLimitCacheSize; bool m_bDrawAnnots; - CFX_RetainPtr m_pOCContext; + RetainPtr m_pOCContext; }; #endif // CORE_FPDFAPI_RENDER_CPDF_RENDEROPTIONS_H_ diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index ef07852e38..e94913d9aa 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -100,7 +100,7 @@ uint32_t CountOutputs( return total; } -void DrawAxialShading(const CFX_RetainPtr& pBitmap, +void DrawAxialShading(const RetainPtr& pBitmap, CFX_Matrix* pObject2Bitmap, CPDF_Dictionary* pDict, const std::vector>& funcs, @@ -185,7 +185,7 @@ void DrawAxialShading(const CFX_RetainPtr& pBitmap, } } -void DrawRadialShading(const CFX_RetainPtr& pBitmap, +void DrawRadialShading(const RetainPtr& pBitmap, CFX_Matrix* pObject2Bitmap, CPDF_Dictionary* pDict, const std::vector>& funcs, @@ -317,7 +317,7 @@ void DrawRadialShading(const CFX_RetainPtr& pBitmap, } } -void DrawFuncShading(const CFX_RetainPtr& pBitmap, +void DrawFuncShading(const RetainPtr& pBitmap, CFX_Matrix* pObject2Bitmap, CPDF_Dictionary* pDict, const std::vector>& funcs, @@ -388,7 +388,7 @@ bool GetScanlineIntersect(int y, return true; } -void DrawGouraud(const CFX_RetainPtr& pBitmap, +void DrawGouraud(const RetainPtr& pBitmap, int alpha, CPDF_MeshVertex triangle[3]) { float min_y = triangle[0].position.y; @@ -470,7 +470,7 @@ void DrawGouraud(const CFX_RetainPtr& pBitmap, } void DrawFreeGouraudShading( - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, CFX_Matrix* pObject2Bitmap, CPDF_Stream* pShadingStream, const std::vector>& funcs, @@ -511,7 +511,7 @@ void DrawFreeGouraudShading( } void DrawLatticeGouraudShading( - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, CFX_Matrix* pObject2Bitmap, CPDF_Stream* pShadingStream, const std::vector>& funcs, @@ -827,7 +827,7 @@ struct CPDF_PatchDrawer { void DrawCoonPatchMeshes( ShadingType type, - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, CFX_Matrix* pObject2Bitmap, CPDF_Stream* pShadingStream, const std::vector>& funcs, @@ -911,13 +911,13 @@ void DrawCoonPatchMeshes( } } -CFX_RetainPtr DrawPatternBitmap(CPDF_Document* pDoc, - CPDF_PageRenderCache* pCache, - CPDF_TilingPattern* pPattern, - const CFX_Matrix* pObject2Device, - int width, - int height, - int flags) { +RetainPtr DrawPatternBitmap(CPDF_Document* pDoc, + CPDF_PageRenderCache* pCache, + CPDF_TilingPattern* pPattern, + const CFX_Matrix* pObject2Device, + int width, + int height, + int flags) { auto pBitmap = pdfium::MakeRetain(); if (!pBitmap->Create(width, height, pPattern->colored() ? FXDIB_Argb : FXDIB_8bppMask)) { @@ -1319,7 +1319,7 @@ bool CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj, fill_argb, stroke_argb, FillType, m_curBlend); } -CFX_RetainPtr CPDF_RenderStatus::GetTransferFunc( +RetainPtr CPDF_RenderStatus::GetTransferFunc( CPDF_Object* pObj) const { ASSERT(pObj); CPDF_DocRenderData* pDocCache = m_pContext->GetDocument()->GetRenderData(); @@ -1557,7 +1557,7 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, int width = FXSYS_round((float)rect.Width() * scaleX); int height = FXSYS_round((float)rect.Height() * scaleY); CFX_DefaultRenderDevice bitmap_device; - CFX_RetainPtr oriDevice; + RetainPtr oriDevice; if (!isolated && (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) { oriDevice = pdfium::MakeRetain(); if (!m_pDevice->CreateCompatibleBitmap(oriDevice, width, height)) @@ -1567,14 +1567,14 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, if (!bitmap_device.Create(width, height, FXDIB_Argb, oriDevice)) return true; - CFX_RetainPtr bitmap = bitmap_device.GetBitmap(); + RetainPtr bitmap = bitmap_device.GetBitmap(); bitmap->Clear(0); CFX_Matrix new_matrix = *pObj2Device; new_matrix.Translate(-rect.left, -rect.top); new_matrix.Scale(scaleX, scaleY); - CFX_RetainPtr pTextMask; + RetainPtr pTextMask; if (bTextClip) { pTextMask = pdfium::MakeRetain(); if (!pTextMask->Create(width, height, FXDIB_8bppMask)) @@ -1609,7 +1609,7 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, if (pSMaskDict) { CFX_Matrix smask_matrix = *pPageObj->m_GeneralState.GetSMaskMatrix(); smask_matrix.Concat(*pObj2Device); - CFX_RetainPtr pSMaskSource = + RetainPtr pSMaskSource = LoadSMask(pSMaskDict, &rect, &smask_matrix); if (pSMaskSource) bitmap->MultiplyAlpha(pSMaskSource); @@ -1638,7 +1638,7 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, return true; } -CFX_RetainPtr CPDF_RenderStatus::GetBackdrop( +RetainPtr CPDF_RenderStatus::GetBackdrop( const CPDF_PageObject* pObj, const FX_RECT& rect, int& left, @@ -1815,7 +1815,7 @@ bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj, &text_matrix, fill_argb, &m_Options); } -CFX_RetainPtr CPDF_RenderStatus::GetCachedType3( +RetainPtr CPDF_RenderStatus::GetCachedType3( CPDF_Type3Font* pFont) { CPDF_Document* pDoc = pFont->GetDocument(); if (!pDoc) @@ -1923,7 +1923,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, } } else if (pType3Char->m_pBitmap) { if (device_class == FXDC_DISPLAY) { - CFX_RetainPtr pCache = GetCachedType3(pType3Font); + RetainPtr pCache = GetCachedType3(pType3Font); refTypeCache.m_dwCount++; CFX_GlyphBitmap* pBitmap = pCache->LoadGlyph(charcode, &matrix, sa, sd); if (!pBitmap) @@ -2086,7 +2086,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, buffer.Initialize(m_pContext.Get(), m_pDevice, &clip_rect, m_pCurObj, 150); CFX_Matrix FinalMatrix = *pMatrix; FinalMatrix.Concat(*buffer.GetMatrix()); - CFX_RetainPtr pBitmap = buffer.GetBitmap(); + RetainPtr pBitmap = buffer.GetBitmap(); if (!pBitmap->GetBuffer()) return; @@ -2290,9 +2290,9 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, } float left_offset = cell_bbox.left - mtPattern2Device.e; float top_offset = cell_bbox.bottom - mtPattern2Device.f; - CFX_RetainPtr pPatternBitmap; + RetainPtr pPatternBitmap; if (width * height < 16) { - CFX_RetainPtr pEnlargedBitmap = + RetainPtr pEnlargedBitmap = DrawPatternBitmap(m_pContext->GetDocument(), m_pContext->GetPageCache(), pPattern, pObj2Device, 8, 8, m_Options.m_Flags); pPatternBitmap = pEnlargedBitmap->StretchTo(width, height, 0, nullptr); @@ -2409,7 +2409,7 @@ bool CPDF_RenderStatus::ProcessImage(CPDF_ImageObject* pImageObj, } void CPDF_RenderStatus::CompositeDIBitmap( - const CFX_RetainPtr& pDIBitmap, + const RetainPtr& pDIBitmap, int left, int top, FX_ARGB mask_argb, @@ -2466,10 +2466,10 @@ void CPDF_RenderStatus::CompositeDIBitmap( FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), top + pDIBitmap->GetHeight()); rect.Intersect(m_pDevice->GetClipBox()); - CFX_RetainPtr pClone; + RetainPtr pClone; if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) { pClone = m_pDevice->GetBackDrop()->Clone(&rect); - CFX_RetainPtr pForeBitmap = m_pDevice->GetBitmap(); + RetainPtr pForeBitmap = m_pDevice->GetBitmap(); pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(), pForeBitmap, rect.left, rect.top); left = left >= 0 ? 0 : left; @@ -2497,7 +2497,7 @@ void CPDF_RenderStatus::CompositeDIBitmap( int back_left, back_top; FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), top + pDIBitmap->GetHeight()); - CFX_RetainPtr pBackdrop = + RetainPtr pBackdrop = GetBackdrop(m_pCurObj, rect, back_left, back_top, blend_mode > FXDIB_BLEND_NORMAL && bIsolated); if (!pBackdrop) @@ -2523,7 +2523,7 @@ void CPDF_RenderStatus::CompositeDIBitmap( m_pDevice->SetDIBits(pBackdrop, back_left, back_top); } -CFX_RetainPtr CPDF_RenderStatus::LoadSMask( +RetainPtr CPDF_RenderStatus::LoadSMask( CPDF_Dictionary* pSMaskDict, FX_RECT* pClipRect, const CFX_Matrix* pMatrix) { diff --git a/core/fpdfapi/render/cpdf_renderstatus.h b/core/fpdfapi/render/cpdf_renderstatus.h index b4872f1d1e..b823834e7d 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.h +++ b/core/fpdfapi/render/cpdf_renderstatus.h @@ -107,7 +107,7 @@ class CPDF_RenderStatus { const CFX_Matrix* pObj2Device, bool bStroke); bool ProcessImage(CPDF_ImageObject* pImageObj, const CFX_Matrix* pObj2Device); - void CompositeDIBitmap(const CFX_RetainPtr& pDIBitmap, + void CompositeDIBitmap(const RetainPtr& pDIBitmap, int left, int top, FX_ARGB mask_argb, @@ -135,19 +135,19 @@ class CPDF_RenderStatus { bool bStroke); bool ProcessForm(const CPDF_FormObject* pFormObj, const CFX_Matrix* pObj2Device); - CFX_RetainPtr GetBackdrop(const CPDF_PageObject* pObj, - const FX_RECT& rect, - int& left, - int& top, - bool bBackAlphaRequired); - CFX_RetainPtr LoadSMask(CPDF_Dictionary* pSMaskDict, - FX_RECT* pClipRect, - const CFX_Matrix* pMatrix); - static CFX_RetainPtr GetCachedType3(CPDF_Type3Font* pFont); + RetainPtr GetBackdrop(const CPDF_PageObject* pObj, + const FX_RECT& rect, + int& left, + int& top, + bool bBackAlphaRequired); + RetainPtr LoadSMask(CPDF_Dictionary* pSMaskDict, + FX_RECT* pClipRect, + const CFX_Matrix* pMatrix); + static RetainPtr GetCachedType3(CPDF_Type3Font* pFont); static std::unique_ptr CloneObjStates( const CPDF_GraphicStates* pPathObj, bool bStroke); - CFX_RetainPtr GetTransferFunc(CPDF_Object* pObject) const; + RetainPtr GetTransferFunc(CPDF_Object* pObject) const; FX_ARGB GetFillArgb(CPDF_PageObject* pObj, bool bType3 = false) const; FX_ARGB GetStrokeArgb(CPDF_PageObject* pObj) const; bool GetObjectClippedRect(const CPDF_PageObject* pObj, diff --git a/core/fpdfapi/render/cpdf_transferfunc.cpp b/core/fpdfapi/render/cpdf_transferfunc.cpp index e9ea0576ae..98528c3c14 100644 --- a/core/fpdfapi/render/cpdf_transferfunc.cpp +++ b/core/fpdfapi/render/cpdf_transferfunc.cpp @@ -20,9 +20,9 @@ FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF rgb) const { m_Samples[512 + FXSYS_GetBValue(rgb)]); } -CFX_RetainPtr CPDF_TransferFunc::TranslateImage( - const CFX_RetainPtr& pSrc) { - CFX_RetainPtr pHolder(this); +RetainPtr CPDF_TransferFunc::TranslateImage( + const RetainPtr& pSrc) { + RetainPtr pHolder(this); auto pDest = pdfium::MakeRetain(pHolder); pDest->LoadSrc(pSrc); return pDest; diff --git a/core/fpdfapi/render/cpdf_transferfunc.h b/core/fpdfapi/render/cpdf_transferfunc.h index ad7bf28c2f..32811891ea 100644 --- a/core/fpdfapi/render/cpdf_transferfunc.h +++ b/core/fpdfapi/render/cpdf_transferfunc.h @@ -7,21 +7,20 @@ #ifndef CORE_FPDFAPI_RENDER_CPDF_TRANSFERFUNC_H_ #define CORE_FPDFAPI_RENDER_CPDF_TRANSFERFUNC_H_ -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/fx_dib.h" class CPDF_Document; class CFX_DIBSource; -class CPDF_TransferFunc : public CFX_Retainable { +class CPDF_TransferFunc : public Retainable { public: template - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr pdfium::MakeRetain(Args&&... args); FX_COLORREF TranslateColor(FX_COLORREF src) const; - CFX_RetainPtr TranslateImage( - const CFX_RetainPtr& pSrc); + RetainPtr TranslateImage(const RetainPtr& pSrc); CFX_UnownedPtr const m_pPDFDoc; bool m_bIdentity; diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp index b87b5ef74a..42b11605c5 100644 --- a/core/fpdfapi/render/cpdf_type3cache.cpp +++ b/core/fpdfapi/render/cpdf_type3cache.cpp @@ -53,8 +53,7 @@ bool IsScanLine8bpp(uint8_t* pBuf, int width) { return false; } -int DetectFirstLastScan(const CFX_RetainPtr& pBitmap, - bool bFirst) { +int DetectFirstLastScan(const RetainPtr& pBitmap, bool bFirst) { int height = pBitmap->GetHeight(); int pitch = pBitmap->GetPitch(); int width = pBitmap->GetWidth(); @@ -123,12 +122,12 @@ std::unique_ptr CPDF_Type3Cache::RenderGlyph( if (!pChar || !pChar->m_pBitmap) return nullptr; - CFX_RetainPtr pBitmap = pChar->m_pBitmap; + RetainPtr pBitmap = pChar->m_pBitmap; CFX_Matrix image_matrix = pChar->m_ImageMatrix; CFX_Matrix text_matrix(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0); image_matrix.Concat(text_matrix); - CFX_RetainPtr pResBitmap; + RetainPtr pResBitmap; int left = 0; int top = 0; if (fabs(image_matrix.b) < fabs(image_matrix.a) / 100 && diff --git a/core/fpdfapi/render/cpdf_type3cache.h b/core/fpdfapi/render/cpdf_type3cache.h index ab748ba989..fe681bbc99 100644 --- a/core/fpdfapi/render/cpdf_type3cache.h +++ b/core/fpdfapi/render/cpdf_type3cache.h @@ -11,17 +11,17 @@ #include #include "core/fpdfapi/font/cpdf_type3font.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" class CPDF_Type3Glyphs; -class CPDF_Type3Cache : public CFX_Retainable { +class CPDF_Type3Cache : public Retainable { public: template - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr pdfium::MakeRetain(Args&&... args); CFX_GlyphBitmap* LoadGlyph(uint32_t charcode, const CFX_Matrix* pMatrix, -- cgit v1.2.3