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

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

Issue 1943413002: Convert FWL_ERR into an enum class. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@bcdattribute
Patch Set: Created 4 years, 7 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
« no previous file with comments | « xfa/fwl/lightwidget/cfwl_picturebox.h ('k') | xfa/fwl/lightwidget/cfwl_pushbutton.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/lightwidget/cfwl_picturebox.h" 7 #include "xfa/fwl/lightwidget/cfwl_picturebox.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
11 CFWL_PictureBox* CFWL_PictureBox::Create() { 11 CFWL_PictureBox* CFWL_PictureBox::Create() {
12 return new CFWL_PictureBox; 12 return new CFWL_PictureBox;
13 } 13 }
14 14
15 FWL_ERR CFWL_PictureBox::Initialize(const CFWL_WidgetProperties* pProperties) { 15 FWL_Error CFWL_PictureBox::Initialize(
16 const CFWL_WidgetProperties* pProperties) {
16 if (m_pIface) 17 if (m_pIface)
17 return FWL_ERR_Indefinite; 18 return FWL_Error::Indefinite;
18 if (pProperties) { 19 if (pProperties) {
19 *m_pProperties = *pProperties; 20 *m_pProperties = *pProperties;
20 } 21 }
21 std::unique_ptr<IFWL_PictureBox> pPictureBox(IFWL_PictureBox::Create( 22 std::unique_ptr<IFWL_PictureBox> pPictureBox(IFWL_PictureBox::Create(
22 m_pProperties->MakeWidgetImpProperties(&m_PictureBoxDP), nullptr)); 23 m_pProperties->MakeWidgetImpProperties(&m_PictureBoxDP), nullptr));
23 FWL_ERR ret = pPictureBox->Initialize(); 24 FWL_Error ret = pPictureBox->Initialize();
24 if (ret != FWL_ERR_Succeeded) { 25 if (ret != FWL_Error::Succeeded) {
25 return ret; 26 return ret;
26 } 27 }
27 m_pIface = pPictureBox.release(); 28 m_pIface = pPictureBox.release();
28 CFWL_Widget::Initialize(); 29 CFWL_Widget::Initialize();
29 return FWL_ERR_Succeeded; 30 return FWL_Error::Succeeded;
30 } 31 }
31 32
32 CFX_DIBitmap* CFWL_PictureBox::GetPicture() { 33 CFX_DIBitmap* CFWL_PictureBox::GetPicture() {
33 return m_PictureBoxDP.m_pBitmap; 34 return m_PictureBoxDP.m_pBitmap;
34 } 35 }
35 36
36 FWL_ERR CFWL_PictureBox::SetPicture(CFX_DIBitmap* pBitmap) { 37 FWL_Error CFWL_PictureBox::SetPicture(CFX_DIBitmap* pBitmap) {
37 m_PictureBoxDP.m_pBitmap = pBitmap; 38 m_PictureBoxDP.m_pBitmap = pBitmap;
38 return FWL_ERR_Succeeded; 39 return FWL_Error::Succeeded;
39 } 40 }
40 41
41 FX_FLOAT CFWL_PictureBox::GetRotation() { 42 FX_FLOAT CFWL_PictureBox::GetRotation() {
42 return m_PictureBoxDP.m_fRotation; 43 return m_PictureBoxDP.m_fRotation;
43 } 44 }
44 45
45 FWL_ERR CFWL_PictureBox::SetRotation(FX_FLOAT fRotation) { 46 FWL_Error CFWL_PictureBox::SetRotation(FX_FLOAT fRotation) {
46 m_PictureBoxDP.m_fRotation = fRotation; 47 m_PictureBoxDP.m_fRotation = fRotation;
47 return FWL_ERR_Succeeded; 48 return FWL_Error::Succeeded;
48 } 49 }
49 50
50 int32_t CFWL_PictureBox::GetFlipMode() { 51 int32_t CFWL_PictureBox::GetFlipMode() {
51 return m_PictureBoxDP.GetFlipMode(m_pIface); 52 return m_PictureBoxDP.GetFlipMode(m_pIface);
52 } 53 }
53 54
54 FWL_ERR CFWL_PictureBox::SetFlipMode(int32_t iFlipMode) { 55 FWL_Error CFWL_PictureBox::SetFlipMode(int32_t iFlipMode) {
55 m_PictureBoxDP.m_iFlipMode = iFlipMode; 56 m_PictureBoxDP.m_iFlipMode = iFlipMode;
56 return FWL_ERR_Succeeded; 57 return FWL_Error::Succeeded;
57 } 58 }
58 59
59 int32_t CFWL_PictureBox::GetOpacity() { 60 int32_t CFWL_PictureBox::GetOpacity() {
60 return m_PictureBoxDP.GetOpacity(m_pIface); 61 return m_PictureBoxDP.GetOpacity(m_pIface);
61 } 62 }
62 63
63 FWL_ERR CFWL_PictureBox::SetOpacity(int32_t iOpacity) { 64 FWL_Error CFWL_PictureBox::SetOpacity(int32_t iOpacity) {
64 m_PictureBoxDP.m_iOpacity = iOpacity; 65 m_PictureBoxDP.m_iOpacity = iOpacity;
65 return FWL_ERR_Succeeded; 66 return FWL_Error::Succeeded;
66 } 67 }
67 68
68 FWL_ERR CFWL_PictureBox::GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY) { 69 FWL_Error CFWL_PictureBox::GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY) {
69 CFX_Matrix matrix; 70 CFX_Matrix matrix;
70 m_PictureBoxDP.GetMatrix(m_pIface, matrix); 71 m_PictureBoxDP.GetMatrix(m_pIface, matrix);
71 matrix.Scale(fScaleX, fScaleY); 72 matrix.Scale(fScaleX, fScaleY);
72 return FWL_ERR_Succeeded; 73 return FWL_Error::Succeeded;
73 } 74 }
74 75
75 FWL_ERR CFWL_PictureBox::SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY) { 76 FWL_Error CFWL_PictureBox::SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY) {
76 m_PictureBoxDP.m_fScaleX = fScaleX; 77 m_PictureBoxDP.m_fScaleX = fScaleX;
77 m_PictureBoxDP.m_fScaleY = fScaleY; 78 m_PictureBoxDP.m_fScaleY = fScaleY;
78 return FWL_ERR_Succeeded; 79 return FWL_Error::Succeeded;
79 } 80 }
80 81
81 FWL_ERR CFWL_PictureBox::GetOffset(FX_FLOAT& fx, FX_FLOAT& fy) { 82 FWL_Error CFWL_PictureBox::GetOffset(FX_FLOAT& fx, FX_FLOAT& fy) {
82 CFX_Matrix matrix; 83 CFX_Matrix matrix;
83 m_PictureBoxDP.GetMatrix(m_pIface, matrix); 84 m_PictureBoxDP.GetMatrix(m_pIface, matrix);
84 fx = matrix.e; 85 fx = matrix.e;
85 fy = matrix.f; 86 fy = matrix.f;
86 return FWL_ERR_Succeeded; 87 return FWL_Error::Succeeded;
87 } 88 }
88 89
89 FWL_ERR CFWL_PictureBox::SetOffset(FX_FLOAT fx, FX_FLOAT fy) { 90 FWL_Error CFWL_PictureBox::SetOffset(FX_FLOAT fx, FX_FLOAT fy) {
90 m_PictureBoxDP.m_fOffSetX = fx; 91 m_PictureBoxDP.m_fOffSetX = fx;
91 m_PictureBoxDP.m_fOffSetY = fy; 92 m_PictureBoxDP.m_fOffSetY = fy;
92 return FWL_ERR_Succeeded; 93 return FWL_Error::Succeeded;
93 } 94 }
94 95
95 CFWL_PictureBox::CFWL_PictureBox() {} 96 CFWL_PictureBox::CFWL_PictureBox() {}
96 97
97 CFWL_PictureBox::~CFWL_PictureBox() {} 98 CFWL_PictureBox::~CFWL_PictureBox() {}
98 99
99 FWL_ERR CFWL_PictureBox::CFWL_PictureBoxDP::GetCaption( 100 FWL_Error CFWL_PictureBox::CFWL_PictureBoxDP::GetCaption(
100 IFWL_Widget* pWidget, 101 IFWL_Widget* pWidget,
101 CFX_WideString& wsCaption) { 102 CFX_WideString& wsCaption) {
102 return FWL_ERR_Succeeded; 103 return FWL_Error::Succeeded;
103 } 104 }
104 105
105 CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetPicture( 106 CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetPicture(
106 IFWL_Widget* pWidget) { 107 IFWL_Widget* pWidget) {
107 return m_pBitmap; 108 return m_pBitmap;
108 } 109 }
109 110
110 CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetErrorPicture( 111 CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetErrorPicture(
111 IFWL_Widget* pWidget) { 112 IFWL_Widget* pWidget) {
112 return m_pBitmap; 113 return m_pBitmap;
113 } 114 }
114 115
115 CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetInitialPicture( 116 CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetInitialPicture(
116 IFWL_Widget* pWidget) { 117 IFWL_Widget* pWidget) {
117 return m_pBitmap; 118 return m_pBitmap;
118 } 119 }
119 120
120 int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetOpacity(IFWL_Widget* pWidget) { 121 int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetOpacity(IFWL_Widget* pWidget) {
121 return m_iOpacity; 122 return m_iOpacity;
122 } 123 }
123 124
124 FWL_ERR CFWL_PictureBox::CFWL_PictureBoxDP::GetMatrix(IFWL_Widget* pWidget, 125 FWL_Error CFWL_PictureBox::CFWL_PictureBoxDP::GetMatrix(IFWL_Widget* pWidget,
125 CFX_Matrix& matrix) { 126 CFX_Matrix& matrix) {
126 CFX_RectF rect; 127 CFX_RectF rect;
127 pWidget->GetClientRect(rect); 128 pWidget->GetClientRect(rect);
128 FX_FLOAT fLen = rect.width / 2; 129 FX_FLOAT fLen = rect.width / 2;
129 FX_FLOAT fWid = rect.height / 2; 130 FX_FLOAT fWid = rect.height / 2;
130 matrix.SetIdentity(); 131 matrix.SetIdentity();
131 matrix.Translate(-fLen, -fWid); 132 matrix.Translate(-fLen, -fWid);
132 matrix.Rotate(m_fRotation); 133 matrix.Rotate(m_fRotation);
133 matrix.Translate(fLen, fWid); 134 matrix.Translate(fLen, fWid);
134 matrix.Scale(m_fScaleX, m_fScaleY); 135 matrix.Scale(m_fScaleX, m_fScaleY);
135 matrix.Translate(m_fOffSetX, m_fOffSetY); 136 matrix.Translate(m_fOffSetX, m_fOffSetY);
136 return FWL_ERR_Succeeded; 137 return FWL_Error::Succeeded;
137 } 138 }
138 139
139 int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetFlipMode(IFWL_Widget* pWidget) { 140 int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetFlipMode(IFWL_Widget* pWidget) {
140 return m_iFlipMode; 141 return m_iFlipMode;
141 } 142 }
OLDNEW
« no previous file with comments | « xfa/fwl/lightwidget/cfwl_picturebox.h ('k') | xfa/fwl/lightwidget/cfwl_pushbutton.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698