diff options
author | Lei Zhang <thestig@chromium.org> | 2018-04-09 20:19:55 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-09 20:19:55 +0000 |
commit | 40baf04a567236d51b26e2d94f0ed7f2694cfeb1 (patch) | |
tree | b3656b2a4590e0aa877d2a66e662751143042ee2 | |
parent | 124abf5d68b9fe96bf8a95f239b77fdd47fdc556 (diff) | |
download | pdfium-40baf04a567236d51b26e2d94f0ed7f2694cfeb1.tar.xz |
Cleanup CPDF_RenderStatus::GetObjectClippedRect().
- Just return the rect directly and let the caller check for emptiness.
- Get rid of a boolean parameter with always false argument.
Change-Id: Ia33587db34c0a628047e59b7faa390c3ac57ec8a
Reviewed-on: https://pdfium-review.googlesource.com/29971
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.cpp | 39 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.h | 6 |
2 files changed, 20 insertions, 25 deletions
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 367519ac83..662377b647 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -1163,25 +1163,22 @@ bool CPDF_RenderStatus::ContinueSingleObject(CPDF_PageObject* pObj, return ContinueSingleObject(pObj, pObj2Device, pPause); } -bool CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, - const CFX_Matrix* pObj2Device, - bool bLogical, - FX_RECT& rect) const { - rect = pObj->GetBBox(pObj2Device); +FX_RECT CPDF_RenderStatus::GetObjectClippedRect( + const CPDF_PageObject* pObj, + const CFX_Matrix* pObj2Device) const { + FX_RECT rect = pObj->GetBBox(pObj2Device); FX_RECT rtClip = m_pDevice->GetClipBox(); - if (!bLogical) { - CFX_Matrix dCTM = m_pDevice->GetCTM(); - float a = fabs(dCTM.a); - float d = fabs(dCTM.d); - if (a != 1.0f || d != 1.0f) { - rect.right = rect.left + (int32_t)ceil((float)rect.Width() * a); - rect.bottom = rect.top + (int32_t)ceil((float)rect.Height() * d); - rtClip.right = rtClip.left + (int32_t)ceil((float)rtClip.Width() * a); - rtClip.bottom = rtClip.top + (int32_t)ceil((float)rtClip.Height() * d); - } + CFX_Matrix dCTM = m_pDevice->GetCTM(); + float a = fabs(dCTM.a); + float d = fabs(dCTM.d); + if (a != 1.0f || d != 1.0f) { + rect.right = rect.left + (int32_t)ceil((float)rect.Width() * a); + rect.bottom = rect.top + (int32_t)ceil((float)rect.Height() * d); + rtClip.right = rtClip.left + (int32_t)ceil((float)rtClip.Width() * a); + rtClip.bottom = rtClip.top + (int32_t)ceil((float)rtClip.Height() * d); } rect.Intersect(rtClip); - return rect.IsEmpty(); + return rect; } void CPDF_RenderStatus::ProcessObjectNoClip(CPDF_PageObject* pObj, @@ -1241,10 +1238,10 @@ void CPDF_RenderStatus::GetScaledMatrix(CFX_Matrix& matrix) const { void CPDF_RenderStatus::DrawObjWithBackground(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device) { - FX_RECT rect; - if (GetObjectClippedRect(pObj, pObj2Device, false, rect)) { + FX_RECT rect = GetObjectClippedRect(pObj, pObj2Device); + if (rect.IsEmpty()) return; - } + int res = 300; if (pObj->IsImage() && m_pDevice->GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) { @@ -2184,8 +2181,8 @@ void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern, } else { return; } - FX_RECT rect; - if (GetObjectClippedRect(pPageObj, pObj2Device, false, rect)) + FX_RECT rect = GetObjectClippedRect(pPageObj, pObj2Device); + if (rect.IsEmpty()) return; CFX_Matrix matrix = *pattern->pattern_to_form(); diff --git a/core/fpdfapi/render/cpdf_renderstatus.h b/core/fpdfapi/render/cpdf_renderstatus.h index 44afa10f19..e5bd872b5c 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.h +++ b/core/fpdfapi/render/cpdf_renderstatus.h @@ -153,10 +153,8 @@ class CPDF_RenderStatus { const CPDF_GraphicStates* pPathObj, bool bStroke); FX_ARGB GetStrokeArgb(CPDF_PageObject* pObj) const; - bool GetObjectClippedRect(const CPDF_PageObject* pObj, - const CFX_Matrix* pObj2Device, - bool bLogical, - FX_RECT& rect) const; + FX_RECT GetObjectClippedRect(const CPDF_PageObject* pObj, + const CFX_Matrix* pObj2Device) const; void GetScaledMatrix(CFX_Matrix& matrix) const; static const int kRenderMaxRecursionDepth = 64; |