summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-08-26 15:17:12 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-26 15:17:13 -0700
commit987f3ee94c3cb8e4a6113ad05453a2948469386c (patch)
treefbd1fdc800c2510c89ae043331a799a42c3251af /core/fpdfapi/fpdf_page/cpdf_allstates.cpp
parent83d2351fd64128156c9abfb70266133d58a5e525 (diff)
downloadpdfium-987f3ee94c3cb8e4a6113ad05453a2948469386c.tar.xz
Make CFX_CountRef<>::m_pObject private, add accessors, fix const-ness.
Hide the CountedObj class from the rest of the code. Rename GetModify() to GetPrivateCopy(), since it turns out there are places where we modify a potentially-shared copy. Add non-const version of GetObject() to permit these. Review-Url: https://codereview.chromium.org/2287633002
Diffstat (limited to 'core/fpdfapi/fpdf_page/cpdf_allstates.cpp')
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_allstates.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
index ab69eb7488..e4b6e328b9 100644
--- a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
@@ -45,7 +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.GetModify();
+ 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++)
@@ -54,7 +54,7 @@ void CPDF_AllStates::SetLineDash(CPDF_Array* pArray,
void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
CPDF_StreamContentParser* pParser) {
- CPDF_GeneralStateData* pGeneralState = m_GeneralState.GetModify();
+ CPDF_GeneralStateData* pGeneralState = m_GeneralState.GetPrivateCopy();
for (const auto& it : *pGS) {
const CFX_ByteString& key_str = it.first;
CPDF_Object* pElement = it.second;
@@ -65,18 +65,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.GetModify()->m_LineWidth = pObject->GetNumber();
+ m_GraphState.GetPrivateCopy()->m_LineWidth = pObject->GetNumber();
break;
case FXBSTR_ID('L', 'C', 0, 0):
- m_GraphState.GetModify()->m_LineCap =
+ m_GraphState.GetPrivateCopy()->m_LineCap =
(CFX_GraphStateData::LineCap)pObject->GetInteger();
break;
case FXBSTR_ID('L', 'J', 0, 0):
- m_GraphState.GetModify()->m_LineJoin =
+ m_GraphState.GetPrivateCopy()->m_LineJoin =
(CFX_GraphStateData::LineJoin)pObject->GetInteger();
break;
case FXBSTR_ID('M', 'L', 0, 0):
- m_GraphState.GetModify()->m_MiterLimit = pObject->GetNumber();
+ m_GraphState.GetPrivateCopy()->m_MiterLimit = pObject->GetNumber();
break;
case FXBSTR_ID('D', 0, 0, 0): {
CPDF_Array* pDash = pObject->AsArray();
@@ -98,7 +98,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
if (!pFont)
break;
- m_TextState.GetModify()->m_FontSize = pFont->GetNumberAt(1);
+ m_TextState.GetPrivateCopy()->m_FontSize = pFont->GetNumberAt(1);
m_TextState.SetFont(pParser->FindFont(pFont->GetStringAt(0)));
break;
}