• 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_DEVICEBUFFER_H_
8 #define CORE_FPDFAPI_RENDER_CPDF_DEVICEBUFFER_H_
9 
10 #include "core/fxcrt/fx_coordinates.h"
11 #include "core/fxcrt/retain_ptr.h"
12 #include "core/fxcrt/unowned_ptr.h"
13 
14 class CFX_DIBitmap;
15 class CFX_RenderDevice;
16 class CPDF_PageObject;
17 class CPDF_RenderContext;
18 
19 class CPDF_DeviceBuffer {
20  public:
21   static CFX_Matrix CalculateMatrix(CFX_RenderDevice* pDevice,
22                                     const FX_RECT& rect,
23                                     int max_dpi,
24                                     bool scale);
25 
26   CPDF_DeviceBuffer(CPDF_RenderContext* pContext,
27                     CFX_RenderDevice* pDevice,
28                     const FX_RECT& rect,
29                     const CPDF_PageObject* pObj,
30                     int max_dpi);
31   ~CPDF_DeviceBuffer();
32 
33   bool Initialize();
34   void OutputToDevice();
GetBitmap()35   RetainPtr<CFX_DIBitmap> GetBitmap() const { return m_pBitmap; }
GetMatrix()36   const CFX_Matrix& GetMatrix() const { return m_Matrix; }
37 
38  private:
39   UnownedPtr<CFX_RenderDevice> const m_pDevice;
40   UnownedPtr<CPDF_RenderContext> const m_pContext;
41   UnownedPtr<const CPDF_PageObject> const m_pObject;
42   RetainPtr<CFX_DIBitmap> const m_pBitmap;
43   const FX_RECT m_Rect;
44   const CFX_Matrix m_Matrix;
45 };
46 
47 #endif  // CORE_FPDFAPI_RENDER_CPDF_DEVICEBUFFER_H_
48