summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render/cpdf_renderstatus.cpp
diff options
context:
space:
mode:
authorJane Liu <janeliulwq@google.com>2017-08-22 10:50:06 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-22 16:42:55 +0000
commit878b27de2fa8e5bdc3b910c98846f4b43185d4aa (patch)
treef21a9528354ebf533a637f5ea0e8edaa44be7427 /core/fpdfapi/render/cpdf_renderstatus.cpp
parentaac59a0e59052366e260396165a759b5b0e80188 (diff)
downloadpdfium-878b27de2fa8e5bdc3b910c98846f4b43185d4aa.tar.xz
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 <dsinclair@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
Diffstat (limited to 'core/fpdfapi/render/cpdf_renderstatus.cpp')
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp32
1 files changed, 13 insertions, 19 deletions
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) /