summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp29
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.h3
2 files changed, 18 insertions, 14 deletions
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 653d657984..8b58295ab4 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -1429,6 +1429,18 @@ void CPDF_RenderStatus::ProcessClipPath(const CPDF_ClipPath& ClipPath,
}
}
+bool CPDF_RenderStatus::ClipPattern(const CPDF_PageObject* pPageObj,
+ const CFX_Matrix* pObj2Device,
+ bool bStroke) {
+ if (pPageObj->IsPath())
+ return SelectClipPath(pPageObj->AsPath(), pObj2Device, bStroke);
+ if (pPageObj->IsImage()) {
+ m_pDevice->SetClip_Rect(pPageObj->GetBBox(pObj2Device));
+ return true;
+ }
+ return false;
+}
+
bool CPDF_RenderStatus::SelectClipPath(const CPDF_PathObject* pPathObj,
const CFX_Matrix* pObj2Device,
bool bStroke) {
@@ -2127,14 +2139,9 @@ void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern,
return;
CFX_RenderDevice::StateRestorer restorer(m_pDevice);
- if (pPageObj->IsPath()) {
- if (!SelectClipPath(pPageObj->AsPath(), pObj2Device, bStroke))
- return;
- } else if (pPageObj->IsImage()) {
- m_pDevice->SetClip_Rect(pPageObj->GetBBox(pObj2Device));
- } else {
+ if (!ClipPattern(pPageObj, pObj2Device, bStroke))
return;
- }
+
FX_RECT rect = GetObjectClippedRect(pPageObj, pObj2Device);
if (rect.IsEmpty())
return;
@@ -2171,14 +2178,8 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
return;
CFX_RenderDevice::StateRestorer restorer(m_pDevice);
- if (pPageObj->IsPath()) {
- if (!SelectClipPath(pPageObj->AsPath(), pObj2Device, bStroke))
- return;
- } else if (pPageObj->IsImage()) {
- m_pDevice->SetClip_Rect(pPageObj->GetBBox(pObj2Device));
- } else {
+ if (!ClipPattern(pPageObj, pObj2Device, bStroke))
return;
- }
FX_RECT clip_box = m_pDevice->GetClipBox();
if (clip_box.IsEmpty())
diff --git a/core/fpdfapi/render/cpdf_renderstatus.h b/core/fpdfapi/render/cpdf_renderstatus.h
index 7dee8142c4..92b96f9bec 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.h
+++ b/core/fpdfapi/render/cpdf_renderstatus.h
@@ -119,6 +119,9 @@ class CPDF_RenderStatus {
const CFX_Matrix* pObj2Device,
const CPDF_Color* pColor,
bool bStroke);
+ bool ClipPattern(const CPDF_PageObject* pPageObj,
+ const CFX_Matrix* pObj2Device,
+ bool bStroke);
bool SelectClipPath(const CPDF_PathObject* pPathObj,
const CFX_Matrix* pObj2Device,
bool bStroke);