From f40c6f122d6ddd73de21d225fca0c1734c9bdeac Mon Sep 17 00:00:00 2001 From: tsepez Date: Tue, 6 Sep 2016 11:45:32 -0700 Subject: Make ColorStateData private to CPDF_ColorState Review-Url: https://codereview.chromium.org/2311313002 --- core/fpdfapi/fpdf_render/fpdf_render.cpp | 38 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 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 27c9fa9bd2..d7c6e2f604 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -10,7 +10,6 @@ #include "core/fpdfapi/fpdf_font/cpdf_type3char.h" #include "core/fpdfapi/fpdf_font/cpdf_type3font.h" -#include "core/fpdfapi/fpdf_page/cpdf_colorstatedata.h" #include "core/fpdfapi/fpdf_page/cpdf_graphicstates.h" #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" #include "core/fpdfapi/fpdf_page/include/cpdf_formobject.h" @@ -510,20 +509,20 @@ CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const { FX_ARGB CPDF_RenderStatus::GetFillArgb(CPDF_PageObject* pObj, FX_BOOL bType3) const { - const CPDF_ColorStateData* pColorData = pObj->m_ColorState.GetObject(); + const CPDF_ColorState* pColorState = &pObj->m_ColorState; if (m_pType3Char && !bType3 && (!m_pType3Char->m_bColored || (m_pType3Char->m_bColored && - (!pColorData || pColorData->m_FillColor.IsNull())))) { + (!*pColorState || pColorState->GetFillColor()->IsNull())))) { return m_T3FillColor; } - if (!pColorData || pColorData->m_FillColor.IsNull()) { - pColorData = m_InitialStates.m_ColorState.GetObject(); - } - FX_COLORREF rgb = pColorData->m_FillRGB; - if (rgb == (uint32_t)-1) { + if (!*pColorState || pColorState->GetFillColor()->IsNull()) + pColorState = &m_InitialStates.m_ColorState; + + FX_COLORREF rgb = pColorState->GetFillRGB(); + if (rgb == (uint32_t)-1) return 0; - } + int32_t alpha = static_cast((pObj->m_GeneralState.GetFillAlpha() * 255)); if (pObj->m_GeneralState.GetTR()) { @@ -538,19 +537,20 @@ FX_ARGB CPDF_RenderStatus::GetFillArgb(CPDF_PageObject* pObj, } FX_ARGB CPDF_RenderStatus::GetStrokeArgb(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())))) { + const CPDF_ColorState* pColorState = &pObj->m_ColorState; + if (m_pType3Char && + (!m_pType3Char->m_bColored || + (m_pType3Char->m_bColored && + (!*pColorState || pColorState->GetStrokeColor()->IsNull())))) { return m_T3FillColor; } - if (!pColorData || pColorData->m_StrokeColor.IsNull()) { - pColorData = m_InitialStates.m_ColorState.GetObject(); - } - FX_COLORREF rgb = pColorData->m_StrokeRGB; - if (rgb == (uint32_t)-1) { + if (!*pColorState || pColorState->GetStrokeColor()->IsNull()) + pColorState = &m_InitialStates.m_ColorState; + + FX_COLORREF rgb = pColorState->GetStrokeRGB(); + if (rgb == (uint32_t)-1) return 0; - } + int32_t alpha = static_cast(pObj->m_GeneralState.GetStrokeAlpha() * 255); // not rounded. if (pObj->m_GeneralState.GetTR()) { -- cgit v1.2.3