summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/cfwl_picturebox.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-07 10:28:47 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-07 10:28:47 -0800
commiteb3f68cc7f25a1e28464eb251161b8f08fcd04bc (patch)
tree36e565bac1a7760e605b181b7da4c08bda151cdd /xfa/fwl/core/cfwl_picturebox.cpp
parenta97fc7c6392c0adbd702bdf898cb9e20cee00a3e (diff)
downloadpdfium-eb3f68cc7f25a1e28464eb251161b8f08fcd04bc.tar.xz
Fold DataProviders into parent classes
This CL removes the data provider classes and folds the code into the parent classes. Review-Url: https://codereview.chromium.org/2480233003
Diffstat (limited to 'xfa/fwl/core/cfwl_picturebox.cpp')
-rw-r--r--xfa/fwl/core/cfwl_picturebox.cpp72
1 files changed, 33 insertions, 39 deletions
diff --git a/xfa/fwl/core/cfwl_picturebox.cpp b/xfa/fwl/core/cfwl_picturebox.cpp
index a0e1c30c6c..28d31864c7 100644
--- a/xfa/fwl/core/cfwl_picturebox.cpp
+++ b/xfa/fwl/core/cfwl_picturebox.cpp
@@ -10,7 +10,16 @@
#include "third_party/base/ptr_util.h"
-CFWL_PictureBox::CFWL_PictureBox(const IFWL_App* app) : CFWL_Widget(app) {}
+CFWL_PictureBox::CFWL_PictureBox(const IFWL_App* app)
+ : CFWL_Widget(app),
+ m_pBitmap(nullptr),
+ m_iOpacity(0),
+ m_iFlipMode(0),
+ m_fRotation(0.0f),
+ m_fScaleX(1.0f),
+ m_fScaleY(1.0f),
+ m_fOffSetX(0.0f),
+ m_fOffSetY(0.0f) {}
CFWL_PictureBox::~CFWL_PictureBox() {}
@@ -18,111 +27,96 @@ void CFWL_PictureBox::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_PictureBox>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(&m_PictureBoxDP));
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
CFWL_Widget::Initialize();
}
CFX_DIBitmap* CFWL_PictureBox::GetPicture() {
- return m_PictureBoxDP.m_pBitmap;
+ return m_pBitmap;
}
FWL_Error CFWL_PictureBox::SetPicture(CFX_DIBitmap* pBitmap) {
- m_PictureBoxDP.m_pBitmap = pBitmap;
+ m_pBitmap = pBitmap;
return FWL_Error::Succeeded;
}
FX_FLOAT CFWL_PictureBox::GetRotation() {
- return m_PictureBoxDP.m_fRotation;
+ return m_fRotation;
}
FWL_Error CFWL_PictureBox::SetRotation(FX_FLOAT fRotation) {
- m_PictureBoxDP.m_fRotation = fRotation;
+ m_fRotation = fRotation;
return FWL_Error::Succeeded;
}
int32_t CFWL_PictureBox::GetFlipMode() {
- return m_PictureBoxDP.GetFlipMode(m_pIface.get());
+ return GetFlipMode(m_pIface.get());
}
FWL_Error CFWL_PictureBox::SetFlipMode(int32_t iFlipMode) {
- m_PictureBoxDP.m_iFlipMode = iFlipMode;
+ m_iFlipMode = iFlipMode;
return FWL_Error::Succeeded;
}
int32_t CFWL_PictureBox::GetOpacity() {
- return m_PictureBoxDP.GetOpacity(m_pIface.get());
+ return GetOpacity(m_pIface.get());
}
FWL_Error CFWL_PictureBox::SetOpacity(int32_t iOpacity) {
- m_PictureBoxDP.m_iOpacity = iOpacity;
+ m_iOpacity = iOpacity;
return FWL_Error::Succeeded;
}
FWL_Error CFWL_PictureBox::GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY) {
CFX_Matrix matrix;
- m_PictureBoxDP.GetMatrix(m_pIface.get(), matrix);
+ GetMatrix(m_pIface.get(), matrix);
matrix.Scale(fScaleX, fScaleY);
return FWL_Error::Succeeded;
}
FWL_Error CFWL_PictureBox::SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY) {
- m_PictureBoxDP.m_fScaleX = fScaleX;
- m_PictureBoxDP.m_fScaleY = fScaleY;
+ m_fScaleX = fScaleX;
+ m_fScaleY = fScaleY;
return FWL_Error::Succeeded;
}
FWL_Error CFWL_PictureBox::GetOffset(FX_FLOAT& fx, FX_FLOAT& fy) {
CFX_Matrix matrix;
- m_PictureBoxDP.GetMatrix(m_pIface.get(), matrix);
+ GetMatrix(m_pIface.get(), matrix);
fx = matrix.e;
fy = matrix.f;
return FWL_Error::Succeeded;
}
FWL_Error CFWL_PictureBox::SetOffset(FX_FLOAT fx, FX_FLOAT fy) {
- m_PictureBoxDP.m_fOffSetX = fx;
- m_PictureBoxDP.m_fOffSetY = fy;
+ m_fOffSetX = fx;
+ m_fOffSetY = fy;
return FWL_Error::Succeeded;
}
-CFWL_PictureBox::CFWL_PictureBoxDP::CFWL_PictureBoxDP()
- : m_pBitmap(nullptr),
- m_iOpacity(0),
- m_iFlipMode(0),
- m_fRotation(0.0f),
- m_fScaleX(1.0f),
- m_fScaleY(1.0f),
- m_fOffSetX(0.0f),
- m_fOffSetY(0.0f) {}
-
-FWL_Error CFWL_PictureBox::CFWL_PictureBoxDP::GetCaption(
- IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+FWL_Error CFWL_PictureBox::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
return FWL_Error::Succeeded;
}
-CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetPicture(
- IFWL_Widget* pWidget) {
+CFX_DIBitmap* CFWL_PictureBox::GetPicture(IFWL_Widget* pWidget) {
return m_pBitmap;
}
-CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetErrorPicture(
- IFWL_Widget* pWidget) {
+CFX_DIBitmap* CFWL_PictureBox::GetErrorPicture(IFWL_Widget* pWidget) {
return m_pBitmap;
}
-CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetInitialPicture(
- IFWL_Widget* pWidget) {
+CFX_DIBitmap* CFWL_PictureBox::GetInitialPicture(IFWL_Widget* pWidget) {
return m_pBitmap;
}
-int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetOpacity(IFWL_Widget* pWidget) {
+int32_t CFWL_PictureBox::GetOpacity(IFWL_Widget* pWidget) {
return m_iOpacity;
}
-FWL_Error CFWL_PictureBox::CFWL_PictureBoxDP::GetMatrix(IFWL_Widget* pWidget,
- CFX_Matrix& matrix) {
+FWL_Error CFWL_PictureBox::GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) {
CFX_RectF rect;
pWidget->GetClientRect(rect);
FX_FLOAT fLen = rect.width / 2;
@@ -136,6 +130,6 @@ FWL_Error CFWL_PictureBox::CFWL_PictureBoxDP::GetMatrix(IFWL_Widget* pWidget,
return FWL_Error::Succeeded;
}
-int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetFlipMode(IFWL_Widget* pWidget) {
+int32_t CFWL_PictureBox::GetFlipMode(IFWL_Widget* pWidget) {
return m_iFlipMode;
}