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

Unified Diff: src/core/SkTileGrid.cpp

Issue 35633002: Replacing SkTDArray with SkAutoSTArray to reduce memory allocation overhead in SkTileGrid::search (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | « src/core/SkTileGrid.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTileGrid.cpp
diff --git a/src/core/SkTileGrid.cpp b/src/core/SkTileGrid.cpp
index c39e21b356886a71368877e1ba3c1b1343e3b343..bbed00603dc1453bab715c7e37773d80a256e45d 100644
--- a/src/core/SkTileGrid.cpp
+++ b/src/core/SkTileGrid.cpp
@@ -91,13 +91,8 @@ void SkTileGrid::search(const SkIRect& query, SkTDArray<void*>* results) {
*results = this->tile(tileStartX, tileStartY);
} else {
results->reset();
- SkTDArray<int> curPositions;
- curPositions.setCount(queryTileCount);
- // Note: Reserving space for 1024 tile pointers on the stack. If the
- // malloc becomes a bottleneck, we may consider increasing that number.
- // Typical large web page, say 2k x 16k, would require 512 tiles of
- // size 256 x 256 pixels.
- SkAutoSTArray<1024, SkTDArray<void *>*> storage(queryTileCount);
+ SkAutoSTArray<kStackAllocationTileCount, int> curPositions(queryTileCount);
+ SkAutoSTArray<kStackAllocationTileCount, SkTDArray<void *>*> storage(queryTileCount);
SkTDArray<void *>** tileRange = storage.get();
int tile = 0;
for (int x = tileStartX; x < tileEndX; ++x) {
« no previous file with comments | « src/core/SkTileGrid.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698