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

Unified Diff: src/core/SkTileGrid.cpp

Issue 452233002: Make BBH::search() const. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More const for tile() Created 6 years, 4 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 35f85d26c9647cbc5b5058dd9fb948ed0d5fabdb..c86e78928cbf4379a0446604c380a4fa8ccf6d77 100644
--- a/src/core/SkTileGrid.cpp
+++ b/src/core/SkTileGrid.cpp
@@ -33,6 +33,10 @@ int SkTileGrid::tileCount(int x, int y) {
return this->tile(x, y).count();
}
+const SkTDArray<void *>& SkTileGrid::tile(int x, int y) const {
+ return fTileData[y * fXTileCount + x];
+}
+
SkTDArray<void *>& SkTileGrid::tile(int x, int y) {
return fTileData[y * fXTileCount + x];
}
@@ -65,7 +69,7 @@ void SkTileGrid::insert(void* data, const SkIRect& bounds, bool) {
fInsertionCount++;
}
-void SkTileGrid::search(const SkIRect& query, SkTDArray<void*>* results) {
+void SkTileGrid::search(const SkIRect& query, SkTDArray<void*>* results) const {
SkIRect adjustedQuery = query;
// The inset is to counteract the outset that was applied in 'insert'
// The outset/inset is to optimize for lookups of size
@@ -96,7 +100,7 @@ void SkTileGrid::search(const SkIRect& query, SkTDArray<void*>* results) {
results->reset();
SkAutoSTArray<kStackAllocationTileCount, int> curPositions(queryTileCount);
SkAutoSTArray<kStackAllocationTileCount, SkTDArray<void *>*> storage(queryTileCount);
- SkTDArray<void *>** tileRange = storage.get();
+ const SkTDArray<void *>** tileRange = const_cast<const SkTDArray<void*>**>(storage.get());
int tile = 0;
for (int x = tileStartX; x < tileEndX; ++x) {
for (int y = tileStartY; y < tileEndY; ++y) {
« 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