OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxgraphics/cagg_graphics.h" | 7 #include "xfa/fxgraphics/cagg_graphics.h" |
8 | 8 |
9 CAGG_Graphics::CAGG_Graphics() : m_owner(nullptr) {} | 9 CAGG_Graphics::CAGG_Graphics() : m_owner(nullptr) {} |
10 | 10 |
11 FWL_Error CAGG_Graphics::Create(CFX_Graphics* owner, | 11 FWL_Error CAGG_Graphics::Create(CFX_Graphics* owner, |
12 int32_t width, | 12 int32_t width, |
13 int32_t height, | 13 int32_t height, |
14 FXDIB_Format format) { | 14 FXDIB_Format format) { |
15 if (owner->m_renderDevice) | 15 if (owner->m_renderDevice) |
16 return FWL_Error::ParameterInvalid; | 16 return FWL_Error::ParameterInvalid; |
17 if (m_owner) | 17 if (m_owner) |
18 return FWL_Error::PropertyInvalid; | 18 return FWL_Error::PropertyInvalid; |
19 | 19 |
20 CFX_FxgeDevice* device = new CFX_FxgeDevice; | 20 CFX_FxgeDevice* device = new CFX_FxgeDevice; |
21 device->Create(width, height, format); | 21 device->Create(width, height, format, nullptr); |
22 m_owner = owner; | 22 m_owner = owner; |
23 m_owner->m_renderDevice = device; | 23 m_owner->m_renderDevice = device; |
24 m_owner->m_renderDevice->GetBitmap()->Clear(0xFFFFFFFF); | 24 m_owner->m_renderDevice->GetBitmap()->Clear(0xFFFFFFFF); |
25 return FWL_Error::Succeeded; | 25 return FWL_Error::Succeeded; |
26 } | 26 } |
27 | 27 |
28 CAGG_Graphics::~CAGG_Graphics() { | 28 CAGG_Graphics::~CAGG_Graphics() { |
29 delete m_owner->m_renderDevice; | 29 delete m_owner->m_renderDevice; |
30 } | 30 } |
OLD | NEW |