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

Unified Diff: src/core/SkTileGrid.h

Issue 465523002: De-parameterize SkNextDatumFunction. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: no <T> 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/SkBBHFactory.cpp ('k') | src/core/SkTileGrid.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTileGrid.h
diff --git a/src/core/SkTileGrid.h b/src/core/SkTileGrid.h
index ea473fb6d0cf85aba67cf0567027a6a8ee5fc82d..163efa5571c813f5a4c10c3b897dfaa8daa4cb34 100644
--- a/src/core/SkTileGrid.h
+++ b/src/core/SkTileGrid.h
@@ -33,12 +33,7 @@ public:
kStackAllocationTileCount = 1024
};
- typedef void* (*SkTileGridNextDatumFunctionPtr)(
- const SkTDArray<void*>** tileData,
- SkAutoSTArray<kStackAllocationTileCount, int>& tileIndices);
-
- SkTileGrid(int xTileCount, int yTileCount, const SkTileGridFactory::TileGridInfo& info,
- SkTileGridNextDatumFunctionPtr nextDatumFunction);
+ SkTileGrid(int xTileCount, int yTileCount, const SkTileGridFactory::TileGridInfo& info);
virtual ~SkTileGrid();
@@ -85,62 +80,8 @@ private:
SkTDArray<void*>* fTileData;
int fInsertionCount;
SkIRect fGridBounds;
- SkTileGridNextDatumFunctionPtr fNextDatumFunction;
typedef SkBBoxHierarchy INHERITED;
};
-/**
- * Generic implementation for SkTileGridNextDatumFunctionPtr. user code may instantiate
- * this template to get a valid SkTileGridNextDatumFunction implementation
- *
- * Returns the next element of tileData[i][tileIndices[i]] for all i and advances
- * tileIndices[] past them. The order in which data are returned by successive
- * calls to this method must reflect the order in which the were originally
- * recorded into the tile grid.
- *
- * \param tileData array of pointers to arrays of tile data
- * \param tileIndices per-tile data indices, indices are incremented for tiles that contain
- * the next datum.
- * \tparam T a type to which it is safe to cast a datum and that has an operator <
- * such that 'a < b' is true if 'a' was inserted into the tile grid before 'b'.
- */
-template <typename T>
-void* SkTileGridNextDatum(const SkTDArray<void*>** tileData,
- SkAutoSTArray<SkTileGrid::kStackAllocationTileCount, int>& tileIndices) {
- T* minVal = NULL;
- int tileCount = tileIndices.count();
- int minIndex = tileCount;
- int maxIndex = 0;
- // Find the next Datum; track where it's found so we reduce the size of the second loop.
- for (int tile = 0; tile < tileCount; ++tile) {
- int pos = tileIndices[tile];
- if (pos != SkTileGrid::kTileFinished) {
- T* candidate = (T*)(*tileData[tile])[pos];
- if (NULL == minVal || (*candidate) < (*minVal)) {
- minVal = candidate;
- minIndex = tile;
- maxIndex = tile;
- } else if (!((*minVal) < (*candidate))) {
- // We don't require operator==; if !(candidate<minVal) && !(minVal<candidate),
- // candidate==minVal and we have to add this tile to the range searched.
- maxIndex = tile;
- }
- }
- }
- // Increment indices past the next datum
- if (minVal != NULL) {
- for (int tile = minIndex; tile <= maxIndex; ++tile) {
- int pos = tileIndices[tile];
- if (pos != SkTileGrid::kTileFinished && (*tileData[tile])[pos] == minVal) {
- if (++(tileIndices[tile]) >= tileData[tile]->count()) {
- tileIndices[tile] = SkTileGrid::kTileFinished;
- }
- }
- }
- return minVal;
- }
- return NULL;
-}
-
#endif
« no previous file with comments | « src/core/SkBBHFactory.cpp ('k') | src/core/SkTileGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698