summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-01-30 10:04:07 -0800
committerChromium commit bot <commit-bot@chromium.org>2017-01-30 18:46:09 +0000
commitf716f0bd85cabfa02cea1d092890a0dea67ef0e3 (patch)
tree78c46e5ce93774bdb8ef3de2e3475acd9ecb44bd /core/fpdfapi/render
parent4ada364e183e05479bc45d2ce41700ae18b7f6a3 (diff)
downloadpdfium-f716f0bd85cabfa02cea1d092890a0dea67ef0e3.tar.xz
Refcount CPDF_OCContext.
Avoids explicit deletes through CPDF_RenderOptions holding pointers to it which may have been copy constructed. Ick. Change-Id: Ic044b66d13bd7c5eaa53de995373858081e115ec Reviewed-on: https://pdfium-review.googlesource.com/2451 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r--core/fpdfapi/render/cpdf_renderoptions.cpp7
-rw-r--r--core/fpdfapi/render/cpdf_renderoptions.h8
2 files changed, 9 insertions, 6 deletions
diff --git a/core/fpdfapi/render/cpdf_renderoptions.cpp b/core/fpdfapi/render/cpdf_renderoptions.cpp
index ea11d7f5ee..717e036fea 100644
--- a/core/fpdfapi/render/cpdf_renderoptions.cpp
+++ b/core/fpdfapi/render/cpdf_renderoptions.cpp
@@ -11,7 +11,6 @@ CPDF_RenderOptions::CPDF_RenderOptions()
m_Flags(RENDER_CLEARTYPE),
m_Interpolation(0),
m_AddFlags(0),
- m_pOCContext(nullptr),
m_dwLimitCacheSize(1024 * 1024 * 100),
m_HalftoneLimit(-1),
m_bDrawAnnots(false) {}
@@ -23,10 +22,12 @@ CPDF_RenderOptions::CPDF_RenderOptions(const CPDF_RenderOptions& rhs)
m_Flags(rhs.m_Flags),
m_Interpolation(rhs.m_Interpolation),
m_AddFlags(rhs.m_AddFlags),
- m_pOCContext(rhs.m_pOCContext),
m_dwLimitCacheSize(rhs.m_dwLimitCacheSize),
m_HalftoneLimit(rhs.m_HalftoneLimit),
- m_bDrawAnnots(rhs.m_bDrawAnnots) {}
+ m_bDrawAnnots(rhs.m_bDrawAnnots),
+ m_pOCContext(rhs.m_pOCContext) {}
+
+CPDF_RenderOptions::~CPDF_RenderOptions() {}
FX_ARGB CPDF_RenderOptions::TranslateColor(FX_ARGB argb) const {
if (m_ColorMode == RENDER_COLOR_NORMAL)
diff --git a/core/fpdfapi/render/cpdf_renderoptions.h b/core/fpdfapi/render/cpdf_renderoptions.h
index 95651d9d7f..b934941d00 100644
--- a/core/fpdfapi/render/cpdf_renderoptions.h
+++ b/core/fpdfapi/render/cpdf_renderoptions.h
@@ -7,11 +7,11 @@
#ifndef CORE_FPDFAPI_RENDER_CPDF_RENDEROPTIONS_H_
#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/fxge/fx_dib.h"
-class CPDF_OCContext;
-
#define RENDER_COLOR_NORMAL 0
#define RENDER_COLOR_GRAY 1
#define RENDER_COLOR_TWOCOLOR 2
@@ -37,6 +37,8 @@ class CPDF_RenderOptions {
public:
CPDF_RenderOptions();
CPDF_RenderOptions(const CPDF_RenderOptions& rhs);
+ ~CPDF_RenderOptions();
+
FX_ARGB TranslateColor(FX_ARGB argb) const;
int m_ColorMode;
@@ -45,10 +47,10 @@ class CPDF_RenderOptions {
uint32_t m_Flags;
int m_Interpolation;
uint32_t m_AddFlags;
- CPDF_OCContext* m_pOCContext;
uint32_t m_dwLimitCacheSize;
int m_HalftoneLimit;
bool m_bDrawAnnots;
+ CFX_RetainPtr<CPDF_OCContext> m_pOCContext;
};
#endif // CORE_FPDFAPI_RENDER_CPDF_RENDEROPTIONS_H_