summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_render
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-08-29 12:52:56 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-29 12:52:56 -0700
commit91ddd3f7501429222f648b986a99f3959a398889 (patch)
treeb6a712b9caf63f1e344a6475281226394e1e07c2 /core/fpdfapi/fpdf_render
parentc37d7d452d6a37c997c8709576dd71406ecff618 (diff)
downloadpdfium-91ddd3f7501429222f648b986a99f3959a398889.tar.xz
Use ->() in CPDF_ColorState
Move methods to CPDF_ColorStateData. Move MakePrivateCopy() methods to call sites. Remove now-empty cpdf_colorstate.cpp file. Review-Url: https://codereview.chromium.org/2291763002
Diffstat (limited to 'core/fpdfapi/fpdf_render')
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render.cpp45
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_image.cpp2
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp4
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_text.cpp4
4 files changed, 28 insertions, 27 deletions
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index 447cc04f06..c53cd2acfd 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -198,17 +198,17 @@ FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext,
m_InitialStates.m_ColorState.GetObject();
const CPDF_ColorStateData* pParentData =
pParentState->m_InitialStates.m_ColorState.GetObject();
- if (!pColorData || pColorData->m_FillColor.IsNull()) {
+ if (!pColorData || pColorData->GetFillColor()->IsNull()) {
m_InitialStates.m_ColorState.MakePrivateCopy();
- m_InitialStates.m_ColorState->m_FillRGB = pParentData->m_FillRGB;
- m_InitialStates.m_ColorState->m_FillColor.Copy(
- &pParentData->m_FillColor);
+ m_InitialStates.m_ColorState->SetFillRGB(pParentData->GetFillRGB());
+ m_InitialStates.m_ColorState->GetFillColor()->Copy(
+ pParentData->GetFillColor());
}
- if (!pColorData || pColorData->m_StrokeColor.IsNull()) {
+ if (!pColorData || pColorData->GetStrokeColor()->IsNull()) {
m_InitialStates.m_ColorState.MakePrivateCopy();
- m_InitialStates.m_ColorState->m_StrokeRGB = pParentData->m_FillRGB;
- m_InitialStates.m_ColorState->m_StrokeColor.Copy(
- &pParentData->m_StrokeColor);
+ m_InitialStates.m_ColorState->SetStrokeRGB(pParentData->GetFillRGB());
+ m_InitialStates.m_ColorState->GetStrokeColor()->Copy(
+ pParentData->GetStrokeColor());
}
}
} else {
@@ -514,13 +514,13 @@ FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj,
if (m_pType3Char && !bType3 &&
(!m_pType3Char->m_bColored ||
(m_pType3Char->m_bColored &&
- (!pColorData || pColorData->m_FillColor.IsNull())))) {
+ (!pColorData || pColorData->GetFillColor()->IsNull())))) {
return m_T3FillColor;
}
- if (!pColorData || pColorData->m_FillColor.IsNull()) {
+ if (!pColorData || pColorData->GetFillColor()->IsNull()) {
pColorData = m_InitialStates.m_ColorState.GetObject();
}
- FX_COLORREF rgb = pColorData->m_FillRGB;
+ FX_COLORREF rgb = pColorData->GetFillRGB();
if (rgb == (uint32_t)-1) {
return 0;
}
@@ -544,15 +544,16 @@ FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj,
}
FX_ARGB CPDF_RenderStatus::GetStrokeArgb(const CPDF_PageObject* pObj) const {
const CPDF_ColorStateData* pColorData = pObj->m_ColorState.GetObject();
- if (m_pType3Char && (!m_pType3Char->m_bColored ||
- (m_pType3Char->m_bColored &&
- (!pColorData || pColorData->m_StrokeColor.IsNull())))) {
+ if (m_pType3Char &&
+ (!m_pType3Char->m_bColored ||
+ (m_pType3Char->m_bColored &&
+ (!pColorData || pColorData->GetStrokeColor()->IsNull())))) {
return m_T3FillColor;
}
- if (!pColorData || pColorData->m_StrokeColor.IsNull()) {
+ if (!pColorData || pColorData->GetStrokeColor()->IsNull()) {
pColorData = m_InitialStates.m_ColorState.GetObject();
}
- FX_COLORREF rgb = pColorData->m_StrokeRGB;
+ FX_COLORREF rgb = pColorData->GetStrokeRGB();
if (rgb == (uint32_t)-1) {
return 0;
}
@@ -918,14 +919,14 @@ CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates(
CPDF_GraphicStates* pStates = new CPDF_GraphicStates;
pStates->CopyStates(*pSrcStates);
const CPDF_Color* pObjColor = bStroke
- ? pSrcStates->m_ColorState.GetStrokeColor()
- : pSrcStates->m_ColorState.GetFillColor();
+ ? pSrcStates->m_ColorState->GetStrokeColor()
+ : pSrcStates->m_ColorState->GetFillColor();
if (!pObjColor->IsNull()) {
pStates->m_ColorState.MakePrivateCopy();
- pStates->m_ColorState->m_FillRGB =
- bStroke ? pSrcStates->m_ColorState->m_StrokeRGB
- : pSrcStates->m_ColorState->m_FillRGB;
- pStates->m_ColorState->m_StrokeRGB = pStates->m_ColorState->m_FillRGB;
+ pStates->m_ColorState->SetFillRGB(
+ bStroke ? pSrcStates->m_ColorState->GetStrokeRGB()
+ : pSrcStates->m_ColorState->GetFillRGB());
+ pStates->m_ColorState->SetStrokeRGB(pStates->m_ColorState->GetFillRGB());
}
return pStates;
}
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
index 295ac4f7d7..b1f09f8c02 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()) {
- const 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 fc06c0be57..b4e5aea8d4 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -1186,14 +1186,14 @@ void CPDF_RenderStatus::ProcessPathPattern(const CPDF_PathObject* pPathObj,
int& filltype,
FX_BOOL& bStroke) {
if (filltype) {
- const 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) {
- const 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/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
index 387ecff27c..fb66e27796 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -279,14 +279,14 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj,
FX_ARGB fill_argb = 0;
bool bPattern = false;
if (bStroke) {
- if (textobj->m_ColorState.GetStrokeColor()->IsPattern()) {
+ if (textobj->m_ColorState->GetStrokeColor()->IsPattern()) {
bPattern = true;
} else {
stroke_argb = GetStrokeArgb(textobj);
}
}
if (bFill) {
- if (textobj->m_ColorState.GetFillColor()->IsPattern()) {
+ if (textobj->m_ColorState->GetFillColor()->IsPattern()) {
bPattern = true;
} else {
fill_argb = GetFillArgb(textobj);