aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkTDArray.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-11 10:17:02 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-11 10:17:02 +0000
commit046f1f6ff4b2b3f4571a9562e74f41e82419a4a1 (patch)
treea7d3af90ac41718bf937e184bdd4a301ef721641 /include/core/SkTDArray.h
parent1195a28892d37ae9632e81e1bc2407cf644522d2 (diff)
Cleaner external buffer handling in SkWriter32
This unifies the internal and external buffer handling so that the difference only has to be noticed when growing. Removing the branches from the common read and write cases gives a significant speedup. BUG=skia:2125 R=tomhudson@google.com, mtklein@google.com, reed@google.com Author: iancottrell@google.com Review URL: https://codereview.chromium.org/156683004 git-svn-id: http://skia.googlecode.com/svn/trunk@13396 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkTDArray.h')
-rw-r--r--include/core/SkTDArray.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/core/SkTDArray.h b/include/core/SkTDArray.h
index 14447217e9..67254ccc9a 100644
--- a/include/core/SkTDArray.h
+++ b/include/core/SkTDArray.h
@@ -101,6 +101,13 @@ public:
int count() const { return fCount; }
/**
+ * Return the total number of elements allocated.
+ * reserved() - count() gives you the number of elements you can add
+ * without causing an allocation.
+ */
+ int reserved() const { return fReserve; }
+
+ /**
* return the number of bytes in the array: count * sizeof(T)
*/
size_t bytes() const { return fCount * sizeof(T); }