summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/page/cpdf_page.cpp20
-rw-r--r--core/fpdfapi/page/cpdf_page.h11
-rw-r--r--core/fpdfapi/page/cpdf_textobject.cpp18
-rw-r--r--core/fpdfapi/page/cpdf_textobject.h2
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp13
-rw-r--r--core/fpdftext/cpdf_textpage.cpp41
-rw-r--r--core/fxge/ge/cfx_renderdevice.cpp3
-rw-r--r--fpdfsdk/cpdfsdk_xfawidgethandler.cpp4
-rw-r--r--fpdfsdk/fpdfformfill.cpp8
-rw-r--r--fpdfsdk/fpdfview.cpp37
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.cpp83
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.h11
-rw-r--r--xfa/fde/cfde_path.cpp21
-rw-r--r--xfa/fde/cfde_path.h11
-rw-r--r--xfa/fde/fde_gedevice.cpp15
-rw-r--r--xfa/fwl/cfwl_edit.cpp5
-rw-r--r--xfa/fwl/cfwl_widgetmgr.cpp13
-rw-r--r--xfa/fxbarcode/oned/BC_OneDimWriter.cpp12
-rw-r--r--xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp27
-rw-r--r--xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp17
-rw-r--r--xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp37
-rw-r--r--xfa/fxfa/app/xfa_ffbarcode.cpp11
-rw-r--r--xfa/fxfa/app/xfa_ffcheckbutton.cpp14
-rw-r--r--xfa/fxfa/app/xfa_ffchoicelist.cpp8
-rw-r--r--xfa/fxfa/app/xfa_ffchoicelist.h4
-rw-r--r--xfa/fxfa/app/xfa_ffexclgroup.cpp3
-rw-r--r--xfa/fxfa/app/xfa_fffield.cpp99
-rw-r--r--xfa/fxfa/app/xfa_fffield.h4
-rw-r--r--xfa/fxfa/app/xfa_ffimage.cpp54
-rw-r--r--xfa/fxfa/app/xfa_ffimageedit.cpp52
-rw-r--r--xfa/fxfa/app/xfa_ffnotify.cpp4
-rw-r--r--xfa/fxfa/app/xfa_ffpageview.cpp39
-rw-r--r--xfa/fxfa/app/xfa_ffpath.cpp78
-rw-r--r--xfa/fxfa/app/xfa_ffpushbutton.cpp68
-rw-r--r--xfa/fxfa/app/xfa_ffsignature.cpp19
-rw-r--r--xfa/fxfa/app/xfa_fftext.cpp117
-rw-r--r--xfa/fxfa/app/xfa_fftext.h1
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.cpp8
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.h4
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp134
-rw-r--r--xfa/fxfa/app/xfa_fwladapter.cpp4
-rw-r--r--xfa/fxfa/app/xfa_rendercontext.cpp9
-rw-r--r--xfa/fxfa/parser/cxfa_line.cpp5
-rw-r--r--xfa/fxfa/parser/cxfa_line.h2
-rw-r--r--xfa/fxfa/xfa_ffpageview.h6
-rw-r--r--xfa/fxfa/xfa_ffwidget.h13
-rw-r--r--xfa/fxgraphics/cfx_graphics.cpp22
-rw-r--r--xfa/fxgraphics/cfx_graphics.h2
48 files changed, 555 insertions, 638 deletions
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index 7714369df8..ba30ce57c3 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -120,15 +120,14 @@ CPDF_Object* CPDF_Page::GetPageAttr(const CFX_ByteString& name) const {
return nullptr;
}
-void CPDF_Page::GetDisplayMatrix(CFX_Matrix& matrix,
- int xPos,
- int yPos,
- int xSize,
- int ySize,
- int iRotate) const {
- if (m_PageWidth == 0 || m_PageHeight == 0) {
- return;
- }
+CFX_Matrix CPDF_Page::GetDisplayMatrix(int xPos,
+ int yPos,
+ int xSize,
+ int ySize,
+ int iRotate) const {
+ if (m_PageWidth == 0 || m_PageHeight == 0)
+ return CFX_Matrix();
+
float x0 = 0;
float y0 = 0;
float x1 = 0;
@@ -170,8 +169,9 @@ void CPDF_Page::GetDisplayMatrix(CFX_Matrix& matrix,
y2 = yPos;
break;
}
- matrix = m_PageMatrix;
+ CFX_Matrix matrix = m_PageMatrix;
matrix.Concat(CFX_Matrix((x2 - x0) / m_PageWidth, (y2 - y0) / m_PageWidth,
(x1 - x0) / m_PageHeight, (y1 - y0) / m_PageHeight,
x0, y0));
+ return matrix;
}
diff --git a/core/fpdfapi/page/cpdf_page.h b/core/fpdfapi/page/cpdf_page.h
index 3812d28670..6d29a8f34e 100644
--- a/core/fpdfapi/page/cpdf_page.h
+++ b/core/fpdfapi/page/cpdf_page.h
@@ -31,12 +31,11 @@ class CPDF_Page : public CPDF_PageObjectHolder {
void ParseContent();
- void GetDisplayMatrix(CFX_Matrix& matrix,
- int xPos,
- int yPos,
- int xSize,
- int ySize,
- int iRotate) const;
+ CFX_Matrix GetDisplayMatrix(int xPos,
+ int yPos,
+ int xSize,
+ int ySize,
+ int iRotate) const;
FX_FLOAT GetPageWidth() const { return m_PageWidth; }
FX_FLOAT GetPageHeight() const { return m_PageHeight; }
diff --git a/core/fpdfapi/page/cpdf_textobject.cpp b/core/fpdfapi/page/cpdf_textobject.cpp
index fb81a40d0c..503ea78f9e 100644
--- a/core/fpdfapi/page/cpdf_textobject.cpp
+++ b/core/fpdfapi/page/cpdf_textobject.cpp
@@ -134,8 +134,7 @@ CPDF_PageObject::Type CPDF_TextObject::GetType() const {
}
void CPDF_TextObject::Transform(const CFX_Matrix& matrix) {
- CFX_Matrix text_matrix;
- GetTextMatrix(&text_matrix);
+ CFX_Matrix text_matrix = GetTextMatrix();
text_matrix.Concat(matrix);
FX_FLOAT* pTextMatrix = m_TextState.GetMutableMatrix();
@@ -160,14 +159,10 @@ const CPDF_TextObject* CPDF_TextObject::AsText() const {
return this;
}
-void CPDF_TextObject::GetTextMatrix(CFX_Matrix* pMatrix) const {
+CFX_Matrix CPDF_TextObject::GetTextMatrix() const {
const FX_FLOAT* pTextMatrix = m_TextState.GetMatrix();
- pMatrix->a = pTextMatrix[0];
- pMatrix->b = pTextMatrix[2];
- pMatrix->c = pTextMatrix[1];
- pMatrix->d = pTextMatrix[3];
- pMatrix->e = m_PosX;
- pMatrix->f = m_PosY;
+ return CFX_Matrix(pTextMatrix[0], pTextMatrix[2], pTextMatrix[1],
+ pTextMatrix[3], m_PosX, m_PosY);
}
void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs,
@@ -361,13 +356,12 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX,
min_y = min_y * fontsize / 1000;
max_y = max_y * fontsize / 1000;
}
- CFX_Matrix matrix;
- GetTextMatrix(&matrix);
+
m_Left = min_x;
m_Right = max_x;
m_Bottom = min_y;
m_Top = max_y;
- matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom);
+ GetTextMatrix().TransformRect(m_Left, m_Right, m_Top, m_Bottom);
if (TextRenderingModeIsStrokeMode(m_TextState.GetTextMode())) {
FX_FLOAT half_width = m_GraphState.GetLineWidth() / 2;
m_Left -= half_width;
diff --git a/core/fpdfapi/page/cpdf_textobject.h b/core/fpdfapi/page/cpdf_textobject.h
index b520e3ee92..2e54f2035e 100644
--- a/core/fpdfapi/page/cpdf_textobject.h
+++ b/core/fpdfapi/page/cpdf_textobject.h
@@ -40,7 +40,7 @@ class CPDF_TextObject : public CPDF_PageObject {
FX_FLOAT GetCharWidth(uint32_t charcode) const;
FX_FLOAT GetPosX() const;
FX_FLOAT GetPosY() const;
- void GetTextMatrix(CFX_Matrix* pMatrix) const;
+ CFX_Matrix GetTextMatrix() const;
CPDF_Font* GetFont() const;
FX_FLOAT GetFontSize() const;
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 86b9670cd1..1bdf4a0382 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -1544,11 +1544,10 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
text_device.Attach(pTextMask.get(), false, nullptr, false);
for (uint32_t i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) {
CPDF_TextObject* textobj = pPageObj->m_ClipPath.GetText(i);
- if (!textobj) {
+ if (!textobj)
break;
- }
- CFX_Matrix text_matrix;
- textobj->GetTextMatrix(&text_matrix);
+
+ CFX_Matrix text_matrix = textobj->GetTextMatrix();
CPDF_TextRenderer::DrawTextPath(
&text_device, textobj->m_nChars, textobj->m_pCharCodes,
textobj->m_pCharPos, textobj->m_TextState.GetFont(),
@@ -1732,8 +1731,7 @@ bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj,
fill_argb = GetFillArgb(textobj);
}
}
- CFX_Matrix text_matrix;
- textobj->GetTextMatrix(&text_matrix);
+ CFX_Matrix text_matrix = textobj->GetTextMatrix();
if (!IsAvailableMatrix(text_matrix))
return true;
@@ -1795,8 +1793,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
CFX_Matrix dCTM = m_pDevice->GetCTM();
FX_FLOAT sa = FXSYS_fabs(dCTM.a);
FX_FLOAT sd = FXSYS_fabs(dCTM.d);
- CFX_Matrix text_matrix;
- textobj->GetTextMatrix(&text_matrix);
+ CFX_Matrix text_matrix = textobj->GetTextMatrix();
CFX_Matrix char_matrix = pType3Font->GetFontMatrix();
FX_FLOAT font_size = textobj->m_TextState.GetFontSize();
char_matrix.Scale(font_size, font_size);
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index a919aa51ec..e5e00168b9 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -115,8 +115,9 @@ CPDF_TextPage::CPDF_TextPage(const CPDF_Page* pPage, FPDFText_Direction flags)
m_bIsParsed(false),
m_TextlineDir(TextOrientation::Unknown) {
m_TextBuf.EstimateSize(0, 10240);
- pPage->GetDisplayMatrix(m_DisplayMatrix, 0, 0, (int)pPage->GetPageWidth(),
- (int)pPage->GetPageHeight(), 0);
+ m_DisplayMatrix =
+ pPage->GetDisplayMatrix(0, 0, static_cast<int>(pPage->GetPageWidth()),
+ static_cast<int>(pPage->GetPageHeight()), 0);
}
CPDF_TextPage::~CPDF_TextPage() {}
@@ -239,8 +240,7 @@ std::vector<CFX_FloatRect> CPDF_TextPage::GetRectArray(int start,
}
if (bFlagNewRect) {
FX_FLOAT orgX = info_curchar.m_OriginX, orgY = info_curchar.m_OriginY;
- CFX_Matrix matrix;
- info_curchar.m_pTextObj->GetTextMatrix(&matrix);
+ CFX_Matrix matrix = info_curchar.m_pTextObj->GetTextMatrix();
matrix.Concat(info_curchar.m_Matrix);
CFX_Matrix matrix_reverse;
@@ -759,8 +759,8 @@ void CPDF_TextPage::ProcessTextObject(
FX_FLOAT prev_width =
GetCharWidth(item.m_CharCode, prev_Obj.m_pTextObj->GetFont()) *
prev_Obj.m_pTextObj->GetFontSize() / 1000;
- CFX_Matrix prev_matrix;
- prev_Obj.m_pTextObj->GetTextMatrix(&prev_matrix);
+
+ CFX_Matrix prev_matrix = prev_Obj.m_pTextObj->GetTextMatrix();
prev_width = FXSYS_fabs(prev_width);
prev_matrix.Concat(prev_Obj.m_formMatrix);
prev_width = prev_matrix.TransformDistance(prev_width);
@@ -769,11 +769,11 @@ void CPDF_TextPage::ProcessTextObject(
pTextObj->GetFontSize() / 1000;
this_width = FXSYS_fabs(this_width);
- CFX_Matrix this_matrix;
- pTextObj->GetTextMatrix(&this_matrix);
+ CFX_Matrix this_matrix = pTextObj->GetTextMatrix();
this_width = FXSYS_fabs(this_width);
this_matrix.Concat(formMatrix);
this_width = this_matrix.TransformDistance(this_width);
+
FX_FLOAT threshold =
prev_width > this_width ? prev_width / 4 : this_width / 4;
FX_FLOAT prev_x = prev_Obj.m_pTextObj->GetPosX(),
@@ -890,10 +890,9 @@ void CPDF_TextPage::ProcessMarkedContent(PDFTEXT_Obj Obj) {
return;
CPDF_Font* pFont = pTextObj->GetFont();
- CFX_Matrix formMatrix = Obj.m_formMatrix;
- CFX_Matrix matrix;
- pTextObj->GetTextMatrix(&matrix);
- matrix.Concat(formMatrix);
+ CFX_Matrix matrix = pTextObj->GetTextMatrix();
+ matrix.Concat(Obj.m_formMatrix);
+
FX_FLOAT fPosX = pTextObj->GetPosX();
FX_FLOAT fPosY = pTextObj->GetPosY();
int nCharInfoIndex = m_TextBuf.GetLength();
@@ -908,6 +907,7 @@ void CPDF_TextPage::ProcessMarkedContent(PDFTEXT_Obj Obj) {
wChar = 0x20;
if (wChar >= 0xFFFD)
continue;
+
PAGECHAR_INFO charinfo;
charinfo.m_OriginX = fPosX;
charinfo.m_OriginY = fPosY;
@@ -977,9 +977,9 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
return;
CFX_Matrix formMatrix = Obj.m_formMatrix;
CPDF_Font* pFont = pTextObj->GetFont();
- CFX_Matrix matrix;
- pTextObj->GetTextMatrix(&matrix);
+ CFX_Matrix matrix = pTextObj->GetTextMatrix();
matrix.Concat(formMatrix);
+
FPDFText_MarkedContent ePreMKC = PreMarkedContent(Obj);
if (ePreMKC == FPDFText_MarkedContent::Done) {
m_pPreTextObj = pTextObj;
@@ -1222,8 +1222,7 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::GetTextObjectWritingMode(
pTextObj->GetCharInfo(0, &first);
pTextObj->GetCharInfo(nChars - 1, &last);
- CFX_Matrix textMatrix;
- pTextObj->GetTextMatrix(&textMatrix);
+ CFX_Matrix textMatrix = pTextObj->GetTextMatrix();
textMatrix.TransformPoint(first.m_OriginX, first.m_OriginY);
textMatrix.TransformPoint(last.m_OriginX, last.m_OriginY);
FX_FLOAT dX = FXSYS_fabs(last.m_OriginX - first.m_OriginX);
@@ -1332,8 +1331,7 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
FX_FLOAT threshold =
last_width > this_width ? last_width / 4 : this_width / 4;
- CFX_Matrix prev_matrix;
- m_pPreTextObj->GetTextMatrix(&prev_matrix);
+ CFX_Matrix prev_matrix = m_pPreTextObj->GetTextMatrix();
prev_matrix.Concat(m_perMatrix);
CFX_Matrix prev_reverse;
@@ -1359,8 +1357,7 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
if (nItem > 1) {
CPDF_TextObjectItem tempItem;
m_pPreTextObj->GetItemInfo(0, &tempItem);
- CFX_Matrix m;
- m_pPreTextObj->GetTextMatrix(&m);
+ CFX_Matrix m = m_pPreTextObj->GetTextMatrix();
if (PrevItem.m_OriginX > tempItem.m_OriginX &&
m_DisplayMatrix.a > 0.9 && m_DisplayMatrix.b < 0.1 &&
m_DisplayMatrix.c < 0.1 && m_DisplayMatrix.d < -0.9 && m.b < 0.1 &&
@@ -1393,9 +1390,9 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
CFX_WideString PrevStr =
m_pPreTextObj->GetFont()->UnicodeFromCharCode(PrevItem.m_CharCode);
FX_WCHAR preChar = PrevStr.GetAt(PrevStr.GetLength() - 1);
- CFX_Matrix matrix;
- pObj->GetTextMatrix(&matrix);
+ CFX_Matrix matrix = pObj->GetTextMatrix();
matrix.Concat(formMatrix);
+
threshold = (FX_FLOAT)(nLastWidth > nThisWidth ? nLastWidth : nThisWidth);
threshold = threshold > 400
? (threshold < 700
diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp
index ba99c87469..15863e7611 100644
--- a/core/fxge/ge/cfx_renderdevice.cpp
+++ b/core/fxge/ge/cfx_renderdevice.cpp
@@ -860,6 +860,7 @@ bool CFX_RenderDevice::DrawNormalText(int nChars,
char2device = *pText2Device;
text2Device = *pText2Device;
}
+
char2device.Scale(font_size, -font_size);
if (FXSYS_fabs(char2device.a) + FXSYS_fabs(char2device.b) > 50 * 1.0f ||
((m_DeviceClass == FXDC_PRINTER) &&
@@ -1072,7 +1073,9 @@ bool CFX_RenderDevice::DrawTextPath(int nChars,
pFont->LoadGlyphPath(charpos.m_GlyphIndex, charpos.m_FontCharWidth);
if (!pPath)
continue;
+
matrix.Concat(*pText2User);
+
CFX_PathData TransformedPath(*pPath);
TransformedPath.Transform(&matrix);
if (fill_color || stroke_color) {
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
index 8d511fcc96..0259be3995 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
@@ -84,9 +84,9 @@ CFX_FloatRect CPDFSDK_XFAWidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
CFX_RectF rcBBox;
XFA_Element eType = pAnnot->GetXFAWidget()->GetDataAcc()->GetUIType();
if (eType == XFA_Element::Signature)
- pAnnot->GetXFAWidget()->GetBBox(rcBBox, XFA_WidgetStatus_Visible, true);
+ rcBBox = pAnnot->GetXFAWidget()->GetBBox(XFA_WidgetStatus_Visible, true);
else
- pAnnot->GetXFAWidget()->GetBBox(rcBBox, XFA_WidgetStatus_None);
+ rcBBox = pAnnot->GetXFAWidget()->GetBBox(XFA_WidgetStatus_None);
CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width,
rcBBox.top + rcBBox.height);
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index beebe65dbb..37ecce509d 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -98,9 +98,8 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
return;
#endif // PDF_ENABLE_XFA
- CFX_Matrix matrix;
- pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate);
-
+ CFX_Matrix matrix =
+ pPage->GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate);
FX_RECT clip(start_x, start_y, start_x + size_x, start_y + size_y);
std::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice);
@@ -190,8 +189,7 @@ DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
CXFA_FFWidget* pXFAAnnot = pWidgetIterator->MoveToNext();
while (pXFAAnnot) {
- CFX_RectF rcBBox;
- pXFAAnnot->GetBBox(rcBBox, 0);
+ CFX_RectF rcBBox = pXFAAnnot->GetBBox(0);
CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width,
rcBBox.top + rcBBox.height);
rcWidget.left -= 1.0f;
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 8aa6ec0fb9..2c2f25ab0b 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -850,16 +850,17 @@ DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page,
pPage->DeviceToPage(start_x, start_y, size_x, size_y, rotate, device_x,
device_y, page_x, page_y);
#else // PDF_ENABLE_XFA
- CFX_Matrix page2device;
- pPage->GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y,
- rotate);
+ CFX_Matrix page2device =
+ pPage->GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate);
CFX_Matrix device2page;
device2page.SetReverse(page2device);
- FX_FLOAT page_x_f, page_y_f;
- device2page.Transform((FX_FLOAT)(device_x), (FX_FLOAT)(device_y), page_x_f,
- page_y_f);
- *page_x = (page_x_f);
- *page_y = (page_y_f);
+
+ FX_FLOAT page_x_f;
+ FX_FLOAT page_y_f;
+ device2page.Transform(static_cast<FX_FLOAT>(device_x),
+ static_cast<FX_FLOAT>(device_y), page_x_f, page_y_f);
+ *page_x = page_x_f;
+ *page_y = page_y_f;
#endif // PDF_ENABLE_XFA
}
@@ -882,12 +883,12 @@ DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page,
pPage->PageToDevice(start_x, start_y, size_x, size_y, rotate, page_x, page_y,
device_x, device_y);
#else // PDF_ENABLE_XFA
- CFX_Matrix page2device;
- pPage->GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y,
- rotate);
- FX_FLOAT device_x_f, device_y_f;
- page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f,
- device_y_f);
+ CFX_Matrix page2device =
+ pPage->GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate);
+ FX_FLOAT device_x_f;
+ FX_FLOAT device_y_f;
+ page2device.Transform(static_cast<FX_FLOAT>(page_x),
+ static_cast<FX_FLOAT>(page_y), device_x_f, device_y_f);
*device_x = FXSYS_round(device_x_f);
*device_y = FXSYS_round(device_y_f);
#endif // PDF_ENABLE_XFA
@@ -982,10 +983,10 @@ void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext,
if (!pPage)
return;
- CFX_Matrix matrix;
- pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate);
- FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y);
- RenderPageImpl(pContext, pPage, matrix, rect, flags, bNeedToRestore, pause);
+ RenderPageImpl(pContext, pPage, pPage->GetDisplayMatrix(
+ start_x, start_y, size_x, size_y, rotate),
+ FX_RECT(start_x, start_y, start_x + size_x, start_y + size_y),
+ flags, bNeedToRestore, pause);
}
DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document,
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index 8011295f96..f39a01078e 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -101,17 +101,16 @@ FX_FLOAT CPDFXFA_Page::GetPageWidth() const {
int nDocType = m_pContext->GetDocType();
switch (nDocType) {
case DOCTYPE_DYNAMIC_XFA: {
- if (m_pXFAPageView) {
- CFX_RectF rect;
- m_pXFAPageView->GetPageViewRect(rect);
- return rect.width;
- }
- } break;
+ if (m_pXFAPageView)
+ return m_pXFAPageView->GetPageViewRect().width;
+ break;
+ }
case DOCTYPE_STATIC_XFA:
case DOCTYPE_PDF: {
if (m_pPDFPage)
return m_pPDFPage->GetPageWidth();
- } break;
+ break;
+ }
default:
return 0.0f;
}
@@ -129,14 +128,13 @@ FX_FLOAT CPDFXFA_Page::GetPageHeight() const {
case DOCTYPE_STATIC_XFA: {
if (m_pPDFPage)
return m_pPDFPage->GetPageHeight();
- } break;
+ break;
+ }
case DOCTYPE_DYNAMIC_XFA: {
- if (m_pXFAPageView) {
- CFX_RectF rect;
- m_pXFAPageView->GetPageViewRect(rect);
- return rect.height;
- }
- } break;
+ if (m_pXFAPageView)
+ return m_pXFAPageView->GetPageViewRect().height;
+ break;
+ }
default:
return 0.0f;
}
@@ -158,16 +156,14 @@ void CPDFXFA_Page::DeviceToPage(int start_x,
FX_FLOAT page_x_f, page_y_f;
- CFX_Matrix page2device;
- GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, rotate);
-
CFX_Matrix device2page;
- device2page.SetReverse(page2device);
- device2page.Transform((FX_FLOAT)(device_x), (FX_FLOAT)(device_y), page_x_f,
- page_y_f);
+ device2page.SetReverse(
+ GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate));
+ device2page.Transform(static_cast<FX_FLOAT>(device_x),
+ static_cast<FX_FLOAT>(device_y), page_x_f, page_y_f);
- *page_x = (page_x_f);
- *page_y = (page_y_f);
+ *page_x = page_x_f;
+ *page_y = page_y_f;
}
void CPDFXFA_Page::PageToDevice(int start_x,
@@ -182,42 +178,43 @@ void CPDFXFA_Page::PageToDevice(int start_x,
if (!m_pPDFPage && !m_pXFAPageView)
return;
- FX_FLOAT device_x_f, device_y_f;
-
- CFX_Matrix page2device;
- GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, rotate);
+ FX_FLOAT device_x_f;
+ FX_FLOAT device_y_f;
- page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f,
- device_y_f);
+ CFX_Matrix page2device =
+ GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate);
+ page2device.Transform(static_cast<FX_FLOAT>(page_x),
+ static_cast<FX_FLOAT>(page_y), device_x_f, device_y_f);
*device_x = FXSYS_round(device_x_f);
*device_y = FXSYS_round(device_y_f);
}
-void CPDFXFA_Page::GetDisplayMatrix(CFX_Matrix& matrix,
- int xPos,
- int yPos,
- int xSize,
- int ySize,
- int iRotate) const {
+CFX_Matrix CPDFXFA_Page::GetDisplayMatrix(int xPos,
+ int yPos,
+ int xSize,
+ int ySize,
+ int iRotate) const {
if (!m_pPDFPage && !m_pXFAPageView)
- return;
+ return CFX_Matrix();
int nDocType = m_pContext->GetDocType();
switch (nDocType) {
case DOCTYPE_DYNAMIC_XFA: {
if (m_pXFAPageView) {
- CFX_Rect rect(xPos, yPos, xSize, ySize);
- m_pXFAPageView->GetDisplayMatrix(matrix, rect, iRotate);
+ return m_pXFAPageView->GetDisplayMatrix(
+ CFX_Rect(xPos, yPos, xSize, ySize), iRotate);
}
- } break;
+ break;
+ }
case DOCTYPE_PDF:
case DOCTYPE_STATIC_XFA: {
- if (m_pPDFPage) {
- m_pPDFPage->GetDisplayMatrix(matrix, xPos, yPos, xSize, ySize, iRotate);
- }
- } break;
+ if (m_pPDFPage)
+ return m_pPDFPage->GetDisplayMatrix(xPos, yPos, xSize, ySize, iRotate);
+ break;
+ }
default:
- return;
+ return CFX_Matrix();
}
+ return CFX_Matrix();
}
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.h b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
index 79158f4ea7..993885d59e 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
@@ -60,12 +60,11 @@ class CPDFXFA_Page {
int* device_x,
int* device_y);
- void GetDisplayMatrix(CFX_Matrix& matrix,
- int xPos,
- int yPos,
- int xSize,
- int ySize,
- int iRotate) const;
+ CFX_Matrix GetDisplayMatrix(int xPos,
+ int yPos,
+ int xSize,
+ int ySize,
+ int iRotate) const;
protected:
// Refcounted class.
diff --git a/xfa/fde/cfde_path.cpp b/xfa/fde/cfde_path.cpp
index 15d33339bf..825de40bfe 100644
--- a/xfa/fde/cfde_path.cpp
+++ b/xfa/fde/cfde_path.cpp
@@ -20,14 +20,11 @@ bool CFDE_Path::CloseFigure() {
return true;
}
-FX_PATHPOINT* CFDE_Path::GetLastPoint(int32_t iCount) const {
- if (iCount < 1)
- return nullptr;
-
+FX_PATHPOINT* CFDE_Path::GetLastPoint() const {
int32_t iPoints = m_Path.GetPointCount();
- if (iCount > iPoints)
+ if (iPoints == 0)
return nullptr;
- return m_Path.GetPoints() + iPoints - iCount;
+ return m_Path.GetPoints() + iPoints - 1;
}
bool CFDE_Path::FigureClosed() const {
@@ -253,16 +250,16 @@ void CFDE_Path::AddRectangle(const CFX_RectF& rect) {
CloseFigure();
}
-void CFDE_Path::GetBBox(CFX_RectF& bbox) const {
+CFX_RectF CFDE_Path::GetBBox() const {
CFX_FloatRect rect = m_Path.GetBoundingBox();
- bbox = CFX_RectF(rect.left, rect.top, rect.Width(), rect.Height());
+ CFX_RectF bbox = CFX_RectF(rect.left, rect.top, rect.Width(), rect.Height());
bbox.Normalize();
+ return bbox;
}
-void CFDE_Path::GetBBox(CFX_RectF& bbox,
- FX_FLOAT fLineWidth,
- FX_FLOAT fMiterLimit) const {
+CFX_RectF CFDE_Path::GetBBox(FX_FLOAT fLineWidth, FX_FLOAT fMiterLimit) const {
CFX_FloatRect rect = m_Path.GetBoundingBox(fLineWidth, fMiterLimit);
- bbox = CFX_RectF(rect.left, rect.top, rect.Width(), rect.Height());
+ CFX_RectF bbox = CFX_RectF(rect.left, rect.top, rect.Width(), rect.Height());
bbox.Normalize();
+ return bbox;
}
diff --git a/xfa/fde/cfde_path.h b/xfa/fde/cfde_path.h
index d2d8fe99ec..ab5995016a 100644
--- a/xfa/fde/cfde_path.h
+++ b/xfa/fde/cfde_path.h
@@ -28,12 +28,11 @@ class CFDE_Path {
void AddPath(const CFDE_Path* pSrc, bool bConnect);
void AddPolygon(const std::vector<CFX_PointF>& points);
void AddRectangle(const CFX_RectF& rect);
- void GetBBox(CFX_RectF& bbox) const;
- void GetBBox(CFX_RectF& bbox,
- FX_FLOAT fLineWidth,
- FX_FLOAT fMiterLimit) const;
FX_PATHPOINT* AddPoints(int32_t iCount);
- FX_PATHPOINT* GetLastPoint(int32_t iCount = 1) const;
+
+ CFX_RectF GetBBox() const;
+ CFX_RectF GetBBox(FX_FLOAT fLineWidth, FX_FLOAT fMiterLimit) const;
+
bool FigureClosed() const;
void MoveTo(FX_FLOAT fx, FX_FLOAT fy);
void LineTo(FX_FLOAT fx, FX_FLOAT fy);
@@ -46,6 +45,8 @@ class CFDE_Path {
FX_FLOAT endAngle);
void MoveTo(const CFX_PointF& p0) { MoveTo(p0.x, p0.y); }
void LineTo(const CFX_PointF& p1) { LineTo(p1.x, p1.y); }
+
+ FX_PATHPOINT* GetLastPoint() const;
void GetCurveTangents(const std::vector<CFX_PointF>& points,
std::vector<CFX_PointF>* tangents,
bool bClosed,
diff --git a/xfa/fde/fde_gedevice.cpp b/xfa/fde/fde_gedevice.cpp
index 8b5ef1c40e..db05f76241 100644
--- a/xfa/fde/fde_gedevice.cpp
+++ b/xfa/fde/fde_gedevice.cpp
@@ -168,12 +168,10 @@ bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush,
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
FxFont.SetFace(pFxFont->GetFace());
m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize,
- (const CFX_Matrix*)pMatrix, argb,
- FXTEXT_CLEARTYPE);
+ pMatrix, argb, FXTEXT_CLEARTYPE);
#else
m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize,
- (const CFX_Matrix*)pMatrix, argb,
- FXTEXT_CLEARTYPE);
+ pMatrix, argb, FXTEXT_CLEARTYPE);
#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
}
pCurFont = pSTFont;
@@ -188,15 +186,14 @@ bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush,
pFxFont = pCurFont->GetDevFont();
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
FxFont.SetFace(pFxFont->GetFace());
- bool bRet = m_pDevice->DrawNormalText(
- iCurCount, pCurCP, &FxFont, -fFontSize, (const CFX_Matrix*)pMatrix,
- argb, FXTEXT_CLEARTYPE);
+ bool bRet =
+ m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize,
+ pMatrix, argb, FXTEXT_CLEARTYPE);
FxFont.SetFace(nullptr);
return bRet;
#else
return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize,
- (const CFX_Matrix*)pMatrix, argb,
- FXTEXT_CLEARTYPE);
+ pMatrix, argb, FXTEXT_CLEARTYPE);
#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
}
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 667104df74..a227176ed0 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -1115,11 +1115,8 @@ void CFWL_Edit::ShowCaret(CFX_RectF* pRect) {
if (!pDocEnvironment)
return;
- CFX_Matrix mt;
- pXFAWidget->GetRotateMatrix(mt);
-
CFX_RectF rt(*pRect);
- mt.TransformRect(rt);
+ pXFAWidget->GetRotateMatrix().TransformRect(rt);
pDocEnvironment->DisplayCaret(pXFAWidget, true, &rt);
}
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index 6e537a4ad9..0af93dc38b 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -432,16 +432,15 @@ void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget,
CFX_RectF clipCopy(0, 0, pWidget->GetWidgetRect().Size());
CFX_RectF clipBounds;
-#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ || \
- _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_
- pWidget->GetDelegate()->OnDrawWidget(pGraphics, pMatrix);
- pGraphics->GetClipRect(clipBounds);
- clipCopy = clipBounds;
-#elif _FX_OS_ == _FX_MACOSX_
+#if _FX_OS_ == _FX_MACOSX_
if (IsFormDisabled()) {
+#endif // _FX_OS_ == _FX_MACOSX_
+
pWidget->GetDelegate()->OnDrawWidget(pGraphics, pMatrix);
- pGraphics->GetClipRect(clipBounds);
+ clipBounds = pGraphics->GetClipRect();
clipCopy = clipBounds;
+
+#if _FX_OS_ == _FX_MACOSX_
} else {
clipBounds = CFX_RectF(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d);
const_cast<CFX_Matrix*>(pMatrix)->SetIdentity(); // FIXME: const cast.
diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
index 49b1847d9c..93a53a88a1 100644
--- a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -223,8 +223,8 @@ void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device,
affine_matrix.Concat(*matrix);
}
device->DrawNormalText(str.GetLength(), pCharPos, m_pFont,
- (FX_FLOAT)iFontSize, &affine_matrix, m_fontColor,
- FXTEXT_CLEARTYPE);
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
}
void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap,
@@ -240,9 +240,11 @@ void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap,
ge.Create((int)geWidth, iTextHeight, m_colorSpace, nullptr);
FX_RECT geRect(0, 0, (int)geWidth, iTextHeight);
ge.FillRect(&geRect, m_backgroundColor);
- CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
- ge.DrawNormalText(str.GetLength(), pCharPos, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
+ CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0,
+ static_cast<FX_FLOAT>(iFontSize));
+ ge.DrawNormalText(str.GetLength(), pCharPos, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
CFX_FxgeDevice geBitmap;
geBitmap.Attach(pOutBitmap, false, nullptr, false);
geBitmap.SetDIBits(ge.GetBitmap(), (int)locX, (int)locY);
diff --git a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index d4b21a8325..bcbc80a61d 100644
--- a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -233,8 +233,9 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
FX_RECT rect(0, 0, strWidth, iTextHeight);
ge.FillRect(&rect, m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 1, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
+ ge.DrawNormalText(iLen, pCharPos + 1, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
} else {
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
@@ -243,8 +244,9 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
if (matrix) {
affine_matrix1.Concat(*matrix);
}
- device->DrawNormalText(iLen, pCharPos + 1, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
+ device->DrawNormalText(iLen, pCharPos + 1, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
}
tempStr = str.Mid(7, 6);
iLen = tempStr.GetLength();
@@ -253,8 +255,9 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
if (pOutBitmap) {
FX_RECT rect1(0, 0, strWidth, iTextHeight);
ge.FillRect(&rect1, m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 7, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
+ ge.DrawNormalText(iLen, pCharPos + 7, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 47 * multiple,
m_Height - iTextHeight);
} else {
@@ -265,8 +268,9 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
if (matrix) {
affine_matrix1.Concat(*matrix);
}
- device->DrawNormalText(iLen, pCharPos + 7, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
+ device->DrawNormalText(iLen, pCharPos + 7, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
}
tempStr = str.Mid(0, 1);
iLen = tempStr.GetLength();
@@ -280,7 +284,7 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
delete ge.GetBitmap();
ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize,
+ ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<FX_FLOAT>(iFontSize),
&affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight);
} else {
@@ -289,8 +293,9 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
if (matrix) {
affine_matrix1.Concat(*matrix);
}
- device->DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
+ device->DrawNormalText(iLen, pCharPos, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
}
FX_Free(pCharPos);
}
diff --git a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index 94019627ea..c40223818f 100644
--- a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -223,7 +223,7 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
delete ge.GetBitmap();
ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize,
+ ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<FX_FLOAT>(iFontSize),
&affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
} else {
@@ -231,8 +231,9 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
(FX_FLOAT)leftPosition * m_outputHScale,
(FX_FLOAT)(m_Height - iTextHeight + iFontSize));
affine_matrix1.Concat(*matrix);
- device->DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
+ device->DrawNormalText(iLen, pCharPos, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
}
tempStr = str.Mid(4, 4);
iLen = tempStr.GetLength();
@@ -242,8 +243,9 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
delete ge.GetBitmap();
ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 4, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
+ ge.DrawNormalText(iLen, pCharPos + 4, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 33 * multiple,
m_Height - iTextHeight);
} else {
@@ -254,8 +256,9 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
if (matrix) {
affine_matrix1.Concat(*matrix);
}
- device->DrawNormalText(iLen, pCharPos + 4, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
+ device->DrawNormalText(iLen, pCharPos + 4, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
}
FX_Free(pCharPos);
}
diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index 1f9a22d5f7..6d6e79637c 100644
--- a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -192,8 +192,9 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
if (pOutBitmap) {
ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 1, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
+ ge.DrawNormalText(iLen, pCharPos + 1, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
} else {
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
@@ -202,8 +203,9 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
if (matrix) {
affine_matrix1.Concat(*matrix);
}
- device->DrawNormalText(iLen, pCharPos + 1, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
+ device->DrawNormalText(iLen, pCharPos + 1, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
}
tempStr = str.Mid(6, 5);
iLen = tempStr.GetLength();
@@ -211,8 +213,9 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
if (pOutBitmap) {
FX_RECT rect2(0, 0, (int)strWidth, iTextHeight);
ge.FillRect(&rect2, m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 6, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
+ ge.DrawNormalText(iLen, pCharPos + 6, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 40 * multiple,
m_Height - iTextHeight);
} else {
@@ -223,8 +226,9 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
if (matrix) {
affine_matrix1.Concat(*matrix);
}
- device->DrawNormalText(iLen, pCharPos + 6, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
+ device->DrawNormalText(iLen, pCharPos + 6, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
}
tempStr = str.Mid(0, 1);
iLen = tempStr.GetLength();
@@ -237,7 +241,7 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
delete ge.GetBitmap();
ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize,
+ ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<FX_FLOAT>(iFontSize),
&affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight);
} else {
@@ -246,8 +250,9 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
if (matrix) {
affine_matrix1.Concat(*matrix);
}
- device->DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
+ device->DrawNormalText(iLen, pCharPos, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
}
tempStr = str.Mid(11, 1);
iLen = tempStr.GetLength();
@@ -256,8 +261,9 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
delete ge.GetBitmap();
ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 11, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
+ ge.DrawNormalText(iLen, pCharPos + 11, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 85 * multiple,
m_Height - iTextHeight);
} else {
@@ -268,8 +274,9 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
if (matrix) {
affine_matrix1.Concat(*matrix);
}
- device->DrawNormalText(iLen, pCharPos + 11, m_pFont, (FX_FLOAT)iFontSize,
- &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
+ device->DrawNormalText(iLen, pCharPos + 11, m_pFont,
+ static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
}
FX_Free(pCharPos);
}
diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp
index 78452d5dd3..0207318e95 100644
--- a/xfa/fxfa/app/xfa_ffbarcode.cpp
+++ b/xfa/fxfa/app/xfa_ffbarcode.cpp
@@ -144,14 +144,13 @@ bool CXFA_FFBarcode::LoadWidget() {
void CXFA_FFBarcode::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
index c8ede3761a..8a20c1a879 100644
--- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
@@ -88,8 +88,7 @@ bool CXFA_FFCheckButton::PerformLayout() {
CXFA_FFWidget::PerformLayout();
FX_FLOAT fCheckSize = m_pDataAcc->GetCheckButtonSize();
CXFA_Margin mgWidget = m_pDataAcc->GetMargin();
- CFX_RectF rtWidget;
- GetRectWithoutRotate(rtWidget);
+ CFX_RectF rtWidget = GetRectWithoutRotate();
if (mgWidget) {
XFA_RectWidthoutMargin(rtWidget, mgWidget);
}
@@ -212,14 +211,13 @@ void CXFA_FFCheckButton::AddUIMargin(int32_t iCapPlacement) {
void CXFA_FFCheckButton::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
DrawBorder(pGS, borderUI, m_rtUI, &mtRotate,
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp
index 847f080f3e..efe8b0c8c2 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.cpp
+++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp
@@ -220,12 +220,10 @@ CXFA_FFComboBox::CXFA_FFComboBox(CXFA_WidgetAcc* pDataAcc)
CXFA_FFComboBox::~CXFA_FFComboBox() {}
-bool CXFA_FFComboBox::GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus) {
+CFX_RectF CXFA_FFComboBox::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
if (bDrawFocus)
- return false;
- return CXFA_FFWidget::GetBBox(rtBox, dwStatus);
+ return CFX_RectF();
+ return CXFA_FFWidget::GetBBox(dwStatus);
}
bool CXFA_FFComboBox::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) {
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.h b/xfa/fxfa/app/xfa_ffchoicelist.h
index 18d58f983e..9eb42e593b 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.h
+++ b/xfa/fxfa/app/xfa_ffchoicelist.h
@@ -45,9 +45,7 @@ class CXFA_FFComboBox : public CXFA_FFField {
~CXFA_FFComboBox() override;
// CXFA_FFField
- bool GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus = false) override;
+ CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override;
bool LoadWidget() override;
void UpdateWidgetProperty() override;
bool OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
diff --git a/xfa/fxfa/app/xfa_ffexclgroup.cpp b/xfa/fxfa/app/xfa_ffexclgroup.cpp
index 938cdbcb23..7d63daddbc 100644
--- a/xfa/fxfa/app/xfa_ffexclgroup.cpp
+++ b/xfa/fxfa/app/xfa_ffexclgroup.cpp
@@ -22,8 +22,7 @@ void CXFA_FFExclGroup::RenderWidget(CFX_Graphics* pGS,
if (!IsMatchVisibleStatus(dwStatus))
return;
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
+ CFX_Matrix mtRotate = GetRotateMatrix();
if (pMatrix)
mtRotate.Concat(*pMatrix);
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp
index 7a2a4cd656..932754c09c 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/xfa_fffield.cpp
@@ -32,36 +32,32 @@ CXFA_FFField::~CXFA_FFField() {
CXFA_FFField::UnloadWidget();
}
-bool CXFA_FFField::GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus) {
+CFX_RectF CXFA_FFField::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
if (!bDrawFocus)
- return CXFA_FFWidget::GetBBox(rtBox, dwStatus);
+ return CXFA_FFWidget::GetBBox(dwStatus);
XFA_Element type = m_pDataAcc->GetUIType();
- if (type == XFA_Element::Button || type == XFA_Element::CheckButton ||
- type == XFA_Element::ImageEdit || type == XFA_Element::Signature ||
- type == XFA_Element::ChoiceList) {
- rtBox = m_rtUI;
- CFX_Matrix mt;
- GetRotateMatrix(mt);
- mt.TransformRect(rtBox);
- return true;
+ if (type != XFA_Element::Button && type != XFA_Element::CheckButton &&
+ type != XFA_Element::ImageEdit && type != XFA_Element::Signature &&
+ type != XFA_Element::ChoiceList) {
+ return CFX_RectF();
}
- return false;
+
+ CFX_RectF rtBox = m_rtUI;
+ GetRotateMatrix().TransformRect(rtBox);
+ return rtBox;
}
void CXFA_FFField::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
@@ -154,8 +150,7 @@ bool CXFA_FFField::PerformLayout() {
return true;
}
void CXFA_FFField::CapPlacement() {
- CFX_RectF rtWidget;
- GetRectWithoutRotate(rtWidget);
+ CFX_RectF rtWidget = GetRectWithoutRotate();
CXFA_Margin mgWidget = m_pDataAcc->GetMargin();
if (mgWidget) {
CXFA_LayoutItem* pItem = this;
@@ -167,15 +162,15 @@ void CXFA_FFField::CapPlacement() {
if (!pItem->GetPrev() && !pItem->GetNext()) {
rtWidget.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
} else {
- if (!pItem->GetPrev()) {
+ if (!pItem->GetPrev())
rtWidget.Deflate(fLeftInset, fTopInset, fRightInset, 0);
- } else if (!pItem->GetNext()) {
+ else if (!pItem->GetNext())
rtWidget.Deflate(fLeftInset, 0, fRightInset, fBottomInset);
- } else {
+ else
rtWidget.Deflate(fLeftInset, 0, fRightInset, 0);
- }
}
}
+
XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
FX_FLOAT fCapReserve = 0;
CXFA_Caption caption = m_pDataAcc->GetCaption();
@@ -569,9 +564,8 @@ FWL_WidgetHit CXFA_FFField::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (m_pNormalWidget->HitTest(ffx, ffy) != FWL_WidgetHit::Unknown)
return FWL_WidgetHit::Client;
}
- CFX_RectF rtBox;
- GetRectWithoutRotate(rtBox);
- if (!rtBox.Contains(fx, fy))
+
+ if (!GetRectWithoutRotate().Contains(fx, fy))
return FWL_WidgetHit::Unknown;
if (m_rtCaption.Contains(fx, fy))
return FWL_WidgetHit::Titlebar;
@@ -597,46 +591,45 @@ void CXFA_FFField::LayoutCaption() {
if (m_rtCaption.height < fHeight)
m_rtCaption.height = fHeight;
}
+
void CXFA_FFField::RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix) {
CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout();
- if (!pCapTextLayout) {
+ if (!pCapTextLayout)
return;
- }
+
CXFA_Caption caption = m_pDataAcc->GetCaption();
- if (caption && caption.GetPresence() == XFA_ATTRIBUTEENUM_Visible) {
- if (!pCapTextLayout->IsLoaded()) {
- pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height));
- }
- CFX_RectF rtWidget;
- GetRectWithoutRotate(rtWidget);
- CFX_RectF rtClip = m_rtCaption;
- rtClip.Intersect(rtWidget);
- CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
- CFX_Matrix mt(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top);
- if (pMatrix) {
- pMatrix->TransformRect(rtClip);
- mt.Concat(*pMatrix);
- }
- pCapTextLayout->DrawString(pRenderDevice, mt, rtClip);
+ if (!caption || caption.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
+ return;
+
+ if (!pCapTextLayout->IsLoaded())
+ pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height));
+
+ CFX_RectF rtClip = m_rtCaption;
+ rtClip.Intersect(GetRectWithoutRotate());
+ CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
+ CFX_Matrix mt(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top);
+ if (pMatrix) {
+ pMatrix->TransformRect(rtClip);
+ mt.Concat(*pMatrix);
}
+ pCapTextLayout->DrawString(pRenderDevice, mt, rtClip);
}
+
bool CXFA_FFField::ProcessCommittedData() {
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) {
+ if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open)
return false;
- }
- if (!IsDataChanged()) {
+ if (!IsDataChanged())
return false;
- }
- if (CalculateOverride() != 1) {
+ if (CalculateOverride() != 1)
return false;
- }
- if (!CommitData()) {
+ if (!CommitData())
return false;
- }
+
m_pDocView->SetChangeMark();
m_pDocView->AddValidateWidget(m_pDataAcc);
return true;
}
+
int32_t CXFA_FFField::CalculateOverride() {
CXFA_WidgetAcc* pAcc = m_pDataAcc->GetExclGroup();
if (!pAcc) {
diff --git a/xfa/fxfa/app/xfa_fffield.h b/xfa/fxfa/app/xfa_fffield.h
index d7f5965fe9..1ccd57f30e 100644
--- a/xfa/fxfa/app/xfa_fffield.h
+++ b/xfa/fxfa/app/xfa_fffield.h
@@ -21,9 +21,7 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate {
~CXFA_FFField() override;
// CXFA_FFWidget
- bool GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus = false) override;
+ CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override;
void RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) override;
diff --git a/xfa/fxfa/app/xfa_ffimage.cpp b/xfa/fxfa/app/xfa_ffimage.cpp
index 996a3d6b3b..a613221ea6 100644
--- a/xfa/fxfa/app/xfa_ffimage.cpp
+++ b/xfa/fxfa/app/xfa_ffimage.cpp
@@ -34,34 +34,36 @@ void CXFA_FFImage::UnloadWidget() {
void CXFA_FFImage::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
- if (CFX_DIBitmap* pDIBitmap = GetDataAcc()->GetImageImage()) {
- CFX_RectF rtImage;
- GetRectWithoutRotate(rtImage);
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
- XFA_RectWidthoutMargin(rtImage, mgWidget);
- }
- int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left;
- int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top;
- if (CXFA_Para para = m_pDataAcc->GetPara()) {
- iHorzAlign = para.GetHorizontalAlign();
- iVertAlign = para.GetVerticalAlign();
- }
- CXFA_Value value = m_pDataAcc->GetFormValue();
- CXFA_Image imageObj = value.GetImage();
- int32_t iAspect = imageObj.GetAspect();
- int32_t iImageXDpi = 0;
- int32_t iImageYDpi = 0;
- m_pDataAcc->GetImageDpi(iImageXDpi, iImageYDpi);
- XFA_DrawImage(pGS, rtImage, &mtRotate, pDIBitmap, iAspect, iImageXDpi,
- iImageYDpi, iHorzAlign, iVertAlign);
+
+ CFX_DIBitmap* pDIBitmap = GetDataAcc()->GetImageImage();
+ if (!pDIBitmap)
+ return;
+
+ CFX_RectF rtImage = GetRectWithoutRotate();
+ if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
+ XFA_RectWidthoutMargin(rtImage, mgWidget);
+
+ int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left;
+ int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top;
+ if (CXFA_Para para = m_pDataAcc->GetPara()) {
+ iHorzAlign = para.GetHorizontalAlign();
+ iVertAlign = para.GetVerticalAlign();
}
+
+ CXFA_Value value = m_pDataAcc->GetFormValue();
+ CXFA_Image imageObj = value.GetImage();
+ int32_t iAspect = imageObj.GetAspect();
+ int32_t iImageXDpi = 0;
+ int32_t iImageYDpi = 0;
+ m_pDataAcc->GetImageDpi(iImageXDpi, iImageYDpi);
+ XFA_DrawImage(pGS, rtImage, &mtRotate, pDIBitmap, iAspect, iImageXDpi,
+ iImageYDpi, iHorzAlign, iVertAlign);
}
diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp
index 791b92b445..93e9481ddf 100644
--- a/xfa/fxfa/app/xfa_ffimageedit.cpp
+++ b/xfa/fxfa/app/xfa_ffimageedit.cpp
@@ -49,38 +49,40 @@ void CXFA_FFImageEdit::UnloadWidget() {
void CXFA_FFImageEdit::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
RenderCaption(pGS, &mtRotate);
- if (CFX_DIBitmap* pDIBitmap = m_pDataAcc->GetImageEditImage()) {
- CFX_RectF rtImage = m_pNormalWidget->GetWidgetRect();
- int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left;
- int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top;
- if (CXFA_Para para = m_pDataAcc->GetPara()) {
- iHorzAlign = para.GetHorizontalAlign();
- iVertAlign = para.GetVerticalAlign();
- }
- int32_t iAspect = XFA_ATTRIBUTEENUM_Fit;
- if (CXFA_Value value = m_pDataAcc->GetFormValue()) {
- if (CXFA_Image imageObj = value.GetImage()) {
- iAspect = imageObj.GetAspect();
- }
- }
- int32_t iImageXDpi = 0;
- int32_t iImageYDpi = 0;
- m_pDataAcc->GetImageEditDpi(iImageXDpi, iImageYDpi);
- XFA_DrawImage(pGS, rtImage, &mtRotate, pDIBitmap, iAspect, iImageXDpi,
- iImageYDpi, iHorzAlign, iVertAlign);
+ CFX_DIBitmap* pDIBitmap = m_pDataAcc->GetImageEditImage();
+ if (!pDIBitmap)
+ return;
+
+ CFX_RectF rtImage = m_pNormalWidget->GetWidgetRect();
+ int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left;
+ int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top;
+ if (CXFA_Para para = m_pDataAcc->GetPara()) {
+ iHorzAlign = para.GetHorizontalAlign();
+ iVertAlign = para.GetVerticalAlign();
+ }
+
+ int32_t iAspect = XFA_ATTRIBUTEENUM_Fit;
+ if (CXFA_Value value = m_pDataAcc->GetFormValue()) {
+ if (CXFA_Image imageObj = value.GetImage())
+ iAspect = imageObj.GetAspect();
}
+
+ int32_t iImageXDpi = 0;
+ int32_t iImageYDpi = 0;
+ m_pDataAcc->GetImageEditDpi(iImageXDpi, iImageYDpi);
+ XFA_DrawImage(pGS, rtImage, &mtRotate, pDIBitmap, iAspect, iImageXDpi,
+ iImageYDpi, iHorzAlign, iVertAlign);
}
bool CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags,
diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp
index 0ea7a9c4e1..951b4fd3f1 100644
--- a/xfa/fxfa/app/xfa_ffnotify.cpp
+++ b/xfa/fxfa/app/xfa_ffnotify.cpp
@@ -487,9 +487,7 @@ void CXFA_FFNotify::OnLayoutItemAdded(CXFA_LayoutProcessor* pLayout,
return;
}
if (pWidget->IsLoaded()) {
- CFX_RectF rtOld;
- pWidget->GetWidgetRect(rtOld);
- if (rtOld != pWidget->RecacheWidgetRect())
+ if (pWidget->GetWidgetRect() != pWidget->RecacheWidgetRect())
pWidget->PerformLayout();
} else {
pWidget->LoadWidget();
diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp
index 7481fa61aa..7ae5493ba6 100644
--- a/xfa/fxfa/app/xfa_ffpageview.cpp
+++ b/xfa/fxfa/app/xfa_ffpageview.cpp
@@ -25,12 +25,12 @@
namespace {
-void GetPageMatrix(CFX_Matrix& pageMatrix,
- const CFX_RectF& docPageRect,
- const CFX_Rect& devicePageRect,
- int32_t iRotate,
- uint32_t dwCoordinatesType) {
+CFX_Matrix GetPageMatrix(const CFX_RectF& docPageRect,
+ const CFX_Rect& devicePageRect,
+ int32_t iRotate,
+ uint32_t dwCoordinatesType) {
ASSERT(iRotate >= 0 && iRotate <= 3);
+
bool bFlipX = (dwCoordinatesType & 0x01) != 0;
bool bFlipY = (dwCoordinatesType & 0x02) != 0;
CFX_Matrix m((bFlipX ? -1.0f : 1.0f), 0, 0, (bFlipY ? -1.0f : 1.0f), 0, 0);
@@ -70,7 +70,7 @@ void GetPageMatrix(CFX_Matrix& pageMatrix,
default:
break;
}
- pageMatrix = m;
+ return m;
}
bool PageWidgetFilter(CXFA_FFWidget* pWidget,
@@ -124,15 +124,13 @@ CXFA_FFDocView* CXFA_FFPageView::GetDocView() const {
return m_pDocView;
}
-void CXFA_FFPageView::GetPageViewRect(CFX_RectF& rtPage) const {
- rtPage = CFX_RectF(0, 0, GetPageSize());
+CFX_RectF CXFA_FFPageView::GetPageViewRect() const {
+ return CFX_RectF(0, 0, GetPageSize());
}
-void CXFA_FFPageView::GetDisplayMatrix(CFX_Matrix& mt,
- const CFX_Rect& rtDisp,
- int32_t iRotate) const {
- CFX_SizeF sz = GetPageSize();
- GetPageMatrix(mt, CFX_RectF(0, 0, sz), rtDisp, iRotate, 0);
+CFX_Matrix CXFA_FFPageView::GetDisplayMatrix(const CFX_Rect& rtDisp,
+ int32_t iRotate) const {
+ return GetPageMatrix(CFX_RectF(0, 0, GetPageSize()), rtDisp, iRotate, 0);
}
IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator(
@@ -365,19 +363,16 @@ void CXFA_FFTabOrderPageWidgetIterator::CreateTabOrderWidgetArray() {
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;
- pWidget1->GetWidgetRect(rt1);
-
- CFX_RectF rt2;
- pWidget2->GetWidgetRect(rt2);
+ auto param1 = *static_cast<CXFA_TabParam**>(const_cast<void*>(phWidget1));
+ auto param2 = *static_cast<CXFA_TabParam**>(const_cast<void*>(phWidget2));
+ CFX_RectF rt1 = param1->m_pWidget->GetWidgetRect();
+ CFX_RectF rt2 = param2->m_pWidget->GetWidgetRect();
FX_FLOAT x1 = rt1.left, y1 = rt1.top, x2 = rt2.left, y2 = rt2.top;
- if (y1 < y2 || (y1 - y2 < XFA_FLOAT_PERCISION && x1 < x2)) {
+ if (y1 < y2 || (y1 - y2 < XFA_FLOAT_PERCISION && x1 < x2))
return -1;
- }
return 1;
}
+
void CXFA_FFTabOrderPageWidgetIterator::OrderContainer(
CXFA_LayoutItemIterator* sIterator,
CXFA_LayoutItem* pContainerItem,
diff --git a/xfa/fxfa/app/xfa_ffpath.cpp b/xfa/fxfa/app/xfa_ffpath.cpp
index 0620982b1c..c4e6554c1a 100644
--- a/xfa/fxfa/app/xfa_ffpath.cpp
+++ b/xfa/fxfa/app/xfa_ffpath.cpp
@@ -54,47 +54,45 @@ void CXFA_FFLine::GetRectFromHand(CFX_RectF& rect,
void CXFA_FFLine::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
+
CXFA_Value value = m_pDataAcc->GetFormValue();
- if (!value) {
+ if (!value)
return;
- }
+
CXFA_Line lineObj = value.GetLine();
FX_ARGB lineColor = 0xFF000000;
int32_t iStrokeType = 0;
FX_FLOAT fLineWidth = 1.0f;
- bool bSlope = lineObj.GetSlop();
int32_t iCap = 0;
CXFA_Edge edge = lineObj.GetEdge();
if (edge) {
- if (edge.GetPresence() != XFA_ATTRIBUTEENUM_Visible) {
+ if (edge.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
return;
- }
+
lineColor = edge.GetColor();
iStrokeType = edge.GetStrokeType();
fLineWidth = edge.GetThickness();
iCap = edge.GetCapType();
}
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
- CFX_RectF rtLine;
- GetRectWithoutRotate(rtLine);
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
+
+ CFX_RectF rtLine = GetRectWithoutRotate();
+ if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
XFA_RectWidthoutMargin(rtLine, mgWidget);
- }
+
GetRectFromHand(rtLine, lineObj.GetHand(), fLineWidth);
CFX_Path linePath;
linePath.Create();
- if (bSlope && rtLine.right() > 0.0f && rtLine.bottom() > 0.0f) {
+ if (lineObj.GetSlope() && rtLine.right() > 0.0f && rtLine.bottom() > 0.0f)
linePath.AddLine(rtLine.right(), rtLine.top, rtLine.left, rtLine.bottom());
- } else {
+ else
linePath.AddLine(rtLine.left, rtLine.top, rtLine.right(), rtLine.bottom());
- }
+
CFX_Color color(lineColor);
pGS->SaveGraphState();
pGS->SetLineWidth(fLineWidth, true);
@@ -112,24 +110,22 @@ CXFA_FFArc::~CXFA_FFArc() {}
void CXFA_FFArc::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
+
CXFA_Value value = m_pDataAcc->GetFormValue();
- if (!value) {
+ if (!value)
return;
- }
+
CXFA_Arc arcObj = value.GetArc();
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
- CFX_RectF rtArc;
- GetRectWithoutRotate(rtArc);
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
+
+ CFX_RectF rtArc = GetRectWithoutRotate();
+ if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
XFA_RectWidthoutMargin(rtArc, mgWidget);
- }
+
DrawBorder(pGS, arcObj, rtArc, &mtRotate);
}
@@ -141,23 +137,21 @@ CXFA_FFRectangle::~CXFA_FFRectangle() {}
void CXFA_FFRectangle::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
+
CXFA_Value value = m_pDataAcc->GetFormValue();
- if (!value) {
+ if (!value)
return;
- }
+
CXFA_Rectangle rtObj = value.GetRectangle();
- CFX_RectF rect;
- GetRectWithoutRotate(rect);
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
+ CFX_RectF rect = GetRectWithoutRotate();
+ if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
XFA_RectWidthoutMargin(rect, mgWidget);
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
DrawBorder(pGS, rtObj, rect, &mtRotate);
}
diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp
index fcb7d32761..9c05083bb0 100644
--- a/xfa/fxfa/app/xfa_ffpushbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp
@@ -33,23 +33,22 @@ CXFA_FFPushButton::~CXFA_FFPushButton() {
void CXFA_FFPushButton::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
RenderHighlightCaption(pGS, &mtRotate);
- CFX_RectF rtWidget;
- GetRectWithoutRotate(rtWidget);
+ CFX_RectF rtWidget = GetRectWithoutRotate();
CFX_Matrix mt(1, 0, 0, 1, rtWidget.left, rtWidget.top);
mt.Concat(mtRotate);
GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt);
}
+
bool CXFA_FFPushButton::LoadWidget() {
ASSERT(!m_pNormalWidget);
CFWL_PushButton* pPushButton = new CFWL_PushButton(GetFWLApp());
@@ -100,8 +99,7 @@ void CXFA_FFPushButton::UnloadWidget() {
bool CXFA_FFPushButton::PerformLayout() {
CXFA_FFWidget::PerformLayout();
- CFX_RectF rtWidget;
- GetRectWithoutRotate(rtWidget);
+ CFX_RectF rtWidget = GetRectWithoutRotate();
m_rtUI = rtWidget;
if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
@@ -171,34 +169,30 @@ void CXFA_FFPushButton::RenderHighlightCaption(CFX_Graphics* pGS,
CFX_Matrix* pMatrix) {
CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout();
CXFA_Caption caption = m_pDataAcc->GetCaption();
- if (caption && caption.GetPresence() == XFA_ATTRIBUTEENUM_Visible) {
- CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
- CFX_RectF rtWidget;
- GetRectWithoutRotate(rtWidget);
- CFX_RectF rtClip = m_rtCaption;
- rtClip.Intersect(rtWidget);
- CFX_Matrix mt(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top);
- if (pMatrix) {
- pMatrix->TransformRect(rtClip);
- mt.Concat(*pMatrix);
- }
- {
- uint32_t dwState = m_pNormalWidget->GetStates();
- if (m_pDownTextLayout && (dwState & FWL_STATE_PSB_Pressed) &&
- (dwState & FWL_STATE_PSB_Hovered)) {
- if (m_pDownTextLayout->DrawString(pRenderDevice, mt, rtClip)) {
- return;
- }
- } else if (m_pRolloverTextLayout && (dwState & FWL_STATE_PSB_Hovered)) {
- if (m_pRolloverTextLayout->DrawString(pRenderDevice, mt, rtClip)) {
- return;
- }
- }
- }
- if (pCapTextLayout) {
- pCapTextLayout->DrawString(pRenderDevice, mt, rtClip);
- }
+ if (!caption || caption.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
+ return;
+
+ CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
+ CFX_RectF rtClip = m_rtCaption;
+ rtClip.Intersect(GetRectWithoutRotate());
+ CFX_Matrix mt(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top);
+ if (pMatrix) {
+ pMatrix->TransformRect(rtClip);
+ mt.Concat(*pMatrix);
+ }
+
+ uint32_t dwState = m_pNormalWidget->GetStates();
+ if (m_pDownTextLayout && (dwState & FWL_STATE_PSB_Pressed) &&
+ (dwState & FWL_STATE_PSB_Hovered)) {
+ if (m_pDownTextLayout->DrawString(pRenderDevice, mt, rtClip))
+ return;
+ } else if (m_pRolloverTextLayout && (dwState & FWL_STATE_PSB_Hovered)) {
+ if (m_pRolloverTextLayout->DrawString(pRenderDevice, mt, rtClip))
+ return;
}
+
+ if (pCapTextLayout)
+ pCapTextLayout->DrawString(pRenderDevice, mt, rtClip);
}
void CXFA_FFPushButton::OnProcessMessage(CFWL_Message* pMessage) {
diff --git a/xfa/fxfa/app/xfa_ffsignature.cpp b/xfa/fxfa/app/xfa_ffsignature.cpp
index 1e03e080cb..53f693d1ba 100644
--- a/xfa/fxfa/app/xfa_ffsignature.cpp
+++ b/xfa/fxfa/app/xfa_ffsignature.cpp
@@ -23,15 +23,15 @@ bool CXFA_FFSignature::LoadWidget() {
void CXFA_FFSignature::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
+
CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
RenderCaption(pGS, &mtRotate);
@@ -88,6 +88,7 @@ bool CXFA_FFSignature::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) {
bool CXFA_FFSignature::OnChar(uint32_t dwChar, uint32_t dwFlags) {
return false;
}
+
FWL_WidgetHit CXFA_FFSignature::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (m_pNormalWidget) {
FX_FLOAT ffx = fx, ffy = fy;
@@ -95,14 +96,14 @@ FWL_WidgetHit CXFA_FFSignature::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (m_pNormalWidget->HitTest(ffx, ffy) != FWL_WidgetHit::Unknown)
return FWL_WidgetHit::Client;
}
- CFX_RectF rtBox;
- GetRectWithoutRotate(rtBox);
- if (!rtBox.Contains(fx, fy))
+
+ if (!GetRectWithoutRotate().Contains(fx, fy))
return FWL_WidgetHit::Unknown;
if (m_rtCaption.Contains(fx, fy))
return FWL_WidgetHit::Titlebar;
return FWL_WidgetHit::Client;
}
+
bool CXFA_FFSignature::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) {
return false;
}
diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp
index 9176276d85..d8231bfda8 100644
--- a/xfa/fxfa/app/xfa_fftext.cpp
+++ b/xfa/fxfa/app/xfa_fftext.cpp
@@ -26,46 +26,48 @@ CXFA_FFText::~CXFA_FFText() {}
void CXFA_FFText::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
+ return;
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
+ mtRotate.Concat(*pMatrix);
+
+ CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
+
+ CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
+ if (!pTextLayout)
return;
- }
- {
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
- mtRotate.Concat(*pMatrix);
- }
- CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
- CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
- if (pTextLayout) {
- CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
- CFX_RectF rtText;
- GetRectWithoutRotate(rtText);
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
- CXFA_LayoutItem* pItem = this;
- if (!pItem->GetPrev() && !pItem->GetNext()) {
- XFA_RectWidthoutMargin(rtText, mgWidget);
- } else {
- FX_FLOAT fLeftInset, fRightInset, fTopInset = 0, fBottomInset = 0;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetRightInset(fRightInset);
- if (!pItem->GetPrev()) {
- mgWidget.GetTopInset(fTopInset);
- } else if (!pItem->GetNext()) {
- mgWidget.GetBottomInset(fBottomInset);
- }
- rtText.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
- }
- }
- CFX_Matrix mt(1, 0, 0, 1, rtText.left, rtText.top);
- CFX_RectF rtClip = rtText;
- mtRotate.TransformRect(rtClip);
- mt.Concat(mtRotate);
- pTextLayout->DrawString(pRenderDevice, mt, rtClip, GetIndex());
+ CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
+ CFX_RectF rtText = GetRectWithoutRotate();
+ if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
+ CXFA_LayoutItem* pItem = this;
+ if (!pItem->GetPrev() && !pItem->GetNext()) {
+ XFA_RectWidthoutMargin(rtText, mgWidget);
+ } else {
+ FX_FLOAT fLeftInset;
+ FX_FLOAT fRightInset;
+ FX_FLOAT fTopInset = 0;
+ FX_FLOAT fBottomInset = 0;
+ mgWidget.GetLeftInset(fLeftInset);
+ mgWidget.GetRightInset(fRightInset);
+ if (!pItem->GetPrev())
+ mgWidget.GetTopInset(fTopInset);
+ else if (!pItem->GetNext())
+ mgWidget.GetBottomInset(fBottomInset);
+
+ rtText.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
}
}
+
+ CFX_Matrix mt(1, 0, 0, 1, rtText.left, rtText.top);
+ CFX_RectF rtClip = rtText;
+ mtRotate.TransformRect(rtClip);
+ mt.Concat(mtRotate);
+ pTextLayout->DrawString(pRenderDevice, mt, rtClip, GetIndex());
}
+
bool CXFA_FFText::IsLoaded() {
CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
return pTextLayout && !pTextLayout->m_bHasBlock;
@@ -104,31 +106,23 @@ bool CXFA_FFText::PerformLayout() {
pTextLayout->m_bHasBlock = false;
return true;
}
+
bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- CFX_RectF rtBox;
- GetRectWithoutRotate(rtBox);
- if (!rtBox.Contains(fx, fy)) {
+ if (!GetRectWithoutRotate().Contains(fx, fy))
return false;
- }
+
const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
- if (!wsURLContent) {
+ if (!wsURLContent)
return false;
- }
+
SetButtonDown(true);
return true;
}
+
bool CXFA_FFText::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- CFX_RectF rtBox;
- GetRectWithoutRotate(rtBox);
- if (!rtBox.Contains(fx, fy)) {
- return false;
- }
- const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
- if (!wsURLContent) {
- return false;
- }
- return true;
+ return GetRectWithoutRotate().Contains(fx, fy) && !!GetLinkURLAtPoint(fx, fy);
}
+
bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
if (!IsButtonDown()) {
return false;
@@ -142,35 +136,28 @@ bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
pDoc->GetDocEnvironment()->GotoURL(pDoc, wsURLContent);
return true;
}
+
FWL_WidgetHit CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
- CFX_RectF rtBox;
- GetRectWithoutRotate(rtBox);
- if (!rtBox.Contains(fx, fy))
+ if (!GetRectWithoutRotate().Contains(fx, fy))
return FWL_WidgetHit::Unknown;
if (!GetLinkURLAtPoint(fx, fy))
return FWL_WidgetHit::Unknown;
return FWL_WidgetHit::HyperLink;
}
+
const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
if (!pTextLayout)
return nullptr;
- FX_FLOAT x(fx);
- FX_FLOAT y(fy);
- FWLToClient(x, y);
-
+ CFX_RectF rect = GetRectWithoutRotate();
for (const auto& pPieceLine : *pTextLayout->GetPieceLines()) {
for (const auto& pPiece : pPieceLine->m_textPieces) {
- if (pPiece->pLinkData && pPiece->rtPiece.Contains(x, y))
+ if (pPiece->pLinkData &&
+ pPiece->rtPiece.Contains(fx - rect.left, fy - rect.top)) {
return pPiece->pLinkData->GetLinkURL();
+ }
}
}
return nullptr;
}
-void CXFA_FFText::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) {
- CFX_RectF rtWidget;
- GetRectWithoutRotate(rtWidget);
- fx -= rtWidget.left;
- fy -= rtWidget.top;
-}
diff --git a/xfa/fxfa/app/xfa_fftext.h b/xfa/fxfa/app/xfa_fftext.h
index 02716e532f..2c01a6f349 100644
--- a/xfa/fxfa/app/xfa_fftext.h
+++ b/xfa/fxfa/app/xfa_fftext.h
@@ -27,7 +27,6 @@ class CXFA_FFText : public CXFA_FFDraw {
private:
const FX_WCHAR* GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy);
- void FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy);
};
#endif // XFA_FXFA_APP_XFA_FFTEXT_H_
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
index 0cb43575b0..ad5ab434c6 100644
--- a/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -493,12 +493,10 @@ CXFA_FFDateTimeEdit::CXFA_FFDateTimeEdit(CXFA_WidgetAcc* pDataAcc)
CXFA_FFDateTimeEdit::~CXFA_FFDateTimeEdit() {}
-bool CXFA_FFDateTimeEdit::GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus) {
+CFX_RectF CXFA_FFDateTimeEdit::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
if (bDrawFocus)
- return false;
- return CXFA_FFWidget::GetBBox(rtBox, dwStatus);
+ return CFX_RectF();
+ return CXFA_FFWidget::GetBBox(dwStatus);
}
bool CXFA_FFDateTimeEdit::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) {
diff --git a/xfa/fxfa/app/xfa_fftextedit.h b/xfa/fxfa/app/xfa_fftextedit.h
index 0c22db7a2f..91c30ba8c9 100644
--- a/xfa/fxfa/app/xfa_fftextedit.h
+++ b/xfa/fxfa/app/xfa_fftextedit.h
@@ -84,9 +84,7 @@ class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit {
~CXFA_FFDateTimeEdit() override;
// CXFA_FFTextEdit
- bool GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus = false) override;
+ CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override;
bool LoadWidget() override;
void UpdateWidgetProperty() override;
void OnProcessEvent(CFWL_Event* pEvent) override;
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index 8bfee69578..3ee0a3cbe8 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -43,18 +43,20 @@ const CFWL_App* CXFA_FFWidget::GetFWLApp() {
return GetPageView()->GetDocView()->GetDoc()->GetApp()->GetFWLApp();
}
-void CXFA_FFWidget::GetWidgetRect(CFX_RectF& rtWidget) {
+CFX_RectF CXFA_FFWidget::GetWidgetRect() {
if ((m_dwStatus & XFA_WidgetStatus_RectCached) == 0)
RecacheWidgetRect();
- rtWidget = m_rtWidget;
+ return m_rtWidget;
}
+
CFX_RectF CXFA_FFWidget::RecacheWidgetRect() {
m_dwStatus |= XFA_WidgetStatus_RectCached;
m_rtWidget = GetRect(false);
return m_rtWidget;
}
-void CXFA_FFWidget::GetRectWithoutRotate(CFX_RectF& rtWidget) {
- GetWidgetRect(rtWidget);
+
+CFX_RectF CXFA_FFWidget::GetRectWithoutRotate() {
+ CFX_RectF rtWidget = GetWidgetRect();
FX_FLOAT fValue = 0;
switch (m_pDataAcc->GetRotate()) {
case 90:
@@ -74,7 +76,9 @@ void CXFA_FFWidget::GetRectWithoutRotate(CFX_RectF& rtWidget) {
rtWidget.height = fValue;
break;
}
+ return rtWidget;
}
+
uint32_t CXFA_FFWidget::GetStatus() {
return m_dwStatus;
}
@@ -83,14 +87,10 @@ void CXFA_FFWidget::ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved) {
m_dwStatus = (m_dwStatus & ~dwRemoved) | dwAdded;
}
-bool CXFA_FFWidget::GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus) {
- if (bDrawFocus)
- return false;
- if (m_pPageView)
- m_pPageView->GetPageViewRect(rtBox);
- return true;
+CFX_RectF CXFA_FFWidget::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
+ if (bDrawFocus || !m_pPageView)
+ return CFX_RectF();
+ return m_pPageView->GetPageViewRect();
}
CXFA_WidgetAcc* CXFA_FFWidget::GetDataAcc() {
@@ -105,24 +105,26 @@ bool CXFA_FFWidget::GetToolTip(CFX_WideString& wsToolTip) {
}
return GetCaptionText(wsToolTip);
}
+
void CXFA_FFWidget::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
+
CXFA_Border border = m_pDataAcc->GetBorder();
- if (border) {
- CFX_RectF rtBorder;
- GetRectWithoutRotate(rtBorder);
- CXFA_Margin margin = border.GetMargin();
- if (margin) {
- XFA_RectWidthoutMargin(rtBorder, margin);
- }
- rtBorder.Normalize();
- DrawBorder(pGS, border, rtBorder, pMatrix);
- }
+ if (!border)
+ return;
+
+ CFX_RectF rtBorder = GetRectWithoutRotate();
+ CXFA_Margin margin = border.GetMargin();
+ if (margin)
+ XFA_RectWidthoutMargin(rtBorder, margin);
+
+ rtBorder.Normalize();
+ DrawBorder(pGS, border, rtBorder, pMatrix);
}
+
bool CXFA_FFWidget::IsLoaded() {
return !!m_pPageView;
}
@@ -146,28 +148,31 @@ void CXFA_FFWidget::DrawBorder(CFX_Graphics* pGS,
uint32_t dwFlags) {
XFA_DrawBox(box, pGS, rtBorder, pMatrix, dwFlags);
}
+
void CXFA_FFWidget::InvalidateWidget(const CFX_RectF* pRect) {
- if (!pRect) {
- CFX_RectF rtWidget;
- GetBBox(rtWidget, XFA_WidgetStatus_Focused);
- rtWidget.Inflate(2, 2);
- GetDoc()->GetDocEnvironment()->InvalidateRect(m_pPageView, rtWidget,
- XFA_INVALIDATE_CurrentPage);
- } else {
+ if (pRect) {
GetDoc()->GetDocEnvironment()->InvalidateRect(m_pPageView, *pRect,
XFA_INVALIDATE_CurrentPage);
+ return;
}
+
+ CFX_RectF rtWidget = GetBBox(XFA_WidgetStatus_Focused);
+ rtWidget.Inflate(2, 2);
+ GetDoc()->GetDocEnvironment()->InvalidateRect(m_pPageView, rtWidget,
+ XFA_INVALIDATE_CurrentPage);
}
+
void CXFA_FFWidget::AddInvalidateRect(const CFX_RectF* pRect) {
CFX_RectF rtWidget;
if (pRect) {
rtWidget = *pRect;
} else {
- GetBBox(rtWidget, XFA_WidgetStatus_Focused);
+ rtWidget = GetBBox(XFA_WidgetStatus_Focused);
rtWidget.Inflate(2, 2);
}
m_pDocView->AddInvalidateRect(m_pPageView, rtWidget);
}
+
bool CXFA_FFWidget::GetCaptionText(CFX_WideString& wsCap) {
CXFA_TextLayout* pCapTextlayout = m_pDataAcc->GetCaptionTextLayout();
if (!pCapTextlayout) {
@@ -312,8 +317,7 @@ bool CXFA_FFWidget::ReplaceSpellCheckWord(CFX_PointF pointf,
return false;
}
void CXFA_FFWidget::Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy) {
- CFX_Matrix mt;
- GetRotateMatrix(mt);
+ CFX_Matrix mt = GetRotateMatrix();
if (mt.IsIdentity()) {
return;
}
@@ -377,20 +381,22 @@ static void XFA_GetMatrix(CFX_Matrix& m,
break;
}
}
-void CXFA_FFWidget::GetRotateMatrix(CFX_Matrix& mt) {
- mt = CFX_Matrix();
+
+CFX_Matrix CXFA_FFWidget::GetRotateMatrix() {
+ CFX_Matrix mt;
int32_t iRotate = m_pDataAcc->GetRotate();
- if (!iRotate) {
- return;
- }
- CFX_RectF rcWidget;
- GetRectWithoutRotate(rcWidget);
+ if (!iRotate)
+ return mt;
+
+ CFX_RectF rcWidget = GetRectWithoutRotate();
XFA_ATTRIBUTEENUM at = XFA_ATTRIBUTEENUM_TopLeft;
XFA_GetMatrix(mt, iRotate, at, rcWidget);
+
+ return mt;
}
+
bool CXFA_FFWidget::IsLayoutRectEmpty() {
- CFX_RectF rtLayout;
- GetRectWithoutRotate(rtLayout);
+ CFX_RectF rtLayout = GetRectWithoutRotate();
return rtLayout.width < 0.1f && rtLayout.height < 0.1f;
}
CXFA_FFWidget* CXFA_FFWidget::GetParent() {
@@ -405,63 +411,45 @@ CXFA_FFWidget* CXFA_FFWidget::GetParent() {
}
return nullptr;
}
+
bool CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) {
- if (!pWidget) {
+ if (!pWidget)
return false;
- }
+
CXFA_Node* pNode = m_pDataAcc->GetNode();
CXFA_Node* pChildNode = pWidget->GetDataAcc()->GetNode();
while (pChildNode) {
- if (pChildNode == pNode) {
+ if (pChildNode == pNode)
return true;
- }
+
pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_Parent);
}
return false;
}
+
bool CXFA_FFWidget::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) {
- CFX_RectF rtWidget;
- GetWidgetRect(rtWidget);
- if (rtWidget.Contains(fx, fy)) {
- return true;
- }
- return false;
+ return GetWidgetRect().Contains(fx, fy);
}
+
CXFA_FFDocView* CXFA_FFWidget::GetDocView() {
return m_pDocView;
}
+
void CXFA_FFWidget::SetDocView(CXFA_FFDocView* pDocView) {
m_pDocView = pDocView;
}
+
CXFA_FFDoc* CXFA_FFWidget::GetDoc() {
return m_pDocView->GetDoc();
}
+
CXFA_FFApp* CXFA_FFWidget::GetApp() {
return GetDoc()->GetApp();
}
+
IXFA_AppProvider* CXFA_FFWidget::GetAppProvider() {
return GetApp()->GetAppProvider();
}
-void CXFA_FFWidget::GetMinMaxWidth(FX_FLOAT fMinWidth, FX_FLOAT fMaxWidth) {
- fMinWidth = fMaxWidth = 0;
- FX_FLOAT fWidth = 0;
- if (m_pDataAcc->GetWidth(fWidth)) {
- fMinWidth = fMaxWidth = fWidth;
- } else {
- m_pDataAcc->GetMinWidth(fMinWidth);
- m_pDataAcc->GetMaxWidth(fMaxWidth);
- }
-}
-void CXFA_FFWidget::GetMinMaxHeight(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight) {
- fMinHeight = fMaxHeight = 0;
- FX_FLOAT fHeight = 0;
- if (m_pDataAcc->GetHeight(fHeight)) {
- fMinHeight = fMaxHeight = fHeight;
- } else {
- m_pDataAcc->GetMinHeight(fMinHeight);
- m_pDataAcc->GetMaxHeight(fMaxHeight);
- }
-}
bool CXFA_FFWidget::IsMatchVisibleStatus(uint32_t dwStatus) {
return !!(m_dwStatus & XFA_WidgetStatus_Visible);
diff --git a/xfa/fxfa/app/xfa_fwladapter.cpp b/xfa/fxfa/app/xfa_fwladapter.cpp
index 3dfa679c4b..e1f3e202ed 100644
--- a/xfa/fxfa/app/xfa_fwladapter.cpp
+++ b/xfa/fxfa/app/xfa_fwladapter.cpp
@@ -30,10 +30,8 @@ bool CXFA_FWLAdapterWidgetMgr::GetPopupPos(CFWL_Widget* pWidget,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) {
CXFA_FFWidget* pFFWidget = pWidget->GetLayoutItem();
- CFX_Matrix mt;
- pFFWidget->GetRotateMatrix(mt);
CFX_RectF rtRotateAnchor(rtAnchor);
- mt.TransformRect(rtRotateAnchor);
+ pFFWidget->GetRotateMatrix().TransformRect(rtRotateAnchor);
pFFWidget->GetDoc()->GetDocEnvironment()->GetPopupPos(
pFFWidget, fMinHeight, fMaxHeight, rtRotateAnchor, rtPopup);
return true;
diff --git a/xfa/fxfa/app/xfa_rendercontext.cpp b/xfa/fxfa/app/xfa_rendercontext.cpp
index f103b23520..a855105e3d 100644
--- a/xfa/fxfa/app/xfa_rendercontext.cpp
+++ b/xfa/fxfa/app/xfa_rendercontext.cpp
@@ -32,11 +32,10 @@ int32_t CXFA_RenderContext::StartRender(CXFA_FFPageView* pPageView,
m_pGS = pGS;
m_matrix = matrix;
m_options = options;
- CFX_RectF rtPage;
- pGS->GetClipRect(rtPage);
+
CFX_Matrix mtRes;
mtRes.SetReverse(matrix);
- m_rtClipRect = rtPage;
+ m_rtClipRect = pGS->GetClipRect();
mtRes.TransformRect(m_rtClipRect);
m_dwStatus = m_options.m_bHighlight ? XFA_WidgetStatus_Highlight : 0;
uint32_t dwFilterType = XFA_WidgetStatus_Visible |
@@ -52,12 +51,12 @@ int32_t CXFA_RenderContext::DoRender(IFX_Pause* pPause) {
int32_t iCount = 0;
while (m_pWidget) {
CXFA_FFWidget* pWidget = m_pWidget;
- CFX_RectF rtWidgetBox;
- pWidget->GetBBox(rtWidgetBox, XFA_WidgetStatus_Visible);
+ CFX_RectF rtWidgetBox = pWidget->GetBBox(XFA_WidgetStatus_Visible);
rtWidgetBox.width += 1;
rtWidgetBox.height += 1;
if (rtWidgetBox.IntersectWith(m_rtClipRect))
pWidget->RenderWidget(m_pGS, &m_matrix, m_dwStatus);
+
m_pWidget = m_pWidgetIterator->MoveToNext();
iCount++;
if (iCount > kMaxCount && pPause && pPause->NeedToPauseNow())
diff --git a/xfa/fxfa/parser/cxfa_line.cpp b/xfa/fxfa/parser/cxfa_line.cpp
index f0d9a0bbfd..38de0d8ca8 100644
--- a/xfa/fxfa/parser/cxfa_line.cpp
+++ b/xfa/fxfa/parser/cxfa_line.cpp
@@ -12,9 +12,8 @@ int32_t CXFA_Line::GetHand() {
return m_pNode->GetEnum(XFA_ATTRIBUTE_Hand);
}
-bool CXFA_Line::GetSlop() {
- XFA_ATTRIBUTEENUM eSlop = m_pNode->GetEnum(XFA_ATTRIBUTE_Slope);
- return eSlop == XFA_ATTRIBUTEENUM_Slash;
+bool CXFA_Line::GetSlope() {
+ return m_pNode->GetEnum(XFA_ATTRIBUTE_Slope) == XFA_ATTRIBUTEENUM_Slash;
}
CXFA_Edge CXFA_Line::GetEdge() {
diff --git a/xfa/fxfa/parser/cxfa_line.h b/xfa/fxfa/parser/cxfa_line.h
index bf180295da..f014cc0618 100644
--- a/xfa/fxfa/parser/cxfa_line.h
+++ b/xfa/fxfa/parser/cxfa_line.h
@@ -18,7 +18,7 @@ class CXFA_Line : public CXFA_Data {
explicit CXFA_Line(CXFA_Node* pNode) : CXFA_Data(pNode) {}
int32_t GetHand();
- bool GetSlop();
+ bool GetSlope();
CXFA_Edge GetEdge();
};
diff --git a/xfa/fxfa/xfa_ffpageview.h b/xfa/fxfa/xfa_ffpageview.h
index 089e276d6e..4b50a2365d 100644
--- a/xfa/fxfa/xfa_ffpageview.h
+++ b/xfa/fxfa/xfa_ffpageview.h
@@ -22,10 +22,8 @@ class CXFA_FFPageView : public CXFA_ContainerLayoutItem {
~CXFA_FFPageView() override;
CXFA_FFDocView* GetDocView() const;
- void GetPageViewRect(CFX_RectF& rtPage) const;
- void GetDisplayMatrix(CFX_Matrix& mt,
- const CFX_Rect& rtDisp,
- int32_t iRotate) const;
+ CFX_RectF GetPageViewRect() const;
+ CFX_Matrix GetDisplayMatrix(const CFX_Rect& rtDisp, int32_t iRotate) const;
IXFA_WidgetIterator* CreateWidgetIterator(
uint32_t dwTraverseWay = XFA_TRAVERSEWAY_Form,
uint32_t dwWidgetFilter = XFA_WidgetStatus_Visible |
diff --git a/xfa/fxfa/xfa_ffwidget.h b/xfa/fxfa/xfa_ffwidget.h
index 8f16dc2521..c7701d357e 100644
--- a/xfa/fxfa/xfa_ffwidget.h
+++ b/xfa/fxfa/xfa_ffwidget.h
@@ -48,9 +48,7 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem {
explicit CXFA_FFWidget(CXFA_WidgetAcc* pDataAcc);
~CXFA_FFWidget() override;
- virtual bool GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus = false);
+ virtual CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false);
virtual void RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus);
@@ -104,7 +102,7 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem {
CXFA_FFPageView* GetPageView() const { return m_pPageView; }
void SetPageView(CXFA_FFPageView* pPageView) { m_pPageView = pPageView; }
- void GetWidgetRect(CFX_RectF& rtWidget);
+ CFX_RectF GetWidgetRect();
CFX_RectF RecacheWidgetRect();
uint32_t GetStatus();
void ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved);
@@ -122,7 +120,7 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem {
bool GetCaptionText(CFX_WideString& wsCap);
bool IsFocused();
void Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy);
- void GetRotateMatrix(CFX_Matrix& mt);
+ CFX_Matrix GetRotateMatrix();
bool IsLayoutRectEmpty();
CXFA_FFWidget* GetParent();
bool IsAncestorOf(CXFA_FFWidget* pWidget);
@@ -136,9 +134,8 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem {
const CFX_RectF& rtBorder,
CFX_Matrix* pMatrix,
uint32_t dwFlags = 0);
- void GetMinMaxWidth(FX_FLOAT fMinWidth, FX_FLOAT fMaxWidth);
- void GetMinMaxHeight(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight);
- void GetRectWithoutRotate(CFX_RectF& rtWidget);
+
+ CFX_RectF GetRectWithoutRotate();
bool IsMatchVisibleStatus(uint32_t dwStatus);
void EventKillFocus();
bool IsButtonDown();
diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cfx_graphics.cpp
index 7ad1aa45e5..bed7c36149 100644
--- a/xfa/fxgraphics/cfx_graphics.cpp
+++ b/xfa/fxgraphics/cfx_graphics.cpp
@@ -872,16 +872,12 @@ CFX_Matrix* CFX_Graphics::GetMatrix() {
return nullptr;
}
-FWL_Error CFX_Graphics::GetClipRect(CFX_RectF& rect) const {
- if (m_type == FX_CONTEXT_Device && m_renderDevice) {
- FX_RECT r = m_renderDevice->GetClipBox();
- rect.left = (FX_FLOAT)r.left;
- rect.top = (FX_FLOAT)r.top;
- rect.width = (FX_FLOAT)r.Width();
- rect.height = (FX_FLOAT)r.Height();
- return FWL_Error::Succeeded;
- }
- return FWL_Error::PropertyInvalid;
+CFX_RectF CFX_Graphics::GetClipRect() const {
+ if (m_type != FX_CONTEXT_Device || !m_renderDevice)
+ return CFX_RectF();
+
+ FX_RECT r = m_renderDevice->GetClipBox();
+ return CFX_Rect(r.left, r.top, r.Width(), r.Height()).As<FX_FLOAT>();
}
FWL_Error CFX_Graphics::SetClipRect(const CFX_RectF& rect) {
@@ -1218,8 +1214,7 @@ FWL_Error CFX_Graphics::RenderDeviceDrawImage(CFX_DIBSource* source,
int32_t left, top;
std::unique_ptr<CFX_DIBitmap> bmp1 = source->FlipImage(false, true);
std::unique_ptr<CFX_DIBitmap> bmp2 = bmp1->TransformTo(&m2, left, top);
- CFX_RectF r;
- GetClipRect(r);
+ CFX_RectF r = GetClipRect();
CFX_DIBitmap* bitmap = m_renderDevice->GetBitmap();
CFX_DIBitmap bmp;
if (bmp.Create(bitmap->GetWidth(), bitmap->GetHeight(), FXDIB_Argb) &&
@@ -1251,8 +1246,7 @@ FWL_Error CFX_Graphics::RenderDeviceStretchImage(CFX_DIBSource* source,
int32_t top;
std::unique_ptr<CFX_DIBitmap> bmp2 = bmp1->FlipImage(false, true);
std::unique_ptr<CFX_DIBitmap> bmp3 = bmp2->TransformTo(&m2, left, top);
- CFX_RectF r;
- GetClipRect(r);
+ CFX_RectF r = GetClipRect();
CFX_DIBitmap* bitmap = m_renderDevice->GetBitmap();
if (bitmap->CompositeBitmap(FXSYS_round(r.left), FXSYS_round(r.top),
FXSYS_round(r.Width()), FXSYS_round(r.Height()),
diff --git a/xfa/fxgraphics/cfx_graphics.h b/xfa/fxgraphics/cfx_graphics.h
index 48784254b0..ed219de967 100644
--- a/xfa/fxgraphics/cfx_graphics.h
+++ b/xfa/fxgraphics/cfx_graphics.h
@@ -125,7 +125,7 @@ class CFX_Graphics {
FWL_Error GetMiterLimit(FX_FLOAT& miterLimit) const;
FWL_Error GetLineWidth(FX_FLOAT& lineWidth) const;
FWL_Error GetStrokeAlignment(FX_StrokeAlignment& strokeAlignment) const;
- FWL_Error GetClipRect(CFX_RectF& rect) const;
+ CFX_RectF GetClipRect() const;
CFX_Matrix* GetMatrix();
CFX_RenderDevice* GetRenderDevice();