• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_RENDER_CPDF_SCALEDRENDERBUFFER_H_
8 #define CORE_FPDFAPI_RENDER_CPDF_SCALEDRENDERBUFFER_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/fx_coordinates.h"
13 #include "core/fxcrt/unowned_ptr.h"
14 #include "core/fxge/cfx_defaultrenderdevice.h"
15 
16 class CFX_RenderDevice;
17 class CPDF_PageObject;
18 class CPDF_RenderContext;
19 class CPDF_RenderOptions;
20 
21 class CPDF_ScaledRenderBuffer {
22  public:
23   CPDF_ScaledRenderBuffer();
24   ~CPDF_ScaledRenderBuffer();
25 
26   bool Initialize(CPDF_RenderContext* pContext,
27                   CFX_RenderDevice* pDevice,
28                   const FX_RECT& pRect,
29                   const CPDF_PageObject* pObj,
30                   const CPDF_RenderOptions* pOptions,
31                   int max_dpi);
32 
GetDevice()33   CFX_RenderDevice* GetDevice() const {
34     return m_pBitmapDevice ? m_pBitmapDevice.get() : m_pDevice.Get();
35   }
GetMatrix()36   CFX_Matrix* GetMatrix() { return &m_Matrix; }
37   void OutputToDevice();
38 
39  private:
40   UnownedPtr<CFX_RenderDevice> m_pDevice;
41   UnownedPtr<CPDF_RenderContext> m_pContext;
42   FX_RECT m_Rect;
43   UnownedPtr<const CPDF_PageObject> m_pObject;
44   std::unique_ptr<CFX_DefaultRenderDevice> m_pBitmapDevice;
45   CFX_Matrix m_Matrix;
46 };
47 
48 #endif  // CORE_FPDFAPI_RENDER_CPDF_SCALEDRENDERBUFFER_H_
49