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

Unified Diff: include/core/SkTDArray.h

Issue 639823005: Use BBH reserve hook to preallocate space for tiles. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: assert -> early check Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkTileGrid.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkTDArray.h
diff --git a/include/core/SkTDArray.h b/include/core/SkTDArray.h
index 92f297c31a63f6a2f0c927f01c2db5ac6f69215e..8e8b4923e3e91d707cb1d2f3ba59be53fe08627c 100644
--- a/include/core/SkTDArray.h
+++ b/include/core/SkTDArray.h
@@ -347,6 +347,11 @@ public:
}
#endif
+ void shrinkToFit() {
+ fReserve = fCount;
+ fArray = (T*)sk_realloc_throw(fArray, fReserve * sizeof(T));
+ }
+
private:
#ifdef SK_DEBUG
enum {
« no previous file with comments | « no previous file | src/core/SkTileGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698