From 80b597d3f32ef2509627c7561abb84a6f5ac09bf Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 3 Jun 2015 16:09:12 -0700 Subject: Kill unused IPDF_ classes. Some are simply never defined. Some are never instantiated. Some have paths that are never reached. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1168503003 --- core/include/fpdfapi/fpdf_module.h | 47 +++++++++++----------- core/include/fpdfapi/fpdf_parser.h | 8 ---- core/include/fpdfapi/fpdf_render.h | 26 ------------ core/include/fpdfdoc/fpdf_tagged.h | 8 ++-- core/include/fpdftext/fpdf_text.h | 9 +++-- .../fpdfapi/fpdf_parser/fpdf_parser_document.cpp | 33 --------------- core/src/fpdfapi/fpdf_render/fpdf_render.cpp | 12 ++---- 7 files changed, 36 insertions(+), 107 deletions(-) diff --git a/core/include/fpdfapi/fpdf_module.h b/core/include/fpdfapi/fpdf_module.h index 6317cd0b18..5be2b192c4 100644 --- a/core/include/fpdfapi/fpdf_module.h +++ b/core/include/fpdfapi/fpdf_module.h @@ -9,20 +9,38 @@ #include "../fxcrt/fx_ext.h" +class CCodec_ModuleMgr; +class CFX_AffineMatrix; +class CFX_BitmapDevice; +class CFX_DIBSource; +class CPDF_ColorSpace; +class CPDF_Dictionary; +class CPDF_DocPageData; +class CPDF_DocRenderData; +class CPDF_Document; +class CPDF_FontGlobals; +class CPDF_Image; class CPDF_ModuleMgr; +class CPDF_Page; class CPDF_PageModuleDef; +class CPDF_PageObjects; +class CPDF_PageRenderCache; +class CPDF_RenderConfig; class CPDF_RenderModuleDef; +class CPDF_RenderOptions; class CPDF_SecurityHandler; -class CCodec_ModuleMgr; -class CPDF_Dictionary; -class ICodec_JpegModule; -class ICodec_JpxModule; +class CPDF_Stream; class ICodec_FaxModule; -class ICodec_Jbig2Module; -class ICodec_IccModule; class ICodec_FlateModule; +class ICodec_IccModule; +class ICodec_Jbig2Module; +class ICodec_JpegModule; +class ICodec_JpxModule; +class IPDF_FontMapper; + #define ADDIN_NAME_CJK "Eastern Asian Language Support" #define ADDIN_NAME_DECODER "JPEG2000 and JBIG2 Image Decoders" + class CPDF_ModuleMgr { public: @@ -117,12 +135,6 @@ protected: CFX_PrivateData m_privateData; }; -class CPDF_Document; -class CPDF_DocPageData; -class CPDF_FontGlobals; -class IPDF_FontMgr; -class IPDF_FontMapper; -class CPDF_ColorSpace; class CPDF_PageModuleDef { public: @@ -150,17 +162,6 @@ public: return NULL; } }; -class CPDF_PageObjects; -class CFX_AffineMatrix; -class CPDF_RenderOptions; -class CPDF_Page; -class CPDF_DocRenderData; -class CPDF_PageRenderCache; -class CFX_BitmapDevice; -class CPDF_Stream; -class CFX_DIBSource; -class CPDF_RenderConfig; -class CPDF_Image; class CPDF_RenderModuleDef { public: diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h index 34568e79ca..d18d362ec0 100644 --- a/core/include/fpdfapi/fpdf_parser.h +++ b/core/include/fpdfapi/fpdf_parser.h @@ -51,12 +51,6 @@ class CFX_PrivateData; // 'R' - otherwise. extern const char PDF_CharType[256]; -class IPDF_EnumPageHandler -{ -public: - virtual ~IPDF_EnumPageHandler() { } - virtual FX_BOOL EnumPage(CPDF_Dictionary* pPageDict) = 0; -}; class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjects { public: @@ -92,8 +86,6 @@ public: int GetPageIndex(FX_DWORD objnum); - void EnumPages(IPDF_EnumPageHandler* pHandler); - FX_DWORD GetUserPermissions(FX_BOOL bCheckRevision = FALSE) const; FX_BOOL IsOwner() const; diff --git a/core/include/fpdfapi/fpdf_render.h b/core/include/fpdfapi/fpdf_render.h index 714fffba5c..47d1b19920 100644 --- a/core/include/fpdfapi/fpdf_render.h +++ b/core/include/fpdfapi/fpdf_render.h @@ -96,8 +96,6 @@ public: void AppendObjectList(CPDF_PageObjects* pObjs, const CFX_AffineMatrix* pObject2Device); - void SetBackground(class IPDF_BackgroundDraw* pBackground); - void Render(CFX_RenderDevice* pDevice, const CPDF_RenderOptions* pOptions = NULL, const CFX_AffineMatrix* pFinalMatrix = NULL); @@ -124,8 +122,6 @@ protected: CFX_ArrayTemplate m_ContentList; - IPDF_BackgroundDraw* m_pBackgroundDraw; - FX_BOOL m_bFirstLayer; void Render(CFX_RenderDevice* pDevice, const CPDF_PageObject* pStopObj, @@ -133,15 +129,6 @@ protected: friend class CPDF_RenderStatus; friend class CPDF_ProgressiveRenderer; }; -class IPDF_BackgroundDraw -{ -public: - virtual ~IPDF_BackgroundDraw() { } - virtual void OnDrawBackground( - CFX_RenderDevice* pBitmapDevice, - const CFX_AffineMatrix* pOriginal2Bitmap - ) = 0; -}; class CPDF_ProgressiveRenderer { public: @@ -234,19 +221,6 @@ public: CPDF_Font* pFont, FX_FLOAT font_size, const CFX_AffineMatrix* pText2Device, FX_ARGB fill_argb); }; -class IPDF_PageImageCache -{ -public: - - static IPDF_PageImageCache* Create(); - - virtual ~IPDF_PageImageCache() {} - - virtual void OutputPage(CFX_RenderDevice* pDevice, CPDF_Page* pPage, - int pos_x, int pos_y, int size_x, int size_y, int rotate) = 0; - - virtual void SetCacheLimit(FX_DWORD limit) = 0; -}; class CPDF_PageRenderCache { public: diff --git a/core/include/fpdfdoc/fpdf_tagged.h b/core/include/fpdfdoc/fpdf_tagged.h index 2c40ac176d..4943ad0ce6 100644 --- a/core/include/fpdfdoc/fpdf_tagged.h +++ b/core/include/fpdfdoc/fpdf_tagged.h @@ -7,13 +7,13 @@ #ifndef CORE_INCLUDE_FPDFDOC_FPDF_TAGGED_H_ #define CORE_INCLUDE_FPDFDOC_FPDF_TAGGED_H_ -class CPDF_StructTree; -class CPDF_StructElement; -struct CPDF_StructKid; class CPDF_Document; class CPDF_Page; -class IPDF_ReflowEngine; +class CPDF_StructElement; +class CPDF_StructTree; class IPDF_ReflowedPage; +struct CPDF_StructKid; + class CPDF_StructTree { public: diff --git a/core/include/fpdftext/fpdf_text.h b/core/include/fpdftext/fpdf_text.h index 936e0f1722..d18a7692c6 100644 --- a/core/include/fpdftext/fpdf_text.h +++ b/core/include/fpdftext/fpdf_text.h @@ -12,6 +12,11 @@ #include "../fpdfapi/fpdf_parser.h" class CPDF_PageObjects; +class IPDF_LinkExtract; +class IPDF_ReflowedPage; +class IPDF_TextPage; +class IPDF_TextPageFind; + #define PDF2TXT_AUTO_ROTATE 1 #define PDF2TXT_AUTO_WIDTH 2 #define PDF2TXT_KEEP_COLUMN 4 @@ -24,9 +29,6 @@ void PDF_GetPageText_Unicode(CFX_WideStringArray& lines, CPDF_Document* pDoc, CP void PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_Document* pDoc, CPDF_Dictionary* pPage, FX_DWORD flags); CFX_WideString PDF_GetFirstTextLine_Unicode(CPDF_Document* pDoc, CPDF_Dictionary* pPage); -class IPDF_TextPage; -class IPDF_LinkExtract; -class IPDF_TextPageFind; #define CHAR_ERROR -1 #define CHAR_NORMAL 0 #define CHAR_GENERATED 1 @@ -50,7 +52,6 @@ typedef CFX_ArrayTemplate CFX_RectArray; #define FPDFTEXT_RIGHT 1 #define FPDFTEXT_UP -2 #define FPDFTEXT_DOWN 2 -class IPDF_ReflowedPage; #define FPDFTEXT_WRITINGMODE_UNKNOW 0 #define FPDFTEXT_WRITINGMODE_LRTB 1 #define FPDFTEXT_WRITINGMODE_RLTB 2 diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp index fb43c64a1a..b11c7eeb44 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp @@ -297,39 +297,6 @@ int CPDF_Document::_GetPageCount() const } return _CountPages(pPages, 0); } -static FX_BOOL _EnumPages(CPDF_Dictionary* pPages, IPDF_EnumPageHandler* pHandler) -{ - CPDF_Array* pKidList = pPages->GetArray(FX_BSTRC("Kids")); - if (pKidList == NULL) { - return pHandler->EnumPage(pPages); - } - for (FX_DWORD i = 0; i < pKidList->GetCount(); i ++) { - CPDF_Dictionary* pKid = pKidList->GetDict(i); - if (pKid == NULL) { - continue; - } - if (!pKid->KeyExist(FX_BSTRC("Kids"))) { - if (!pHandler->EnumPage(pKid)) { - return FALSE; - } - } else { - return _EnumPages(pKid, pHandler); - } - } - return TRUE; -} -void CPDF_Document::EnumPages(IPDF_EnumPageHandler* pHandler) -{ - CPDF_Dictionary* pRoot = GetRoot(); - if (pRoot == NULL) { - return; - } - CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages")); - if (pPages == NULL) { - return; - } - _EnumPages(pPages, pHandler); -} FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum, CPDF_Dictionary* pThisPageDict) { for (int i = 0; i < m_PageList.GetSize(); i ++) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index f8c4a41186..a9212522b8 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -915,12 +915,9 @@ void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer, const CPDF_PageObj { CFX_FxgeDevice device; device.Attach(pBuffer); - if (m_pBackgroundDraw) { - m_pBackgroundDraw->OnDrawBackground(&device, pFinalMatrix); - } else { - FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight()); - device.FillRect(&rect, 0xffffffff); - } + + FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight()); + device.FillRect(&rect, 0xffffffff); Render(&device, pObj, pOptions, pFinalMatrix); } CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates(const CPDF_GraphicStates* pSrcStates, FX_BOOL bStroke) @@ -946,7 +943,6 @@ CPDF_RenderContext::CPDF_RenderContext() void CPDF_RenderContext::Create(CPDF_Document* pDoc, CPDF_PageRenderCache* pPageCache, CPDF_Dictionary* pPageResources, FX_BOOL bFirstLayer) { - m_pBackgroundDraw = NULL; m_pDocument = pDoc; m_pPageResources = pPageResources; m_pPageCache = pPageCache; @@ -954,7 +950,6 @@ void CPDF_RenderContext::Create(CPDF_Document* pDoc, CPDF_PageRenderCache* pPage } void CPDF_RenderContext::Create(CPDF_Page* pPage, FX_BOOL bFirstLayer) { - m_pBackgroundDraw = NULL; m_pDocument = pPage->m_pDocument; m_pPageResources = pPage->m_pPageResources; m_pPageCache = pPage->GetRenderCache(); @@ -968,7 +963,6 @@ void CPDF_RenderContext::Clear() m_pDocument = NULL; m_pPageResources = NULL; m_pPageCache = NULL; - m_pBackgroundDraw = NULL; m_bFirstLayer = TRUE; m_ContentList.RemoveAll(); } -- cgit v1.2.3