diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-05-25 15:53:57 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-25 23:07:41 +0000 |
commit | d0409afc6a994a3e24043b8a96c83c022bcaa189 (patch) | |
tree | 15fa78b8a601ec97fc8bee39f8e56590c37babe3 /core/fpdfapi/render | |
parent | 2eddb665763f3e089d4c210d2a011d112683f3ea (diff) | |
download | pdfium-d0409afc6a994a3e24043b8a96c83c022bcaa189.tar.xz |
Mass conversion of remaining class members (non-xfa)
Change-Id: I8365ba80e3395d59a3cf35dbd9d9162e86e712e3
Reviewed-on: https://pdfium-review.googlesource.com/5970
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r-- | core/fpdfapi/render/cpdf_imageloader.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_imageloader.h | 5 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_imagerenderer.cpp | 8 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_imagerenderer.h | 3 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_pagerendercache.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_rendercontext.cpp | 10 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_rendercontext.h | 7 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.cpp | 35 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.h | 11 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_scaledrenderbuffer.h | 12 |
11 files changed, 60 insertions, 43 deletions
diff --git a/core/fpdfapi/render/cpdf_imageloader.cpp b/core/fpdfapi/render/cpdf_imageloader.cpp index 53b6009c15..b09b919baa 100644 --- a/core/fpdfapi/render/cpdf_imageloader.cpp +++ b/core/fpdfapi/render/cpdf_imageloader.cpp @@ -36,8 +36,8 @@ bool CPDF_ImageLoader::Start(const CPDF_ImageObject* pImage, GroupFamily, bLoadMask, pRenderStatus); } else { ret = m_pImageObject->GetImage()->StartLoadDIBSource( - pRenderStatus->m_pFormResource, pRenderStatus->m_pPageResource, bStdCS, - GroupFamily, bLoadMask); + pRenderStatus->m_pFormResource.Get(), + pRenderStatus->m_pPageResource.Get(), bStdCS, GroupFamily, bLoadMask); } if (!ret) HandleFailure(); diff --git a/core/fpdfapi/render/cpdf_imageloader.h b/core/fpdfapi/render/cpdf_imageloader.h index f17f29cce5..47dd2f9812 100644 --- a/core/fpdfapi/render/cpdf_imageloader.h +++ b/core/fpdfapi/render/cpdf_imageloader.h @@ -9,6 +9,7 @@ #include <memory> +#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_basic.h" #include "core/fxge/fx_dib.h" @@ -37,8 +38,8 @@ class CPDF_ImageLoader { private: void HandleFailure(); - CPDF_PageRenderCache* m_pCache; - CPDF_ImageObject* m_pImageObject; + CFX_UnownedPtr<CPDF_PageRenderCache> m_pCache; + CFX_UnownedPtr<CPDF_ImageObject> m_pImageObject; }; #endif // CORE_FPDFAPI_RENDER_CPDF_IMAGELOADER_H_ diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp index ff4ed9c7d9..716203a7a5 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.cpp +++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp @@ -225,8 +225,8 @@ void CPDF_ImageRenderer::CalculateDrawImage( CFX_Matrix* pNewMatrix, const FX_RECT& rect) const { CPDF_RenderStatus bitmap_render; - bitmap_render.Initialize(m_pRenderStatus->m_pContext, pBitmapDevice2, nullptr, - nullptr, nullptr, nullptr, nullptr, 0, + bitmap_render.Initialize(m_pRenderStatus->m_pContext.Get(), pBitmapDevice2, + nullptr, nullptr, nullptr, nullptr, nullptr, 0, m_pRenderStatus->m_bDropObjects, nullptr, true); CPDF_ImageRenderer image_render; if (image_render.Start(&bitmap_render, pDIBSource, 0xffffffff, 255, @@ -276,7 +276,7 @@ bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { bitmap_device1.GetBitmap()->Clear(0xffffff); CPDF_RenderStatus bitmap_render; - bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, + bitmap_render.Initialize(m_pRenderStatus->m_pContext.Get(), &bitmap_device1, nullptr, nullptr, nullptr, nullptr, &m_pRenderStatus->m_Options, 0, m_pRenderStatus->m_bDropObjects, nullptr, true); @@ -329,7 +329,7 @@ bool CPDF_ImageRenderer::DrawMaskedImage() { bitmap_device1.GetBitmap()->Clear(0xffffff); #endif CPDF_RenderStatus bitmap_render; - bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, + bitmap_render.Initialize(m_pRenderStatus->m_pContext.Get(), &bitmap_device1, nullptr, nullptr, nullptr, nullptr, nullptr, 0, m_pRenderStatus->m_bDropObjects, nullptr, true); CPDF_ImageRenderer image_render; diff --git a/core/fpdfapi/render/cpdf_imagerenderer.h b/core/fpdfapi/render/cpdf_imagerenderer.h index bf73098cde..46159284b2 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.h +++ b/core/fpdfapi/render/cpdf_imagerenderer.h @@ -10,6 +10,7 @@ #include <memory> #include "core/fpdfapi/render/cpdf_imageloader.h" +#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxge/dib/cfx_imagerenderer.h" @@ -72,7 +73,7 @@ class CPDF_ImageRenderer { CFX_RetainPtr<CFX_DIBitmap> m_pClone; int m_BitmapAlpha; bool m_bPatternColor; - CPDF_Pattern* m_pPattern; + CFX_UnownedPtr<CPDF_Pattern> m_pPattern; FX_ARGB m_FillArgb; uint32_t m_Flags; std::unique_ptr<CFX_ImageTransformer> m_pTransformer; diff --git a/core/fpdfapi/render/cpdf_pagerendercache.cpp b/core/fpdfapi/render/cpdf_pagerendercache.cpp index a997e34906..455b7f5ddb 100644 --- a/core/fpdfapi/render/cpdf_pagerendercache.cpp +++ b/core/fpdfapi/render/cpdf_pagerendercache.cpp @@ -95,8 +95,8 @@ bool CPDF_PageRenderCache::StartGetCachedBitmap( new CPDF_ImageCacheEntry(m_pPage->m_pDocument.Get(), pImage); } int ret = m_pCurImageCacheEntry->StartGetCachedBitmap( - pRenderStatus->m_pFormResource, m_pPage->m_pPageResources.Get(), bStdCS, - GroupFamily, bLoadMask, pRenderStatus); + pRenderStatus->m_pFormResource.Get(), m_pPage->m_pPageResources.Get(), + bStdCS, GroupFamily, bLoadMask, pRenderStatus); if (ret == 2) return true; diff --git a/core/fpdfapi/render/cpdf_rendercontext.cpp b/core/fpdfapi/render/cpdf_rendercontext.cpp index 2cd59cac18..dec513276d 100644 --- a/core/fpdfapi/render/cpdf_rendercontext.cpp +++ b/core/fpdfapi/render/cpdf_rendercontext.cpp @@ -72,12 +72,12 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, status.Initialize(this, pDevice, pLastMatrix, pStopObj, nullptr, nullptr, pOptions, layer.m_pObjectHolder->m_Transparency, false, nullptr); - status.RenderObjectList(layer.m_pObjectHolder, &FinalMatrix); + status.RenderObjectList(layer.m_pObjectHolder.Get(), &FinalMatrix); } else { status.Initialize(this, pDevice, nullptr, pStopObj, nullptr, nullptr, pOptions, layer.m_pObjectHolder->m_Transparency, false, nullptr); - status.RenderObjectList(layer.m_pObjectHolder, &layer.m_Matrix); + status.RenderObjectList(layer.m_pObjectHolder.Get(), &layer.m_Matrix); } if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize); @@ -85,3 +85,9 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, break; } } + +CPDF_RenderContext::Layer::Layer() {} + +CPDF_RenderContext::Layer::Layer(const Layer& that) = default; + +CPDF_RenderContext::Layer::~Layer() {} diff --git a/core/fpdfapi/render/cpdf_rendercontext.h b/core/fpdfapi/render/cpdf_rendercontext.h index 4980d37ed6..220ff2b775 100644 --- a/core/fpdfapi/render/cpdf_rendercontext.h +++ b/core/fpdfapi/render/cpdf_rendercontext.h @@ -9,6 +9,7 @@ #include <vector> +#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_basic.h" #include "core/fxcrt/fx_coordinates.h" @@ -27,7 +28,11 @@ class CPDF_RenderContext { public: class Layer { public: - CPDF_PageObjectHolder* m_pObjectHolder; + Layer(); + Layer(const Layer& that); + ~Layer(); + + CFX_UnownedPtr<CPDF_PageObjectHolder> m_pObjectHolder; CFX_Matrix m_Matrix; }; diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 7c17ff56b4..beeca3febe 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -1235,7 +1235,8 @@ void CPDF_RenderStatus::DrawObjWithBackground(CPDF_PageObject* pObj, res = 0; } CPDF_ScaledRenderBuffer buffer; - if (!buffer.Initialize(m_pContext, m_pDevice, rect, pObj, &m_Options, res)) { + if (!buffer.Initialize(m_pContext.Get(), m_pDevice, rect, pObj, &m_Options, + res)) { return; } CFX_Matrix matrix = *pObj2Device; @@ -1249,8 +1250,8 @@ void CPDF_RenderStatus::DrawObjWithBackground(CPDF_PageObject* pObj, } } CPDF_RenderStatus status; - status.Initialize(m_pContext, buffer.GetDevice(), buffer.GetMatrix(), nullptr, - nullptr, nullptr, &m_Options, m_Transparency, + status.Initialize(m_pContext.Get(), buffer.GetDevice(), buffer.GetMatrix(), + nullptr, nullptr, nullptr, &m_Options, m_Transparency, m_bDropObjects, pFormResource); status.RenderSingleObject(pObj, &matrix); buffer.OutputToDevice(); @@ -1273,9 +1274,9 @@ bool CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj, pResources = pFormObj->m_pForm->m_pFormDict->GetDictFor("Resources"); } CPDF_RenderStatus status; - status.Initialize(m_pContext, m_pDevice, nullptr, m_pStopObj, this, pFormObj, - &m_Options, m_Transparency, m_bDropObjects, pResources, - false); + status.Initialize(m_pContext.Get(), m_pDevice, nullptr, m_pStopObj, this, + pFormObj, &m_Options, m_Transparency, m_bDropObjects, + pResources, false); status.m_curBlend = m_curBlend; { CFX_RenderDevice::StateRestorer restorer(m_pDevice); @@ -1605,9 +1606,9 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, } } CPDF_RenderStatus bitmap_render; - bitmap_render.Initialize(m_pContext, &bitmap_device, nullptr, m_pStopObj, - nullptr, nullptr, &m_Options, 0, m_bDropObjects, - pFormResource, true); + bitmap_render.Initialize(m_pContext.Get(), &bitmap_device, nullptr, + m_pStopObj, nullptr, nullptr, &m_Options, 0, + m_bDropObjects, pFormResource, true); bitmap_render.ProcessObjectNoClip(pPageObj, &new_matrix); #if defined _SKIA_SUPPORT_PATHS_ bitmap_device.Flush(); @@ -1871,7 +1872,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, matrix.e += iChar ? textobj->m_CharPos[iChar - 1] : 0; matrix.Concat(text_matrix); matrix.Concat(*pObj2Device); - if (!pType3Char->LoadBitmap(m_pContext)) { + if (!pType3Char->LoadBitmap(m_pContext.Get())) { if (!glyphs.empty()) { for (int i = 0; i < iChar; i++) { const FXTEXT_GLYPHPOS& glyph = glyphs[i]; @@ -1897,7 +1898,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, } if (fill_alpha == 255) { CPDF_RenderStatus status; - status.Initialize(m_pContext, m_pDevice, nullptr, nullptr, this, + status.Initialize(m_pContext.Get(), m_pDevice, nullptr, nullptr, this, pStates.get(), &Options, pType3Char->m_pForm->m_Transparency, m_bDropObjects, pFormResource, false, pType3Char, fill_argb); @@ -1919,8 +1920,8 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, } bitmap_device.GetBitmap()->Clear(0); CPDF_RenderStatus status; - status.Initialize(m_pContext, &bitmap_device, nullptr, nullptr, this, - pStates.get(), &Options, + status.Initialize(m_pContext.Get(), &bitmap_device, nullptr, nullptr, + this, pStates.get(), &Options, pType3Char->m_pForm->m_Transparency, m_bDropObjects, pFormResource, false, pType3Char, fill_argb); status.m_Type3FontCache = m_Type3FontCache; @@ -2093,7 +2094,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, return; } CPDF_DeviceBuffer buffer; - buffer.Initialize(m_pContext, m_pDevice, &clip_rect, m_pCurObj, 150); + buffer.Initialize(m_pContext.Get(), m_pDevice, &clip_rect, m_pCurObj, 150); CFX_Matrix FinalMatrix = *pMatrix; FinalMatrix.Concat(*buffer.GetMatrix()); CFX_RetainPtr<CFX_DIBitmap> pBitmap = buffer.GetBitmap(); @@ -2190,7 +2191,7 @@ void CPDF_RenderStatus::ProcessShading(const CPDF_ShadingObject* pShadingObj, CFX_Matrix matrix = pShadingObj->m_Matrix; matrix.Concat(*pObj2Device); - DrawShading(pShadingObj->m_pShading, &matrix, rect, + DrawShading(pShadingObj->m_pShading.Get(), &matrix, rect, FXSYS_round(255 * pShadingObj->m_GeneralState.GetFillAlpha()), m_Options.m_ColorMode == RENDER_COLOR_ALPHA); } @@ -2276,7 +2277,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, original.y - mtPattern2Device.f); CFX_RenderDevice::StateRestorer restorer2(m_pDevice); CPDF_RenderStatus status; - status.Initialize(m_pContext, m_pDevice, nullptr, nullptr, this, + status.Initialize(m_pContext.Get(), m_pDevice, nullptr, nullptr, this, pStates.get(), &m_Options, pPattern->form()->m_Transparency, m_bDropObjects, pFormResource); @@ -2628,7 +2629,7 @@ CFX_RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask( CPDF_RenderOptions options; options.m_ColorMode = bLuminosity ? RENDER_COLOR_NORMAL : RENDER_COLOR_ALPHA; CPDF_RenderStatus status; - status.Initialize(m_pContext, &bitmap_device, nullptr, nullptr, nullptr, + status.Initialize(m_pContext.Get(), &bitmap_device, nullptr, nullptr, nullptr, nullptr, &options, 0, m_bDropObjects, pFormResource, true, nullptr, 0, color_space_family, bLuminosity); status.RenderObjectList(&form, &matrix); diff --git a/core/fpdfapi/render/cpdf_renderstatus.h b/core/fpdfapi/render/cpdf_renderstatus.h index ab5ddd9f0d..47fbac8a7c 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.h +++ b/core/fpdfapi/render/cpdf_renderstatus.h @@ -13,6 +13,7 @@ #include "core/fpdfapi/page/cpdf_clippath.h" #include "core/fpdfapi/page/cpdf_graphicstates.h" #include "core/fpdfapi/render/cpdf_renderoptions.h" +#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxge/cfx_renderdevice.h" class CFX_PathData; @@ -61,15 +62,15 @@ class CPDF_RenderStatus { bool ContinueSingleObject(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device, IFX_Pause* pPause); - CPDF_RenderContext* GetContext() { return m_pContext; } + CPDF_RenderContext* GetContext() const { return m_pContext.Get(); } #if defined _SKIA_SUPPORT_ void DebugVerifyDeviceIsPreMultiplied() const; #endif CPDF_RenderOptions m_Options; - CPDF_Dictionary* m_pFormResource; - CPDF_Dictionary* m_pPageResource; + CFX_UnownedPtr<CPDF_Dictionary> m_pFormResource; + CFX_UnownedPtr<CPDF_Dictionary> m_pPageResource; std::vector<CPDF_Type3Font*> m_Type3FontCache; private: @@ -157,7 +158,7 @@ class CPDF_RenderStatus { static const int kRenderMaxRecursionDepth = 64; static int s_CurrentRecursionDepth; - CPDF_RenderContext* m_pContext; + CFX_UnownedPtr<CPDF_RenderContext> m_pContext; bool m_bStopped; CFX_RenderDevice* m_pDevice; CFX_Matrix m_DeviceMatrix; @@ -172,7 +173,7 @@ class CPDF_RenderStatus { bool m_bStdCS; uint32_t m_GroupFamily; bool m_bLoadMask; - CPDF_Type3Char* m_pType3Char; + CFX_UnownedPtr<CPDF_Type3Char> m_pType3Char; FX_ARGB m_T3FillColor; int m_curBlend; }; diff --git a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp index 74d506c05c..17e33af3b1 100644 --- a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp +++ b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp @@ -67,8 +67,8 @@ bool CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, } m_Matrix.Scale(0.5f, 0.5f); } - m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions, - &m_Matrix); + m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject.Get(), + pOptions, &m_Matrix); return true; } diff --git a/core/fpdfapi/render/cpdf_scaledrenderbuffer.h b/core/fpdfapi/render/cpdf_scaledrenderbuffer.h index 92fabefbee..47ab5ad39f 100644 --- a/core/fpdfapi/render/cpdf_scaledrenderbuffer.h +++ b/core/fpdfapi/render/cpdf_scaledrenderbuffer.h @@ -9,6 +9,7 @@ #include <memory> +#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxge/cfx_defaultrenderdevice.h" @@ -28,17 +29,18 @@ class CPDF_ScaledRenderBuffer { const CPDF_PageObject* pObj, const CPDF_RenderOptions* pOptions, int max_dpi); - CFX_RenderDevice* GetDevice() { - return m_pBitmapDevice ? m_pBitmapDevice.get() : m_pDevice; + + CFX_RenderDevice* GetDevice() const { + return m_pBitmapDevice ? m_pBitmapDevice.get() : m_pDevice.Get(); } CFX_Matrix* GetMatrix() { return &m_Matrix; } void OutputToDevice(); private: - CFX_RenderDevice* m_pDevice; - CPDF_RenderContext* m_pContext; + CFX_UnownedPtr<CFX_RenderDevice> m_pDevice; + CFX_UnownedPtr<CPDF_RenderContext> m_pContext; FX_RECT m_Rect; - const CPDF_PageObject* m_pObject; + CFX_UnownedPtr<const CPDF_PageObject> m_pObject; std::unique_ptr<CFX_DefaultRenderDevice> m_pBitmapDevice; CFX_Matrix m_Matrix; }; |