From adbd32950006075fc04ff2cbb01bf3a099f0e010 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 29 Aug 2016 14:07:28 -0700 Subject: Revert "Use ->() in CPDF_ColorState" This reverts commit 91ddd3f7501429222f648b986a99f3959a398889. Reason for revert: may introduce sublte bugs, more thought required. TBR=dsinclair@chromium.org Review-Url: https://codereview.chromium.org/2294553002 --- core/fpdfapi/fpdf_render/fpdf_render.cpp | 45 ++++++++++++------------ core/fpdfapi/fpdf_render/fpdf_render_image.cpp | 2 +- core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 4 +-- core/fpdfapi/fpdf_render/fpdf_render_text.cpp | 4 +-- 4 files changed, 27 insertions(+), 28 deletions(-) (limited to 'core/fpdfapi/fpdf_render') diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp index c53cd2acfd..447cc04f06 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->GetFillColor()->IsNull()) { + if (!pColorData || pColorData->m_FillColor.IsNull()) { m_InitialStates.m_ColorState.MakePrivateCopy(); - m_InitialStates.m_ColorState->SetFillRGB(pParentData->GetFillRGB()); - m_InitialStates.m_ColorState->GetFillColor()->Copy( - pParentData->GetFillColor()); + m_InitialStates.m_ColorState->m_FillRGB = pParentData->m_FillRGB; + m_InitialStates.m_ColorState->m_FillColor.Copy( + &pParentData->m_FillColor); } - if (!pColorData || pColorData->GetStrokeColor()->IsNull()) { + if (!pColorData || pColorData->m_StrokeColor.IsNull()) { m_InitialStates.m_ColorState.MakePrivateCopy(); - m_InitialStates.m_ColorState->SetStrokeRGB(pParentData->GetFillRGB()); - m_InitialStates.m_ColorState->GetStrokeColor()->Copy( - pParentData->GetStrokeColor()); + m_InitialStates.m_ColorState->m_StrokeRGB = pParentData->m_FillRGB; + m_InitialStates.m_ColorState->m_StrokeColor.Copy( + &pParentData->m_StrokeColor); } } } 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->GetFillColor()->IsNull())))) { + (!pColorData || pColorData->m_FillColor.IsNull())))) { return m_T3FillColor; } - if (!pColorData || pColorData->GetFillColor()->IsNull()) { + if (!pColorData || pColorData->m_FillColor.IsNull()) { pColorData = m_InitialStates.m_ColorState.GetObject(); } - FX_COLORREF rgb = pColorData->GetFillRGB(); + FX_COLORREF rgb = pColorData->m_FillRGB; if (rgb == (uint32_t)-1) { return 0; } @@ -544,16 +544,15 @@ 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->GetStrokeColor()->IsNull())))) { + if (m_pType3Char && (!m_pType3Char->m_bColored || + (m_pType3Char->m_bColored && + (!pColorData || pColorData->m_StrokeColor.IsNull())))) { return m_T3FillColor; } - if (!pColorData || pColorData->GetStrokeColor()->IsNull()) { + if (!pColorData || pColorData->m_StrokeColor.IsNull()) { pColorData = m_InitialStates.m_ColorState.GetObject(); } - FX_COLORREF rgb = pColorData->GetStrokeRGB(); + FX_COLORREF rgb = pColorData->m_StrokeRGB; if (rgb == (uint32_t)-1) { return 0; } @@ -919,14 +918,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->SetFillRGB( - bStroke ? pSrcStates->m_ColorState->GetStrokeRGB() - : pSrcStates->m_ColorState->GetFillRGB()); - pStates->m_ColorState->SetStrokeRGB(pStates->m_ColorState->GetFillRGB()); + 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; } return pStates; } diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp index b1f09f8c02..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()) { - 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 b4e5aea8d4..fc06c0be57 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 fb66e27796..387ecff27c 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); -- cgit v1.2.3