| Index: core/fpdfapi/fpdf_page/cpdf_clippath.cpp
|
| diff --git a/core/fpdfapi/fpdf_page/cpdf_clippath.cpp b/core/fpdfapi/fpdf_page/cpdf_clippath.cpp
|
| index e820260131dce522fdc2e859a81926c65c47986d..51ff593a5a4b3ffcb6a304a92192c892f88eed6e 100644
|
| --- a/core/fpdfapi/fpdf_page/cpdf_clippath.cpp
|
| +++ b/core/fpdfapi/fpdf_page/cpdf_clippath.cpp
|
| @@ -8,29 +8,36 @@
|
|
|
| #include <utility>
|
|
|
| +#include "core/fpdfapi/fpdf_page/include/cpdf_path.h"
|
| #include "core/fpdfapi/fpdf_page/include/cpdf_textobject.h"
|
| #include "third_party/base/stl_util.h"
|
|
|
| #define FPDF_CLIPPATH_MAX_TEXTS 1024
|
|
|
| +CPDF_ClipPath::CPDF_ClipPath() {}
|
| +
|
| +CPDF_ClipPath::CPDF_ClipPath(const CPDF_ClipPath& that) : m_Ref(that.m_Ref) {}
|
| +
|
| +CPDF_ClipPath::~CPDF_ClipPath() {}
|
| +
|
| uint32_t CPDF_ClipPath::GetPathCount() const {
|
| - return pdfium::CollectionSize<uint32_t>(GetObject()->m_PathAndTypeList);
|
| + return pdfium::CollectionSize<uint32_t>(m_Ref.GetObject()->m_PathAndTypeList);
|
| }
|
|
|
| CPDF_Path CPDF_ClipPath::GetPath(size_t i) const {
|
| - return GetObject()->m_PathAndTypeList[i].first;
|
| + return m_Ref.GetObject()->m_PathAndTypeList[i].first;
|
| }
|
|
|
| uint8_t CPDF_ClipPath::GetClipType(size_t i) const {
|
| - return GetObject()->m_PathAndTypeList[i].second;
|
| + return m_Ref.GetObject()->m_PathAndTypeList[i].second;
|
| }
|
|
|
| uint32_t CPDF_ClipPath::GetTextCount() const {
|
| - return pdfium::CollectionSize<uint32_t>(GetObject()->m_TextList);
|
| + return pdfium::CollectionSize<uint32_t>(m_Ref.GetObject()->m_TextList);
|
| }
|
|
|
| CPDF_TextObject* CPDF_ClipPath::GetText(size_t i) const {
|
| - return GetObject()->m_TextList[i].get();
|
| + return m_Ref.GetObject()->m_TextList[i].get();
|
| }
|
|
|
| CFX_FloatRect CPDF_ClipPath::GetClipBox() const {
|
| @@ -73,7 +80,7 @@ CFX_FloatRect CPDF_ClipPath::GetClipBox() const {
|
| }
|
|
|
| void CPDF_ClipPath::AppendPath(CPDF_Path path, uint8_t type, bool bAutoMerge) {
|
| - CPDF_ClipPathData* pData = GetPrivateCopy();
|
| + PathData* pData = m_Ref.GetPrivateCopy();
|
| if (!pData->m_PathAndTypeList.empty() && bAutoMerge) {
|
| const CPDF_Path& old_path = pData->m_PathAndTypeList.back().first;
|
| if (old_path.IsRect()) {
|
| @@ -89,7 +96,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 = GetPrivateCopy();
|
| + PathData* pData = m_Ref.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 +106,7 @@ void CPDF_ClipPath::AppendTexts(
|
| }
|
|
|
| void CPDF_ClipPath::Transform(const CFX_Matrix& matrix) {
|
| - CPDF_ClipPathData* pData = GetPrivateCopy();
|
| + PathData* pData = m_Ref.GetPrivateCopy();
|
| for (auto& obj : pData->m_PathAndTypeList)
|
| obj.first.Transform(&matrix);
|
| for (auto& text : pData->m_TextList) {
|
| @@ -107,3 +114,17 @@ void CPDF_ClipPath::Transform(const CFX_Matrix& matrix) {
|
| text->Transform(matrix);
|
| }
|
| }
|
| +
|
| +CPDF_ClipPath::PathData::PathData() {}
|
| +
|
| +CPDF_ClipPath::PathData::PathData(const PathData& that) {
|
| + m_PathAndTypeList = that.m_PathAndTypeList;
|
| +
|
| + m_TextList.resize(that.m_TextList.size());
|
| + for (size_t i = 0; i < that.m_TextList.size(); ++i) {
|
| + if (that.m_TextList[i])
|
| + m_TextList[i].reset(that.m_TextList[i]->Clone());
|
| + }
|
| +}
|
| +
|
| +CPDF_ClipPath::PathData::~PathData() {}
|
|
|