Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: xfa/fwl/core/cfwl_picturebox.cpp

Issue 2436103002: Remove FWL globals. (Closed)
Patch Set: fix mac Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "xfa/fwl/core/cfwl_picturebox.h" 7 #include "xfa/fwl/core/cfwl_picturebox.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
11 CFWL_PictureBox::CFWL_PictureBox(const IFWL_App* app) : CFWL_Widget(app) {}
12
13 CFWL_PictureBox::~CFWL_PictureBox() {}
14
15 void CFWL_PictureBox::Initialize(const CFWL_WidgetProperties* pProperties) {
16 ASSERT(!m_pIface);
17
18 if (pProperties)
19 *m_pProperties = *pProperties;
20
21 std::unique_ptr<IFWL_PictureBox> pPictureBox(new IFWL_PictureBox(
22 m_pApp, m_pProperties->MakeWidgetImpProperties(&m_PictureBoxDP)));
23 pPictureBox->Initialize();
24
25 m_pIface = std::move(pPictureBox);
26 CFWL_Widget::Initialize(pProperties);
27 }
28
11 IFWL_PictureBox* CFWL_PictureBox::GetWidget() { 29 IFWL_PictureBox* CFWL_PictureBox::GetWidget() {
12 return static_cast<IFWL_PictureBox*>(m_pIface.get()); 30 return static_cast<IFWL_PictureBox*>(m_pIface.get());
13 } 31 }
14 32
15 const IFWL_PictureBox* CFWL_PictureBox::GetWidget() const { 33 const IFWL_PictureBox* CFWL_PictureBox::GetWidget() const {
16 return static_cast<IFWL_PictureBox*>(m_pIface.get()); 34 return static_cast<IFWL_PictureBox*>(m_pIface.get());
17 } 35 }
18 36
19 FWL_Error CFWL_PictureBox::Initialize(
20 const CFWL_WidgetProperties* pProperties) {
21 if (m_pIface)
22 return FWL_Error::Indefinite;
23 if (pProperties) {
24 *m_pProperties = *pProperties;
25 }
26 std::unique_ptr<IFWL_PictureBox> pPictureBox(new IFWL_PictureBox(
27 m_pProperties->MakeWidgetImpProperties(&m_PictureBoxDP)));
28 FWL_Error ret = pPictureBox->Initialize();
29 if (ret != FWL_Error::Succeeded) {
30 return ret;
31 }
32 m_pIface = std::move(pPictureBox);
33 CFWL_Widget::Initialize();
34 return FWL_Error::Succeeded;
35 }
36
37 CFX_DIBitmap* CFWL_PictureBox::GetPicture() { 37 CFX_DIBitmap* CFWL_PictureBox::GetPicture() {
38 return m_PictureBoxDP.m_pBitmap; 38 return m_PictureBoxDP.m_pBitmap;
39 } 39 }
40 40
41 FWL_Error CFWL_PictureBox::SetPicture(CFX_DIBitmap* pBitmap) { 41 FWL_Error CFWL_PictureBox::SetPicture(CFX_DIBitmap* pBitmap) {
42 m_PictureBoxDP.m_pBitmap = pBitmap; 42 m_PictureBoxDP.m_pBitmap = pBitmap;
43 return FWL_Error::Succeeded; 43 return FWL_Error::Succeeded;
44 } 44 }
45 45
46 FX_FLOAT CFWL_PictureBox::GetRotation() { 46 FX_FLOAT CFWL_PictureBox::GetRotation() {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 fy = matrix.f; 90 fy = matrix.f;
91 return FWL_Error::Succeeded; 91 return FWL_Error::Succeeded;
92 } 92 }
93 93
94 FWL_Error CFWL_PictureBox::SetOffset(FX_FLOAT fx, FX_FLOAT fy) { 94 FWL_Error CFWL_PictureBox::SetOffset(FX_FLOAT fx, FX_FLOAT fy) {
95 m_PictureBoxDP.m_fOffSetX = fx; 95 m_PictureBoxDP.m_fOffSetX = fx;
96 m_PictureBoxDP.m_fOffSetY = fy; 96 m_PictureBoxDP.m_fOffSetY = fy;
97 return FWL_Error::Succeeded; 97 return FWL_Error::Succeeded;
98 } 98 }
99 99
100 CFWL_PictureBox::CFWL_PictureBox() {}
101
102 CFWL_PictureBox::~CFWL_PictureBox() {}
103
104 CFWL_PictureBox::CFWL_PictureBoxDP::CFWL_PictureBoxDP() 100 CFWL_PictureBox::CFWL_PictureBoxDP::CFWL_PictureBoxDP()
105 : m_pBitmap(nullptr), 101 : m_pBitmap(nullptr),
106 m_iOpacity(0), 102 m_iOpacity(0),
107 m_iFlipMode(0), 103 m_iFlipMode(0),
108 m_fRotation(0.0f), 104 m_fRotation(0.0f),
109 m_fScaleX(1.0f), 105 m_fScaleX(1.0f),
110 m_fScaleY(1.0f), 106 m_fScaleY(1.0f),
111 m_fOffSetX(0.0f), 107 m_fOffSetX(0.0f),
112 m_fOffSetY(0.0f) {} 108 m_fOffSetY(0.0f) {}
113 109
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 matrix.Rotate(m_fRotation); 143 matrix.Rotate(m_fRotation);
148 matrix.Translate(fLen, fWid); 144 matrix.Translate(fLen, fWid);
149 matrix.Scale(m_fScaleX, m_fScaleY); 145 matrix.Scale(m_fScaleX, m_fScaleY);
150 matrix.Translate(m_fOffSetX, m_fOffSetY); 146 matrix.Translate(m_fOffSetX, m_fOffSetY);
151 return FWL_Error::Succeeded; 147 return FWL_Error::Succeeded;
152 } 148 }
153 149
154 int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetFlipMode(IFWL_Widget* pWidget) { 150 int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetFlipMode(IFWL_Widget* pWidget) {
155 return m_iFlipMode; 151 return m_iFlipMode;
156 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698