Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: core/fpdfapi/fpdf_page/cpdf_clippath.cpp

Issue 2283113002: Add -> operators to CFX_CountRef. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@privatize
Patch Set: Regenerate patch, rebase off of master. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_allstates.cpp ('k') | core/fpdfapi/fpdf_page/cpdf_colorstate.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/fpdf_page/include/cpdf_clippath.h" 7 #include "core/fpdfapi/fpdf_page/include/cpdf_clippath.h"
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } else { 66 } else {
67 layer_rect.Union(CFX_FloatRect(pTextObj->GetBBox(nullptr))); 67 layer_rect.Union(CFX_FloatRect(pTextObj->GetBBox(nullptr)));
68 } 68 }
69 } 69 }
70 } 70 }
71 } 71 }
72 return rect; 72 return rect;
73 } 73 }
74 74
75 void CPDF_ClipPath::AppendPath(CPDF_Path path, uint8_t type, bool bAutoMerge) { 75 void CPDF_ClipPath::AppendPath(CPDF_Path path, uint8_t type, bool bAutoMerge) {
76 CPDF_ClipPathData* pData = GetPrivateCopy(); 76 MakePrivateCopy();
77 CPDF_ClipPathData* pData = GetObject();
77 if (!pData->m_PathAndTypeList.empty() && bAutoMerge) { 78 if (!pData->m_PathAndTypeList.empty() && bAutoMerge) {
78 const CPDF_Path& old_path = pData->m_PathAndTypeList.back().first; 79 const CPDF_Path& old_path = pData->m_PathAndTypeList.back().first;
79 if (old_path.IsRect()) { 80 if (old_path.IsRect()) {
80 CFX_FloatRect old_rect(old_path.GetPointX(0), old_path.GetPointY(0), 81 CFX_FloatRect old_rect(old_path.GetPointX(0), old_path.GetPointY(0),
81 old_path.GetPointX(2), old_path.GetPointY(2)); 82 old_path.GetPointX(2), old_path.GetPointY(2));
82 CFX_FloatRect new_rect = path.GetBoundingBox(); 83 CFX_FloatRect new_rect = path.GetBoundingBox();
83 if (old_rect.Contains(new_rect)) 84 if (old_rect.Contains(new_rect))
84 pData->m_PathAndTypeList.pop_back(); 85 pData->m_PathAndTypeList.pop_back();
85 } 86 }
86 } 87 }
87 pData->m_PathAndTypeList.push_back(std::make_pair(path, type)); 88 pData->m_PathAndTypeList.push_back(std::make_pair(path, type));
88 } 89 }
89 90
90 void CPDF_ClipPath::AppendTexts( 91 void CPDF_ClipPath::AppendTexts(
91 std::vector<std::unique_ptr<CPDF_TextObject>>* pTexts) { 92 std::vector<std::unique_ptr<CPDF_TextObject>>* pTexts) {
92 CPDF_ClipPathData* pData = GetPrivateCopy(); 93 MakePrivateCopy();
94 CPDF_ClipPathData* pData = GetObject();
93 if (pData->m_TextList.size() + pTexts->size() <= FPDF_CLIPPATH_MAX_TEXTS) { 95 if (pData->m_TextList.size() + pTexts->size() <= FPDF_CLIPPATH_MAX_TEXTS) {
94 for (size_t i = 0; i < pTexts->size(); i++) 96 for (size_t i = 0; i < pTexts->size(); i++)
95 pData->m_TextList.push_back(std::move((*pTexts)[i])); 97 pData->m_TextList.push_back(std::move((*pTexts)[i]));
96 pData->m_TextList.push_back(std::unique_ptr<CPDF_TextObject>()); 98 pData->m_TextList.push_back(std::unique_ptr<CPDF_TextObject>());
97 } 99 }
98 pTexts->clear(); 100 pTexts->clear();
99 } 101 }
100 102
101 void CPDF_ClipPath::Transform(const CFX_Matrix& matrix) { 103 void CPDF_ClipPath::Transform(const CFX_Matrix& matrix) {
102 CPDF_ClipPathData* pData = GetPrivateCopy(); 104 MakePrivateCopy();
105 CPDF_ClipPathData* pData = GetObject();
103 for (auto& obj : pData->m_PathAndTypeList) 106 for (auto& obj : pData->m_PathAndTypeList)
104 obj.first.Transform(&matrix); 107 obj.first.Transform(&matrix);
105 for (auto& text : pData->m_TextList) { 108 for (auto& text : pData->m_TextList) {
106 if (text) 109 if (text)
107 text->Transform(matrix); 110 text->Transform(matrix);
108 } 111 }
109 } 112 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_allstates.cpp ('k') | core/fpdfapi/fpdf_page/cpdf_colorstate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698