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

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

Issue 2453163002: Take advantage of implicit std::unique_ptr<>(nulltpr_t) ctor. (Closed)
Patch Set: Created 4 years, 1 month 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/font/cpdf_font.cpp ('k') | core/fpdfapi/page/cpdf_colorspace.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/page/cpdf_clippath.h" 7 #include "core/fpdfapi/page/cpdf_clippath.h"
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 pData->m_PathAndTypeList.push_back(std::make_pair(path, type)); 94 pData->m_PathAndTypeList.push_back(std::make_pair(path, type));
95 } 95 }
96 96
97 void CPDF_ClipPath::AppendTexts( 97 void CPDF_ClipPath::AppendTexts(
98 std::vector<std::unique_ptr<CPDF_TextObject>>* pTexts) { 98 std::vector<std::unique_ptr<CPDF_TextObject>>* pTexts) {
99 PathData* pData = m_Ref.GetPrivateCopy(); 99 PathData* pData = m_Ref.GetPrivateCopy();
100 if (pData->m_TextList.size() + pTexts->size() <= FPDF_CLIPPATH_MAX_TEXTS) { 100 if (pData->m_TextList.size() + pTexts->size() <= FPDF_CLIPPATH_MAX_TEXTS) {
101 for (size_t i = 0; i < pTexts->size(); i++) 101 for (size_t i = 0; i < pTexts->size(); i++)
102 pData->m_TextList.push_back(std::move((*pTexts)[i])); 102 pData->m_TextList.push_back(std::move((*pTexts)[i]));
103 pData->m_TextList.push_back(std::unique_ptr<CPDF_TextObject>()); 103 pData->m_TextList.push_back(nullptr);
104 } 104 }
105 pTexts->clear(); 105 pTexts->clear();
106 } 106 }
107 107
108 void CPDF_ClipPath::Transform(const CFX_Matrix& matrix) { 108 void CPDF_ClipPath::Transform(const CFX_Matrix& matrix) {
109 PathData* pData = m_Ref.GetPrivateCopy(); 109 PathData* pData = m_Ref.GetPrivateCopy();
110 for (auto& obj : pData->m_PathAndTypeList) 110 for (auto& obj : pData->m_PathAndTypeList)
111 obj.first.Transform(&matrix); 111 obj.first.Transform(&matrix);
112 for (auto& text : pData->m_TextList) { 112 for (auto& text : pData->m_TextList) {
113 if (text) 113 if (text)
114 text->Transform(matrix); 114 text->Transform(matrix);
115 } 115 }
116 } 116 }
117 117
118 CPDF_ClipPath::PathData::PathData() {} 118 CPDF_ClipPath::PathData::PathData() {}
119 119
120 CPDF_ClipPath::PathData::PathData(const PathData& that) { 120 CPDF_ClipPath::PathData::PathData(const PathData& that) {
121 m_PathAndTypeList = that.m_PathAndTypeList; 121 m_PathAndTypeList = that.m_PathAndTypeList;
122 122
123 m_TextList.resize(that.m_TextList.size()); 123 m_TextList.resize(that.m_TextList.size());
124 for (size_t i = 0; i < that.m_TextList.size(); ++i) { 124 for (size_t i = 0; i < that.m_TextList.size(); ++i) {
125 if (that.m_TextList[i]) 125 if (that.m_TextList[i])
126 m_TextList[i].reset(that.m_TextList[i]->Clone()); 126 m_TextList[i].reset(that.m_TextList[i]->Clone());
127 } 127 }
128 } 128 }
129 129
130 CPDF_ClipPath::PathData::~PathData() {} 130 CPDF_ClipPath::PathData::~PathData() {}
OLDNEW
« no previous file with comments | « core/fpdfapi/font/cpdf_font.cpp ('k') | core/fpdfapi/page/cpdf_colorspace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698