OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 |
| 7 #ifndef CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_PROGRESSIVERENDERER_H_ |
| 8 #define CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_PROGRESSIVERENDERER_H_ |
| 9 |
| 10 #include <memory> |
| 11 |
| 12 #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" |
| 13 #include "core/include/fpdfapi/fpdf_page.h" |
| 14 #include "core/include/fxcrt/fx_coordinates.h" |
| 15 #include "core/include/fxcrt/fx_system.h" |
| 16 |
| 17 class CPDF_RenderOptions; |
| 18 class CPDF_RenderStatus; |
| 19 class CFX_RenderDevice; |
| 20 class IFX_Pause; |
| 21 |
| 22 class CPDF_ProgressiveRenderer { |
| 23 public: |
| 24 // Must match FDF_RENDER_* definitions in public/fpdf_progressive.h, but |
| 25 // cannot #include that header. fpdfsdk/fpdf_progressive.cpp has |
| 26 // static_asserts to make sure the two sets of values match. |
| 27 enum Status { |
| 28 Ready, // FPDF_RENDER_READER |
| 29 ToBeContinued, // FPDF_RENDER_TOBECOUNTINUED |
| 30 Done, // FPDF_RENDER_DONE |
| 31 Failed // FPDF_RENDER_FAILED |
| 32 }; |
| 33 |
| 34 static int ToFPDFStatus(Status status) { return static_cast<int>(status); } |
| 35 |
| 36 CPDF_ProgressiveRenderer(CPDF_RenderContext* pContext, |
| 37 CFX_RenderDevice* pDevice, |
| 38 const CPDF_RenderOptions* pOptions); |
| 39 ~CPDF_ProgressiveRenderer(); |
| 40 |
| 41 Status GetStatus() const { return m_Status; } |
| 42 void Start(IFX_Pause* pPause); |
| 43 void Continue(IFX_Pause* pPause); |
| 44 |
| 45 private: |
| 46 void RenderStep(); |
| 47 |
| 48 // Maximum page objects to render before checking for pause. |
| 49 static const int kStepLimit = 100; |
| 50 |
| 51 Status m_Status; |
| 52 CPDF_RenderContext* const m_pContext; |
| 53 CFX_RenderDevice* const m_pDevice; |
| 54 const CPDF_RenderOptions* const m_pOptions; |
| 55 std::unique_ptr<CPDF_RenderStatus> m_pRenderStatus; |
| 56 CFX_FloatRect m_ClipRect; |
| 57 FX_DWORD m_LayerIndex; |
| 58 CPDF_RenderContext::Layer* m_pCurrentLayer; |
| 59 CPDF_PageObjectList::iterator m_LastObjectRendered; |
| 60 }; |
| 61 |
| 62 #endif // CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_PROGRESSIVERENDERER_H_ |
OLD | NEW |