summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-25 15:53:57 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-25 23:07:41 +0000
commitd0409afc6a994a3e24043b8a96c83c022bcaa189 (patch)
tree15fa78b8a601ec97fc8bee39f8e56590c37babe3 /core
parent2eddb665763f3e089d4c210d2a011d112683f3ea (diff)
downloadpdfium-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')
-rw-r--r--core/fpdfapi/cmaps/fpdf_cmaps.cpp2
-rw-r--r--core/fpdfapi/font/font_int.h5
-rw-r--r--core/fpdfapi/page/cpdf_color.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_shadingobject.h3
-rw-r--r--core/fpdfapi/page/cpdf_shadingpattern.h6
-rw-r--r--core/fpdfapi/parser/cfdf_document.h5
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.h3
-rw-r--r--core/fpdfapi/parser/cpdf_object_unittest.cpp26
-rw-r--r--core/fpdfapi/render/cpdf_imageloader.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_imageloader.h5
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.cpp8
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.h3
-rw-r--r--core/fpdfapi/render/cpdf_pagerendercache.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_rendercontext.cpp10
-rw-r--r--core/fpdfapi/render/cpdf_rendercontext.h7
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp35
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.h11
-rw-r--r--core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_scaledrenderbuffer.h12
-rw-r--r--core/fpdfdoc/cpdf_formfield.cpp2
-rw-r--r--core/fpdfdoc/cpdf_formfield.h4
-rw-r--r--core/fpdfdoc/cpdf_interform.cpp2
-rw-r--r--core/fpdfdoc/cpdf_interform.h5
-rw-r--r--core/fpdfdoc/cpdf_link.cpp8
-rw-r--r--core/fpdfdoc/cpdf_link.h12
-rw-r--r--core/fpdftext/cpdf_textpage.cpp12
-rw-r--r--core/fpdftext/cpdf_textpage.h6
-rw-r--r--core/fxcodec/codec/ccodec_jbig2module.h3
-rw-r--r--core/fxcodec/codec/ccodec_progressivedecoder.h5
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp14
-rw-r--r--core/fxcodec/jbig2/JBig2_GrdProc.cpp34
-rw-r--r--core/fxcodec/jbig2/JBig2_GrdProc.h4
-rw-r--r--core/fxcodec/lgif/cgifcontext.h3
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp2
-rw-r--r--core/fxge/android/cfpf_skiafont.h5
-rw-r--r--core/fxge/android/cfx_androidfontinfo.h3
-rw-r--r--core/fxge/cfx_facecache.h3
-rw-r--r--core/fxge/cfx_renderdevice.h9
-rw-r--r--core/fxge/dib/cfx_bitmapcomposer.h3
-rw-r--r--core/fxge/dib/cfx_imagerenderer.cpp4
-rw-r--r--core/fxge/dib/cfx_imagerenderer.h3
-rw-r--r--core/fxge/dib/cstretchengine.h3
-rw-r--r--core/fxge/ge/cfx_facecache.cpp4
-rw-r--r--core/fxge/ge/cfx_folderfontinfo.h3
-rw-r--r--core/fxge/ge/cfx_font.cpp4
-rw-r--r--core/fxge/ge/cfx_renderdevice.cpp9
-rw-r--r--core/fxge/skia/fx_skia_device.cpp6
-rw-r--r--core/fxge/win32/cfx_psrenderer.cpp2
-rw-r--r--core/fxge/win32/fx_win32_device.cpp2
50 files changed, 203 insertions, 133 deletions
diff --git a/core/fpdfapi/cmaps/fpdf_cmaps.cpp b/core/fpdfapi/cmaps/fpdf_cmaps.cpp
index cb2f09fb3c..13aec268ae 100644
--- a/core/fpdfapi/cmaps/fpdf_cmaps.cpp
+++ b/core/fpdfapi/cmaps/fpdf_cmaps.cpp
@@ -61,7 +61,7 @@ void FPDFAPI_FindEmbeddedCMap(const CFX_ByteString& bsName,
CPDF_FontGlobals* pFontGlobals =
CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
const FXCMAP_CMap* pCMaps =
- pFontGlobals->m_EmbeddedCharsets[charset].m_pMapList;
+ pFontGlobals->m_EmbeddedCharsets[charset].m_pMapList.Get();
for (uint32_t i = 0; i < pFontGlobals->m_EmbeddedCharsets[charset].m_Count;
i++) {
if (bsName == pCMaps[i].m_Name) {
diff --git a/core/fpdfapi/font/font_int.h b/core/fpdfapi/font/font_int.h
index ebd08e258a..5544a1b016 100644
--- a/core/fpdfapi/font/font_int.h
+++ b/core/fpdfapi/font/font_int.h
@@ -14,6 +14,7 @@
#include "core/fpdfapi/font/cpdf_cidfont.h"
#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_basic.h"
class CPDF_CID2UnicodeMap;
@@ -194,7 +195,7 @@ class CPDF_ToUnicodeMap {
uint32_t GetUnicode();
std::map<uint32_t, uint32_t> m_Map;
- CPDF_CID2UnicodeMap* m_pBaseMap;
+ CFX_UnownedPtr<CPDF_CID2UnicodeMap> m_pBaseMap;
CFX_WideTextBuf m_MultiCharBuf;
};
@@ -213,7 +214,7 @@ class CPDF_FontGlobals {
CPDF_CMapManager m_CMapManager;
struct {
- const FXCMAP_CMap* m_pMapList;
+ CFX_UnownedPtr<const FXCMAP_CMap> m_pMapList;
uint32_t m_Count;
} m_EmbeddedCharsets[CIDSET_NUM_SETS];
struct {
diff --git a/core/fpdfapi/page/cpdf_color.cpp b/core/fpdfapi/page/cpdf_color.cpp
index e6665c83ac..747e6844ec 100644
--- a/core/fpdfapi/page/cpdf_color.cpp
+++ b/core/fpdfapi/page/cpdf_color.cpp
@@ -160,6 +160,6 @@ CPDF_Pattern* CPDF_Color::GetPattern() const {
if (!m_pBuffer || m_pCS->GetFamily() != PDFCS_PATTERN)
return nullptr;
- PatternValue* pvalue = (PatternValue*)m_pBuffer;
+ PatternValue* pvalue = reinterpret_cast<PatternValue*>(m_pBuffer);
return pvalue->m_pPattern;
}
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index 345180f368..90ef8944d3 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -190,7 +190,7 @@ class CPDF_IndexedCS : public CPDF_ColorSpace {
void EnableStdConversion(bool bEnabled) override;
CPDF_ColorSpace* m_pBaseCS;
- CPDF_CountedColorSpace* m_pCountedBaseCS;
+ CFX_UnownedPtr<CPDF_CountedColorSpace> m_pCountedBaseCS;
int m_nBaseComponents;
int m_MaxIndex;
CFX_ByteString m_Table;
diff --git a/core/fpdfapi/page/cpdf_shadingobject.h b/core/fpdfapi/page/cpdf_shadingobject.h
index ffd622379e..9db6712824 100644
--- a/core/fpdfapi/page/cpdf_shadingobject.h
+++ b/core/fpdfapi/page/cpdf_shadingobject.h
@@ -8,6 +8,7 @@
#define CORE_FPDFAPI_PAGE_CPDF_SHADINGOBJECT_H_
#include "core/fpdfapi/page/cpdf_pageobject.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
class CPDF_ShadingPattern;
@@ -26,7 +27,7 @@ class CPDF_ShadingObject : public CPDF_PageObject {
void CalcBoundingBox();
- CPDF_ShadingPattern* m_pShading;
+ CFX_UnownedPtr<CPDF_ShadingPattern> m_pShading;
CFX_Matrix m_Matrix;
};
diff --git a/core/fpdfapi/page/cpdf_shadingpattern.h b/core/fpdfapi/page/cpdf_shadingpattern.h
index 068d772bc3..24ad4c200e 100644
--- a/core/fpdfapi/page/cpdf_shadingpattern.h
+++ b/core/fpdfapi/page/cpdf_shadingpattern.h
@@ -55,7 +55,7 @@ class CPDF_ShadingPattern : public CPDF_Pattern {
ShadingType GetShadingType() const { return m_ShadingType; }
bool IsShadingObject() const { return m_bShadingObj; }
CPDF_Object* GetShadingObject() const { return m_pShadingObj.Get(); }
- CPDF_ColorSpace* GetCS() const { return m_pCS; }
+ CPDF_ColorSpace* GetCS() const { return m_pCS.Get(); }
const std::vector<std::unique_ptr<CPDF_Function>>& GetFuncs() const {
return m_pFunctions;
}
@@ -67,9 +67,9 @@ class CPDF_ShadingPattern : public CPDF_Pattern {
// Still keep |m_pCS| as some CPDF_ColorSpace (name object) are not managed
// as counted objects. Refer to CPDF_DocPageData::GetColorSpace.
- CPDF_ColorSpace* m_pCS;
+ CFX_UnownedPtr<CPDF_ColorSpace> m_pCS;
- CPDF_CountedColorSpace* m_pCountedCS;
+ CFX_UnownedPtr<CPDF_CountedColorSpace> m_pCountedCS;
std::vector<std::unique_ptr<CPDF_Function>> m_pFunctions;
};
diff --git a/core/fpdfapi/parser/cfdf_document.h b/core/fpdfapi/parser/cfdf_document.h
index f83adc1a30..9a13877544 100644
--- a/core/fpdfapi/parser/cfdf_document.h
+++ b/core/fpdfapi/parser/cfdf_document.h
@@ -11,6 +11,7 @@
#include "core/fpdfapi/parser/cpdf_indirect_object_holder.h"
#include "core/fpdfapi/parser/cpdf_object.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_basic.h"
class CPDF_Dictionary;
@@ -27,12 +28,12 @@ class CFDF_Document : public CPDF_IndirectObjectHolder {
~CFDF_Document() override;
bool WriteBuf(CFX_ByteTextBuf& buf) const;
- CPDF_Dictionary* GetRoot() const { return m_pRootDict; }
+ CPDF_Dictionary* GetRoot() const { return m_pRootDict.Get(); }
protected:
void ParseStream(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile);
- CPDF_Dictionary* m_pRootDict;
+ CFX_UnownedPtr<CPDF_Dictionary> m_pRootDict;
CFX_RetainPtr<IFX_SeekableReadStream> m_pFile;
};
diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h
index 8edf062590..f47c859697 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.h
+++ b/core/fpdfapi/parser/cpdf_data_avail.h
@@ -13,6 +13,7 @@
#include "core/fpdfapi/parser/cpdf_parser.h"
#include "core/fpdfapi/parser/cpdf_syntax_parser.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_basic.h"
class CPDF_Dictionary;
@@ -204,7 +205,7 @@ class CPDF_DataAvail final {
uint32_t m_dwRootObjNum;
uint32_t m_dwInfoObjNum;
std::unique_ptr<CPDF_LinearizedHeader> m_pLinearized;
- CPDF_Object* m_pTrailer;
+ CFX_UnownedPtr<CPDF_Object> m_pTrailer;
bool m_bDocAvail;
FX_FILESIZE m_dwHeaderOffset;
FX_FILESIZE m_dwLastXRefOffset;
diff --git a/core/fpdfapi/parser/cpdf_object_unittest.cpp b/core/fpdfapi/parser/cpdf_object_unittest.cpp
index 1923992d7a..24a989665f 100644
--- a/core/fpdfapi/parser/cpdf_object_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_object_unittest.cpp
@@ -82,7 +82,7 @@ class PDFObjectsTest : public testing::Test {
// All direct objects.
CPDF_Object* objs[] = {boolean_false_obj, boolean_true_obj, number_int_obj,
number_float_obj, str_reg_obj, str_spec_obj,
- name_obj, m_ArrayObj, m_DictObj,
+ name_obj, m_ArrayObj.Get(), m_DictObj.Get(),
stream_obj, null_obj};
m_DirectObjTypes = {
CPDF_Object::BOOLEAN, CPDF_Object::BOOLEAN, CPDF_Object::NUMBER,
@@ -179,9 +179,9 @@ class PDFObjectsTest : public testing::Test {
std::vector<std::unique_ptr<CPDF_Object>> m_DirectObjs;
std::vector<int> m_DirectObjTypes;
std::vector<std::unique_ptr<CPDF_Object>> m_RefObjs;
- CPDF_Dictionary* m_DictObj;
- CPDF_Dictionary* m_StreamDictObj;
- CPDF_Array* m_ArrayObj;
+ CFX_UnownedPtr<CPDF_Dictionary> m_DictObj;
+ CFX_UnownedPtr<CPDF_Dictionary> m_StreamDictObj;
+ CFX_UnownedPtr<CPDF_Array> m_ArrayObj;
std::vector<CPDF_Object*> m_IndirectObjs;
};
@@ -244,23 +244,29 @@ TEST_F(PDFObjectsTest, GetInteger) {
TEST_F(PDFObjectsTest, GetDict) {
const CPDF_Dictionary* const direct_obj_results[] = {
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, m_DictObj, m_StreamDictObj, nullptr};
+ nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, m_DictObj.Get(), m_StreamDictObj.Get(),
+ nullptr};
// Check for direct objects.
for (size_t i = 0; i < m_DirectObjs.size(); ++i)
EXPECT_EQ(direct_obj_results[i], m_DirectObjs[i]->GetDict());
// Check indirect references.
- const CPDF_Dictionary* const indirect_obj_results[] = {
- nullptr, nullptr, nullptr, nullptr, nullptr, m_DictObj, m_StreamDictObj};
+ const CPDF_Dictionary* const indirect_obj_results[] = {nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ m_DictObj.Get(),
+ m_StreamDictObj.Get()};
for (size_t i = 0; i < m_RefObjs.size(); ++i)
EXPECT_TRUE(Equal(indirect_obj_results[i], m_RefObjs[i]->GetDict()));
}
TEST_F(PDFObjectsTest, GetArray) {
const CPDF_Array* const direct_obj_results[] = {
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, m_ArrayObj, nullptr, nullptr, nullptr};
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, m_ArrayObj.Get(), nullptr, nullptr, nullptr};
// Check for direct objects.
for (size_t i = 0; i < m_DirectObjs.size(); ++i)
EXPECT_EQ(direct_obj_results[i], m_DirectObjs[i]->AsArray());
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;
};
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index 97ea052436..cd47f269bc 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -899,7 +899,7 @@ bool CPDF_FormField::ClearSelectedOptions(bool bNotify) {
}
void CPDF_FormField::LoadDA() {
- CPDF_Dictionary* pFormDict = m_pForm->m_pFormDict;
+ CPDF_Dictionary* pFormDict = m_pForm->m_pFormDict.Get();
if (!pFormDict)
return;
diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h
index f2038e41bd..f5c4c6964b 100644
--- a/core/fpdfdoc/cpdf_formfield.h
+++ b/core/fpdfdoc/cpdf_formfield.h
@@ -134,7 +134,7 @@ class CPDF_FormField {
#endif // PDF_ENABLE_XFA
float GetFontSize() const { return m_FontSize; }
- CPDF_Font* GetFont() const { return m_pFont; }
+ CPDF_Font* GetFont() const { return m_pFont.Get(); }
const CPDF_Dictionary* GetDict() const { return m_pDict.Get(); }
const CPDF_InterForm* GetForm() const { return m_pForm.Get(); }
@@ -176,7 +176,7 @@ class CPDF_FormField {
// Owned by InterForm parent.
std::vector<CFX_UnownedPtr<CPDF_FormControl>> m_ControlList;
float m_FontSize;
- CPDF_Font* m_pFont;
+ CFX_UnownedPtr<CPDF_Font> m_pFont;
};
#endif // CORE_FPDFDOC_CPDF_FORMFIELD_H_
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index de99a5de0f..9c3730ad70 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -961,7 +961,7 @@ int CPDF_InterForm::FindFieldInCalculationOrder(const CPDF_FormField* pField) {
}
CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csNameTag) const {
- return GetFont(m_pFormDict, m_pDocument.Get(), csNameTag);
+ return GetFont(m_pFormDict.Get(), m_pDocument.Get(), csNameTag);
}
CPDF_DefaultAppearance CPDF_InterForm::GetDefaultAppearance() const {
diff --git a/core/fpdfdoc/cpdf_interform.h b/core/fpdfdoc/cpdf_interform.h
index 0a9b3e0e4a..9dc0532939 100644
--- a/core/fpdfdoc/cpdf_interform.h
+++ b/core/fpdfdoc/cpdf_interform.h
@@ -13,6 +13,7 @@
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "core/fpdfdoc/cpdf_defaultappearance.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
@@ -109,12 +110,12 @@ class CPDF_InterForm {
static bool s_bUpdateAP;
CFX_UnownedPtr<CPDF_Document> const m_pDocument;
- CPDF_Dictionary* m_pFormDict;
+ CFX_UnownedPtr<CPDF_Dictionary> m_pFormDict;
std::map<const CPDF_Dictionary*, std::unique_ptr<CPDF_FormControl>>
m_ControlMap;
std::unique_ptr<CFieldTree> m_pFieldTree;
CFX_ByteString m_bsEncoding;
- IPDF_FormNotify* m_pFormNotify;
+ CFX_UnownedPtr<IPDF_FormNotify> m_pFormNotify;
};
#endif // CORE_FPDFDOC_CPDF_INTERFORM_H_
diff --git a/core/fpdfdoc/cpdf_link.cpp b/core/fpdfdoc/cpdf_link.cpp
index 20ec486df2..b622094a73 100644
--- a/core/fpdfdoc/cpdf_link.cpp
+++ b/core/fpdfdoc/cpdf_link.cpp
@@ -9,6 +9,14 @@
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfdoc/cpdf_nametree.h"
+CPDF_Link::CPDF_Link() {}
+
+CPDF_Link::CPDF_Link(CPDF_Dictionary* pDict) : m_pDict(pDict) {}
+
+CPDF_Link::CPDF_Link(const CPDF_Link& that) = default;
+
+CPDF_Link::~CPDF_Link() {}
+
CFX_FloatRect CPDF_Link::GetRect() {
return m_pDict->GetRectFor("Rect");
}
diff --git a/core/fpdfdoc/cpdf_link.h b/core/fpdfdoc/cpdf_link.h
index 162630d6ac..82f50fe004 100644
--- a/core/fpdfdoc/cpdf_link.h
+++ b/core/fpdfdoc/cpdf_link.h
@@ -9,23 +9,25 @@
#include "core/fpdfdoc/cpdf_action.h"
#include "core/fpdfdoc/cpdf_dest.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
class CPDF_Dictionary;
class CPDF_Link {
public:
- CPDF_Link() : m_pDict(nullptr) {}
- explicit CPDF_Link(CPDF_Dictionary* pDict) : m_pDict(pDict) {}
-
- CPDF_Dictionary* GetDict() const { return m_pDict; }
+ CPDF_Link();
+ explicit CPDF_Link(CPDF_Dictionary* pDict);
+ CPDF_Link(const CPDF_Link& that);
+ ~CPDF_Link();
+ CPDF_Dictionary* GetDict() const { return m_pDict.Get(); }
CFX_FloatRect GetRect();
CPDF_Dest GetDest(CPDF_Document* pDoc);
CPDF_Action GetAction();
private:
- CPDF_Dictionary* m_pDict;
+ CFX_UnownedPtr<CPDF_Dictionary> m_pDict;
};
#endif // CORE_FPDFDOC_CPDF_LINK_H_
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 7a493c004d..e3db1c62c9 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -108,6 +108,12 @@ float MaskPercentFilled(const std::vector<bool>& mask,
} // namespace
+PDFTEXT_Obj::PDFTEXT_Obj() {}
+
+PDFTEXT_Obj::PDFTEXT_Obj(const PDFTEXT_Obj& that) = default;
+
+PDFTEXT_Obj::~PDFTEXT_Obj() {}
+
FPDF_CHAR_INFO::FPDF_CHAR_INFO()
: m_Unicode(0),
m_Charcode(0),
@@ -799,7 +805,7 @@ void CPDF_TextPage::ProcessTextObject(
}
FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
- CPDF_TextObject* pTextObj = Obj.m_pTextObj;
+ CPDF_TextObject* pTextObj = Obj.m_pTextObj.Get();
if (!pTextObj->m_ContentMark.HasRef())
return FPDFText_MarkedContent::Pass;
@@ -862,7 +868,7 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
}
void CPDF_TextPage::ProcessMarkedContent(PDFTEXT_Obj Obj) {
- CPDF_TextObject* pTextObj = Obj.m_pTextObj;
+ CPDF_TextObject* pTextObj = Obj.m_pTextObj.Get();
if (!pTextObj->m_ContentMark.HasRef())
return;
@@ -952,7 +958,7 @@ bool CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj,
}
void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
- CPDF_TextObject* pTextObj = Obj.m_pTextObj;
+ CPDF_TextObject* pTextObj = Obj.m_pTextObj.Get();
if (fabs(pTextObj->m_Right - pTextObj->m_Left) < 0.01f)
return;
CFX_Matrix formMatrix = Obj.m_formMatrix;
diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h
index a18310667d..0f507de4aa 100644
--- a/core/fpdftext/cpdf_textpage.h
+++ b/core/fpdftext/cpdf_textpage.h
@@ -84,7 +84,11 @@ class PAGECHAR_INFO {
};
struct PDFTEXT_Obj {
- CPDF_TextObject* m_pTextObj;
+ PDFTEXT_Obj();
+ PDFTEXT_Obj(const PDFTEXT_Obj& that);
+ ~PDFTEXT_Obj();
+
+ CFX_UnownedPtr<CPDF_TextObject> m_pTextObj;
CFX_Matrix m_formMatrix;
};
diff --git a/core/fxcodec/codec/ccodec_jbig2module.h b/core/fxcodec/codec/ccodec_jbig2module.h
index 43abe042f0..e8dec945b8 100644
--- a/core/fxcodec/codec/ccodec_jbig2module.h
+++ b/core/fxcodec/codec/ccodec_jbig2module.h
@@ -10,6 +10,7 @@
#include <memory>
#include "core/fxcodec/fx_codec_def.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_basic.h"
class CJBig2_Context;
@@ -29,7 +30,7 @@ class CCodec_Jbig2Context {
CFX_RetainPtr<CPDF_StreamAcc> m_pSrcStream;
uint8_t* m_dest_buf;
uint32_t m_dest_pitch;
- IFX_Pause* m_pPause;
+ CFX_UnownedPtr<IFX_Pause> m_pPause;
std::unique_ptr<CJBig2_Context> m_pContext;
};
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h
index 2b343b7e94..6dd7357b12 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.h
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.h
@@ -17,6 +17,7 @@
#include "core/fxcodec/fx_codec_def.h"
#include "core/fxcodec/lgif/cgifcontext.h"
#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxge/fx_dib.h"
@@ -127,12 +128,12 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate,
};
CFX_RetainPtr<IFX_SeekableReadStream> m_pFile;
- CCodec_ModuleMgr* m_pCodecMgr;
+ CFX_UnownedPtr<CCodec_ModuleMgr> m_pCodecMgr;
FXJPEG_Context* m_pJpegContext;
FXPNG_Context* m_pPngContext;
std::unique_ptr<CGifContext> m_pGifContext;
FXBMP_Context* m_pBmpContext;
- CCodec_TiffContext* m_pTiffContext;
+ CFX_UnownedPtr<CCodec_TiffContext> m_pTiffContext;
FXCODEC_IMAGE_TYPE m_imagType;
uint32_t m_offSet;
uint8_t* m_pSrcBuf;
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index 9e470f3f14..209a9735f0 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -302,7 +302,7 @@ CCodec_ProgressiveDecoder::~CCodec_ProgressiveDecoder() {
if (m_pPngContext)
m_pCodecMgr->GetPngModule()->Finish(m_pPngContext);
if (m_pTiffContext)
- m_pCodecMgr->GetTiffModule()->DestroyDecoder(m_pTiffContext);
+ m_pCodecMgr->GetTiffModule()->DestroyDecoder(m_pTiffContext.Get());
FX_Free(m_pSrcBuf);
FX_Free(m_pDecodeBuf);
FX_Free(m_pSrcPalette);
@@ -1213,13 +1213,13 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
return false;
}
int32_t dummy_bpc;
- bool ret = pTiffModule->LoadFrameInfo(m_pTiffContext, 0, &m_SrcWidth,
- &m_SrcHeight, &m_SrcComponents,
- &dummy_bpc, pAttribute);
+ bool ret = pTiffModule->LoadFrameInfo(
+ m_pTiffContext.Get(), 0, &m_SrcWidth, &m_SrcHeight, &m_SrcComponents,
+ &dummy_bpc, pAttribute);
m_SrcComponents = 4;
m_clipBox = FX_RECT(0, 0, m_SrcWidth, m_SrcHeight);
if (!ret) {
- pTiffModule->DestroyDecoder(m_pTiffContext);
+ pTiffModule->DestroyDecoder(m_pTiffContext.Get());
m_pTiffContext = nullptr;
m_status = FXCODEC_STATUS_ERR_FORMAT;
return false;
@@ -2170,7 +2170,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() {
m_SrcHeight == m_sizeY && m_startX == 0 && m_startY == 0 &&
m_clipBox.left == 0 && m_clipBox.top == 0 &&
m_clipBox.right == m_SrcWidth && m_clipBox.bottom == m_SrcHeight) {
- ret = pTiffModule->Decode(m_pTiffContext, m_pDeviceBitmap);
+ ret = pTiffModule->Decode(m_pTiffContext.Get(), m_pDeviceBitmap);
m_pDeviceBitmap = nullptr;
m_pFile = nullptr;
if (!ret) {
@@ -2189,7 +2189,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() {
m_status = FXCODEC_STATUS_ERR_MEMORY;
return m_status;
}
- ret = pTiffModule->Decode(m_pTiffContext, pDIBitmap);
+ ret = pTiffModule->Decode(m_pTiffContext.Get(), pDIBitmap);
if (!ret) {
m_pDeviceBitmap = nullptr;
m_pFile = nullptr;
diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrdProc.cpp
index 0d9f991d4c..a8140bdd24 100644
--- a/core/fxcodec/jbig2/JBig2_GrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_GrdProc.cpp
@@ -25,6 +25,8 @@ CJBig2_GRDProc::CJBig2_GRDProc()
m_ReplaceRect.right = 0;
}
+CJBig2_GRDProc::~CJBig2_GRDProc() {}
+
bool CJBig2_GRDProc::UseTemplate0Opt3() const {
return (GBAT[0] == 3) && (GBAT[1] == -1) && (GBAT[2] == -3) &&
(GBAT[3] == -1) && (GBAT[4] == 2) && (GBAT[5] == -2) &&
@@ -663,35 +665,35 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith(IFX_Pause* pPause) {
CJBig2_Image* pImage = *m_pImage;
if (GBTEMPLATE == 0) {
if (UseTemplate0Opt3()) {
- m_ProssiveStatus = decode_Arith_Template0_opt3(pImage, m_pArithDecoder,
- m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template0_opt3(
+ pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
} else {
- m_ProssiveStatus = decode_Arith_Template0_unopt(pImage, m_pArithDecoder,
- m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template0_unopt(
+ pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
}
} else if (GBTEMPLATE == 1) {
if (UseTemplate1Opt3()) {
- m_ProssiveStatus = decode_Arith_Template1_opt3(pImage, m_pArithDecoder,
- m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template1_opt3(
+ pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
} else {
- m_ProssiveStatus = decode_Arith_Template1_unopt(pImage, m_pArithDecoder,
- m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template1_unopt(
+ pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
}
} else if (GBTEMPLATE == 2) {
if (UseTemplate23Opt3()) {
- m_ProssiveStatus = decode_Arith_Template2_opt3(pImage, m_pArithDecoder,
- m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template2_opt3(
+ pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
} else {
- m_ProssiveStatus = decode_Arith_Template2_unopt(pImage, m_pArithDecoder,
- m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template2_unopt(
+ pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
}
} else {
if (UseTemplate23Opt3()) {
- m_ProssiveStatus = decode_Arith_Template3_opt3(pImage, m_pArithDecoder,
- m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template3_opt3(
+ pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
} else {
- m_ProssiveStatus = decode_Arith_Template3_unopt(pImage, m_pArithDecoder,
- m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template3_unopt(
+ pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
}
}
m_ReplaceRect.left = 0;
diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.h b/core/fxcodec/jbig2/JBig2_GrdProc.h
index 447447fe8b..c6e8ae38d0 100644
--- a/core/fxcodec/jbig2/JBig2_GrdProc.h
+++ b/core/fxcodec/jbig2/JBig2_GrdProc.h
@@ -8,6 +8,7 @@
#define CORE_FXCODEC_JBIG2_JBIG2_GRDPROC_H_
#include "core/fxcodec/fx_codec_def.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
@@ -20,6 +21,7 @@ struct JBig2ArithCtx;
class CJBig2_GRDProc {
public:
CJBig2_GRDProc();
+ ~CJBig2_GRDProc();
CJBig2_Image* decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext);
@@ -112,7 +114,7 @@ class CJBig2_GRDProc {
uint8_t* m_pLine;
FXCODEC_STATUS m_ProssiveStatus;
CJBig2_Image** m_pImage;
- CJBig2_ArithDecoder* m_pArithDecoder;
+ CFX_UnownedPtr<CJBig2_ArithDecoder> m_pArithDecoder;
JBig2ArithCtx* m_gbContext;
uint16_t m_DecodeType;
int m_LTP;
diff --git a/core/fxcodec/lgif/cgifcontext.h b/core/fxcodec/lgif/cgifcontext.h
index 08a66c18e2..20d640ef35 100644
--- a/core/fxcodec/lgif/cgifcontext.h
+++ b/core/fxcodec/lgif/cgifcontext.h
@@ -11,6 +11,7 @@
#include <vector>
#include "core/fxcodec/lgif/fx_gif.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_basic.h"
class CCodec_GifModule;
@@ -44,7 +45,7 @@ class CGifContext {
int32_t decode_status;
uint32_t skip_size;
- CCodec_GifModule* m_Module;
+ CFX_UnownedPtr<CCodec_GifModule> m_Module;
char* err_ptr;
CFX_ByteString cmt_data;
std::unique_ptr<GifGCE> m_GifGCE;
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index 6174f6e18f..22d80071a9 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -438,7 +438,7 @@ class CFX_Renderer {
CFX_RetainPtr<CFX_DIBitmap> m_pOriDevice;
CFX_RetainPtr<CFX_DIBitmap> m_pClipMask;
CFX_RetainPtr<CFX_DIBitmap> m_pDevice;
- const CFX_ClipRgn* m_pClipRgn;
+ CFX_UnownedPtr<const CFX_ClipRgn> m_pClipRgn;
};
void CFX_Renderer::CompositeSpan(uint8_t* dest_scan,
diff --git a/core/fxge/android/cfpf_skiafont.h b/core/fxge/android/cfpf_skiafont.h
index 657ced88f2..5686e9e31f 100644
--- a/core/fxge/android/cfpf_skiafont.h
+++ b/core/fxge/android/cfpf_skiafont.h
@@ -7,6 +7,7 @@
#ifndef CORE_FXGE_ANDROID_CFPF_SKIAFONT_H_
#define CORE_FXGE_ANDROID_CFPF_SKIAFONT_H_
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxge/fx_font.h"
@@ -42,8 +43,8 @@ class CFPF_SkiaFont {
uint8_t uCharset);
private:
- CFPF_SkiaFontMgr* m_pFontMgr;
- CFPF_SkiaFontDescriptor* m_pFontDes;
+ CFX_UnownedPtr<CFPF_SkiaFontMgr> m_pFontMgr;
+ CFX_UnownedPtr<CFPF_SkiaFontDescriptor> m_pFontDes;
FXFT_Face m_Face;
uint32_t m_dwStyle;
uint8_t m_uCharset;
diff --git a/core/fxge/android/cfx_androidfontinfo.h b/core/fxge/android/cfx_androidfontinfo.h
index ce08f2558a..17bbf89a3e 100644
--- a/core/fxge/android/cfx_androidfontinfo.h
+++ b/core/fxge/android/cfx_androidfontinfo.h
@@ -7,6 +7,7 @@
#ifndef CORE_FXGE_ANDROID_CFX_ANDROIDFONTINFO_H_
#define CORE_FXGE_ANDROID_CFX_ANDROIDFONTINFO_H_
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/fx_font.h"
@@ -39,7 +40,7 @@ class CFX_AndroidFontInfo : public IFX_SystemFontInfo {
void DeleteFont(void* hFont) override;
protected:
- CFPF_SkiaFontMgr* m_pFontMgr;
+ CFX_UnownedPtr<CFPF_SkiaFontMgr> m_pFontMgr;
};
#endif // CORE_FXGE_ANDROID_CFX_ANDROIDFONTINFO_H_
diff --git a/core/fxge/cfx_facecache.h b/core/fxge/cfx_facecache.h
index 5857a6310b..d6847debdb 100644
--- a/core/fxge/cfx_facecache.h
+++ b/core/fxge/cfx_facecache.h
@@ -10,6 +10,7 @@
#include <map>
#include <memory>
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/fx_freetype.h"
@@ -59,7 +60,7 @@ class CFX_FaceCache {
std::map<CFX_ByteString, std::unique_ptr<CFX_SizeGlyphCache>> m_SizeMap;
std::map<uint32_t, std::unique_ptr<CFX_PathData>> m_PathMap;
#if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_
- CFX_TypeFace* m_pTypeface;
+ CFX_UnownedPtr<CFX_TypeFace> m_pTypeface;
#endif
};
diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h
index 4d8b407b35..f33da57cc9 100644
--- a/core/fxge/cfx_renderdevice.h
+++ b/core/fxge/cfx_renderdevice.h
@@ -9,6 +9,7 @@
#include <memory>
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxge/fx_dib.h"
#include "core/fxge/fx_font.h"
@@ -84,13 +85,11 @@ class CFX_RenderDevice {
public:
class StateRestorer {
public:
- explicit StateRestorer(CFX_RenderDevice* pDevice) : m_pDevice(pDevice) {
- m_pDevice->SaveState();
- }
- ~StateRestorer() { m_pDevice->RestoreState(false); }
+ explicit StateRestorer(CFX_RenderDevice* pDevice);
+ ~StateRestorer();
private:
- CFX_RenderDevice* m_pDevice;
+ CFX_UnownedPtr<CFX_RenderDevice> m_pDevice;
};
CFX_RenderDevice();
diff --git a/core/fxge/dib/cfx_bitmapcomposer.h b/core/fxge/dib/cfx_bitmapcomposer.h
index 6e961cbd45..cc4ecb13fe 100644
--- a/core/fxge/dib/cfx_bitmapcomposer.h
+++ b/core/fxge/dib/cfx_bitmapcomposer.h
@@ -10,6 +10,7 @@
#include <vector>
#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxge/dib/cfx_scanlinecompositor.h"
#include "core/fxge/dib/ifx_scanlinecomposer.h"
@@ -56,7 +57,7 @@ class CFX_BitmapComposer : public IFX_ScanlineComposer {
const uint8_t* scan_extra_alpha);
CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
- const CFX_ClipRgn* m_pClipRgn;
+ CFX_UnownedPtr<const CFX_ClipRgn> m_pClipRgn;
FXDIB_Format m_SrcFormat;
int m_DestLeft;
int m_DestTop;
diff --git a/core/fxge/dib/cfx_imagerenderer.cpp b/core/fxge/dib/cfx_imagerenderer.cpp
index cff95fdd70..ec611cacbe 100644
--- a/core/fxge/dib/cfx_imagerenderer.cpp
+++ b/core/fxge/dib/cfx_imagerenderer.cpp
@@ -122,14 +122,14 @@ bool CFX_ImageRenderer::Continue(IFX_Pause* pPause) {
m_pDevice->CompositeMask(
m_pTransformer->result().left, m_pTransformer->result().top,
pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap, m_MaskColor, 0, 0,
- m_BlendType, m_pClipRgn, m_bRgbByteOrder, m_AlphaFlag);
+ m_BlendType, m_pClipRgn.Get(), m_bRgbByteOrder, m_AlphaFlag);
} else {
if (m_BitmapAlpha != 255)
pBitmap->MultiplyAlpha(m_BitmapAlpha);
m_pDevice->CompositeBitmap(
m_pTransformer->result().left, m_pTransformer->result().top,
pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap, 0, 0, m_BlendType,
- m_pClipRgn, m_bRgbByteOrder);
+ m_pClipRgn.Get(), m_bRgbByteOrder);
}
return false;
}
diff --git a/core/fxge/dib/cfx_imagerenderer.h b/core/fxge/dib/cfx_imagerenderer.h
index f3d1286dc6..cad621e19c 100644
--- a/core/fxge/dib/cfx_imagerenderer.h
+++ b/core/fxge/dib/cfx_imagerenderer.h
@@ -10,6 +10,7 @@
#include <memory>
#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxge/dib/cfx_bitmapcomposer.h"
#include "core/fxge/dib/cfx_dibitmap.h"
@@ -38,7 +39,7 @@ class CFX_ImageRenderer {
private:
CFX_RetainPtr<CFX_DIBitmap> m_pDevice;
- const CFX_ClipRgn* m_pClipRgn;
+ CFX_UnownedPtr<const CFX_ClipRgn> m_pClipRgn;
int m_BitmapAlpha;
uint32_t m_MaskColor;
CFX_Matrix m_Matrix;
diff --git a/core/fxge/dib/cstretchengine.h b/core/fxge/dib/cstretchengine.h
index 280641cb59..049059361e 100644
--- a/core/fxge/dib/cstretchengine.h
+++ b/core/fxge/dib/cstretchengine.h
@@ -9,6 +9,7 @@
#include <vector>
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxge/fx_dib.h"
@@ -58,7 +59,7 @@ class CStretchEngine {
int m_DestBpp;
int m_SrcBpp;
int m_bHasAlpha;
- IFX_ScanlineComposer* m_pDestBitmap;
+ CFX_UnownedPtr<IFX_ScanlineComposer> m_pDestBitmap;
int m_DestWidth;
int m_DestHeight;
FX_RECT m_DestClip;
diff --git a/core/fxge/ge/cfx_facecache.cpp b/core/fxge/ge/cfx_facecache.cpp
index 9c79444dd3..6049729089 100644
--- a/core/fxge/ge/cfx_facecache.cpp
+++ b/core/fxge/ge/cfx_facecache.cpp
@@ -90,7 +90,7 @@ CFX_FaceCache::CFX_FaceCache(FXFT_Face face)
CFX_FaceCache::~CFX_FaceCache() {
#if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_
- SkSafeUnref(m_pTypeface);
+ SkSafeUnref(m_pTypeface.Get());
#endif
}
@@ -370,7 +370,7 @@ CFX_TypeFace* CFX_FaceCache::GetDeviceCache(const CFX_Font* pFont) {
new SkMemoryStream(pFont->GetFontData(), pFont->GetSize()));
}
#endif
- return m_pTypeface;
+ return m_pTypeface.Get();
}
#endif
diff --git a/core/fxge/ge/cfx_folderfontinfo.h b/core/fxge/ge/cfx_folderfontinfo.h
index 6aadb1526f..ad363b5f0d 100644
--- a/core/fxge/ge/cfx_folderfontinfo.h
+++ b/core/fxge/ge/cfx_folderfontinfo.h
@@ -11,6 +11,7 @@
#include <memory>
#include <vector>
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/ifx_systemfontinfo.h"
@@ -62,7 +63,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
std::map<CFX_ByteString, std::unique_ptr<CFX_FontFaceInfo>> m_FontList;
std::vector<CFX_ByteString> m_PathList;
- CFX_FontMapper* m_pMapper;
+ CFX_UnownedPtr<CFX_FontMapper> m_pMapper;
};
#endif // CORE_FXGE_GE_CFX_FOLDERFONTINFO_H_
diff --git a/core/fxge/ge/cfx_font.cpp b/core/fxge/ge/cfx_font.cpp
index 229ede7894..144675cdbd 100644
--- a/core/fxge/ge/cfx_font.cpp
+++ b/core/fxge/ge/cfx_font.cpp
@@ -28,12 +28,12 @@
namespace {
-typedef struct {
+struct OUTLINE_PARAMS {
CFX_PathData* m_pPath;
int m_CurX;
int m_CurY;
float m_CoordUnit;
-} OUTLINE_PARAMS;
+};
#ifdef PDF_ENABLE_XFA
diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp
index f9153d1cdb..4404833758 100644
--- a/core/fxge/ge/cfx_renderdevice.cpp
+++ b/core/fxge/ge/cfx_renderdevice.cpp
@@ -1120,3 +1120,12 @@ bool CFX_RenderDevice::DrawTextPath(int nChars,
}
return true;
}
+
+CFX_RenderDevice::StateRestorer::StateRestorer(CFX_RenderDevice* pDevice)
+ : m_pDevice(pDevice) {
+ m_pDevice->SaveState();
+}
+
+CFX_RenderDevice::StateRestorer::~StateRestorer() {
+ m_pDevice->RestoreState(false);
+}
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 7d91ab2b72..f4b72fe2ad 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -822,7 +822,7 @@ class SkiaState {
skPaint.setAntiAlias(true);
skPaint.setColor(m_fillColor);
if (m_pTypeFace) { // exclude placeholder test fonts
- sk_sp<SkTypeface> typeface(SkSafeRef(m_pTypeFace));
+ sk_sp<SkTypeface> typeface(SkSafeRef(m_pTypeFace.Get()));
skPaint.setTypeface(typeface);
}
skPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
@@ -1266,8 +1266,8 @@ class SkiaState {
CFX_GraphStateData m_clipState;
CFX_GraphStateData m_drawState;
CFX_Matrix m_clipMatrix;
- CFX_SkiaDeviceDriver* m_pDriver;
- CFX_TypeFace* m_pTypeFace;
+ CFX_UnownedPtr<CFX_SkiaDeviceDriver> m_pDriver;
+ CFX_UnownedPtr<CFX_TypeFace> m_pTypeFace;
float m_fontSize;
uint32_t m_fillColor;
uint32_t m_strokeColor;
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index 400babd16b..b5260c1073 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -76,7 +76,7 @@ void PSCompressData(int PSLevel,
} // namespace
struct PSGlyph {
- CFX_Font* m_pFont;
+ CFX_UnownedPtr<CFX_Font> m_pFont;
uint32_t m_GlyphIndex;
bool m_bGlyphAdjust;
float m_AdjustMatrix[4];
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index b495251dee..f6481187b3 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -363,7 +363,7 @@ class CFX_Win32FontInfo final : public IFX_SystemFontInfo {
CFX_ByteString FindFont(const CFX_ByteString& name);
HDC m_hDC;
- CFX_FontMapper* m_pMapper;
+ CFX_UnownedPtr<CFX_FontMapper> m_pMapper;
CFX_ByteString m_LastFamily;
CFX_ByteString m_KaiTi, m_FangSong;
};