From 878b27de2fa8e5bdc3b910c98846f4b43185d4aa Mon Sep 17 00:00:00 2001 From: Jane Liu Date: Tue, 22 Aug 2017 10:50:06 -0400 Subject: Converted CFX_Matrix::TransformRect() to take in consts Currently, all three of CFX_Matrix::TransformRect() take in rect values and modify them in place. This CL converts them to take in constant values and return the transformed values instead, and fixes all the call sites. Bug=pdfium:874 Change-Id: I9c274df3b14e9d88c100ba0530068e06e8fec32b Reviewed-on: https://pdfium-review.googlesource.com/11550 Reviewed-by: dsinclair Commit-Queue: Jane Liu --- core/fpdfapi/font/cpdf_cidfont.cpp | 4 +- core/fpdfapi/font/cpdf_type3font.cpp | 2 +- core/fpdfapi/page/cpdf_contentparser.cpp | 4 +- core/fpdfapi/page/cpdf_formobject.cpp | 4 +- core/fpdfapi/page/cpdf_imageobject.cpp | 7 +-- core/fpdfapi/page/cpdf_pageobject.cpp | 6 +-- core/fpdfapi/page/cpdf_pathobject.cpp | 2 +- core/fpdfapi/page/cpdf_shadingobject.cpp | 3 +- core/fpdfapi/page/cpdf_streamcontentparser.cpp | 3 +- core/fpdfapi/page/cpdf_textobject.cpp | 8 +--- core/fpdfapi/render/cpdf_devicebuffer.cpp | 6 +-- core/fpdfapi/render/cpdf_progressiverenderer.cpp | 4 +- core/fpdfapi/render/cpdf_renderstatus.cpp | 32 ++++++------- core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp | 5 +- core/fpdfdoc/cpdf_annot.cpp | 4 +- core/fpdfdoc/cpdf_annotlist.cpp | 7 ++- core/fpdfdoc/cpdf_formcontrol.cpp | 4 +- core/fpdftext/cpdf_textpage.cpp | 2 +- core/fxcrt/fx_coordinates.cpp | 58 ++++++++++++++---------- core/fxcrt/fx_coordinates.h | 16 +++---- core/fxge/cfx_renderdevice.cpp | 2 +- core/fxge/dib/cfx_imagetransformer.cpp | 5 +- core/fxge/win32/cfx_psrenderer.cpp | 5 +- core/fxge/win32/fx_win32_device.cpp | 2 +- fpdfsdk/formfiller/cffl_formfiller.cpp | 8 +--- fpdfsdk/fpdf_flatten.cpp | 2 +- fpdfsdk/fpdfeditpage.cpp | 3 +- fpdfsdk/pwl/cpwl_edit_impl.cpp | 7 +-- fpdfsdk/pwl/cpwl_wnd.cpp | 8 ++-- fxbarcode/oned/BC_OneDimWriter.cpp | 3 +- fxbarcode/oned/BC_OnedEAN13Writer.cpp | 9 ++-- fxbarcode/oned/BC_OnedEAN8Writer.cpp | 6 +-- fxbarcode/oned/BC_OnedUPCAWriter.cpp | 12 ++--- xfa/fde/cfde_textout.cpp | 4 +- xfa/fwl/cfwl_edit.cpp | 9 ++-- xfa/fwl/cfwl_listbox.cpp | 3 +- xfa/fwl/cfwl_spinbutton.cpp | 3 -- xfa/fwl/cfwl_widgetmgr.cpp | 6 +-- xfa/fxfa/cxfa_fffield.cpp | 6 +-- xfa/fxfa/cxfa_ffpushbutton.cpp | 2 +- xfa/fxfa/cxfa_fftext.cpp | 3 +- xfa/fxfa/cxfa_fwladapterwidgetmgr.cpp | 4 +- xfa/fxgraphics/cxfa_graphics.cpp | 4 +- 43 files changed, 129 insertions(+), 168 deletions(-) diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp index 9a2261caa9..a67abd29ac 100644 --- a/core/fpdfapi/font/cpdf_cidfont.cpp +++ b/core/fpdfapi/font/cpdf_cidfont.cpp @@ -499,9 +499,7 @@ FX_RECT CPDF_CIDFont::GetCharBBox(uint32_t charcode) { CIDTransformToFloat(pTransform[3]), CIDTransformToFloat(pTransform[4]) * 1000, CIDTransformToFloat(pTransform[5]) * 1000); - CFX_FloatRect rect_f(rect); - matrix.TransformRect(rect_f); - rect = rect_f.GetOuterRect(); + rect = matrix.TransformRect(CFX_FloatRect(rect)).GetOuterRect(); } } if (charcode < 256) diff --git a/core/fpdfapi/font/cpdf_type3font.cpp b/core/fpdfapi/font/cpdf_type3font.cpp index b22551a26a..e13deaa56b 100644 --- a/core/fpdfapi/font/cpdf_type3font.cpp +++ b/core/fpdfapi/font/cpdf_type3font.cpp @@ -130,7 +130,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) { if (rcBBox.right <= rcBBox.left || rcBBox.bottom >= rcBBox.top) char_rect = pNewChar->m_pForm->CalcBoundingBox(); - m_FontMatrix.TransformRect(char_rect); + char_rect = m_FontMatrix.TransformRect(char_rect); rcBBox.left = FXSYS_round(char_rect.left * 1000); rcBBox.right = FXSYS_round(char_rect.right * 1000); rcBBox.top = FXSYS_round(char_rect.top * 1000); diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp index 4f4036f078..36dea17572 100644 --- a/core/fpdfapi/page/cpdf_contentparser.cpp +++ b/core/fpdfapi/page/cpdf_contentparser.cpp @@ -91,9 +91,9 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, if (pParentMatrix) ClipPath.Transform(pParentMatrix); - form_matrix.TransformRect(form_bbox); + form_bbox = form_matrix.TransformRect(form_bbox); if (pParentMatrix) - pParentMatrix->TransformRect(form_bbox); + form_bbox = pParentMatrix->TransformRect(form_bbox); } CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDictFor("Resources"); diff --git a/core/fpdfapi/page/cpdf_formobject.cpp b/core/fpdfapi/page/cpdf_formobject.cpp index 5642a5dd01..c0cdd3e950 100644 --- a/core/fpdfapi/page/cpdf_formobject.cpp +++ b/core/fpdfapi/page/cpdf_formobject.cpp @@ -34,8 +34,8 @@ CPDF_PageObject::Type CPDF_FormObject::GetType() const { } void CPDF_FormObject::CalcBoundingBox() { - CFX_FloatRect form_rect = m_pForm->CalcBoundingBox(); - m_FormMatrix.TransformRect(form_rect); + CFX_FloatRect form_rect = + m_FormMatrix.TransformRect(m_pForm->CalcBoundingBox()); m_Left = form_rect.left; m_Bottom = form_rect.bottom; m_Right = form_rect.right; diff --git a/core/fpdfapi/page/cpdf_imageobject.cpp b/core/fpdfapi/page/cpdf_imageobject.cpp index a74ac4802c..dd07385db4 100644 --- a/core/fpdfapi/page/cpdf_imageobject.cpp +++ b/core/fpdfapi/page/cpdf_imageobject.cpp @@ -41,11 +41,8 @@ const CPDF_ImageObject* CPDF_ImageObject::AsImage() const { } void CPDF_ImageObject::CalcBoundingBox() { - m_Left = 0; - m_Bottom = 0; - m_Right = 1.0f; - m_Top = 1.0f; - m_Matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom); + std::tie(m_Left, m_Right, m_Top, m_Bottom) = + m_Matrix.TransformRect(0.f, 1.f, 1.f, 0.f); } void CPDF_ImageObject::SetImage(const CFX_RetainPtr& pImage) { diff --git a/core/fpdfapi/page/cpdf_pageobject.cpp b/core/fpdfapi/page/cpdf_pageobject.cpp index 79d9bbc540..8bb5bf5978 100644 --- a/core/fpdfapi/page/cpdf_pageobject.cpp +++ b/core/fpdfapi/page/cpdf_pageobject.cpp @@ -95,8 +95,8 @@ void CPDF_PageObject::TransformGeneralState(CFX_Matrix& matrix) { FX_RECT CPDF_PageObject::GetBBox(const CFX_Matrix* pMatrix) const { CFX_FloatRect rect(m_Left, m_Bottom, m_Right, m_Top); - if (pMatrix) { - pMatrix->TransformRect(rect); - } + if (pMatrix) + rect = pMatrix->TransformRect(rect); + return rect.GetOuterRect(); } diff --git a/core/fpdfapi/page/cpdf_pathobject.cpp b/core/fpdfapi/page/cpdf_pathobject.cpp index 7dd91598c6..d8c2cb8741 100644 --- a/core/fpdfapi/page/cpdf_pathobject.cpp +++ b/core/fpdfapi/page/cpdf_pathobject.cpp @@ -42,7 +42,7 @@ void CPDF_PathObject::CalcBoundingBox() { } else { rect = m_Path.GetBoundingBox(); } - m_Matrix.TransformRect(rect); + rect = m_Matrix.TransformRect(rect); if (width == 0 && m_bStroke) { rect.left += -0.5f; diff --git a/core/fpdfapi/page/cpdf_shadingobject.cpp b/core/fpdfapi/page/cpdf_shadingobject.cpp index 8a61161f17..df3fbd17cd 100644 --- a/core/fpdfapi/page/cpdf_shadingobject.cpp +++ b/core/fpdfapi/page/cpdf_shadingobject.cpp @@ -25,7 +25,8 @@ void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) { if (m_ClipPath.HasRef()) { CalcBoundingBox(); } else { - matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom); + std::tie(m_Left, m_Right, m_Top, m_Bottom) = + matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom); } } diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index ca92b9efdf..1d5ddaeed2 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -130,8 +130,7 @@ CFX_FloatRect GetShadingBBox(CPDF_ShadingPattern* pShading, if (bGouraud) stream.BitStream()->ByteAlign(); } - matrix.TransformRect(rect); - return rect; + return matrix.TransformRect(rect); } struct AbbrPair { diff --git a/core/fpdfapi/page/cpdf_textobject.cpp b/core/fpdfapi/page/cpdf_textobject.cpp index 7a70101789..a4d714ff72 100644 --- a/core/fpdfapi/page/cpdf_textobject.cpp +++ b/core/fpdfapi/page/cpdf_textobject.cpp @@ -261,12 +261,8 @@ CFX_PointF CPDF_TextObject::CalcPositionData(float horz_scale) { min_y = min_y * fontsize / 1000; max_y = max_y * fontsize / 1000; } - - m_Left = min_x; - m_Right = max_x; - m_Bottom = min_y; - m_Top = max_y; - GetTextMatrix().TransformRect(m_Left, m_Right, m_Top, m_Bottom); + std::tie(m_Left, m_Right, m_Top, m_Bottom) = + GetTextMatrix().TransformRect(min_x, max_x, max_y, min_y); if (!TextRenderingModeIsStrokeMode(m_TextState.GetTextMode())) return ret; diff --git a/core/fpdfapi/render/cpdf_devicebuffer.cpp b/core/fpdfapi/render/cpdf_devicebuffer.cpp index 8125ea5df1..b632dee49d 100644 --- a/core/fpdfapi/render/cpdf_devicebuffer.cpp +++ b/core/fpdfapi/render/cpdf_devicebuffer.cpp @@ -45,10 +45,8 @@ bool CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, CFX_Matrix ctm = m_pDevice->GetCTM(); m_Matrix.Concat(CFX_Matrix(fabs(ctm.a), 0, 0, fabs(ctm.d), 0, 0)); - CFX_FloatRect rect(*pRect); - m_Matrix.TransformRect(rect); - - FX_RECT bitmap_rect = rect.GetOuterRect(); + FX_RECT bitmap_rect = + m_Matrix.TransformRect(CFX_FloatRect(*pRect)).GetOuterRect(); m_pBitmap = pdfium::MakeRetain(); m_pBitmap->Create(bitmap_rect.Width(), bitmap_rect.Height(), FXDIB_Argb); return true; diff --git a/core/fpdfapi/render/cpdf_progressiverenderer.cpp b/core/fpdfapi/render/cpdf_progressiverenderer.cpp index c61902cda7..3c6be3ba34 100644 --- a/core/fpdfapi/render/cpdf_progressiverenderer.cpp +++ b/core/fpdfapi/render/cpdf_progressiverenderer.cpp @@ -59,8 +59,8 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) { m_pOptions, m_pCurrentLayer->m_pObjectHolder->m_Transparency, false, nullptr); m_pDevice->SaveState(); - m_ClipRect = CFX_FloatRect(m_pDevice->GetClipBox()); - m_pCurrentLayer->m_Matrix.GetInverse().TransformRect(m_ClipRect); + m_ClipRect = m_pCurrentLayer->m_Matrix.GetInverse().TransformRect( + CFX_FloatRect(m_pDevice->GetClipBox())); } CPDF_PageObjectList::iterator iter; CPDF_PageObjectList::iterator iterEnd = diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 439ad4e5f0..01deab0bea 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -925,9 +925,9 @@ CFX_RetainPtr DrawPatternBitmap(CPDF_Document* pDoc, CFX_DefaultRenderDevice bitmap_device; bitmap_device.Attach(pBitmap, false, nullptr, false); pBitmap->Clear(0); - CFX_FloatRect cell_bbox = pPattern->bbox(); - pPattern->pattern_to_form()->TransformRect(cell_bbox); - pObject2Device->TransformRect(cell_bbox); + CFX_FloatRect cell_bbox = + pPattern->pattern_to_form()->TransformRect(pPattern->bbox()); + cell_bbox = pObject2Device->TransformRect(cell_bbox); CFX_FloatRect bitmap_rect(0.0f, 0.0f, (float)width, (float)height); CFX_Matrix mtAdjust; mtAdjust.MatchRect(bitmap_rect, cell_bbox); @@ -1048,9 +1048,8 @@ void CPDF_RenderStatus::RenderObjectList( #if defined _SKIA_SUPPORT_ DebugVerifyDeviceIsPreMultiplied(); #endif - CFX_FloatRect clip_rect(m_pDevice->GetClipBox()); - pObj2Device->GetInverse().TransformRect(clip_rect); - + CFX_FloatRect clip_rect = pObj2Device->GetInverse().TransformRect( + CFX_FloatRect(m_pDevice->GetClipBox())); for (const auto& pCurObj : *pObjectHolder->GetPageObjectList()) { if (pCurObj.get() == m_pStopObj) { m_bStopped = true; @@ -1899,10 +1898,9 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, CFX_RenderDevice::StateRestorer restorer(m_pDevice); status.RenderObjectList(pType3Char->m_pForm.get(), &matrix); } else { - CFX_FloatRect rect_f = pType3Char->m_pForm->CalcBoundingBox(); - matrix.TransformRect(rect_f); - - FX_RECT rect = rect_f.GetOuterRect(); + FX_RECT rect = + matrix.TransformRect(pType3Char->m_pForm->CalcBoundingBox()) + .GetOuterRect(); CFX_DefaultRenderDevice bitmap_device; if (!bitmap_device.Create((int)(rect.Width() * sa), (int)(rect.Height() * sd), FXDIB_Argb, @@ -2075,9 +2073,8 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, } } if (pDict->KeyExist("BBox")) { - CFX_FloatRect rect = pDict->GetRectFor("BBox"); - pMatrix->TransformRect(rect); - clip_rect.Intersect(rect.GetOuterRect()); + clip_rect.Intersect( + pMatrix->TransformRect(pDict->GetRectFor("BBox")).GetOuterRect()); } if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SHADING && m_pDevice->GetDeviceDriver()->DrawShading(pPattern, pMatrix, clip_rect, @@ -2224,9 +2221,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, pPattern->bbox().top == pPattern->y_step() && (mtPattern2Device.IsScaled() || mtPattern2Device.Is90Rotated()); - CFX_FloatRect cell_bbox = pPattern->bbox(); - mtPattern2Device.TransformRect(cell_bbox); - + CFX_FloatRect cell_bbox = mtPattern2Device.TransformRect(pPattern->bbox()); int width = static_cast(ceil(cell_bbox.Width())); int height = static_cast(ceil(cell_bbox.Height())); if (width == 0) @@ -2234,9 +2229,8 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, if (height == 0) height = 1; - CFX_FloatRect clip_box_p(clip_box); - mtPattern2Device.GetInverse().TransformRect(clip_box_p); - + CFX_FloatRect clip_box_p = + mtPattern2Device.GetInverse().TransformRect(CFX_FloatRect(clip_box)); int min_col = (int)ceil((clip_box_p.left - pPattern->bbox().right) / pPattern->x_step()); int max_col = (int)floor((clip_box_p.right - pPattern->bbox().left) / diff --git a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp index 17e33af3b1..82970e5e60 100644 --- a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp +++ b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp @@ -52,9 +52,8 @@ bool CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, bpp = 32; } while (1) { - CFX_FloatRect rect(pRect); - m_Matrix.TransformRect(rect); - FX_RECT bitmap_rect = rect.GetOuterRect(); + FX_RECT bitmap_rect = + m_Matrix.TransformRect(CFX_FloatRect(pRect)).GetOuterRect(); int32_t iWidth = bitmap_rect.Width(); int32_t iHeight = bitmap_rect.Height(); int32_t iPitch = (iWidth * bpp + 31) / 32 * 4; diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp index e43a7353b6..f2b54e81fe 100644 --- a/core/fpdfdoc/cpdf_annot.cpp +++ b/core/fpdfdoc/cpdf_annot.cpp @@ -52,9 +52,9 @@ CPDF_Form* AnnotGetMatrix(const CPDF_Page* pPage, if (!pForm) return nullptr; - CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRectFor("BBox"); CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixFor("Matrix"); - form_matrix.TransformRect(form_bbox); + CFX_FloatRect form_bbox = + form_matrix.TransformRect(pForm->m_pFormDict->GetRectFor("BBox")); matrix->MatchRect(pAnnot->GetRect(), form_bbox); matrix->Concat(*pUser2Device); return pForm; diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp index e4ecf466f5..9f6f79a02c 100644 --- a/core/fpdfdoc/cpdf_annotlist.cpp +++ b/core/fpdfdoc/cpdf_annotlist.cpp @@ -148,12 +148,11 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage, continue; } } - CFX_FloatRect annot_rect_f = pAnnot->GetRect(); + CFX_Matrix matrix = *pMatrix; if (clip_rect) { - matrix.TransformRect(annot_rect_f); - - FX_RECT annot_rect = annot_rect_f.GetOuterRect(); + FX_RECT annot_rect = + matrix.TransformRect(pAnnot->GetRect()).GetOuterRect(); annot_rect.Intersect(*clip_rect); if (annot_rect.IsEmpty()) continue; diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp index 54524a64e2..322abc0eb1 100644 --- a/core/fpdfdoc/cpdf_formcontrol.cpp +++ b/core/fpdfdoc/cpdf_formcontrol.cpp @@ -173,9 +173,9 @@ void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice, if (!pStream) return; - CFX_FloatRect form_bbox = pStream->GetDict()->GetRectFor("BBox"); CFX_Matrix form_matrix = pStream->GetDict()->GetMatrixFor("Matrix"); - form_matrix.TransformRect(form_bbox); + CFX_FloatRect form_bbox = + form_matrix.TransformRect(pStream->GetDict()->GetRectFor("BBox")); CFX_FloatRect arect = m_pWidgetDict->GetRectFor("Rect"); CFX_Matrix matrix; matrix.MatchRect(arect, form_bbox); diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index a4c8b8fba0..223b59f4e8 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -1136,7 +1136,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { charinfo.m_CharBox.right = charinfo.m_CharBox.left + pTextObj->GetCharWidth(charinfo.m_CharCode); } - matrix.TransformRect(charinfo.m_CharBox); + charinfo.m_CharBox = matrix.TransformRect(charinfo.m_CharBox); charinfo.m_Matrix = matrix; if (wstrItem.IsEmpty()) { charinfo.m_Unicode = 0; diff --git a/core/fxcrt/fx_coordinates.cpp b/core/fxcrt/fx_coordinates.cpp index 26c9169fd9..b3d0432e1c 100644 --- a/core/fxcrt/fx_coordinates.cpp +++ b/core/fxcrt/fx_coordinates.cpp @@ -313,9 +313,7 @@ float CFX_Matrix::GetYUnit() const { } CFX_FloatRect CFX_Matrix::GetUnitRect() const { - CFX_FloatRect rect(0, 0, 1, 1); - TransformRect(rect); - return rect; + return TransformRect(CFX_FloatRect(0.f, 0.f, 1.f, 1.f)); } float CFX_Matrix::TransformXDistance(float dx) const { @@ -338,33 +336,47 @@ CFX_PointF CFX_Matrix::Transform(const CFX_PointF& point) const { return CFX_PointF(a * point.x + c * point.y + e, b * point.x + d * point.y + f); } - -void CFX_Matrix::TransformRect(CFX_RectF& rect) const { - float right = rect.right(), bottom = rect.bottom(); - TransformRect(rect.left, right, bottom, rect.top); - rect.width = right - rect.left; - rect.height = bottom - rect.top; -} - -void CFX_Matrix::TransformRect(float& left, - float& right, - float& top, - float& bottom) const { +std::tuple CFX_Matrix::TransformRect( + const float& left, + const float& right, + const float& top, + const float& bottom) const { CFX_PointF points[] = { {left, top}, {left, bottom}, {right, top}, {right, bottom}}; for (int i = 0; i < 4; i++) points[i] = Transform(points[i]); - right = points[0].x; - left = points[0].x; - top = points[0].y; - bottom = points[0].y; + float new_right = points[0].x; + float new_left = points[0].x; + float new_top = points[0].y; + float new_bottom = points[0].y; for (int i = 1; i < 4; i++) { - right = std::max(right, points[i].x); - left = std::min(left, points[i].x); - top = std::max(top, points[i].y); - bottom = std::min(bottom, points[i].y); + new_right = std::max(new_right, points[i].x); + new_left = std::min(new_left, points[i].x); + new_top = std::max(new_top, points[i].y); + new_bottom = std::min(new_bottom, points[i].y); } + return std::make_tuple(new_left, new_right, new_top, new_bottom); +} + +CFX_RectF CFX_Matrix::TransformRect(const CFX_RectF& rect) const { + float left; + float right; + float bottom; + float top; + std::tie(left, right, bottom, top) = + TransformRect(rect.left, rect.right(), rect.bottom(), rect.top); + return CFX_RectF(left, top, right - left, bottom - top); +} + +CFX_FloatRect CFX_Matrix::TransformRect(const CFX_FloatRect& rect) const { + float left; + float right; + float top; + float bottom; + std::tie(left, right, top, bottom) = + TransformRect(rect.left, rect.right, rect.top, rect.bottom); + return CFX_FloatRect(left, bottom, right, top); } void CFX_Matrix::ConcatInternal(const CFX_Matrix& other, bool prepend) { diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index cc14508d70..a4074a4afa 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -8,6 +8,7 @@ #define CORE_FXCRT_FX_COORDINATES_H_ #include +#include #include "core/fxcrt/fx_basic.h" @@ -672,14 +673,13 @@ class CFX_Matrix { CFX_PointF Transform(const CFX_PointF& point) const; - void TransformRect(CFX_RectF& rect) const; - void TransformRect(float& left, - float& right, - float& top, - float& bottom) const; - void TransformRect(CFX_FloatRect& rect) const { - TransformRect(rect.left, rect.right, rect.top, rect.bottom); - } + std::tuple TransformRect( + const float& left, + const float& right, + const float& top, + const float& bottom) const; + CFX_RectF TransformRect(const CFX_RectF& rect) const; + CFX_FloatRect TransformRect(const CFX_FloatRect& rect) const; float a; float b; diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp index 8f35dce2da..e088bc4f9a 100644 --- a/core/fxge/cfx_renderdevice.cpp +++ b/core/fxge/cfx_renderdevice.cpp @@ -622,7 +622,7 @@ bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData, bbox = pPathData->GetBoundingBox(); } if (pObject2Device) - pObject2Device->TransformRect(bbox); + bbox = pObject2Device->TransformRect(bbox); CFX_Matrix ctm = GetCTM(); float fScaleX = fabs(ctm.a); diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp index 7a097ced12..c05dd795b5 100644 --- a/core/fxge/dib/cfx_imagetransformer.cpp +++ b/core/fxge/dib/cfx_imagetransformer.cpp @@ -233,9 +233,8 @@ CFX_ImageTransformer::CFX_ImageTransformer( m_pMatrix->e, m_pMatrix->f)); m_dest2stretch = stretch2dest.GetInverse(); - CFX_FloatRect clip_rect_f(result_clip); - m_dest2stretch.TransformRect(clip_rect_f); - m_StretchClip = clip_rect_f.GetOuterRect(); + m_StretchClip = + m_dest2stretch.TransformRect(CFX_FloatRect(result_clip)).GetOuterRect(); m_StretchClip.Intersect(0, 0, stretch_width, stretch_height); m_Stretcher = pdfium::MakeUnique( &m_Storer, m_pSrc, stretch_width, stretch_height, m_StretchClip, m_Flags); diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index 72ee731d56..c02058d1dd 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -213,7 +213,7 @@ void CFX_PSRenderer::SetClip_PathFill(const CFX_PathData* pPathData, OutputPath(pPathData, pObject2Device); CFX_FloatRect rect = pPathData->GetBoundingBox(); if (pObject2Device) - pObject2Device->TransformRect(rect); + rect = pObject2Device->TransformRect(rect); m_ClipBox.left = static_cast(rect.left); m_ClipBox.right = static_cast(rect.left + rect.right); @@ -242,8 +242,7 @@ void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData, OutputPath(pPathData, nullptr); CFX_FloatRect rect = pPathData->GetBoundingBox(pGraphState->m_LineWidth, pGraphState->m_MiterLimit); - pObject2Device->TransformRect(rect); - m_ClipBox.Intersect(rect.GetOuterRect()); + m_ClipBox.Intersect(pObject2Device->TransformRect(rect).GetOuterRect()); m_pStream->WriteString("strokepath W n"); if (pObject2Device) diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index 5f778f8965..fd1944a1b4 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -994,7 +994,7 @@ bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, !pPlatform->m_GdiplusExt.IsAvailable()) { CFX_FloatRect bbox_f = pPathData->GetBoundingBox(); if (pMatrix) - pMatrix->TransformRect(bbox_f); + bbox_f = pMatrix->TransformRect(bbox_f); FX_RECT bbox = bbox_f.GetInnerRect(); if (bbox.Width() <= 0) { diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index e0d02d0f4c..f682122083 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -456,15 +456,11 @@ CFX_FloatRect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) { } CFX_FloatRect CFFL_FormFiller::FFLtoPWL(const CFX_FloatRect& rect) { - CFX_FloatRect temp = rect; - GetCurMatrix().GetInverse().TransformRect(temp); - return temp; + return GetCurMatrix().GetInverse().TransformRect(rect); } CFX_FloatRect CFFL_FormFiller::PWLtoFFL(const CFX_FloatRect& rect) { - CFX_FloatRect temp = rect; - GetCurMatrix().TransformRect(temp); - return temp; + return GetCurMatrix().TransformRect(rect); } CFX_PointF CFFL_FormFiller::FFLtoPWL(const CFX_PointF& point) { diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index 5be322a9b0..b8e84c8cc4 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -222,7 +222,7 @@ CFX_Matrix GetMatrix(CFX_FloatRect rcAnnot, if (rcStream.IsEmpty()) return CFX_Matrix(); - matrix.TransformRect(rcStream); + rcStream = matrix.TransformRect(rcStream); rcStream.Normalize(); float a = rcAnnot.Width() / rcStream.Width(); diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index 489053080c..79155e52d5 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -299,10 +299,9 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPage_TransformAnnots(FPDF_PAGE page, CPDF_AnnotList AnnotList(pPage); for (size_t i = 0; i < AnnotList.Count(); ++i) { CPDF_Annot* pAnnot = AnnotList.GetAt(i); - CFX_FloatRect rect = pAnnot->GetRect(); // transformAnnots Rectangle CFX_Matrix matrix((float)a, (float)b, (float)c, (float)d, (float)e, (float)f); - matrix.TransformRect(rect); + CFX_FloatRect rect = matrix.TransformRect(pAnnot->GetRect()); CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict(); CPDF_Array* pRectArray = pAnnotDict->GetArrayFor("Rect"); diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp index f26811e137..5d7a44c623 100644 --- a/fpdfsdk/pwl/cpwl_edit_impl.cpp +++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp @@ -468,11 +468,8 @@ void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice, int32_t nFontIndex = -1; CFX_PointF ptBT; CFX_RenderDevice::StateRestorer restorer(pDevice); - if (!rcClip.IsEmpty()) { - CFX_FloatRect rcTemp = rcClip; - mtUser2Device.TransformRect(rcTemp); - pDevice->SetClip_Rect(rcTemp.ToFxRect()); - } + if (!rcClip.IsEmpty()) + pDevice->SetClip_Rect(mtUser2Device.TransformRect(rcClip).ToFxRect()); CPWL_EditImpl_Iterator* pIterator = pEdit->GetIterator(); IPVT_FontMap* pFontMap = pEdit->GetFontMap(); diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp index 96a3720daf..0198c63d6a 100644 --- a/fpdfsdk/pwl/cpwl_wnd.cpp +++ b/fpdfsdk/pwl/cpwl_wnd.cpp @@ -738,9 +738,8 @@ CFX_Matrix CPWL_Wnd::GetWindowMatrix() const { } FX_RECT CPWL_Wnd::PWLtoWnd(const CFX_FloatRect& rect) const { - CFX_FloatRect rcTemp = rect; CFX_Matrix mt = GetWindowMatrix(); - mt.TransformRect(rcTemp); + CFX_FloatRect rcTemp = mt.TransformRect(rect); return FX_RECT((int32_t)(rcTemp.left + 0.5), (int32_t)(rcTemp.bottom + 0.5), (int32_t)(rcTemp.right + 0.5), (int32_t)(rcTemp.top + 0.5)); } @@ -764,9 +763,8 @@ CFX_FloatRect CPWL_Wnd::ParentToChild(const CFX_FloatRect& rect) const { CFX_Matrix inverse = mt.GetInverse(); if (!inverse.IsIdentity()) mt = inverse; - CFX_FloatRect rc = rect; - mt.TransformRect(rc); - return rc; + + return mt.TransformRect(rect); } CFX_Matrix CPWL_Wnd::GetChildToRoot() const { diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp index cc0a6e5546..29c360921f 100644 --- a/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/fxbarcode/oned/BC_OneDimWriter.cpp @@ -189,8 +189,7 @@ void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device, if (geWidth != m_Width) { rect.right -= 1; } - matrix->TransformRect(rect); - FX_RECT re = rect.GetOuterRect(); + FX_RECT re = matrix->TransformRect(rect).GetOuterRect(); device->FillRect(&re, m_backgroundColor); CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (float)locX, (float)(locY + iFontSize)); diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp index 85f545c602..9149982ebe 100644 --- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp +++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp @@ -168,24 +168,21 @@ bool CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents, CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight), (float)(leftPosition + strWidth - 0.5), (float)m_Height); matr.Concat(*matrix); - matr.TransformRect(rect); - FX_RECT re = rect.GetOuterRect(); + FX_RECT re = matr.TransformRect(rect).GetOuterRect(); device->FillRect(&re, m_backgroundColor); CFX_FloatRect rect1( (float)(leftPosition + 47 * multiple), (float)(m_Height - iTextHeight), (float)(leftPosition + 47 * multiple + strWidth - 0.5), (float)m_Height); CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); matr1.Concat(*matrix); - matr1.TransformRect(rect1); - re = rect1.GetOuterRect(); + re = matr1.TransformRect(rect1).GetOuterRect(); device->FillRect(&re, m_backgroundColor); int32_t strWidth1 = multiple * 7; CFX_Matrix matr2(m_outputHScale, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f); CFX_FloatRect rect2(0.0f, (float)(m_Height - iTextHeight), (float)strWidth1 - 0.5f, (float)m_Height); matr2.Concat(*matrix); - matr2.TransformRect(rect2); - re = rect2.GetOuterRect(); + re = matr2.TransformRect(rect2).GetOuterRect(); device->FillRect(&re, m_backgroundColor); float blank = 0.0; diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp index ae10fe52ef..0ddafd6f17 100644 --- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -171,16 +171,14 @@ bool CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight), (float)(leftPosition + strWidth - 0.5), (float)m_Height); matr.Concat(*matrix); - matr.TransformRect(rect); - FX_RECT re = rect.GetOuterRect(); + FX_RECT re = matr.TransformRect(rect).GetOuterRect(); device->FillRect(&re, m_backgroundColor); CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); CFX_FloatRect rect1( (float)(leftPosition + 33 * multiple), (float)(m_Height - iTextHeight), (float)(leftPosition + 33 * multiple + strWidth - 0.5), (float)m_Height); matr1.Concat(*matrix); - matr1.TransformRect(rect1); - re = rect1.GetOuterRect(); + re = matr1.TransformRect(rect1).GetOuterRect(); device->FillRect(&re, m_backgroundColor); strWidth = (int32_t)(strWidth * m_outputHScale); diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp index fff4184221..07c3e7f174 100644 --- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp +++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp @@ -127,8 +127,7 @@ bool CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight), (float)(leftPosition + strWidth - 0.5), (float)m_Height); matr.Concat(*matrix); - matr.TransformRect(rect); - FX_RECT re = rect.GetOuterRect(); + FX_RECT re = matr.TransformRect(rect).GetOuterRect(); device->FillRect(&re, m_backgroundColor); CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); CFX_FloatRect rect1((float)(leftPosition + 40 * multiple), @@ -136,16 +135,14 @@ bool CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, (float)((leftPosition + 40 * multiple) + strWidth - 0.5), (float)m_Height); matr1.Concat(*matrix); - matr1.TransformRect(rect1); - re = rect1.GetOuterRect(); + re = matr1.TransformRect(rect1).GetOuterRect(); device->FillRect(&re, m_backgroundColor); float strWidth1 = (float)multiple * 7; CFX_Matrix matr2(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); CFX_FloatRect rect2(0.0, (float)(m_Height - iTextHeight), (float)strWidth1 - 1, (float)m_Height); matr2.Concat(*matrix); - matr2.TransformRect(rect2); - re = rect2.GetOuterRect(); + re = matr2.TransformRect(rect2).GetOuterRect(); device->FillRect(&re, m_backgroundColor); CFX_Matrix matr3(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); CFX_FloatRect rect3((float)(leftPosition + 85 * multiple), @@ -153,8 +150,7 @@ bool CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, (float)((leftPosition + 85 * multiple) + strWidth1 - 0.5), (float)m_Height); matr3.Concat(*matrix); - matr3.TransformRect(rect3); - re = rect3.GetOuterRect(); + re = matr3.TransformRect(rect3).GetOuterRect(); device->FillRect(&re, m_backgroundColor); strWidth = strWidth * m_outputHScale; diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp index 2e4753a902..76ffcf9517 100644 --- a/xfa/fde/cfde_textout.cpp +++ b/xfa/fde/cfde_textout.cpp @@ -299,9 +299,7 @@ void CFDE_TextOut::DrawLogicText(CFX_RenderDevice* device, if (!device || m_ttoLines.empty()) return; - CFX_RectF rtClip; - m_Matrix.TransformRect(rtClip); - + CFX_RectF rtClip = m_Matrix.TransformRect(CFX_RectF()); device->SaveState(); if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f) device->SetClip_Rect(rtClip); diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index fc8b0fa888..127c258d04 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -228,7 +228,7 @@ void CFWL_Edit::DrawSpellCheck(CXFA_Graphics* pGraphics, CFX_RectF rtClip = m_rtEngine; CFX_Matrix mt(1, 0, 0, 1, fOffSetX, fOffSetY); if (pMatrix) { - pMatrix->TransformRect(rtClip); + rtClip = pMatrix->TransformRect(rtClip); mt.Concat(*pMatrix); } pGraphics->SetClipRect(rtClip); @@ -511,7 +511,7 @@ void CFWL_Edit::DrawContent(CXFA_Graphics* pGraphics, float fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset; CFX_Matrix mt(1, 0, 0, 1, fOffSetX, fOffSetY); if (pMatrix) { - pMatrix->TransformRect(rtClip); + rtClip = pMatrix->TransformRect(rtClip); mt.Concat(*pMatrix); } @@ -609,7 +609,7 @@ void CFWL_Edit::RenderText(CFX_RenderDevice* pRenderDev, rtDocClip.width = static_cast(pRenderDev->GetWidth()); rtDocClip.height = static_cast(pRenderDev->GetHeight()); } - mt.GetInverse().TransformRect(rtDocClip); + rtDocClip = mt.GetInverse().TransformRect(rtDocClip); std::vector char_pos; @@ -1130,8 +1130,7 @@ void CFWL_Edit::ShowCaret(CFX_RectF* pRect) { if (!pDocEnvironment) return; - CFX_RectF rt(*pRect); - pXFAWidget->GetRotateMatrix().TransformRect(rt); + CFX_RectF rt = pXFAWidget->GetRotateMatrix().TransformRect(*pRect); pDocEnvironment->DisplayCaret(pXFAWidget, true, &rt); } diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp index ce1c0133f9..210ec1f06e 100644 --- a/xfa/fwl/cfwl_listbox.cpp +++ b/xfa/fwl/cfwl_listbox.cpp @@ -107,9 +107,8 @@ void CFWL_ListBox::DrawWidget(CXFA_Graphics* pGraphics, rtClip.height -= m_fScorllBarWidth; if (IsShowScrollBar(true)) rtClip.width -= m_fScorllBarWidth; - matrix.TransformRect(rtClip); - pGraphics->SetClipRect(rtClip); + pGraphics->SetClipRect(matrix.TransformRect(rtClip)); if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_NoBackground) == 0) DrawBkground(pGraphics, pTheme, &matrix); diff --git a/xfa/fwl/cfwl_spinbutton.cpp b/xfa/fwl/cfwl_spinbutton.cpp index 3119c7517a..f4ca339089 100644 --- a/xfa/fwl/cfwl_spinbutton.cpp +++ b/xfa/fwl/cfwl_spinbutton.cpp @@ -83,9 +83,6 @@ void CFWL_SpinButton::DrawWidget(CXFA_Graphics* pGraphics, if (!pGraphics) return; - CFX_RectF rtClip(m_rtClient); - matrix.TransformRect(rtClip); - IFWL_ThemeProvider* pTheme = GetAvailableTheme(); if (HasBorder()) DrawBorder(pGraphics, CFWL_Part::Border, pTheme, matrix); diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index f5beb411e6..d3f2dd4655 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp @@ -514,8 +514,8 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget, return true; } - CFX_RectF rtWidget(0, 0, pWidget->GetWidgetRect().Size()); - pMatrix->TransformRect(rtWidget); + CFX_RectF rtWidget = + pMatrix->TransformRect(CFX_RectF(0, 0, pWidget->GetWidgetRect().Size())); if (!rtWidget.IntersectWith(rtDirty)) return false; @@ -593,7 +593,7 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget, if (repaintPoint > 0) return true; - pMatrix->TransformRect(rtChilds); + rtChilds = pMatrix->TransformRect(rtChilds); if (rtChilds.Contains(rtDirty) || rtChilds.Contains(rtWidget)) return false; return true; diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index 31003417a8..bfc9e4edbc 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp @@ -52,9 +52,7 @@ CFX_RectF CXFA_FFField::GetBBox(uint32_t dwStatus, bool bDrawFocus) { return CFX_RectF(); } - CFX_RectF rtBox = m_rtUI; - GetRotateMatrix().TransformRect(rtBox); - return rtBox; + return GetRotateMatrix().TransformRect(m_rtUI); } void CXFA_FFField::RenderWidget(CXFA_Graphics* pGS, @@ -619,7 +617,7 @@ void CXFA_FFField::RenderCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) { CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice(); CFX_Matrix mt(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top); if (pMatrix) { - pMatrix->TransformRect(rtClip); + rtClip = pMatrix->TransformRect(rtClip); mt.Concat(*pMatrix); } pCapTextLayout->DrawString(pRenderDevice, mt, rtClip); diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp index d201e42c86..63079cfaa0 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.cpp +++ b/xfa/fxfa/cxfa_ffpushbutton.cpp @@ -176,7 +176,7 @@ void CXFA_FFPushButton::RenderHighlightCaption(CXFA_Graphics* pGS, rtClip.Intersect(GetRectWithoutRotate()); CFX_Matrix mt(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top); if (pMatrix) { - pMatrix->TransformRect(rtClip); + rtClip = pMatrix->TransformRect(rtClip); mt.Concat(*pMatrix); } diff --git a/xfa/fxfa/cxfa_fftext.cpp b/xfa/fxfa/cxfa_fftext.cpp index 6246ec5731..274f3bfb61 100644 --- a/xfa/fxfa/cxfa_fftext.cpp +++ b/xfa/fxfa/cxfa_fftext.cpp @@ -61,8 +61,7 @@ void CXFA_FFText::RenderWidget(CXFA_Graphics* pGS, } CFX_Matrix mt(1, 0, 0, 1, rtText.left, rtText.top); - CFX_RectF rtClip = rtText; - mtRotate.TransformRect(rtClip); + CFX_RectF rtClip = mtRotate.TransformRect(rtText); mt.Concat(mtRotate); pTextLayout->DrawString(pRenderDevice, mt, rtClip, GetIndex()); } diff --git a/xfa/fxfa/cxfa_fwladapterwidgetmgr.cpp b/xfa/fxfa/cxfa_fwladapterwidgetmgr.cpp index 4dacd0300b..6fdd553712 100644 --- a/xfa/fxfa/cxfa_fwladapterwidgetmgr.cpp +++ b/xfa/fxfa/cxfa_fwladapterwidgetmgr.cpp @@ -30,8 +30,8 @@ bool CXFA_FWLAdapterWidgetMgr::GetPopupPos(CFWL_Widget* pWidget, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) { CXFA_FFWidget* pFFWidget = pWidget->GetLayoutItem(); - CFX_RectF rtRotateAnchor(rtAnchor); - pFFWidget->GetRotateMatrix().TransformRect(rtRotateAnchor); + CFX_RectF rtRotateAnchor = + pFFWidget->GetRotateMatrix().TransformRect(rtAnchor); pFFWidget->GetDoc()->GetDocEnvironment()->GetPopupPos( pFFWidget, fMinHeight, fMaxHeight, rtRotateAnchor, rtPopup); return true; diff --git a/xfa/fxgraphics/cxfa_graphics.cpp b/xfa/fxgraphics/cxfa_graphics.cpp index 7cad380802..a94e99e200 100644 --- a/xfa/fxgraphics/cxfa_graphics.cpp +++ b/xfa/fxgraphics/cxfa_graphics.cpp @@ -346,8 +346,8 @@ void CXFA_Graphics::FillPathWithPattern(const CXFA_Path* path, auto mask = pdfium::MakeRetain(); mask->Create(data.width, data.height, FXDIB_1bppMask); memcpy(mask->GetBuffer(), data.maskBits, mask->GetPitch() * data.height); - CFX_FloatRect rectf = path->GetPathData()->GetBoundingBox(); - matrix.TransformRect(rectf); + CFX_FloatRect rectf = + matrix.TransformRect(path->GetPathData()->GetBoundingBox()); FX_RECT rect(FXSYS_round(rectf.left), FXSYS_round(rectf.top), FXSYS_round(rectf.right), FXSYS_round(rectf.bottom)); -- cgit v1.2.3