Home | History | Annotate | Download | only in fde
      1 // Copyright 2014 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 XFA_FDE_FDE_RENDER_H_
      8 #define XFA_FDE_FDE_RENDER_H_
      9 
     10 #include <memory>
     11 #include <vector>
     12 
     13 #include "core/fxcrt/fx_coordinates.h"
     14 #include "xfa/fde/fde_gedevice.h"
     15 #include "xfa/fde/fde_iterator.h"
     16 #include "xfa/fde/fde_visualset.h"
     17 
     18 class CFDE_RenderDevice;
     19 
     20 enum FDE_RENDERSTATUS {
     21   FDE_RENDERSTATUS_Reset = 0,
     22   FDE_RENDERSTATUS_Paused,
     23   FDE_RENDERSTATUS_Done,
     24   FDE_RENDERSTATUS_Failed,
     25 };
     26 
     27 class CFDE_RenderContext {
     28  public:
     29   CFDE_RenderContext();
     30   ~CFDE_RenderContext();
     31 
     32   bool StartRender(CFDE_RenderDevice* pRenderDevice,
     33                    IFDE_CanvasSet* pCanvasSet,
     34                    const CFX_Matrix& tmDoc2Device);
     35   FDE_RENDERSTATUS GetStatus() const { return m_eStatus; }
     36   FDE_RENDERSTATUS DoRender(IFX_Pause* pPause = nullptr);
     37   void StopRender();
     38   void RenderText(IFDE_TextSet* pTextSet, FDE_TEXTEDITPIECE* pText);
     39 
     40  protected:
     41   FDE_RENDERSTATUS m_eStatus;
     42   CFDE_RenderDevice* m_pRenderDevice;
     43   CFX_Matrix m_Transform;
     44   std::vector<FXTEXT_CHARPOS> m_CharPos;
     45   std::unique_ptr<CFDE_Brush> m_pBrush;
     46   std::unique_ptr<CFDE_VisualSetIterator> m_pIterator;
     47 };
     48 
     49 #endif  // XFA_FDE_FDE_RENDER_H_
     50