OLD | NEW |
(Empty) | |
| 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 #include "xfa/fxgraphics/cagg_graphics.h" |
| 8 |
| 9 CAGG_Graphics::CAGG_Graphics() : m_owner(nullptr) {} |
| 10 |
| 11 FX_ERR CAGG_Graphics::Create(CFX_Graphics* owner, |
| 12 int32_t width, |
| 13 int32_t height, |
| 14 FXDIB_Format format) { |
| 15 if (owner->m_renderDevice) |
| 16 return FX_ERR_Parameter_Invalid; |
| 17 if (m_owner) |
| 18 return FX_ERR_Property_Invalid; |
| 19 |
| 20 CFX_FxgeDevice* device = new CFX_FxgeDevice; |
| 21 device->Create(width, height, format); |
| 22 m_owner = owner; |
| 23 m_owner->m_renderDevice = device; |
| 24 m_owner->m_renderDevice->GetBitmap()->Clear(0xFFFFFFFF); |
| 25 return FX_ERR_Succeeded; |
| 26 } |
| 27 |
| 28 CAGG_Graphics::~CAGG_Graphics() { |
| 29 if (m_owner->m_renderDevice) |
| 30 delete (CFX_FxgeDevice*)m_owner->m_renderDevice; |
| 31 m_owner = nullptr; |
| 32 } |
OLD | NEW |