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

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

Issue 2285283003: Revert "Add -> operators to CFX_CountRef." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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 MakePrivateCopy(); 76 CPDF_ClipPathData* pData = GetPrivateCopy();
77 CPDF_ClipPathData* pData = GetObject();
78 if (!pData->m_PathAndTypeList.empty() && bAutoMerge) { 77 if (!pData->m_PathAndTypeList.empty() && bAutoMerge) {
79 const CPDF_Path& old_path = pData->m_PathAndTypeList.back().first; 78 const CPDF_Path& old_path = pData->m_PathAndTypeList.back().first;
80 if (old_path.IsRect()) { 79 if (old_path.IsRect()) {
81 CFX_FloatRect old_rect(old_path.GetPointX(0), old_path.GetPointY(0), 80 CFX_FloatRect old_rect(old_path.GetPointX(0), old_path.GetPointY(0),
82 old_path.GetPointX(2), old_path.GetPointY(2)); 81 old_path.GetPointX(2), old_path.GetPointY(2));
83 CFX_FloatRect new_rect = path.GetBoundingBox(); 82 CFX_FloatRect new_rect = path.GetBoundingBox();
84 if (old_rect.Contains(new_rect)) 83 if (old_rect.Contains(new_rect))
85 pData->m_PathAndTypeList.pop_back(); 84 pData->m_PathAndTypeList.pop_back();
86 } 85 }
87 } 86 }
88 pData->m_PathAndTypeList.push_back(std::make_pair(path, type)); 87 pData->m_PathAndTypeList.push_back(std::make_pair(path, type));
89 } 88 }
90 89
91 void CPDF_ClipPath::AppendTexts( 90 void CPDF_ClipPath::AppendTexts(
92 std::vector<std::unique_ptr<CPDF_TextObject>>* pTexts) { 91 std::vector<std::unique_ptr<CPDF_TextObject>>* pTexts) {
93 MakePrivateCopy(); 92 CPDF_ClipPathData* pData = GetPrivateCopy();
94 CPDF_ClipPathData* pData = GetObject();
95 if (pData->m_TextList.size() + pTexts->size() <= FPDF_CLIPPATH_MAX_TEXTS) { 93 if (pData->m_TextList.size() + pTexts->size() <= FPDF_CLIPPATH_MAX_TEXTS) {
96 for (size_t i = 0; i < pTexts->size(); i++) 94 for (size_t i = 0; i < pTexts->size(); i++)
97 pData->m_TextList.push_back(std::move((*pTexts)[i])); 95 pData->m_TextList.push_back(std::move((*pTexts)[i]));
98 pData->m_TextList.push_back(std::unique_ptr<CPDF_TextObject>()); 96 pData->m_TextList.push_back(std::unique_ptr<CPDF_TextObject>());
99 } 97 }
100 pTexts->clear(); 98 pTexts->clear();
101 } 99 }
102 100
103 void CPDF_ClipPath::Transform(const CFX_Matrix& matrix) { 101 void CPDF_ClipPath::Transform(const CFX_Matrix& matrix) {
104 MakePrivateCopy(); 102 CPDF_ClipPathData* pData = GetPrivateCopy();
105 CPDF_ClipPathData* pData = GetObject();
106 for (auto& obj : pData->m_PathAndTypeList) 103 for (auto& obj : pData->m_PathAndTypeList)
107 obj.first.Transform(&matrix); 104 obj.first.Transform(&matrix);
108 for (auto& text : pData->m_TextList) { 105 for (auto& text : pData->m_TextList) {
109 if (text) 106 if (text)
110 text->Transform(matrix); 107 text->Transform(matrix);
111 } 108 }
112 } 109 }
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