OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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 "../../../foxitlib.h" | 7 #include "../../../foxitlib.h" |
8 CFWL_PictureBox* CFWL_PictureBox::Create() { | 8 CFWL_PictureBox* CFWL_PictureBox::Create() { |
9 return new CFWL_PictureBox; | 9 return new CFWL_PictureBox; |
10 } | 10 } |
11 FWL_ERR CFWL_PictureBox::Initialize(const CFWL_WidgetProperties* pProperties) { | 11 FWL_ERR CFWL_PictureBox::Initialize(const CFWL_WidgetProperties* pProperties) { |
12 if (m_pIface) | 12 if (m_pIface) |
13 return FWL_ERR_Indefinite; | 13 return FWL_ERR_Indefinite; |
14 if (pProperties) { | 14 if (pProperties) { |
15 *m_pProperties = *pProperties; | 15 *m_pProperties = *pProperties; |
16 } | 16 } |
17 m_pIface = new IFWL_PictureBox; | 17 nonstd::unique_ptr<IFWL_PictureBox> pPictureBox(IFWL_PictureBox::Create( |
18 FWL_ERR ret = | 18 m_pProperties->MakeWidgetImpProperties(&m_PictureBoxDP), nullptr)); |
19 ((IFWL_PictureBox*)m_pIface) | 19 FWL_ERR ret = pPictureBox->Initialize(); |
20 ->Initialize(m_pProperties->MakeWidgetImpProperties(&m_PictureBoxDP), | 20 if (ret != FWL_ERR_Succeeded) { |
21 nullptr); | 21 return ret; |
22 if (ret == FWL_ERR_Succeeded) { | |
23 CFWL_Widget::Initialize(); | |
24 } | 22 } |
25 return ret; | 23 m_pIface = pPictureBox.release(); |
| 24 CFWL_Widget::Initialize(); |
| 25 return FWL_ERR_Succeeded; |
26 } | 26 } |
27 CFX_DIBitmap* CFWL_PictureBox::GetPicture() { | 27 CFX_DIBitmap* CFWL_PictureBox::GetPicture() { |
28 return m_PictureBoxDP.m_pBitmap; | 28 return m_PictureBoxDP.m_pBitmap; |
29 } | 29 } |
30 FWL_ERR CFWL_PictureBox::SetPicture(CFX_DIBitmap* pBitmap) { | 30 FWL_ERR CFWL_PictureBox::SetPicture(CFX_DIBitmap* pBitmap) { |
31 m_PictureBoxDP.m_pBitmap = pBitmap; | 31 m_PictureBoxDP.m_pBitmap = pBitmap; |
32 return FWL_ERR_Succeeded; | 32 return FWL_ERR_Succeeded; |
33 } | 33 } |
34 FX_FLOAT CFWL_PictureBox::GetRotation() { | 34 FX_FLOAT CFWL_PictureBox::GetRotation() { |
35 return m_PictureBoxDP.m_fRotation; | 35 return m_PictureBoxDP.m_fRotation; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 matrix.Translate(-fLen, -fWid); | 107 matrix.Translate(-fLen, -fWid); |
108 matrix.Rotate(m_fRotation); | 108 matrix.Rotate(m_fRotation); |
109 matrix.Translate(fLen, fWid); | 109 matrix.Translate(fLen, fWid); |
110 matrix.Scale(m_fScaleX, m_fScaleY); | 110 matrix.Scale(m_fScaleX, m_fScaleY); |
111 matrix.Translate(m_fOffSetX, m_fOffSetY); | 111 matrix.Translate(m_fOffSetX, m_fOffSetY); |
112 return FWL_ERR_Succeeded; | 112 return FWL_ERR_Succeeded; |
113 } | 113 } |
114 int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetFlipMode(IFWL_Widget* pWidget) { | 114 int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetFlipMode(IFWL_Widget* pWidget) { |
115 return m_iFlipMode; | 115 return m_iFlipMode; |
116 } | 116 } |
OLD | NEW |