From e6a5138ec89a1235bf426fd19a0e4f61dfeafca0 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 16 Feb 2016 09:17:44 -0800 Subject: Rework progressive render loop. Migrating this off of CFX_PrtList depends on first making this saner. The tricky part is checking whether new objects have been added to a partially-parsed layer. The old code used to do this by keeping track of the last element in the list, and seeing if it changes. It's far simpler to keep track of the last element processed, and just keep looking for more objects after it with each pass. Fold together some duplicated blocks along the way. Remove unused EstimateProgress() method. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1699443002 . --- core/include/fpdfapi/fpdf_module.h | 2 -- core/include/fpdfapi/fpdf_render.h | 16 +++++----------- 2 files changed, 5 insertions(+), 13 deletions(-) (limited to 'core/include/fpdfapi') diff --git a/core/include/fpdfapi/fpdf_module.h b/core/include/fpdfapi/fpdf_module.h index 6a17a489c2..6888e81000 100644 --- a/core/include/fpdfapi/fpdf_module.h +++ b/core/include/fpdfapi/fpdf_module.h @@ -26,7 +26,6 @@ class CPDF_Image; class CPDF_Page; class CPDF_PageObjectList; class CPDF_PageRenderCache; -class CPDF_RenderConfig; class CPDF_RenderOptions; class CPDF_Stream; class ICodec_FaxModule; @@ -107,7 +106,6 @@ class IPDF_RenderModule { virtual CPDF_DocRenderData* GetRenderData() = 0; virtual CPDF_PageRenderCache* CreatePageCache(CPDF_Page* pPage) = 0; virtual void DestroyPageCache(CPDF_PageRenderCache*) = 0; - virtual CPDF_RenderConfig* GetConfig() = 0; }; #endif // CORE_INCLUDE_FPDFAPI_FPDF_MODULE_H_ diff --git a/core/include/fpdfapi/fpdf_render.h b/core/include/fpdfapi/fpdf_render.h index 2637dd3252..ec5d151914 100644 --- a/core/include/fpdfapi/fpdf_render.h +++ b/core/include/fpdfapi/fpdf_render.h @@ -136,11 +136,13 @@ class CPDF_ProgressiveRenderer { Status GetStatus() const { return m_Status; } void Start(IFX_Pause* pPause); void Continue(IFX_Pause* pPause); - int EstimateProgress(); private: void RenderStep(); + // Maximum page objects to render before checking for pause. + static const int kStepLimit = 100; + Status m_Status; CPDF_RenderContext* const m_pContext; CFX_RenderDevice* const m_pDevice; @@ -148,9 +150,8 @@ class CPDF_ProgressiveRenderer { std::unique_ptr m_pRenderStatus; CFX_FloatRect m_ClipRect; FX_DWORD m_LayerIndex; - FX_DWORD m_ObjectIndex; - FX_POSITION m_ObjectPos; - FX_POSITION m_PrevLastPos; + CPDF_RenderContext::Layer* m_pCurrentLayer; + FX_POSITION m_LastObjectRendered; }; class CPDF_TextRenderer { @@ -261,13 +262,6 @@ class CPDF_PageRenderCache { FX_DWORD m_nCacheSize; FX_BOOL m_bCurFindCache; }; -class CPDF_RenderConfig { - public: - CPDF_RenderConfig(); - ~CPDF_RenderConfig(); - int m_HalftoneLimit; - int m_RenderStepLimit; -}; FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix); -- cgit v1.2.3