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 24 matching lines...) Expand all Loading... |
35 /** | 35 /** |
36 * Populate 'results' with opIndexes corresponding to bounding boxes that in
tersect 'query'. | 36 * Populate 'results' with opIndexes corresponding to bounding boxes that in
tersect 'query'. |
37 * This will be fastest if the query is an exact match to a single grid tile
. | 37 * This will be fastest if the query is an exact match to a single grid tile
. |
38 */ | 38 */ |
39 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const
SK_OVERRIDE; | 39 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const
SK_OVERRIDE; |
40 | 40 |
41 // For testing. | 41 // For testing. |
42 int tileCount(int x, int y) { return fTiles[y * fXTiles + x].count(); } | 42 int tileCount(int x, int y) { return fTiles[y * fXTiles + x].count(); } |
43 | 43 |
44 private: | 44 private: |
| 45 void commonAdjust(SkRect*) const; |
| 46 void userToGrid(const SkRect&, SkIRect* grid) const; |
| 47 |
45 const int fXTiles, fYTiles; | 48 const int fXTiles, fYTiles; |
46 SkTileGridFactory::TileGridInfo fInfo; | 49 const SkScalar fInvWidth, fInvHeight; |
| 50 const SkScalar fMarginWidth, fMarginHeight; |
| 51 const SkPoint fOffset; |
| 52 const SkRect fGridBounds; |
47 | 53 |
48 // (fXTiles * fYTiles) SkTDArrays, each listing ops overlapping that tile in
order. | 54 // (fXTiles * fYTiles) SkTDArrays, each listing ops overlapping that tile in
order. |
49 SkTDArray<unsigned>* fTiles; | 55 SkTDArray<unsigned>* fTiles; |
50 | 56 |
51 typedef SkBBoxHierarchy INHERITED; | 57 typedef SkBBoxHierarchy INHERITED; |
52 }; | 58 }; |
53 | 59 |
54 #endif | 60 #endif |
OLD | NEW |