Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1580)

Unified Diff: include/core/SkTArray.h

Issue 5056048: [GPU] Use new Var type for inputs/outputs of FS and VS (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: remove decl of deleted function Created 13 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« gpu/src/GrGLProgram.cpp ('K') | « gyp/gpu.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkTArray.h
===================================================================
--- include/core/SkTArray.h (revision 2287)
+++ include/core/SkTArray.h (working copy)
@@ -246,6 +246,16 @@
}
/**
+ * Version of above that uses a copy constructor to initialize the new item
+ */
+ T& push_back(const T& t) {
+ checkRealloc(1);
+ new ((char*)fMemArray+sizeof(T)*fCount) T(t);
+ ++fCount;
+ return fItemArray[fCount-1];
+ }
+
+ /**
* Allocates n more default T values, and returns the address of the start
* of that new range. Note: this address is only valid until the next API
* call made on the array that might add or remove elements.
@@ -261,6 +271,34 @@
}
/**
+ * Version of above that uses a copy constructor to initialize all n items
+ * to the same T.
+ */
+ T* push_back_n(int n, const T& t) {
+ SkASSERT(n >= 0);
+ checkRealloc(n);
+ for (int i = 0; i < n; ++i) {
+ new (fItemArray + fCount + i) T(t);
+ }
+ fCount += n;
+ return fItemArray + fCount - n;
+ }
+
+ /**
+ * Version of above that uses a copy constructor to initialize the n items
+ * to separate T values.
+ */
+ T* push_back_n(int n, const T t[]) {
+ SkASSERT(n >= 0);
+ checkRealloc(n);
+ for (int i = 0; i < n; ++i) {
+ new (fItemArray + fCount + i) T(t[i]);
+ }
+ fCount += n;
+ return fItemArray + fCount - n;
+ }
+
+ /**
* Removes the last element. Not safe to call when count() == 0.
*/
void pop_back() {
« gpu/src/GrGLProgram.cpp ('K') | « gyp/gpu.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b