diff options
author | tsepez <tsepez@chromium.org> | 2016-08-31 10:26:38 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-31 10:26:38 -0700 |
commit | 4d9df422c340b3bc33e044d3d94e1ff9582e1260 (patch) | |
tree | 8ad5a366cac2a11a133a7e7babd76497a737e554 /core/fpdfapi/fpdf_page/cpdf_allstates.cpp | |
parent | 21ce1a68bb9f80bfbd4f295fd3b7181e56502fdc (diff) | |
download | pdfium-4d9df422c340b3bc33e044d3d94e1ff9582e1260.tar.xz |
Make CPDF_GraphState have a CPDF_GraphStateData instead of inheriting.
Get callers out of the copy-before-write business, and let the
class manage it instead.
Review-Url: https://codereview.chromium.org/2292363002
Diffstat (limited to 'core/fpdfapi/fpdf_page/cpdf_allstates.cpp')
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_allstates.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp index e01b379bed..acecafd01e 100644 --- a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp @@ -45,11 +45,7 @@ void CPDF_AllStates::Copy(const CPDF_AllStates& src) { void CPDF_AllStates::SetLineDash(CPDF_Array* pArray, FX_FLOAT phase, FX_FLOAT scale) { - CFX_GraphStateData* pData = m_GraphState.GetPrivateCopy(); - pData->m_DashPhase = phase * scale; - pData->SetDashCount(static_cast<int>(pArray->GetCount())); - for (size_t i = 0; i < pArray->GetCount(); i++) - pData->m_DashArray[i] = pArray->GetNumberAt(i) * scale; + m_GraphState.SetLineDash(pArray, phase, scale); } void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, @@ -65,18 +61,18 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, uint32_t key = key_str.GetID(); switch (key) { case FXBSTR_ID('L', 'W', 0, 0): - m_GraphState.GetPrivateCopy()->m_LineWidth = pObject->GetNumber(); + m_GraphState.SetLineWidth(pObject->GetNumber()); break; case FXBSTR_ID('L', 'C', 0, 0): - m_GraphState.GetPrivateCopy()->m_LineCap = - (CFX_GraphStateData::LineCap)pObject->GetInteger(); + m_GraphState.SetLineCap( + static_cast<CFX_GraphStateData::LineCap>(pObject->GetInteger())); break; case FXBSTR_ID('L', 'J', 0, 0): - m_GraphState.GetPrivateCopy()->m_LineJoin = - (CFX_GraphStateData::LineJoin)pObject->GetInteger(); + m_GraphState.SetLineJoin( + static_cast<CFX_GraphStateData::LineJoin>(pObject->GetInteger())); break; case FXBSTR_ID('M', 'L', 0, 0): - m_GraphState.GetPrivateCopy()->m_MiterLimit = pObject->GetNumber(); + m_GraphState.SetMiterLimit(pObject->GetNumber()); break; case FXBSTR_ID('D', 0, 0, 0): { CPDF_Array* pDash = pObject->AsArray(); |