summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r--core/fpdfapi/render/cpdf_devicebuffer.cpp5
-rw-r--r--core/fpdfapi/render/cpdf_devicebuffer.h11
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.h10
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.cpp14
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.h6
-rw-r--r--core/fpdfapi/render/cpdf_rendercontext.h12
7 files changed, 33 insertions, 29 deletions
diff --git a/core/fpdfapi/render/cpdf_devicebuffer.cpp b/core/fpdfapi/render/cpdf_devicebuffer.cpp
index be87128a49..8125ea5df1 100644
--- a/core/fpdfapi/render/cpdf_devicebuffer.cpp
+++ b/core/fpdfapi/render/cpdf_devicebuffer.cpp
@@ -14,8 +14,7 @@
#include "core/fxge/fx_dib.h"
#include "third_party/base/ptr_util.h"
-CPDF_DeviceBuffer::CPDF_DeviceBuffer()
- : m_pDevice(nullptr), m_pContext(nullptr), m_pObject(nullptr) {}
+CPDF_DeviceBuffer::CPDF_DeviceBuffer() {}
CPDF_DeviceBuffer::~CPDF_DeviceBuffer() {}
@@ -68,7 +67,7 @@ void CPDF_DeviceBuffer::OutputToDevice() {
auto pBuffer = pdfium::MakeRetain<CFX_DIBitmap>();
m_pDevice->CreateCompatibleBitmap(pBuffer, m_pBitmap->GetWidth(),
m_pBitmap->GetHeight());
- m_pContext->GetBackground(pBuffer, m_pObject, nullptr, &m_Matrix);
+ m_pContext->GetBackground(pBuffer, m_pObject.Get(), nullptr, &m_Matrix);
pBuffer->CompositeBitmap(0, 0, pBuffer->GetWidth(), pBuffer->GetHeight(),
m_pBitmap, 0, 0);
m_pDevice->StretchDIBits(pBuffer, m_Rect.left, m_Rect.top, m_Rect.Width(),
diff --git a/core/fpdfapi/render/cpdf_devicebuffer.h b/core/fpdfapi/render/cpdf_devicebuffer.h
index 61cdc9776b..bfab27503b 100644
--- a/core/fpdfapi/render/cpdf_devicebuffer.h
+++ b/core/fpdfapi/render/cpdf_devicebuffer.h
@@ -9,6 +9,8 @@
#include <memory>
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
class CFX_DIBitmap;
@@ -20,6 +22,7 @@ class CPDF_DeviceBuffer {
public:
CPDF_DeviceBuffer();
~CPDF_DeviceBuffer();
+
bool Initialize(CPDF_RenderContext* pContext,
CFX_RenderDevice* pDevice,
FX_RECT* pRect,
@@ -30,11 +33,11 @@ class CPDF_DeviceBuffer {
const CFX_Matrix* GetMatrix() const { return &m_Matrix; }
private:
- CFX_RenderDevice* m_pDevice;
- CPDF_RenderContext* m_pContext;
- FX_RECT m_Rect;
- const CPDF_PageObject* m_pObject;
+ CFX_UnownedPtr<CFX_RenderDevice> m_pDevice;
+ CFX_UnownedPtr<CPDF_RenderContext> m_pContext;
+ CFX_UnownedPtr<const CPDF_PageObject> m_pObject;
CFX_RetainPtr<CFX_DIBitmap> 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 3bb91ecf1b..de4ee7401f 100644
--- a/core/fpdfapi/render/cpdf_dibsource.cpp
+++ b/core/fpdfapi/render/cpdf_dibsource.cpp
@@ -752,8 +752,8 @@ CFX_RetainPtr<CPDF_DIBSource> CPDF_DIBSource::DetachMask() {
int CPDF_DIBSource::StartLoadMaskDIB() {
m_pMask = pdfium::MakeRetain<CPDF_DIBSource>();
- int ret = m_pMask->StartLoadDIBSource(m_pDocument, m_pMaskStream, false,
- nullptr, nullptr, true);
+ int ret = m_pMask->StartLoadDIBSource(m_pDocument.Get(), m_pMaskStream.Get(),
+ false, nullptr, nullptr, true);
if (ret == 2) {
if (m_Status == 0)
m_Status = 2;
diff --git a/core/fpdfapi/render/cpdf_dibsource.h b/core/fpdfapi/render/cpdf_dibsource.h
index d0730cc4fd..50e9a038e8 100644
--- a/core/fpdfapi/render/cpdf_dibsource.h
+++ b/core/fpdfapi/render/cpdf_dibsource.h
@@ -18,6 +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/fxge/cfx_defaultrenderdevice.h"
#include "core/fxge/cfx_renderdevice.h"
@@ -119,10 +121,10 @@ class CPDF_DIBSource : public CFX_DIBSource {
int clip_width) const;
bool TransMask() const;
- CPDF_Document* m_pDocument;
- const CPDF_Stream* m_pStream;
+ CFX_UnownedPtr<CPDF_Document> m_pDocument;
+ CFX_UnownedPtr<const CPDF_Stream> m_pStream;
+ CFX_UnownedPtr<const CPDF_Dictionary> m_pDict;
CFX_RetainPtr<CPDF_StreamAcc> m_pStreamAcc;
- const CPDF_Dictionary* m_pDict;
CPDF_ColorSpace* m_pColorSpace;
uint32_t m_Family;
uint32_t m_bpc;
@@ -145,7 +147,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
CFX_RetainPtr<CPDF_StreamAcc> m_pGlobalStream;
std::unique_ptr<CCodec_ScanlineDecoder> m_pDecoder;
std::unique_ptr<CCodec_Jbig2Context> m_pJbig2Context;
- CPDF_Stream* m_pMaskStream;
+ CFX_UnownedPtr<CPDF_Stream> m_pMaskStream;
int m_Status;
};
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index 70371d847b..ff4ed9c7d9 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -59,10 +59,10 @@ bool CPDF_ImageRenderer::StartLoadDIBSource() {
if (!image_rect.Valid())
return false;
- if (m_Loader.Start(m_pImageObject,
+ if (m_Loader.Start(m_pImageObject.Get(),
m_pRenderStatus->m_pContext->GetPageCache(), m_bStdCS,
m_pRenderStatus->m_GroupFamily,
- m_pRenderStatus->m_bLoadMask, m_pRenderStatus)) {
+ m_pRenderStatus->m_bLoadMask, m_pRenderStatus.Get())) {
m_Status = 4;
return true;
}
@@ -102,7 +102,7 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() {
if (m_pPattern)
m_bPatternColor = true;
}
- m_FillArgb = m_pRenderStatus->GetFillArgb(m_pImageObject);
+ m_FillArgb = m_pRenderStatus->GetFillArgb(m_pImageObject.Get());
} else if (m_pRenderStatus->m_Options.m_ColorMode == RENDER_COLOR_GRAY) {
m_pClone = m_pDIBSource->Clone(nullptr);
m_pClone->ConvertColorScale(m_pRenderStatus->m_Options.m_BackColor,
@@ -127,7 +127,7 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() {
return DrawMaskedImage();
if (m_bPatternColor)
- return DrawPatternImage(m_pObj2Device);
+ return DrawPatternImage(m_pObj2Device.Get());
if (m_BitmapAlpha != 255 || !state.HasRef() || !state.GetFillOP() ||
state.GetOPMode() != 0 || state.GetBlendType() != FXDIB_BLEND_NORMAL ||
@@ -284,11 +284,11 @@ bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) {
patternDevice.Translate(static_cast<float>(-rect.left),
static_cast<float>(-rect.top));
if (CPDF_TilingPattern* pTilingPattern = m_pPattern->AsTilingPattern()) {
- bitmap_render.DrawTilingPattern(pTilingPattern, m_pImageObject,
+ bitmap_render.DrawTilingPattern(pTilingPattern, m_pImageObject.Get(),
&patternDevice, false);
} else if (CPDF_ShadingPattern* pShadingPattern =
m_pPattern->AsShadingPattern()) {
- bitmap_render.DrawShadingPattern(pShadingPattern, m_pImageObject,
+ bitmap_render.DrawShadingPattern(pShadingPattern, m_pImageObject.Get(),
&patternDevice, false);
}
@@ -539,7 +539,7 @@ bool CPDF_ImageRenderer::Continue(IFX_Pause* pPause) {
pPause);
if (m_Status == 4) {
- if (m_Loader.Continue(pPause, m_pRenderStatus))
+ if (m_Loader.Continue(pPause, m_pRenderStatus.Get()))
return true;
if (StartRenderDIBSource())
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.h b/core/fpdfapi/render/cpdf_imagerenderer.h
index 4468b470d9..bf73098cde 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.h
+++ b/core/fpdfapi/render/cpdf_imagerenderer.h
@@ -62,10 +62,10 @@ class CPDF_ImageRenderer {
const FX_RECT& rect) const;
void HandleFilters();
- CPDF_RenderStatus* m_pRenderStatus;
- CPDF_ImageObject* m_pImageObject;
+ CFX_UnownedPtr<CPDF_RenderStatus> m_pRenderStatus;
+ CFX_UnownedPtr<CPDF_ImageObject> m_pImageObject;
int m_Status;
- const CFX_Matrix* m_pObj2Device;
+ CFX_UnownedPtr<const CFX_Matrix> m_pObj2Device;
CFX_Matrix m_ImageMatrix;
CPDF_ImageLoader m_Loader;
CFX_RetainPtr<CFX_DIBSource> m_pDIBSource;
diff --git a/core/fpdfapi/render/cpdf_rendercontext.h b/core/fpdfapi/render/cpdf_rendercontext.h
index 0cce1ae77e..4980d37ed6 100644
--- a/core/fpdfapi/render/cpdf_rendercontext.h
+++ b/core/fpdfapi/render/cpdf_rendercontext.h
@@ -55,14 +55,14 @@ class CPDF_RenderContext {
size_t CountLayers() const { return m_Layers.size(); }
Layer* GetLayer(uint32_t index) { return &m_Layers[index]; }
- CPDF_Document* GetDocument() const { return m_pDocument; }
- CPDF_Dictionary* GetPageResources() const { return m_pPageResources; }
- CPDF_PageRenderCache* GetPageCache() const { return m_pPageCache; }
+ CPDF_Document* GetDocument() const { return m_pDocument.Get(); }
+ CPDF_Dictionary* GetPageResources() const { return m_pPageResources.Get(); }
+ CPDF_PageRenderCache* GetPageCache() const { return m_pPageCache.Get(); }
protected:
- CPDF_Document* const m_pDocument;
- CPDF_Dictionary* m_pPageResources;
- CPDF_PageRenderCache* m_pPageCache;
+ CFX_UnownedPtr<CPDF_Document> const m_pDocument;
+ CFX_UnownedPtr<CPDF_Dictionary> m_pPageResources;
+ CFX_UnownedPtr<CPDF_PageRenderCache> m_pPageCache;
std::vector<Layer> m_Layers;
};