diff options
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/font/cpdf_cidfont.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/font/cpdf_type3font.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_contentparser.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_formobject.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_imageobject.cpp | 7 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_pageobject.cpp | 6 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_pathobject.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_shadingobject.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_streamcontentparser.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_textobject.cpp | 8 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_devicebuffer.cpp | 6 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_progressiverenderer.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.cpp | 32 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp | 5 |
14 files changed, 36 insertions, 54 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<CPDF_Image>& 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<CFX_DIBitmap>(); 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<CFX_DIBitmap> 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<int>(ceil(cell_bbox.Width())); int height = static_cast<int>(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; |