diff options
author | tsepez <tsepez@chromium.org> | 2016-10-11 12:29:38 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-11 12:29:38 -0700 |
commit | 9fa95efa11f211a6faf9b2adb27211f784aee89a (patch) | |
tree | 821d0ba42f8cff01eac78da0ebd151e160a93306 | |
parent | 4ea4281ad5775686317ef53f48eab39898d13d23 (diff) | |
download | pdfium-9fa95efa11f211a6faf9b2adb27211f784aee89a.tar.xz |
Rename fpdf_page_doc.cpp -> cpdf_docpagedata.h
Review-Url: https://codereview.chromium.org/2409283002
21 files changed, 108 insertions, 72 deletions
@@ -435,6 +435,8 @@ static_library("fpdfapi") { "core/fpdfapi/page/cpdf_contentmarkitem.cpp", "core/fpdfapi/page/cpdf_contentmarkitem.h", "core/fpdfapi/page/cpdf_countedobject.h", + "core/fpdfapi/page/cpdf_docpagedata.cpp", + "core/fpdfapi/page/cpdf_docpagedata.h", "core/fpdfapi/page/cpdf_form.cpp", "core/fpdfapi/page/cpdf_form.h", "core/fpdfapi/page/cpdf_formobject.cpp", @@ -476,7 +478,6 @@ static_library("fpdfapi") { "core/fpdfapi/page/cpdf_tilingpattern.cpp", "core/fpdfapi/page/cpdf_tilingpattern.h", "core/fpdfapi/page/fpdf_page_colors.cpp", - "core/fpdfapi/page/fpdf_page_doc.cpp", "core/fpdfapi/page/fpdf_page_func.cpp", "core/fpdfapi/page/fpdf_page_parser.cpp", "core/fpdfapi/page/fpdf_page_parser_old.cpp", diff --git a/core/fpdfapi/cpdf_modulemgr.cpp b/core/fpdfapi/cpdf_modulemgr.cpp index ff7d95a68e..8ae8464ef5 100644 --- a/core/fpdfapi/cpdf_modulemgr.cpp +++ b/core/fpdfapi/cpdf_modulemgr.cpp @@ -32,6 +32,10 @@ CPDF_ModuleMgr::CPDF_ModuleMgr() : m_pCodecModule(nullptr) {} CPDF_ModuleMgr::~CPDF_ModuleMgr() {} +void CPDF_ModuleMgr::InitPageModule() { + m_pPageModule.reset(new CPDF_PageModule); +} + CCodec_FaxModule* CPDF_ModuleMgr::GetFaxModule() { return m_pCodecModule ? m_pCodecModule->GetFaxModule() : nullptr; } diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp index 8697598756..66a47406f5 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp @@ -7,6 +7,7 @@ #include "core/fpdfapi/edit/cpdf_pagecontentgenerator.h" #include "core/fpdfapi/edit/cpdf_creator.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/cpdf_image.h" #include "core/fpdfapi/page/cpdf_imageobject.h" #include "core/fpdfapi/page/cpdf_page.h" diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp index 1cfecb8ded..d39f752a8b 100644 --- a/core/fpdfapi/font/cpdf_font.cpp +++ b/core/fpdfapi/font/cpdf_font.cpp @@ -15,8 +15,8 @@ #include "core/fpdfapi/font/cpdf_type1font.h" #include "core/fpdfapi/font/cpdf_type3font.h" #include "core/fpdfapi/font/font_int.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/cpdf_pagemodule.h" -#include "core/fpdfapi/page/pageint.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_document.h" diff --git a/core/fpdfapi/page/cpdf_color.cpp b/core/fpdfapi/page/cpdf_color.cpp index d06d445adf..68fa0edacf 100644 --- a/core/fpdfapi/page/cpdf_color.cpp +++ b/core/fpdfapi/page/cpdf_color.cpp @@ -6,6 +6,7 @@ #include "core/fpdfapi/page/cpdf_color.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/pageint.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_document.h" diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp index 6925f691c9..fe840d10df 100644 --- a/core/fpdfapi/page/cpdf_colorspace.cpp +++ b/core/fpdfapi/page/cpdf_colorspace.cpp @@ -9,8 +9,8 @@ #include <memory> #include "core/fpdfapi/cpdf_modulemgr.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/cpdf_pagemodule.h" -#include "core/fpdfapi/page/pageint.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_document.h" diff --git a/core/fpdfapi/page/fpdf_page_doc.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp index 6fa64cfa8e..7a85e60da2 100644 --- a/core/fpdfapi/page/fpdf_page_doc.cpp +++ b/core/fpdfapi/page/cpdf_docpagedata.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/page/pageint.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include <algorithm> #include <set> @@ -24,10 +24,6 @@ #include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "third_party/base/stl_util.h" -void CPDF_ModuleMgr::InitPageModule() { - m_pPageModule.reset(new CPDF_PageModule); -} - CPDF_DocPageData::CPDF_DocPageData(CPDF_Document* pPDFDoc) : m_pPDFDoc(pPDFDoc), m_bForceClear(false) {} diff --git a/core/fpdfapi/page/cpdf_docpagedata.h b/core/fpdfapi/page/cpdf_docpagedata.h new file mode 100644 index 0000000000..64c0444a5e --- /dev/null +++ b/core/fpdfapi/page/cpdf_docpagedata.h @@ -0,0 +1,85 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_PAGE_CPDF_DOCPAGEDATA_H_ +#define CORE_FPDFAPI_PAGE_CPDF_DOCPAGEDATA_H_ + +#include <map> +#include <set> + +#include "core/fpdfapi/page/cpdf_countedobject.h" +#include "core/fxcrt/fx_coordinates.h" +#include "core/fxcrt/fx_string.h" + +class CPDF_Dictionary; +class CPDF_Document; +class CPDF_Font; +class CPDF_FontEncoding; +class CPDF_IccProfile; +class CPDF_Image; +class CPDF_Object; +class CPDF_Stream; +class CPDF_StreamAcc; + +class CPDF_DocPageData { + public: + explicit CPDF_DocPageData(CPDF_Document* pPDFDoc); + ~CPDF_DocPageData(); + + void Clear(bool bRelease = FALSE); + CPDF_Font* GetFont(CPDF_Dictionary* pFontDict); + CPDF_Font* GetStandardFont(const CFX_ByteString& fontName, + CPDF_FontEncoding* pEncoding); + void ReleaseFont(const CPDF_Dictionary* pFontDict); + CPDF_ColorSpace* GetColorSpace(CPDF_Object* pCSObj, + const CPDF_Dictionary* pResources); + CPDF_ColorSpace* GetCopiedColorSpace(CPDF_Object* pCSObj); + void ReleaseColorSpace(const CPDF_Object* pColorSpace); + CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj, + bool bShading, + const CFX_Matrix& matrix); + void ReleasePattern(const CPDF_Object* pPatternObj); + CPDF_Image* GetImage(CPDF_Object* pImageStream); + void ReleaseImage(const CPDF_Object* pImageStream); + CPDF_IccProfile* GetIccProfile(CPDF_Stream* pIccProfileStream); + void ReleaseIccProfile(const CPDF_IccProfile* pIccProfile); + CPDF_StreamAcc* GetFontFileStreamAcc(CPDF_Stream* pFontStream); + void ReleaseFontFileStreamAcc(const CPDF_Stream* pFontStream); + bool IsForceClear() const { return m_bForceClear; } + CPDF_CountedColorSpace* FindColorSpacePtr(CPDF_Object* pCSObj) const; + CPDF_CountedPattern* FindPatternPtr(CPDF_Object* pPatternObj) const; + + private: + using CPDF_CountedFont = CPDF_CountedObject<CPDF_Font>; + using CPDF_CountedIccProfile = CPDF_CountedObject<CPDF_IccProfile>; + using CPDF_CountedImage = CPDF_CountedObject<CPDF_Image>; + using CPDF_CountedStreamAcc = CPDF_CountedObject<CPDF_StreamAcc>; + + using CPDF_ColorSpaceMap = + std::map<const CPDF_Object*, CPDF_CountedColorSpace*>; + using CPDF_FontFileMap = std::map<const CPDF_Stream*, CPDF_CountedStreamAcc*>; + using CPDF_FontMap = std::map<const CPDF_Dictionary*, CPDF_CountedFont*>; + using CPDF_IccProfileMap = + std::map<const CPDF_Stream*, CPDF_CountedIccProfile*>; + using CPDF_ImageMap = std::map<uint32_t, CPDF_CountedImage*>; + using CPDF_PatternMap = std::map<const CPDF_Object*, CPDF_CountedPattern*>; + + CPDF_ColorSpace* GetColorSpaceImpl(CPDF_Object* pCSObj, + const CPDF_Dictionary* pResources, + std::set<CPDF_Object*>* pVisited); + + CPDF_Document* const m_pPDFDoc; + bool m_bForceClear; + std::map<CFX_ByteString, CPDF_Stream*> m_HashProfileMap; + CPDF_ColorSpaceMap m_ColorSpaceMap; + CPDF_FontFileMap m_FontFileMap; + CPDF_FontMap m_FontMap; + CPDF_IccProfileMap m_IccProfileMap; + CPDF_ImageMap m_ImageMap; + CPDF_PatternMap m_PatternMap; +}; + +#endif // CORE_FPDFAPI_PAGE_CPDF_DOCPAGEDATA_H_ diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp index ae962e8b98..64d0114eb9 100644 --- a/core/fpdfapi/page/cpdf_image.cpp +++ b/core/fpdfapi/page/cpdf_image.cpp @@ -11,8 +11,8 @@ #include <vector> #include "core/fpdfapi/cpdf_modulemgr.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/cpdf_page.h" -#include "core/fpdfapi/page/pageint.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_boolean.h" #include "core/fpdfapi/parser/cpdf_document.h" diff --git a/core/fpdfapi/page/cpdf_imageobject.cpp b/core/fpdfapi/page/cpdf_imageobject.cpp index 9fbebfd8bf..c51f648b6f 100644 --- a/core/fpdfapi/page/cpdf_imageobject.cpp +++ b/core/fpdfapi/page/cpdf_imageobject.cpp @@ -8,8 +8,8 @@ #include <memory> +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/cpdf_image.h" -#include "core/fpdfapi/page/pageint.h" #include "core/fpdfapi/parser/cpdf_document.h" CPDF_ImageObject::CPDF_ImageObject() diff --git a/core/fpdfapi/page/cpdf_shadingobject.cpp b/core/fpdfapi/page/cpdf_shadingobject.cpp index 8050fc75b9..84b6aa7cd5 100644 --- a/core/fpdfapi/page/cpdf_shadingobject.cpp +++ b/core/fpdfapi/page/cpdf_shadingobject.cpp @@ -6,8 +6,8 @@ #include "core/fpdfapi/page/cpdf_shadingobject.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/cpdf_shadingpattern.h" -#include "core/fpdfapi/page/pageint.h" #include "core/fpdfapi/parser/cpdf_document.h" CPDF_ShadingObject::CPDF_ShadingObject() : m_pShading(nullptr) {} diff --git a/core/fpdfapi/page/cpdf_shadingpattern.cpp b/core/fpdfapi/page/cpdf_shadingpattern.cpp index dbe35b4714..d2736870e1 100644 --- a/core/fpdfapi/page/cpdf_shadingpattern.cpp +++ b/core/fpdfapi/page/cpdf_shadingpattern.cpp @@ -6,6 +6,7 @@ #include "core/fpdfapi/page/cpdf_shadingpattern.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/pageint.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" diff --git a/core/fpdfapi/page/cpdf_textstate.cpp b/core/fpdfapi/page/cpdf_textstate.cpp index 6fc8ed29cc..cce036c41a 100644 --- a/core/fpdfapi/page/cpdf_textstate.cpp +++ b/core/fpdfapi/page/cpdf_textstate.cpp @@ -6,8 +6,8 @@ #include "core/fpdfapi/page/cpdf_textstate.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/font/cpdf_font.h" -#include "core/fpdfapi/page/pageint.h" #include "core/fpdfapi/parser/cpdf_document.h" CPDF_TextState::CPDF_TextState() {} diff --git a/core/fpdfapi/page/fpdf_page_parser.cpp b/core/fpdfapi/page/fpdf_page_parser.cpp index 124bf71189..60cb3b4bfa 100644 --- a/core/fpdfapi/page/fpdf_page_parser.cpp +++ b/core/fpdfapi/page/fpdf_page_parser.cpp @@ -14,6 +14,7 @@ #include "core/fpdfapi/font/cpdf_font.h" #include "core/fpdfapi/font/cpdf_type3font.h" #include "core/fpdfapi/page/cpdf_allstates.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/cpdf_form.h" #include "core/fpdfapi/page/cpdf_formobject.h" #include "core/fpdfapi/page/cpdf_image.h" diff --git a/core/fpdfapi/page/fpdf_page_parser_old.cpp b/core/fpdfapi/page/fpdf_page_parser_old.cpp index f073b51b27..8c69903b2c 100644 --- a/core/fpdfapi/page/fpdf_page_parser_old.cpp +++ b/core/fpdfapi/page/fpdf_page_parser_old.cpp @@ -11,6 +11,7 @@ #include "core/fpdfapi/cpdf_modulemgr.h" #include "core/fpdfapi/font/cpdf_type3char.h" #include "core/fpdfapi/page/cpdf_allstates.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/cpdf_form.h" #include "core/fpdfapi/page/cpdf_page.h" #include "core/fpdfapi/page/cpdf_pageobject.h" diff --git a/core/fpdfapi/page/pageint.h b/core/fpdfapi/page/pageint.h index 79cd46b819..5f8351e261 100644 --- a/core/fpdfapi/page/pageint.h +++ b/core/fpdfapi/page/pageint.h @@ -307,64 +307,6 @@ class CPDF_ContentParser { std::unique_ptr<CPDF_StreamContentParser> m_pParser; }; -class CPDF_DocPageData { - public: - explicit CPDF_DocPageData(CPDF_Document* pPDFDoc); - ~CPDF_DocPageData(); - - void Clear(bool bRelease = FALSE); - CPDF_Font* GetFont(CPDF_Dictionary* pFontDict); - CPDF_Font* GetStandardFont(const CFX_ByteString& fontName, - CPDF_FontEncoding* pEncoding); - void ReleaseFont(const CPDF_Dictionary* pFontDict); - CPDF_ColorSpace* GetColorSpace(CPDF_Object* pCSObj, - const CPDF_Dictionary* pResources); - CPDF_ColorSpace* GetCopiedColorSpace(CPDF_Object* pCSObj); - void ReleaseColorSpace(const CPDF_Object* pColorSpace); - CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj, - bool bShading, - const CFX_Matrix& matrix); - void ReleasePattern(const CPDF_Object* pPatternObj); - CPDF_Image* GetImage(CPDF_Object* pImageStream); - void ReleaseImage(const CPDF_Object* pImageStream); - CPDF_IccProfile* GetIccProfile(CPDF_Stream* pIccProfileStream); - void ReleaseIccProfile(const CPDF_IccProfile* pIccProfile); - CPDF_StreamAcc* GetFontFileStreamAcc(CPDF_Stream* pFontStream); - void ReleaseFontFileStreamAcc(const CPDF_Stream* pFontStream); - bool IsForceClear() const { return m_bForceClear; } - CPDF_CountedColorSpace* FindColorSpacePtr(CPDF_Object* pCSObj) const; - CPDF_CountedPattern* FindPatternPtr(CPDF_Object* pPatternObj) const; - - private: - using CPDF_CountedFont = CPDF_CountedObject<CPDF_Font>; - using CPDF_CountedIccProfile = CPDF_CountedObject<CPDF_IccProfile>; - using CPDF_CountedImage = CPDF_CountedObject<CPDF_Image>; - using CPDF_CountedStreamAcc = CPDF_CountedObject<CPDF_StreamAcc>; - - using CPDF_ColorSpaceMap = - std::map<const CPDF_Object*, CPDF_CountedColorSpace*>; - using CPDF_FontFileMap = std::map<const CPDF_Stream*, CPDF_CountedStreamAcc*>; - using CPDF_FontMap = std::map<const CPDF_Dictionary*, CPDF_CountedFont*>; - using CPDF_IccProfileMap = - std::map<const CPDF_Stream*, CPDF_CountedIccProfile*>; - using CPDF_ImageMap = std::map<uint32_t, CPDF_CountedImage*>; - using CPDF_PatternMap = std::map<const CPDF_Object*, CPDF_CountedPattern*>; - - CPDF_ColorSpace* GetColorSpaceImpl(CPDF_Object* pCSObj, - const CPDF_Dictionary* pResources, - std::set<CPDF_Object*>* pVisited); - - CPDF_Document* const m_pPDFDoc; - bool m_bForceClear; - std::map<CFX_ByteString, CPDF_Stream*> m_HashProfileMap; - CPDF_ColorSpaceMap m_ColorSpaceMap; - CPDF_FontFileMap m_FontFileMap; - CPDF_FontMap m_FontMap; - CPDF_IccProfileMap m_IccProfileMap; - CPDF_ImageMap m_ImageMap; - CPDF_PatternMap m_PatternMap; -}; - class CPDF_Function { public: enum class Type { diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp index a5bf39d438..c5f64a790c 100644 --- a/core/fpdfapi/parser/cpdf_document.cpp +++ b/core/fpdfapi/parser/cpdf_document.cpp @@ -12,6 +12,7 @@ #include "core/fpdfapi/cpdf_modulemgr.h" #include "core/fpdfapi/font/cpdf_fontencoding.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/cpdf_pagemodule.h" #include "core/fpdfapi/page/pageint.h" #include "core/fpdfapi/parser/cpdf_array.h" diff --git a/core/fpdfapi/render/fpdf_render.cpp b/core/fpdfapi/render/fpdf_render.cpp index 5feeae8f53..4dcad15949 100644 --- a/core/fpdfapi/render/fpdf_render.cpp +++ b/core/fpdfapi/render/fpdf_render.cpp @@ -11,6 +11,7 @@ #include "core/fpdfapi/cpdf_modulemgr.h" #include "core/fpdfapi/font/cpdf_type3char.h" #include "core/fpdfapi/font/cpdf_type3font.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/cpdf_form.h" #include "core/fpdfapi/page/cpdf_formobject.h" #include "core/fpdfapi/page/cpdf_graphicstates.h" diff --git a/core/fpdfapi/render/fpdf_render_image.cpp b/core/fpdfapi/render/fpdf_render_image.cpp index 766eb950fe..049eff30c0 100644 --- a/core/fpdfapi/render/fpdf_render_image.cpp +++ b/core/fpdfapi/render/fpdf_render_image.cpp @@ -10,6 +10,7 @@ #include <utility> #include <vector> +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/cpdf_form.h" #include "core/fpdfapi/page/cpdf_image.h" #include "core/fpdfapi/page/cpdf_imageobject.h" diff --git a/core/fpdfapi/render/fpdf_render_loadimage.cpp b/core/fpdfapi/render/fpdf_render_loadimage.cpp index 0a4579e45e..940aa37479 100644 --- a/core/fpdfapi/render/fpdf_render_loadimage.cpp +++ b/core/fpdfapi/render/fpdf_render_loadimage.cpp @@ -11,9 +11,9 @@ #include <vector> #include "core/fpdfapi/cpdf_modulemgr.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/cpdf_image.h" #include "core/fpdfapi/page/cpdf_imageobject.h" -#include "core/fpdfapi/page/pageint.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_document.h" diff --git a/core/fpdfapi/render/fpdf_render_text.cpp b/core/fpdfapi/render/fpdf_render_text.cpp index 26edc1b0f4..528e11dc44 100644 --- a/core/fpdfapi/render/fpdf_render_text.cpp +++ b/core/fpdfapi/render/fpdf_render_text.cpp @@ -12,12 +12,12 @@ #include "core/fpdfapi/font/cpdf_font.h" #include "core/fpdfapi/font/cpdf_type3char.h" #include "core/fpdfapi/font/cpdf_type3font.h" +#include "core/fpdfapi/page/cpdf_docpagedata.h" #include "core/fpdfapi/page/cpdf_form.h" #include "core/fpdfapi/page/cpdf_imageobject.h" #include "core/fpdfapi/page/cpdf_pageobject.h" #include "core/fpdfapi/page/cpdf_pathobject.h" #include "core/fpdfapi/page/cpdf_textobject.h" -#include "core/fpdfapi/page/pageint.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_document.h" #include "core/fpdfapi/render/cpdf_renderoptions.h" |