summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-07 16:36:39 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-08 01:36:02 +0000
commitbba2a7cf30da9e84bcc14ef32dbb0bb944229219 (patch)
tree94a74de8d07b3e395bf6e08a62811a3a0d652d19 /xfa/fxfa
parent55e026b7b6eec17b012c819c4a7d39e63094b5c4 (diff)
downloadpdfium-bba2a7cf30da9e84bcc14ef32dbb0bb944229219.tar.xz
Update to use CFX_Rect{F} and CFX_Matrix constructors.
This Cl updates the code to use the constructors instead of creating an empty object and calling Set(). It also removes the various memsets of the CFX_Rect{F} classes. Change-Id: I6e20cec00866a38372858dcba5a30d31103172e4 Reviewed-on: https://pdfium-review.googlesource.com/2550 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/app/xfa_ffbarcode.cpp4
-rw-r--r--xfa/fxfa/app/xfa_ffcheckbutton.cpp10
-rw-r--r--xfa/fxfa/app/xfa_ffdocview.cpp5
-rw-r--r--xfa/fxfa/app/xfa_ffexclgroup.cpp8
-rw-r--r--xfa/fxfa/app/xfa_fffield.cpp18
-rw-r--r--xfa/fxfa/app/xfa_ffpageview.cpp13
-rw-r--r--xfa/fxfa/app/xfa_ffpushbutton.cpp25
-rw-r--r--xfa/fxfa/app/xfa_fftext.cpp4
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp33
-rw-r--r--xfa/fxfa/app/xfa_ffwidgetacc.cpp26
-rw-r--r--xfa/fxfa/app/xfa_fwltheme.cpp2
-rw-r--r--xfa/fxfa/app/xfa_rendercontext.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_layoutitem.cpp12
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp11
14 files changed, 69 insertions, 104 deletions
diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp
index e42bf919c7..78452d5dd3 100644
--- a/xfa/fxfa/app/xfa_ffbarcode.cpp
+++ b/xfa/fxfa/app/xfa_ffbarcode.cpp
@@ -157,8 +157,8 @@ void CXFA_FFBarcode::RenderWidget(CFX_Graphics* pGS,
DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
RenderCaption(pGS, &mtRotate);
CFX_RectF rtWidget = m_pNormalWidget->GetWidgetRect();
- CFX_Matrix mt;
- mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top);
+
+ CFX_Matrix mt(1, 0, 0, 1, rtWidget.left, rtWidget.top);
mt.Concat(mtRotate);
m_pNormalWidget->DrawWidget(pGS, &mt);
}
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
index 3de3672a63..c8ede3761a 100644
--- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
@@ -19,9 +19,7 @@
#include "xfa/fxfa/xfa_ffwidget.h"
CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_WidgetAcc* pDataAcc)
- : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {
- m_rtCheckBox.Set(0, 0, 0, 0);
-}
+ : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
CXFA_FFCheckButton::~CXFA_FFCheckButton() {}
@@ -99,8 +97,7 @@ bool CXFA_FFCheckButton::PerformLayout() {
FX_FLOAT fCapReserve = 0;
CXFA_Caption caption = m_pDataAcc->GetCaption();
if (caption && caption.GetPresence()) {
- m_rtCaption.Set(rtWidget.left, rtWidget.top, rtWidget.width,
- rtWidget.height);
+ m_rtCaption = rtWidget;
iCapPlacement = caption.GetPlacementType();
fCapReserve = caption.GetReserve();
if (fCapReserve <= 0) {
@@ -232,8 +229,7 @@ void CXFA_FFCheckButton::RenderWidget(CFX_Graphics* pGS,
RenderCaption(pGS, &mtRotate);
DrawHighlight(pGS, &mtRotate, dwStatus,
m_pDataAcc->GetCheckButtonShape() == XFA_ATTRIBUTEENUM_Round);
- CFX_Matrix mt;
- mt.Set(1, 0, 0, 1, m_rtCheckBox.left, m_rtCheckBox.top);
+ CFX_Matrix mt(1, 0, 0, 1, m_rtCheckBox.left, m_rtCheckBox.top);
mt.Concat(mtRotate);
GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt);
}
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp
index 847ae07d87..87441814e5 100644
--- a/xfa/fxfa/app/xfa_ffdocview.cpp
+++ b/xfa/fxfa/app/xfa_ffdocview.cpp
@@ -551,10 +551,7 @@ void CXFA_FFDocView::AddInvalidateRect(CXFA_FFPageView* pPageView,
m_mapPageInvalidate[pPageView]->Union(rtInvalidate);
return;
}
- CFX_RectF* pRect = new CFX_RectF;
- pRect->Set(rtInvalidate.left, rtInvalidate.top, rtInvalidate.width,
- rtInvalidate.height);
- m_mapPageInvalidate[pPageView].reset(pRect);
+ m_mapPageInvalidate[pPageView] = pdfium::MakeUnique<CFX_RectF>(rtInvalidate);
}
void CXFA_FFDocView::RunInvalidate() {
diff --git a/xfa/fxfa/app/xfa_ffexclgroup.cpp b/xfa/fxfa/app/xfa_ffexclgroup.cpp
index 6b47cfb8eb..938cdbcb23 100644
--- a/xfa/fxfa/app/xfa_ffexclgroup.cpp
+++ b/xfa/fxfa/app/xfa_ffexclgroup.cpp
@@ -19,13 +19,13 @@ CXFA_FFExclGroup::~CXFA_FFExclGroup() {}
void CXFA_FFExclGroup::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
+
CFX_Matrix mtRotate;
GetRotateMatrix(mtRotate);
- if (pMatrix) {
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
}
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp
index c053a8c6ca..0f9bb65b6f 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/xfa_fffield.cpp
@@ -26,10 +26,7 @@
#include "xfa/fxgraphics/cfx_path.h"
CXFA_FFField::CXFA_FFField(CXFA_WidgetAcc* pDataAcc)
- : CXFA_FFWidget(pDataAcc), m_pNormalWidget(nullptr) {
- m_rtUI.Set(0, 0, 0, 0);
- m_rtCaption.Set(0, 0, 0, 0);
-}
+ : CXFA_FFWidget(pDataAcc), m_pNormalWidget(nullptr) {}
CXFA_FFField::~CXFA_FFField() {
CXFA_FFField::UnloadWidget();
@@ -72,8 +69,7 @@ void CXFA_FFField::RenderWidget(CFX_Graphics* pGS,
DrawHighlight(pGS, &mtRotate, dwStatus, false);
CFX_RectF rtWidget = m_pNormalWidget->GetWidgetRect();
- CFX_Matrix mt;
- mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top);
+ CFX_Matrix mt(1, 0, 0, 1, rtWidget.left, rtWidget.top);
mt.Concat(mtRotate);
GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt);
}
@@ -186,15 +182,14 @@ void CXFA_FFField::CapPlacement() {
if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) {
iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType();
if (iCapPlacement == XFA_ATTRIBUTEENUM_Top && GetPrev()) {
- m_rtCaption.Set(0, 0, 0, 0);
+ m_rtCaption.Reset();
} else if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom && GetNext()) {
- m_rtCaption.Set(0, 0, 0, 0);
+ m_rtCaption.Reset();
} else {
fCapReserve = caption.GetReserve();
CXFA_LayoutItem* pItem = this;
if (!pItem->GetPrev() && !pItem->GetNext()) {
- m_rtCaption.Set(rtWidget.left, rtWidget.top, rtWidget.width,
- rtWidget.height);
+ m_rtCaption = rtWidget;
} else {
pItem = pItem->GetFirst();
m_rtCaption = pItem->GetRect(false);
@@ -617,8 +612,7 @@ void CXFA_FFField::RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix) {
CFX_RectF rtClip = m_rtCaption;
rtClip.Intersect(rtWidget);
CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
- CFX_Matrix mt;
- mt.Set(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top);
+ CFX_Matrix mt(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top);
if (pMatrix) {
pMatrix->TransformRect(rtClip);
mt.Concat(*pMatrix);
diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp
index 3dfa237c0f..da31cbf3b3 100644
--- a/xfa/fxfa/app/xfa_ffpageview.cpp
+++ b/xfa/fxfa/app/xfa_ffpageview.cpp
@@ -33,8 +33,7 @@ void GetPageMatrix(CFX_Matrix& pageMatrix,
ASSERT(iRotate >= 0 && iRotate <= 3);
bool bFlipX = (dwCoordinatesType & 0x01) != 0;
bool bFlipY = (dwCoordinatesType & 0x02) != 0;
- CFX_Matrix m;
- m.Set((bFlipX ? -1.0f : 1.0f), 0, 0, (bFlipY ? -1.0f : 1.0f), 0, 0);
+ CFX_Matrix m((bFlipX ? -1.0f : 1.0f), 0, 0, (bFlipY ? -1.0f : 1.0f), 0, 0);
if (iRotate == 0 || iRotate == 2) {
m.a *= (FX_FLOAT)devicePageRect.width / docPageRect.width;
m.d *= (FX_FLOAT)devicePageRect.height / docPageRect.height;
@@ -126,16 +125,14 @@ CXFA_FFDocView* CXFA_FFPageView::GetDocView() const {
}
void CXFA_FFPageView::GetPageViewRect(CFX_RectF& rtPage) const {
- rtPage.Set(0, 0, GetPageSize());
+ rtPage = CFX_RectF(0, 0, GetPageSize());
}
void CXFA_FFPageView::GetDisplayMatrix(CFX_Matrix& mt,
const CFX_Rect& rtDisp,
int32_t iRotate) const {
CFX_SizeF sz = GetPageSize();
- CFX_RectF fdePage;
- fdePage.Set(0, 0, sz.x, sz.y);
- GetPageMatrix(mt, fdePage, rtDisp, iRotate, 0);
+ GetPageMatrix(mt, CFX_RectF(0, 0, sz.x, sz.y), rtDisp, iRotate, 0);
}
IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator(
@@ -370,8 +367,10 @@ static int32_t XFA_TabOrderWidgetComparator(const void* phWidget1,
const void* phWidget2) {
CXFA_FFWidget* pWidget1 = (*(CXFA_TabParam**)phWidget1)->m_pWidget;
CXFA_FFWidget* pWidget2 = (*(CXFA_TabParam**)phWidget2)->m_pWidget;
- CFX_RectF rt1, rt2;
+ CFX_RectF rt1;
pWidget1->GetWidgetRect(rt1);
+
+ CFX_RectF rt2;
pWidget2->GetWidgetRect(rt2);
FX_FLOAT x1 = rt1.left, y1 = rt1.top, x2 = rt2.left, y2 = rt2.top;
if (y1 < y2 || (y1 - y2 < XFA_FLOAT_PERCISION && x1 < x2)) {
diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp
index 92e5b70d4e..fcb7d32761 100644
--- a/xfa/fxfa/app/xfa_ffpushbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp
@@ -45,8 +45,8 @@ void CXFA_FFPushButton::RenderWidget(CFX_Graphics* pGS,
RenderHighlightCaption(pGS, &mtRotate);
CFX_RectF rtWidget;
GetRectWithoutRotate(rtWidget);
- CFX_Matrix mt;
- mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top);
+
+ CFX_Matrix mt(1, 0, 0, 1, rtWidget.left, rtWidget.top);
mt.Concat(mtRotate);
GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt);
}
@@ -102,20 +102,21 @@ bool CXFA_FFPushButton::PerformLayout() {
CXFA_FFWidget::PerformLayout();
CFX_RectF rtWidget;
GetRectWithoutRotate(rtWidget);
+
m_rtUI = rtWidget;
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
+ if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
XFA_RectWidthoutMargin(rtWidget, mgWidget);
- }
+
CXFA_Caption caption = m_pDataAcc->GetCaption();
- m_rtCaption.Set(rtWidget.left, rtWidget.top, rtWidget.width, rtWidget.height);
- if (CXFA_Margin mgCap = caption.GetMargin()) {
+ m_rtCaption = rtWidget;
+ if (CXFA_Margin mgCap = caption.GetMargin())
XFA_RectWidthoutMargin(m_rtCaption, mgCap);
- }
+
LayoutHighlightCaption();
SetFWLRect();
- if (m_pNormalWidget) {
+ if (m_pNormalWidget)
m_pNormalWidget->Update();
- }
+
return true;
}
FX_FLOAT CXFA_FFPushButton::GetLineWidth() {
@@ -176,8 +177,7 @@ void CXFA_FFPushButton::RenderHighlightCaption(CFX_Graphics* pGS,
GetRectWithoutRotate(rtWidget);
CFX_RectF rtClip = m_rtCaption;
rtClip.Intersect(rtWidget);
- CFX_Matrix mt;
- mt.Set(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top);
+ CFX_Matrix mt(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top);
if (pMatrix) {
pMatrix->TransformRect(rtClip);
mt.Concat(*pMatrix);
@@ -215,8 +215,7 @@ void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics,
if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HiliteInverted) {
if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) &&
(m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) {
- CFX_RectF rtFill = m_pNormalWidget->GetWidgetRect();
- rtFill.left = rtFill.top = 0;
+ CFX_RectF rtFill(0, 0, m_pNormalWidget->GetWidgetRect().Size());
FX_FLOAT fLineWith = GetLineWidth();
rtFill.Deflate(fLineWith, fLineWith);
CFX_Color cr(FXARGB_MAKE(128, 128, 255, 255));
diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp
index b87645d8a7..9176276d85 100644
--- a/xfa/fxfa/app/xfa_fftext.cpp
+++ b/xfa/fxfa/app/xfa_fftext.cpp
@@ -57,8 +57,8 @@ void CXFA_FFText::RenderWidget(CFX_Graphics* pGS,
rtText.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
}
}
- CFX_Matrix mt;
- mt.Set(1, 0, 0, 1, rtText.left, rtText.top);
+
+ CFX_Matrix mt(1, 0, 0, 1, rtText.left, rtText.top);
CFX_RectF rtClip = rtText;
mtRotate.TransformRect(rtClip);
mt.Concat(mtRotate);
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index 95cfe2e59f..d34cecc44c 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -35,9 +35,7 @@
CXFA_FFWidget::CXFA_FFWidget(CXFA_WidgetAcc* pDataAcc)
: CXFA_ContentLayoutItem(pDataAcc->GetNode()),
m_pPageView(nullptr),
- m_pDataAcc(pDataAcc) {
- m_rtWidget.Set(0, 0, 0, 0);
-}
+ m_pDataAcc(pDataAcc) {}
CXFA_FFWidget::~CXFA_FFWidget() {}
@@ -380,7 +378,7 @@ static void XFA_GetMatrix(CFX_Matrix& m,
}
}
void CXFA_FFWidget::GetRotateMatrix(CFX_Matrix& mt) {
- mt.Set(1, 0, 0, 1, 0, 0);
+ mt = CFX_Matrix();
int32_t iRotate = m_pDataAcc->GetRotate();
if (!iRotate) {
return;
@@ -831,18 +829,15 @@ void XFA_DrawImage(CFX_Graphics* pGS,
int32_t iImageYDpi,
int32_t iHorzAlign,
int32_t iVertAlign) {
- if (rtImage.IsEmpty()) {
+ if (rtImage.IsEmpty())
return;
- }
- if (!pDIBitmap || !pDIBitmap->GetBuffer()) {
+ if (!pDIBitmap || !pDIBitmap->GetBuffer())
return;
- }
- FX_FLOAT fWidth =
- XFA_UnitPx2Pt((FX_FLOAT)pDIBitmap->GetWidth(), (FX_FLOAT)iImageXDpi);
- FX_FLOAT fHeight =
- XFA_UnitPx2Pt((FX_FLOAT)pDIBitmap->GetHeight(), (FX_FLOAT)iImageYDpi);
- CFX_RectF rtFit;
- rtFit.Set(rtImage.left, rtImage.top, fWidth, fHeight);
+
+ CFX_RectF rtFit(
+ rtImage.TopLeft(),
+ XFA_UnitPx2Pt((FX_FLOAT)pDIBitmap->GetWidth(), (FX_FLOAT)iImageXDpi),
+ XFA_UnitPx2Pt((FX_FLOAT)pDIBitmap->GetHeight(), (FX_FLOAT)iImageYDpi));
switch (iAspect) {
case XFA_ATTRIBUTEENUM_Fit: {
FX_FLOAT f1 = rtImage.height / rtFit.height;
@@ -1348,10 +1343,9 @@ static void XFA_BOX_GetPath(CXFA_Box box,
if (bInverted) {
sy *= -1;
}
- CFX_RectF rtRadius;
- rtRadius.Set(cp1.x + offsetX * 2, cp1.y + offsetY * 2,
- fRadius1 * 2 * vx - offsetX * 2,
- fRadius1 * 2 * vy - offsetY * 2);
+ CFX_RectF rtRadius(cp1.x + offsetX * 2, cp1.y + offsetY * 2,
+ fRadius1 * 2 * vx - offsetX * 2,
+ fRadius1 * 2 * vy - offsetY * 2);
rtRadius.Normalize();
if (bInverted) {
rtRadius.Offset(-fRadius1 * vx, -fRadius1 * vy);
@@ -1501,8 +1495,7 @@ static void XFA_BOX_GetFillPath(CXFA_Box box,
if (bInverted) {
sy *= -1;
}
- CFX_RectF rtRadius;
- rtRadius.Set(cp1.x, cp1.y, fRadius1 * 2 * vx, fRadius1 * 2 * vy);
+ CFX_RectF rtRadius(cp1.x, cp1.y, fRadius1 * 2 * vx, fRadius1 * 2 * vy);
rtRadius.Normalize();
if (bInverted) {
rtRadius.Offset(-fRadius1 * vx, -fRadius1 * vy);
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
index 97adff30ac..704aec634d 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
@@ -927,16 +927,15 @@ bool CXFA_WidgetAcc::CalculateImageAutoSize(CFX_SizeF& size) {
}
size.clear();
if (CFX_DIBitmap* pBitmap = GetImageImage()) {
- CFX_RectF rtImage, rtFit;
- rtImage.Set(0, 0, 0, 0);
- rtFit.Set(0, 0, 0, 0);
int32_t iImageXDpi = 0;
int32_t iImageYDpi = 0;
GetImageDpi(iImageXDpi, iImageYDpi);
- rtImage.width =
- XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetWidth(), (FX_FLOAT)iImageXDpi);
- rtImage.height =
- XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetHeight(), (FX_FLOAT)iImageYDpi);
+ CFX_RectF rtImage(
+ 0, 0,
+ XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetWidth(), (FX_FLOAT)iImageXDpi),
+ XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetHeight(), (FX_FLOAT)iImageYDpi));
+
+ CFX_RectF rtFit;
if (GetWidth(rtFit.width)) {
GetWidthWithoutMargin(rtFit.width);
} else {
@@ -958,16 +957,15 @@ bool CXFA_WidgetAcc::CalculateImageEditAutoSize(CFX_SizeF& size) {
}
size.clear();
if (CFX_DIBitmap* pBitmap = GetImageEditImage()) {
- CFX_RectF rtImage, rtFit;
- rtImage.Set(0, 0, 0, 0);
- rtFit.Set(0, 0, 0, 0);
int32_t iImageXDpi = 0;
int32_t iImageYDpi = 0;
GetImageEditDpi(iImageXDpi, iImageYDpi);
- rtImage.width =
- XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetWidth(), (FX_FLOAT)iImageXDpi);
- rtImage.height =
- XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetHeight(), (FX_FLOAT)iImageYDpi);
+ CFX_RectF rtImage(
+ 0, 0,
+ XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetWidth(), (FX_FLOAT)iImageXDpi),
+ XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetHeight(), (FX_FLOAT)iImageYDpi));
+
+ CFX_RectF rtFit;
if (GetWidth(rtFit.width)) {
GetWidthWithoutMargin(rtFit.width);
} else {
diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp
index 1de302e995..3398c8a25c 100644
--- a/xfa/fxfa/app/xfa_fwltheme.cpp
+++ b/xfa/fxfa/app/xfa_fwltheme.cpp
@@ -149,8 +149,6 @@ void CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) {
CFX_RectF CXFA_FWLTheme::GetUIMargin(CFWL_ThemePart* pThemePart) const {
CFX_RectF rect;
- rect.Reset();
-
CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget);
if (!pWidget)
return rect;
diff --git a/xfa/fxfa/app/xfa_rendercontext.cpp b/xfa/fxfa/app/xfa_rendercontext.cpp
index 75e7e7d84e..f103b23520 100644
--- a/xfa/fxfa/app/xfa_rendercontext.cpp
+++ b/xfa/fxfa/app/xfa_rendercontext.cpp
@@ -36,7 +36,7 @@ int32_t CXFA_RenderContext::StartRender(CXFA_FFPageView* pPageView,
pGS->GetClipRect(rtPage);
CFX_Matrix mtRes;
mtRes.SetReverse(matrix);
- m_rtClipRect.Set(rtPage.left, rtPage.top, rtPage.width, rtPage.height);
+ m_rtClipRect = rtPage;
mtRes.TransformRect(m_rtClipRect);
m_dwStatus = m_options.m_bHighlight ? XFA_WidgetStatus_Highlight : 0;
uint32_t dwFilterType = XFA_WidgetStatus_Visible |
diff --git a/xfa/fxfa/parser/cxfa_layoutitem.cpp b/xfa/fxfa/parser/cxfa_layoutitem.cpp
index 7a373e1e9a..476d6118ac 100644
--- a/xfa/fxfa/parser/cxfa_layoutitem.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutitem.cpp
@@ -67,11 +67,8 @@ CFX_RectF CXFA_LayoutItem::GetRect(bool bRelative) const {
auto pThis = static_cast<const CXFA_ContentLayoutItem*>(this);
CFX_PointF sPos = pThis->m_sPos;
CFX_SizeF sSize = pThis->m_sSize;
- if (bRelative) {
- CFX_RectF rtLayout;
- rtLayout.Set(sPos.x, sPos.y, sSize.x, sSize.y);
- return rtLayout;
- }
+ if (bRelative)
+ return CFX_RectF(sPos, sSize);
for (CXFA_LayoutItem* pLayoutItem = pThis->m_pParent; pLayoutItem;
pLayoutItem = pLayoutItem->m_pParent) {
@@ -99,10 +96,7 @@ CFX_RectF CXFA_LayoutItem::GetRect(bool bRelative) const {
if (pLayoutItem->m_pFormNode->GetElementType() == XFA_Element::PageArea)
break;
}
-
- CFX_RectF rtLayout;
- rtLayout.Set(sPos.x, sPos.y, sSize.x, sSize.y);
- return rtLayout;
+ return CFX_RectF(sPos, sSize);
}
CXFA_LayoutItem* CXFA_LayoutItem::GetFirst() {
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 6dc3fa6561..d3533c277a 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -407,19 +407,17 @@ CXFA_Border CXFA_WidgetData::GetUIBorder() {
}
CFX_RectF CXFA_WidgetData::GetUIMargin() {
- CFX_RectF rtUIMargin;
- rtUIMargin.Reset();
-
CXFA_Node* pUIChild = GetUIChild();
CXFA_Margin mgUI = CXFA_Margin(
pUIChild ? pUIChild->GetProperty(0, XFA_Element::Margin, false)
: nullptr);
+
if (!mgUI)
- return rtUIMargin;
+ return CFX_RectF();
CXFA_Border border = GetUIBorder();
if (border && border.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
- return rtUIMargin;
+ return CFX_RectF();
FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset;
bool bLeft = mgUI.GetLeftInset(fLeftInset);
@@ -443,8 +441,7 @@ CFX_RectF CXFA_WidgetData::GetUIMargin() {
fLeftInset = GetEdgeThickness(strokes, bVisible, 3);
}
}
- rtUIMargin.Set(fLeftInset, fTopInset, fRightInset, fBottomInset);
- return rtUIMargin;
+ return CFX_RectF(fLeftInset, fTopInset, fRightInset, fBottomInset);
}
int32_t CXFA_WidgetData::GetButtonHighlight() {