Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: core/include/fpdfapi/fpdf_render.h

Issue 1233453014: Refactor progressive renderer class. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_render/fpdf_render.cpp » ('j') | fpdfsdk/src/fpdfview.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/include/fpdfapi/fpdf_render.h
diff --git a/core/include/fpdfapi/fpdf_render.h b/core/include/fpdfapi/fpdf_render.h
index c0792cfc356c79ac086304fa8e08a254f58e8929..f3590095ad517b1b6d7f7e06a2739ff4f9225340 100644
--- a/core/include/fpdfapi/fpdf_render.h
+++ b/core/include/fpdfapi/fpdf_render.h
@@ -7,22 +7,26 @@
#ifndef CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_
#define CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_
+#include "../../../third_party/base/nonstd_unique_ptr.h"
+#include "../../../public/fpdf_progressive.h"
#include "../fxge/fx_ge.h"
#include "fpdf_page.h"
-class CPDF_RenderContext;
-class CPDF_RenderOptions;
-class CPDF_ImageCache;
-class IPDF_OCContext;
-class CPDF_QuickStretcher;
-class CFX_PathData;
class CFX_GraphStateData;
+class CFX_PathData;
class CFX_RenderDevice;
-class CPDF_TextObject;
-class CPDF_PathObject;
+class CPDF_FormObject;
+class CPDF_ImageCache;
class CPDF_ImageObject;
+class CPDF_PathObject;
+class CPDF_QuickStretcher;
+class CPDF_RenderContext;
+class CPDF_RenderOptions;
+class CPDF_RenderStatus;
class CPDF_ShadingObject;
-class CPDF_FormObject;
+class CPDF_TextObject;
+class IFX_Pause;
+
class IPDF_OCContext
{
public:
@@ -129,63 +133,44 @@ protected:
friend class CPDF_RenderStatus;
friend class CPDF_ProgressiveRenderer;
};
+
class CPDF_ProgressiveRenderer
{
public:
-
- CPDF_ProgressiveRenderer();
-
+ // Must match FDF_RENDER_* definitions in fpdf_progressive.h.
+ enum Status {
+ Ready = FPDF_RENDER_READER,
+ ToBeContinued = FPDF_RENDER_TOBECOUNTINUED,
+ Done = FPDF_RENDER_DONE,
+ Failed = FPDF_RENDER_FAILED
+ };
+ static int ToFPDFStatus(Status status) { return static_cast<int>(status); }
+
+ CPDF_ProgressiveRenderer(CPDF_RenderContext* pContext,
+ CFX_RenderDevice* pDevice,
+ const CPDF_RenderOptions* pOptions);
~CPDF_ProgressiveRenderer();
- typedef enum {
- Ready,
- ToBeContinued,
- Done,
- Failed
- } RenderStatus;
-
- RenderStatus GetStatus()
- {
- return m_Status;
- }
-
-
-
- void Start(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice,
- const CPDF_RenderOptions* pOptions, class IFX_Pause* pPause, FX_BOOL bDropObjects = FALSE);
-
- void Continue(class IFX_Pause* pPause);
-
-
- int EstimateProgress();
-
- void Clear();
-protected:
-
- RenderStatus m_Status;
-
- CPDF_RenderContext* m_pContext;
-
- CFX_RenderDevice* m_pDevice;
-
- const CPDF_RenderOptions* m_pOptions;
-
- FX_BOOL m_bDropObjects;
-
- class CPDF_RenderStatus* m_pRenderer;
-
- CFX_FloatRect m_ClipRect;
-
- FX_DWORD m_LayerIndex;
-
- FX_DWORD m_ObjectIndex;
-
- FX_POSITION m_ObjectPos;
-
- FX_POSITION m_PrevLastPos;
-
- void RenderStep();
+ Status GetStatus() const { return m_Status; }
+ void Start(IFX_Pause* pPause);
+ void Continue(IFX_Pause* pPause);
+ int EstimateProgress();
+
+private:
+ void RenderStep();
+
+ Status m_Status;
+ CPDF_RenderContext* const m_pContext;
+ CFX_RenderDevice* const m_pDevice;
+ const CPDF_RenderOptions* const m_pOptions;
+ nonstd::unique_ptr<CPDF_RenderStatus> m_pRenderStatus;
+ CFX_FloatRect m_ClipRect;
+ FX_DWORD m_LayerIndex;
+ FX_DWORD m_ObjectIndex;
+ FX_POSITION m_ObjectPos;
+ FX_POSITION m_PrevLastPos;
};
+
class CPDF_TextRenderer
{
public:
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_render/fpdf_render.cpp » ('j') | fpdfsdk/src/fpdfview.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698