diff options
author | Lei Zhang <thestig@chromium.org> | 2015-06-10 15:25:22 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-06-10 15:25:22 -0700 |
commit | a8a718c974210a919f2af0b099d540143cf330c6 (patch) | |
tree | f4e77f130256d1a9f075824fbfc7cf65ebde286d /core/src/fpdfapi/fpdf_page/pageint.h | |
parent | 7b2897c47245f04c806cfa8cee09458e31ba3777 (diff) | |
download | pdfium-a8a718c974210a919f2af0b099d540143cf330c6.tar.xz |
Convert CPDF_ImageMap to std::map.
Also simplify CPDF_DocPageData::ReleaseIccProfile() since its first
argument is always null.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1149273004.
Diffstat (limited to 'core/src/fpdfapi/fpdf_page/pageint.h')
-rw-r--r-- | core/src/fpdfapi/fpdf_page/pageint.h | 41 |
1 files changed, 4 insertions, 37 deletions
diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h index 2855969e46..3e6abc2059 100644 --- a/core/src/fpdfapi/fpdf_page/pageint.h +++ b/core/src/fpdfapi/fpdf_page/pageint.h @@ -12,7 +12,6 @@ #include "../../../include/fpdfapi/fpdf_pageobj.h" #define PARSE_STEP_LIMIT 100 -#define STREAM_PARSE_BUFSIZE 20480 class CPDF_StreamParser { @@ -328,40 +327,6 @@ public: FX_FLOAT m_TextLeading, m_TextRise, m_TextHorzScale; }; -template <class KeyType, class ValueType> -KeyType PDF_DocPageData_FindValue(const CFX_MapPtrTemplate<KeyType, CPDF_CountedObject<ValueType>*> &map, ValueType findValue, CPDF_CountedObject<ValueType>*& findData) -{ - FX_POSITION pos = map.GetStartPosition(); - while (pos) { - KeyType findKey; - map.GetNextAssoc(pos, findKey, findData); - if (findData->m_Obj == findValue) { - return findKey; - } - } - findData = NULL; - return (KeyType)(uintptr_t)NULL; -} -template <class KeyType, class ValueType> -FX_BOOL PDF_DocPageData_Release(CFX_MapPtrTemplate<KeyType, CPDF_CountedObject<ValueType>*> &map, KeyType findKey, ValueType findValue, FX_BOOL bForce = FALSE) -{ - if (!findKey && !findValue) { - return FALSE; - } - CPDF_CountedObject<ValueType>* findData = NULL; - if (!findKey) { - findKey = PDF_DocPageData_FindValue<KeyType, ValueType>(map, findValue, findData); - } else if (!map.Lookup(findKey, findData)) { - return FALSE; - } - if (findData && ((-- findData->m_nCount) == 0 || bForce)) { - delete findData->m_Obj; - delete findData; - map.RemoveKey(findKey); - return TRUE; - } - return FALSE; -} class CPDF_DocPageData { public: @@ -380,7 +345,7 @@ class CPDF_DocPageData CPDF_Image* GetImage(CPDF_Object* pImageStream); void ReleaseImage(CPDF_Object* pImageStream); CPDF_IccProfile* GetIccProfile(CPDF_Stream* pIccProfileStream); - void ReleaseIccProfile(CPDF_Stream* pIccProfileStream, CPDF_IccProfile* pIccProfile); + void ReleaseIccProfile(CPDF_IccProfile* pIccProfile); CPDF_StreamAcc* GetFontFileStreamAcc(CPDF_Stream* pFontStream); void ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOOL bForce = FALSE); FX_BOOL IsForceClear() const {return m_bForceClear;} @@ -388,7 +353,6 @@ class CPDF_DocPageData CPDF_CountedPattern* FindPatternPtr(CPDF_Object* pPatternObj) const; CPDF_Document* m_pPDFDoc; - CPDF_ImageMap m_ImageMap; CPDF_IccProfileMap m_IccProfileMap; CFX_MapByteStringToPtr m_HashProfileMap; CPDF_FontFileMap m_FontFileMap; @@ -396,13 +360,16 @@ class CPDF_DocPageData private: using CPDF_CountedFont = CPDF_CountedObject<CPDF_Font*>; + using CPDF_CountedImage = CPDF_CountedObject<CPDF_Image*>; using CPDF_ColorSpaceMap = std::map<CPDF_Object*, CPDF_CountedColorSpace*>; using CPDF_FontMap = std::map<CPDF_Dictionary*, CPDF_CountedFont*>; + using CPDF_ImageMap = std::map<FX_DWORD, CPDF_CountedImage*>; using CPDF_PatternMap = std::map<CPDF_Object*, CPDF_CountedPattern*>; CPDF_ColorSpaceMap m_ColorSpaceMap; CPDF_FontMap m_FontMap; + CPDF_ImageMap m_ImageMap; CPDF_PatternMap m_PatternMap; }; |