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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_render/fpdf_render.cpp » ('j') | fpdfsdk/src/fpdfview.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_
8 #define CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ 8 #define CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_
9 9
10 #include "../../../third_party/base/nonstd_unique_ptr.h"
11 #include "../../../public/fpdf_progressive.h"
10 #include "../fxge/fx_ge.h" 12 #include "../fxge/fx_ge.h"
11 #include "fpdf_page.h" 13 #include "fpdf_page.h"
12 14
15 class CFX_GraphStateData;
16 class CFX_PathData;
17 class CFX_RenderDevice;
18 class CPDF_FormObject;
19 class CPDF_ImageCache;
20 class CPDF_ImageObject;
21 class CPDF_PathObject;
22 class CPDF_QuickStretcher;
13 class CPDF_RenderContext; 23 class CPDF_RenderContext;
14 class CPDF_RenderOptions; 24 class CPDF_RenderOptions;
15 class CPDF_ImageCache; 25 class CPDF_RenderStatus;
16 class IPDF_OCContext; 26 class CPDF_ShadingObject;
17 class CPDF_QuickStretcher;
18 class CFX_PathData;
19 class CFX_GraphStateData;
20 class CFX_RenderDevice;
21 class CPDF_TextObject; 27 class CPDF_TextObject;
22 class CPDF_PathObject; 28 class IFX_Pause;
23 class CPDF_ImageObject; 29
24 class CPDF_ShadingObject;
25 class CPDF_FormObject;
26 class IPDF_OCContext 30 class IPDF_OCContext
27 { 31 {
28 public: 32 public:
29 33
30 virtual ~IPDF_OCContext() {} 34 virtual ~IPDF_OCContext() {}
31 35
32 virtual FX_BOOL CheckOCGVisible(const CPDF_Dictionary* pOCG) = 0; 36 virtual FX_BOOL CheckOCGVisible(const CPDF_Dictionary* pOCG) = 0;
33 37
34 FX_BOOL CheckObjectVisible(const CPDF_PageObject* pObj); 38 FX_BOOL CheckObjectVisible(const CPDF_PageObject* pObj);
35 }; 39 };
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 126
123 CFX_ArrayTemplate<struct _PDF_RenderItem> m_ContentList; 127 CFX_ArrayTemplate<struct _PDF_RenderItem> m_ContentList;
124 128
125 FX_BOOL m_bFirstLayer; 129 FX_BOOL m_bFirstLayer;
126 130
127 void Render(CFX_RenderDevice* pDevice, const CPDF_Pag eObject* pStopObj, 131 void Render(CFX_RenderDevice* pDevice, const CPDF_Pag eObject* pStopObj,
128 const CPDF_RenderOptions* pOptions, const CFX_AffineM atrix* pFinalMatrix); 132 const CPDF_RenderOptions* pOptions, const CFX_AffineM atrix* pFinalMatrix);
129 friend class CPDF_RenderStatus; 133 friend class CPDF_RenderStatus;
130 friend class CPDF_ProgressiveRenderer; 134 friend class CPDF_ProgressiveRenderer;
131 }; 135 };
136
132 class CPDF_ProgressiveRenderer 137 class CPDF_ProgressiveRenderer
133 { 138 {
134 public: 139 public:
140 // Must match FDF_RENDER_* definitions in fpdf_progressive.h.
141 enum Status {
142 Ready = FPDF_RENDER_READER,
143 ToBeContinued = FPDF_RENDER_TOBECOUNTINUED,
144 Done = FPDF_RENDER_DONE,
145 Failed = FPDF_RENDER_FAILED
146 };
147 static int ToFPDFStatus(Status status) { return static_cast<int>(status); }
135 148
136 CPDF_ProgressiveRenderer(); 149 CPDF_ProgressiveRenderer(CPDF_RenderContext* pContext,
137 150 CFX_RenderDevice* pDevice,
151 const CPDF_RenderOptions* pOptions);
138 ~CPDF_ProgressiveRenderer(); 152 ~CPDF_ProgressiveRenderer();
139 153
140 typedef enum { 154 Status GetStatus() const { return m_Status; }
141 Ready, 155 void Start(IFX_Pause* pPause);
142 ToBeContinued, 156 void Continue(IFX_Pause* pPause);
143 Done, 157 int EstimateProgress();
144 Failed
145 } RenderStatus;
146 158
147 RenderStatus» » GetStatus() 159 private:
148 { 160 void RenderStep();
149 return m_Status;
150 }
151 161
162 Status m_Status;
163 CPDF_RenderContext* const m_pContext;
164 CFX_RenderDevice* const m_pDevice;
165 const CPDF_RenderOptions* const m_pOptions;
166 nonstd::unique_ptr<CPDF_RenderStatus> m_pRenderStatus;
167 CFX_FloatRect m_ClipRect;
168 FX_DWORD m_LayerIndex;
169 FX_DWORD m_ObjectIndex;
170 FX_POSITION m_ObjectPos;
171 FX_POSITION m_PrevLastPos;
172 };
152 173
153
154 void Start(CPDF_RenderContext* pContext, CFX_ RenderDevice* pDevice,
155 const CPDF_RenderOptions* pOptions, class IFX_Paus e* pPause, FX_BOOL bDropObjects = FALSE);
156
157 void Continue(class IFX_Pause* pPause);
158
159
160 int EstimateProgress();
161
162 void Clear();
163 protected:
164
165 RenderStatus m_Status;
166
167 CPDF_RenderContext* m_pContext;
168
169 CFX_RenderDevice* m_pDevice;
170
171 const CPDF_RenderOptions* m_pOptions;
172
173 FX_BOOL m_bDropObjects;
174
175 class CPDF_RenderStatus* m_pRenderer;
176
177 CFX_FloatRect m_ClipRect;
178
179 FX_DWORD m_LayerIndex;
180
181 FX_DWORD m_ObjectIndex;
182
183 FX_POSITION m_ObjectPos;
184
185 FX_POSITION m_PrevLastPos;
186
187 void RenderStep();
188 };
189 class CPDF_TextRenderer 174 class CPDF_TextRenderer
190 { 175 {
191 public: 176 public:
192 177
193 static void DrawTextString(CFX_RenderDevice* pDevice, int left, int top, 178 static void DrawTextString(CFX_RenderDevice* pDevice, int left, int top,
194 CPDF_Font* pFont, 179 CPDF_Font* pFont,
195 int height, 180 int height,
196 const CFX_ByteString& str, 181 const CFX_ByteString& str,
197 FX_ARGB argb); 182 FX_ARGB argb);
198 183
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 class CPDF_RenderConfig 267 class CPDF_RenderConfig
283 { 268 {
284 public: 269 public:
285 CPDF_RenderConfig(); 270 CPDF_RenderConfig();
286 ~CPDF_RenderConfig(); 271 ~CPDF_RenderConfig();
287 int m_HalftoneLimit; 272 int m_HalftoneLimit;
288 int m_RenderStepLimit; 273 int m_RenderStepLimit;
289 }; 274 };
290 275
291 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ 276 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_
OLDNEW
« 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