aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-11-28 19:54:12 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-11-28 19:54:12 +0000
commit1271d78e8ff4cda0622a24dcec6063b50f6be051 (patch)
tree6b6de7aac0be0e15f02d50eefbdf4de6208c17ba /include
parent1e0e6079219de9cea6ad4b74b1ca5498fa9d3597 (diff)
add bytes() to SkTDArray, which returns the number of bytes in the array,
as opposed to count() which returns the number of elements. git-svn-id: http://skia.googlecode.com/svn/trunk@2758 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkTDArray.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/core/SkTDArray.h b/include/core/SkTDArray.h
index b9597e8ee2..5f62203d21 100644
--- a/include/core/SkTDArray.h
+++ b/include/core/SkTDArray.h
@@ -91,7 +91,17 @@ public:
}
bool isEmpty() const { return fCount == 0; }
+
+ /**
+ * Return the number of elements in the array
+ */
int count() const { return fCount; }
+
+ /**
+ * return the number of bytes in the array: count * sizeof(T)
+ */
+ size_t bytes() const { return fCount * sizeof(T); }
+
T* begin() const { return fArray; }
T* end() const { return fArray ? fArray + fCount : NULL; }
T& operator[](int index) const {