diff options
author | mtklein <mtklein@chromium.org> | 2014-10-02 08:50:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-02 08:50:41 -0700 |
commit | 15c7ceb6aabec88ee4950135dbc74011b7446193 (patch) | |
tree | 4c86f6ca7c916e4477c5ba3bdef203e24e89ac0f /src | |
parent | b1fc64b8faa17a1d7fc7140dc18906b639fbd27b (diff) |
TileGrid: earliest need not be a pointer anymore
BUG=skia:
Review URL: https://codereview.chromium.org/625573003
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkTileGrid.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/core/SkTileGrid.cpp b/src/core/SkTileGrid.cpp index 8cdebcb0b6..317d74a2d7 100644 --- a/src/core/SkTileGrid.cpp +++ b/src/core/SkTileGrid.cpp @@ -122,26 +122,24 @@ void SkTileGrid::search(const SkRect& query, SkTDArray<unsigned>* results) const // Merge tiles into results until they're fully consumed. results->reset(); while (true) { - // The tiles themselves are already ordered, so the earliest is at the front of some tile. - // It may be at the front of several, even all, tiles. - const unsigned* earliest = NULL; + // The tiles themselves are already ordered, so the earliest op is at the front of some + // tile. It may be at the front of several, even all, tiles. + unsigned earliest = SK_MaxU32; for (int i = 0; i < starts.count(); i++) { if (starts[i] < ends[i]) { - if (NULL == earliest || *starts[i]< *earliest) { - earliest = starts[i]; - } + earliest = SkTMin(earliest, *starts[i]); } } - // If we didn't find an earliest entry, there isn't anything left to merge. - if (NULL == earliest) { + // If we didn't find an earliest op, there isn't anything left to merge. + if (SK_MaxU32 == earliest) { return; } - // We did find an earliest entry. Output it, and step forward every tile that contains it. - results->push(*earliest); + // We did find an earliest op. Output it, and step forward every tile that contains it. + results->push(earliest); for (int i = 0; i < starts.count(); i++) { - if (starts[i] < ends[i] && *starts[i] == *earliest) { + if (starts[i] < ends[i] && *starts[i] == earliest) { starts[i]++; } } |