diff options
author | tsepez <tsepez@chromium.org> | 2016-08-26 15:17:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-26 15:17:13 -0700 |
commit | 987f3ee94c3cb8e4a6113ad05453a2948469386c (patch) | |
tree | fbd1fdc800c2510c89ae043331a799a42c3251af /core/fpdfapi/fpdf_page/cpdf_clippath.cpp | |
parent | 83d2351fd64128156c9abfb70266133d58a5e525 (diff) | |
download | pdfium-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_clippath.cpp')
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_clippath.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_clippath.cpp b/core/fpdfapi/fpdf_page/cpdf_clippath.cpp index ea854d1b29..e820260131 100644 --- a/core/fpdfapi/fpdf_page/cpdf_clippath.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_clippath.cpp @@ -14,23 +14,23 @@ #define FPDF_CLIPPATH_MAX_TEXTS 1024 uint32_t CPDF_ClipPath::GetPathCount() const { - return pdfium::CollectionSize<uint32_t>(m_pObject->m_PathAndTypeList); + return pdfium::CollectionSize<uint32_t>(GetObject()->m_PathAndTypeList); } CPDF_Path CPDF_ClipPath::GetPath(size_t i) const { - return m_pObject->m_PathAndTypeList[i].first; + return GetObject()->m_PathAndTypeList[i].first; } uint8_t CPDF_ClipPath::GetClipType(size_t i) const { - return m_pObject->m_PathAndTypeList[i].second; + return GetObject()->m_PathAndTypeList[i].second; } uint32_t CPDF_ClipPath::GetTextCount() const { - return pdfium::CollectionSize<uint32_t>(m_pObject->m_TextList); + return pdfium::CollectionSize<uint32_t>(GetObject()->m_TextList); } CPDF_TextObject* CPDF_ClipPath::GetText(size_t i) const { - return m_pObject->m_TextList[i].get(); + return GetObject()->m_TextList[i].get(); } CFX_FloatRect CPDF_ClipPath::GetClipBox() const { @@ -73,7 +73,7 @@ CFX_FloatRect CPDF_ClipPath::GetClipBox() const { } void CPDF_ClipPath::AppendPath(CPDF_Path path, uint8_t type, bool bAutoMerge) { - CPDF_ClipPathData* pData = GetModify(); + CPDF_ClipPathData* pData = GetPrivateCopy(); if (!pData->m_PathAndTypeList.empty() && bAutoMerge) { const CPDF_Path& old_path = pData->m_PathAndTypeList.back().first; if (old_path.IsRect()) { @@ -89,7 +89,7 @@ void CPDF_ClipPath::AppendPath(CPDF_Path path, uint8_t type, bool bAutoMerge) { void CPDF_ClipPath::AppendTexts( std::vector<std::unique_ptr<CPDF_TextObject>>* pTexts) { - CPDF_ClipPathData* pData = GetModify(); + CPDF_ClipPathData* pData = GetPrivateCopy(); if (pData->m_TextList.size() + pTexts->size() <= FPDF_CLIPPATH_MAX_TEXTS) { for (size_t i = 0; i < pTexts->size(); i++) pData->m_TextList.push_back(std::move((*pTexts)[i])); @@ -99,7 +99,7 @@ void CPDF_ClipPath::AppendTexts( } void CPDF_ClipPath::Transform(const CFX_Matrix& matrix) { - CPDF_ClipPathData* pData = GetModify(); + CPDF_ClipPathData* pData = GetPrivateCopy(); for (auto& obj : pData->m_PathAndTypeList) obj.first.Transform(&matrix); for (auto& text : pData->m_TextList) { |