summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_render
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/fpdf_render')
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render.cpp13
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_image.cpp2
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp6
-rw-r--r--core/fpdfapi/fpdf_render/render_int.h2
4 files changed, 13 insertions, 10 deletions
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index f24a66857d..f77e46d923 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -199,12 +199,14 @@ FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext,
const CPDF_ColorStateData* pParentData =
pParentState->m_InitialStates.m_ColorState.GetObject();
if (!pColorData || pColorData->m_FillColor.IsNull()) {
- CPDF_ColorStateData* pData = m_InitialStates.m_ColorState.GetModify();
+ CPDF_ColorStateData* pData =
+ m_InitialStates.m_ColorState.GetPrivateCopy();
pData->m_FillRGB = pParentData->m_FillRGB;
pData->m_FillColor.Copy(&pParentData->m_FillColor);
}
if (!pColorData || pColorData->m_StrokeColor.IsNull()) {
- CPDF_ColorStateData* pData = m_InitialStates.m_ColorState.GetModify();
+ CPDF_ColorStateData* pData =
+ m_InitialStates.m_ColorState.GetPrivateCopy();
pData->m_StrokeRGB = pParentData->m_FillRGB;
pData->m_StrokeColor.Copy(&pParentData->m_StrokeColor);
}
@@ -915,10 +917,11 @@ CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates(
}
CPDF_GraphicStates* pStates = new CPDF_GraphicStates;
pStates->CopyStates(*pSrcStates);
- CPDF_Color* pObjColor = bStroke ? pSrcStates->m_ColorState.GetStrokeColor()
- : pSrcStates->m_ColorState.GetFillColor();
+ const CPDF_Color* pObjColor = bStroke
+ ? pSrcStates->m_ColorState.GetStrokeColor()
+ : pSrcStates->m_ColorState.GetFillColor();
if (!pObjColor->IsNull()) {
- CPDF_ColorStateData* pColorData = pStates->m_ColorState.GetModify();
+ CPDF_ColorStateData* pColorData = pStates->m_ColorState.GetPrivateCopy();
pColorData->m_FillRGB =
bStroke ? pSrcStates->m_ColorState.GetObject()->m_StrokeRGB
: pSrcStates->m_ColorState.GetObject()->m_FillRGB;
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
index 8d638f62f8..295ac4f7d7 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -422,7 +422,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() {
m_bPatternColor = FALSE;
m_pPattern = nullptr;
if (m_pDIBSource->IsAlphaMask()) {
- CPDF_Color* pColor = m_pImageObject->m_ColorState.GetFillColor();
+ const CPDF_Color* pColor = m_pImageObject->m_ColorState.GetFillColor();
if (pColor && pColor->IsPattern()) {
m_pPattern = pColor->GetPattern();
if (m_pPattern) {
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index 21af7686fc..fc06c0be57 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -1169,7 +1169,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
void CPDF_RenderStatus::DrawPathWithPattern(const CPDF_PathObject* pPathObj,
const CFX_Matrix* pObj2Device,
- CPDF_Color* pColor,
+ const CPDF_Color* pColor,
FX_BOOL bStroke) {
CPDF_Pattern* pattern = pColor->GetPattern();
if (!pattern)
@@ -1186,14 +1186,14 @@ void CPDF_RenderStatus::ProcessPathPattern(const CPDF_PathObject* pPathObj,
int& filltype,
FX_BOOL& bStroke) {
if (filltype) {
- CPDF_Color& FillColor = *pPathObj->m_ColorState.GetFillColor();
+ const CPDF_Color& FillColor = *pPathObj->m_ColorState.GetFillColor();
if (FillColor.IsPattern()) {
DrawPathWithPattern(pPathObj, pObj2Device, &FillColor, FALSE);
filltype = 0;
}
}
if (bStroke) {
- CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor();
+ const CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor();
if (StrokeColor.IsPattern()) {
DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE);
bStroke = FALSE;
diff --git a/core/fpdfapi/fpdf_render/render_int.h b/core/fpdfapi/fpdf_render/render_int.h
index a10dca5db8..66d0a70d52 100644
--- a/core/fpdfapi/fpdf_render/render_int.h
+++ b/core/fpdfapi/fpdf_render/render_int.h
@@ -186,7 +186,7 @@ class CPDF_RenderStatus {
FX_BOOL& bStroke);
void DrawPathWithPattern(const CPDF_PathObject* pPathObj,
const CFX_Matrix* pObj2Device,
- CPDF_Color* pColor,
+ const CPDF_Color* pColor,
FX_BOOL bStroke);
void DrawTilingPattern(CPDF_TilingPattern* pPattern,
const CPDF_PageObject* pPageObj,