diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-26 13:13:20 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-26 13:13:20 -0700 |
commit | d647a6b2e3fbd2711273637e5a56e659a113d2e9 (patch) | |
tree | 91c3a2865fe5abeed901d4a5c392afa95205eed4 /core/fpdfapi/fpdf_render | |
parent | 518fd4c5ababbfbf28e010a9c27098e8f6669e4b (diff) | |
download | pdfium-d647a6b2e3fbd2711273637e5a56e659a113d2e9.tar.xz |
Remove several IPDF_ interfaces and CPDF_RenderModule.
This CL removes the interfaces:
* IPDF_ObjectRenderer
* IPDF_OCContext
* IPDF_RenderModule
* IPDF_PageModule
The CPDF_RenderModule was just wrapping new and delete calls. This Cl moves
those up to the callers and removes the CPDF_RenderModule class.
Review URL: https://codereview.chromium.org/1918323003
Diffstat (limited to 'core/fpdfapi/fpdf_render')
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render.cpp | 56 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render_image.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h | 4 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/render_int.h | 72 |
4 files changed, 44 insertions, 90 deletions
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp index c8fa406a08..4f83370ad2 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -22,13 +22,12 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/ipdf_occontext.h" #include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" #include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" -#include "core/fpdfapi/ipdf_rendermodule.h" +#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fxge/include/fx_ge.h" CPDF_DocRenderData::CPDF_DocRenderData(CPDF_Document* pPDFDoc) @@ -88,37 +87,6 @@ void CPDF_DocRenderData::ReleaseCachedType3(CPDF_Type3Font* pFont) { it->second->RemoveRef(); } -class CPDF_RenderModule : public IPDF_RenderModule { - public: - CPDF_RenderModule() {} - - private: - ~CPDF_RenderModule() override {} - - CPDF_DocRenderData* CreateDocData(CPDF_Document* pDoc) override; - void DestroyDocData(CPDF_DocRenderData* p) override; - void ClearDocData(CPDF_DocRenderData* p) override; - - CPDF_DocRenderData* GetRenderData() override { return &m_RenderData; } - - CPDF_DocRenderData m_RenderData; -}; - -CPDF_DocRenderData* CPDF_RenderModule::CreateDocData(CPDF_Document* pDoc) { - return new CPDF_DocRenderData(pDoc); -} -void CPDF_RenderModule::DestroyDocData(CPDF_DocRenderData* pDocData) { - delete pDocData; -} -void CPDF_RenderModule::ClearDocData(CPDF_DocRenderData* p) { - if (p) { - p->Clear(FALSE); - } -} -void CPDF_ModuleMgr::InitRenderModule() { - m_pRenderModule.reset(new CPDF_RenderModule); -} - CPDF_RenderOptions::CPDF_RenderOptions() : m_ColorMode(RENDER_COLOR_NORMAL), m_Flags(RENDER_CLEARTYPE), @@ -242,7 +210,7 @@ FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext, } else { m_InitialStates.DefaultStates(); } - m_pObjectRenderer.reset(); + m_pImageRenderer.reset(); m_Transparency = transparency; return TRUE; } @@ -295,13 +263,13 @@ void CPDF_RenderStatus::RenderSingleObject(const CPDF_PageObject* pObj, FX_BOOL CPDF_RenderStatus::ContinueSingleObject(const CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device, IFX_Pause* pPause) { - if (m_pObjectRenderer) { - if (m_pObjectRenderer->Continue(pPause)) + if (m_pImageRenderer) { + if (m_pImageRenderer->Continue(pPause)) return TRUE; - if (!m_pObjectRenderer->m_Result) + if (!m_pImageRenderer->m_Result) DrawObjWithBackground(pObj, pObj2Device); - m_pObjectRenderer.reset(); + m_pImageRenderer.reset(); return FALSE; } @@ -316,11 +284,11 @@ FX_BOOL CPDF_RenderStatus::ContinueSingleObject(const CPDF_PageObject* pObj, return FALSE; if (pObj->IsImage()) { - m_pObjectRenderer.reset(IPDF_ObjectRenderer::Create()); - if (!m_pObjectRenderer->Start(this, pObj, pObj2Device, FALSE)) { - if (!m_pObjectRenderer->m_Result) + m_pImageRenderer.reset(new CPDF_ImageRenderer); + if (!m_pImageRenderer->Start(this, pObj, pObj2Device, FALSE)) { + if (!m_pImageRenderer->m_Result) DrawObjWithBackground(pObj, pObj2Device); - m_pObjectRenderer.reset(); + m_pImageRenderer.reset(); return FALSE; } return ContinueSingleObject(pObj, pObj2Device, pPause); @@ -330,10 +298,6 @@ FX_BOOL CPDF_RenderStatus::ContinueSingleObject(const CPDF_PageObject* pObj, return FALSE; } -IPDF_ObjectRenderer* IPDF_ObjectRenderer::Create() { - return new CPDF_ImageRenderer; -} - FX_BOOL CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device, FX_BOOL bLogical, diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp index aedf8036cb..528ad78d2b 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -19,10 +19,10 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/ipdf_occontext.h" #include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" +#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fxcodec/include/fx_codec.h" #include "core/fxcrt/include/fx_safe_types.h" #include "core/fxge/include/fx_ge.h" diff --git a/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h index 6935d695be..2590dbbd2d 100644 --- a/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h +++ b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h @@ -10,7 +10,7 @@ #include "core/fxcrt/include/fx_system.h" #include "core/fxge/include/fx_dib.h" -class IPDF_OCContext; +class CPDF_OCContext; #define RENDER_COLOR_NORMAL 0 #define RENDER_COLOR_GRAY 1 @@ -44,7 +44,7 @@ class CPDF_RenderOptions { uint32_t m_Flags; int m_Interpolation; uint32_t m_AddFlags; - IPDF_OCContext* m_pOCContext; + CPDF_OCContext* m_pOCContext; uint32_t m_dwLimitCacheSize; int m_HalftoneLimit; }; diff --git a/core/fpdfapi/fpdf_render/render_int.h b/core/fpdfapi/fpdf_render/render_int.h index a94820ab8e..464ca38784 100644 --- a/core/fpdfapi/fpdf_render/render_int.h +++ b/core/fpdfapi/fpdf_render/render_int.h @@ -16,32 +16,33 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" -class CPDF_PageObjectHolder; -class CPDF_PageRenderCache; -class CPDF_RenderStatus; +class CCodec_ScanlineDecoder; +class CFX_FontCache; class CFX_GlyphBitmap; class CFX_ImageTransformer; +class CPDF_Color; +class CPDF_Dictionary; +class CPDF_Document; +class CPDF_Font; +class CPDF_FormObject; class CPDF_ImageCacheEntry; class CPDF_ImageLoaderHandle; -class CCodec_ScanlineDecoder; -class CPDF_Type3Font; -class CPDF_Type3Cache; -class CPDF_Type3Char; -class CPDF_TransferFunc; -class CPDF_Document; +class CPDF_ImageObject; +class CPDF_ImageRenderer; class CPDF_Object; -class CFX_FontCache; -class CPDF_Font; class CPDF_PageObject; +class CPDF_PageObjectHolder; +class CPDF_PageRenderCache; class CPDF_PathObject; +class CPDF_RenderStatus; class CPDF_ShadingObject; -class CPDF_FormObject; class CPDF_ShadingPattern; -class CPDF_TilingPattern; -class CPDF_Color; -class CPDF_Dictionary; -class CPDF_ImageObject; class CPDF_Stream; +class CPDF_TilingPattern; +class CPDF_TransferFunc; +class CPDF_Type3Cache; +class CPDF_Type3Char; +class CPDF_Type3Font; #define TYPE3_MAX_BLUES 16 @@ -118,19 +119,6 @@ class CPDF_DocRenderData { CPDF_TransferFuncMap m_TransferFuncMap; }; -class IPDF_ObjectRenderer { - public: - static IPDF_ObjectRenderer* Create(); - virtual ~IPDF_ObjectRenderer() {} - virtual FX_BOOL Start(CPDF_RenderStatus* pRenderStatus, - const CPDF_PageObject* pObj, - const CFX_Matrix* pObj2Device, - FX_BOOL bStdCS, - int blendType = FXDIB_BLEND_NORMAL) = 0; - virtual FX_BOOL Continue(IFX_Pause* pPause) = 0; - FX_BOOL m_Result; -}; - class CPDF_RenderStatus { public: CPDF_RenderStatus(); @@ -275,7 +263,7 @@ class CPDF_RenderStatus { const CPDF_PageObject* m_pStopObj; CPDF_GraphicStates m_InitialStates; int m_HalftoneLimit; - std::unique_ptr<IPDF_ObjectRenderer> m_pObjectRenderer; + std::unique_ptr<CPDF_ImageRenderer> m_pImageRenderer; FX_BOOL m_bPrint; int m_Transparency; int m_DitherBits; @@ -342,18 +330,17 @@ class CPDF_ImageLoaderHandle { int32_t m_nDownsampleHeight; }; -class CPDF_ImageRenderer : public IPDF_ObjectRenderer { +class CPDF_ImageRenderer { public: CPDF_ImageRenderer(); - ~CPDF_ImageRenderer() override; + ~CPDF_ImageRenderer(); - // IPDF_ObjectRenderer FX_BOOL Start(CPDF_RenderStatus* pStatus, const CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device, FX_BOOL bStdCS, - int blendType = FXDIB_BLEND_NORMAL) override; - FX_BOOL Continue(IFX_Pause* pPause) override; + int blendType = FXDIB_BLEND_NORMAL); + FX_BOOL Continue(IFX_Pause* pPause); FX_BOOL Start(CPDF_RenderStatus* pStatus, const CFX_DIBSource* pDIBSource, @@ -364,7 +351,16 @@ class CPDF_ImageRenderer : public IPDF_ObjectRenderer { FX_BOOL bStdCS, int blendType = FXDIB_BLEND_NORMAL); + FX_BOOL m_Result; + protected: + FX_BOOL StartBitmapAlpha(); + FX_BOOL StartDIBSource(); + FX_BOOL StartRenderDIBSource(); + FX_BOOL StartLoadDIBSource(); + FX_BOOL DrawMaskedImage(); + FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device); + CPDF_RenderStatus* m_pRenderStatus; const CPDF_ImageObject* m_pImageObject; int m_Status; @@ -383,12 +379,6 @@ class CPDF_ImageRenderer : public IPDF_ObjectRenderer { CPDF_ImageLoaderHandle* m_LoadHandle; FX_BOOL m_bStdCS; int m_BlendType; - FX_BOOL StartBitmapAlpha(); - FX_BOOL StartDIBSource(); - FX_BOOL StartRenderDIBSource(); - FX_BOOL StartLoadDIBSource(); - FX_BOOL DrawMaskedImage(); - FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device); }; class CPDF_ScaledRenderBuffer { |