summaryrefslogtreecommitdiff
path: root/core/include/fpdfapi/fpdf_resource.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/include/fpdfapi/fpdf_resource.h')
-rw-r--r--core/include/fpdfapi/fpdf_resource.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/core/include/fpdfapi/fpdf_resource.h b/core/include/fpdfapi/fpdf_resource.h
index 7bad01501a..54e1c97ee7 100644
--- a/core/include/fpdfapi/fpdf_resource.h
+++ b/core/include/fpdfapi/fpdf_resource.h
@@ -38,6 +38,28 @@ class CFX_DIBitmap;
typedef struct FT_FaceRec_* FXFT_Face;
class CFX_CTTGSUBTable;
class CPDF_Page;
+
+template <class ObjClass> class CPDF_CountedObject : public CFX_Object
+{
+public:
+ ObjClass m_Obj;
+ FX_DWORD m_nCount;
+};
+typedef CPDF_CountedObject<CPDF_Font*> CPDF_CountedFont;
+typedef CPDF_CountedObject<CPDF_ColorSpace*> CPDF_CountedColorSpace;
+typedef CPDF_CountedObject<CPDF_Pattern*> CPDF_CountedPattern;
+typedef CPDF_CountedObject<CPDF_Image*> CPDF_CountedImage;
+typedef CPDF_CountedObject<CPDF_IccProfile*> CPDF_CountedICCProfile;
+typedef CPDF_CountedObject<CPDF_StreamAcc*> CPDF_CountedStreamAcc;
+
+
+typedef CFX_MapPtrTemplate<CPDF_Dictionary*, CPDF_CountedFont*> CPDF_FontMap;
+typedef CFX_MapPtrTemplate<CPDF_Object*, CPDF_CountedColorSpace*> CPDF_ColorSpaceMap;
+typedef CFX_MapPtrTemplate<CPDF_Object*, CPDF_CountedPattern*> CPDF_PatternMap;
+typedef CFX_MapPtrTemplate<FX_DWORD, CPDF_CountedImage*> CPDF_ImageMap;
+typedef CFX_MapPtrTemplate<CPDF_Stream*, CPDF_CountedICCProfile*> CPDF_IccProfileMap;
+typedef CFX_MapPtrTemplate<CPDF_Stream*, CPDF_CountedStreamAcc*> CPDF_FontFileMap;
+
#define PDFFONT_TYPE1 1
#define PDFFONT_TRUETYPE 2
#define PDFFONT_TYPE3 3
@@ -790,8 +812,9 @@ public:
int m_ShadingType;
- CPDF_ColorSpace* m_pCS;
+ CPDF_ColorSpace* m_pCS; // Still keep m_pCS as some CPDF_ColorSpace (name object) are not managed as counted objects. Refer to CPDF_DocPageData::GetColorSpace.
+ CPDF_CountedColorSpace* m_pCountedCS;
CPDF_Function* m_pFunctions[4];