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

Side by Side Diff: include/core/SkTArray.h

Issue 1359943003: SkPDF: add basic metadata support (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: style change Created 5 years, 2 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 | « include/core/SkDocument.h ('k') | src/doc/SkDocument_PDF.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 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkTArray_DEFINED 8 #ifndef SkTArray_DEFINED
9 #define SkTArray_DEFINED 9 #define SkTArray_DEFINED
10 10
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 /** 187 /**
188 * Version of above that uses a copy constructor to initialize the new item 188 * Version of above that uses a copy constructor to initialize the new item
189 */ 189 */
190 T& push_back(const T& t) { 190 T& push_back(const T& t) {
191 T* newT = reinterpret_cast<T*>(this->push_back_raw(1)); 191 T* newT = reinterpret_cast<T*>(this->push_back_raw(1));
192 new (newT) T(t); 192 new (newT) T(t);
193 return *newT; 193 return *newT;
194 } 194 }
195 195
196 /** 196 /**
197 * Construct a new T at the back of this array.
198 */
199 template<class... Args> T& emplace_back(Args&&... args) {
200 T* newT = reinterpret_cast<T*>(this->push_back_raw(1));
201 return *new (newT) T(skstd::forward<Args>(args)...);
202 }
203
204 /**
197 * Allocates n more default-initialized T values, and returns the address of 205 * Allocates n more default-initialized T values, and returns the address of
198 * the start of that new range. Note: this address is only valid until the 206 * the start of that new range. Note: this address is only valid until the
199 * next API call made on the array that might add or remove elements. 207 * next API call made on the array that might add or remove elements.
200 */ 208 */
201 T* push_back_n(int n) { 209 T* push_back_n(int n) {
202 SkASSERT(n >= 0); 210 SkASSERT(n >= 0);
203 T* newTs = reinterpret_cast<T*>(this->push_back_raw(n)); 211 T* newTs = reinterpret_cast<T*>(this->push_back_raw(n));
204 for (int i = 0; i < n; ++i) { 212 for (int i = 0; i < n; ++i) {
205 new (newTs + i) T; 213 new (newTs + i) T;
206 } 214 }
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 SkSTArray& operator= (const INHERITED& array) { 549 SkSTArray& operator= (const INHERITED& array) {
542 INHERITED::operator=(array); 550 INHERITED::operator=(array);
543 return *this; 551 return *this;
544 } 552 }
545 553
546 private: 554 private:
547 SkAlignedSTStorage<N,T> fStorage; 555 SkAlignedSTStorage<N,T> fStorage;
548 }; 556 };
549 557
550 #endif 558 #endif
OLDNEW
« no previous file with comments | « include/core/SkDocument.h ('k') | src/doc/SkDocument_PDF.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698