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