From bbee445c5a77dfbaea9041308f001c756e49c5fd Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 2 Sep 2016 15:22:00 -0700 Subject: Make CPDF_GeneralState have a CPDF_GeneralStateData Remove a const cast along the way and propagate to callers. Review-Url: https://codereview.chromium.org/2303553002 --- core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp') diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index fc06c0be57..090060d2c0 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -961,7 +961,9 @@ void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern, CFX_Matrix matrix = *pattern->pattern_to_form(); matrix.Concat(*pObj2Device); GetScaledMatrix(matrix); - int alpha = pPageObj->m_GeneralState.GetAlpha(bStroke); + int alpha = + FXSYS_round(255 * (bStroke ? pPageObj->m_GeneralState.GetStrokeAlpha() + : pPageObj->m_GeneralState.GetFillAlpha())); DrawShading(pattern, &matrix, rect, alpha, m_Options.m_ColorMode == RENDER_COLOR_ALPHA); m_pDevice->RestoreState(false); @@ -978,12 +980,12 @@ void CPDF_RenderStatus::ProcessShading(const CPDF_ShadingObject* pShadingObj, CFX_Matrix matrix = pShadingObj->m_Matrix; matrix.Concat(*pObj2Device); DrawShading(pShadingObj->m_pShading, &matrix, rect, - pShadingObj->m_GeneralState.GetAlpha(FALSE), + FXSYS_round(255 * pShadingObj->m_GeneralState.GetFillAlpha()), m_Options.m_ColorMode == RENDER_COLOR_ALPHA); } void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, - const CPDF_PageObject* pPageObj, + CPDF_PageObject* pPageObj, const CFX_Matrix* pObj2Device, FX_BOOL bStroke) { if (!pPattern->Load()) { @@ -1167,7 +1169,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, m_pDevice->RestoreState(false); } -void CPDF_RenderStatus::DrawPathWithPattern(const CPDF_PathObject* pPathObj, +void CPDF_RenderStatus::DrawPathWithPattern(CPDF_PathObject* pPathObj, const CFX_Matrix* pObj2Device, const CPDF_Color* pColor, FX_BOOL bStroke) { @@ -1181,7 +1183,7 @@ void CPDF_RenderStatus::DrawPathWithPattern(const CPDF_PathObject* pPathObj, DrawShadingPattern(pShadingPattern, pPathObj, pObj2Device, bStroke); } -void CPDF_RenderStatus::ProcessPathPattern(const CPDF_PathObject* pPathObj, +void CPDF_RenderStatus::ProcessPathPattern(CPDF_PathObject* pPathObj, const CFX_Matrix* pObj2Device, int& filltype, FX_BOOL& bStroke) { -- cgit v1.2.3