| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkTileGrid_DEFINED | 8 #ifndef SkTileGrid_DEFINED |
| 9 #define SkTileGrid_DEFINED | 9 #define SkTileGrid_DEFINED |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * Populate 'results' with opIndexes corresponding to bounding boxes that in
tersect 'query'. | 34 * Populate 'results' with opIndexes corresponding to bounding boxes that in
tersect 'query'. |
| 35 * This will be fastest if the query is an exact match to a single grid tile
. | 35 * This will be fastest if the query is an exact match to a single grid tile
. |
| 36 */ | 36 */ |
| 37 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const
SK_OVERRIDE; | 37 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const
SK_OVERRIDE; |
| 38 | 38 |
| 39 // For testing. | 39 // For testing. |
| 40 int tileCount(int x, int y) { return fTiles[y * fXTiles + x].count(); } | 40 int tileCount(int x, int y) { return fTiles[y * fXTiles + x].count(); } |
| 41 | 41 |
| 42 virtual void reserve(unsigned opCount) SK_OVERRIDE; | |
| 43 virtual void flushDeferredInserts() SK_OVERRIDE; | |
| 44 | |
| 45 private: | 42 private: |
| 46 void commonAdjust(SkRect*) const; | 43 void commonAdjust(SkRect*) const; |
| 47 void userToGrid(const SkRect&, SkIRect* grid) const; | 44 void userToGrid(const SkRect&, SkIRect* grid) const; |
| 48 | 45 |
| 49 const int fXTiles, fYTiles; | 46 const int fXTiles, fYTiles; |
| 50 const SkScalar fInvWidth, fInvHeight; | 47 const SkScalar fInvWidth, fInvHeight; |
| 51 const SkScalar fMarginWidth, fMarginHeight; | 48 const SkScalar fMarginWidth, fMarginHeight; |
| 52 const SkPoint fOffset; | 49 const SkPoint fOffset; |
| 53 const SkRect fGridBounds; | 50 const SkRect fGridBounds; |
| 54 | 51 |
| 55 // (fXTiles * fYTiles) SkTDArrays, each listing ops overlapping that tile in
order. | 52 // (fXTiles * fYTiles) SkTDArrays, each listing ops overlapping that tile in
order. |
| 56 SkTDArray<unsigned>* fTiles; | 53 SkTDArray<unsigned>* fTiles; |
| 57 | 54 |
| 58 typedef SkBBoxHierarchy INHERITED; | 55 typedef SkBBoxHierarchy INHERITED; |
| 59 }; | 56 }; |
| 60 | 57 |
| 61 #endif | 58 #endif |
| OLD | NEW |