Chromium Code Reviews| Index: src/core/SkTileGrid.h |
| diff --git a/src/core/SkTileGrid.h b/src/core/SkTileGrid.h |
| index c02235a12327aa6911a24f353f465a41abb7d22a..7606c6678b86adb81132fc819d73e845cae2a01b 100644 |
| --- a/src/core/SkTileGrid.h |
| +++ b/src/core/SkTileGrid.h |
| @@ -1,4 +1,3 @@ |
| - |
| /* |
| * Copyright 2012 Google Inc. |
| * |
| @@ -11,21 +10,15 @@ |
| #include "SkBBHFactory.h" |
| #include "SkBBoxHierarchy.h" |
| -#include "SkPictureStateTree.h" |
| /** |
| * Subclass of SkBBoxHierarchy that stores elements in buckets that correspond |
| * to tile regions, disposed in a regular grid. This is useful when the tile |
| * structure that will be use in search() calls is known prior to insertion. |
| - * Calls to search will return in constant time. |
| - * |
| - * Note: Current implementation of search() only supports looking-up regions |
| - * that are an exact match to a single tile. Implementation could be augmented |
| - * to support arbitrary rectangles, but performance would be sub-optimal. |
| */ |
| class SkTileGrid : public SkBBoxHierarchy { |
| public: |
| - SkTileGrid(int xTileCount, int yTileCount, const SkTileGridFactory::TileGridInfo& info); |
| + SkTileGrid(int xTiles, int yTiles, const SkTileGridFactory::TileGridInfo& info); |
| virtual ~SkTileGrid(); |
| @@ -47,26 +40,25 @@ public: |
| virtual void clear() SK_OVERRIDE; |
| - /** |
| - * Gets the number of insertions |
| - */ |
| - virtual int getCount() const SK_OVERRIDE; |
| + virtual int getCount() const SK_OVERRIDE { return fCount; } |
| virtual int getDepth() const SK_OVERRIDE { return -1; } |
| virtual void rewindInserts() SK_OVERRIDE; |
| - int tileCount(int x, int y); // For testing only. |
| + // For testing. |
| + int tileCount(int x, int y) { return fTiles[y * fXTiles + x].count(); } |
| private: |
| - const SkTDArray<void*>& tile(int x, int y) const; |
| - SkTDArray<void*>& tile(int x, int y); |
| + struct Entry { |
|
robertphillips
2014/08/12 12:44:37
// The data's order of insertion into the tile gri
|
| + size_t order; |
| + void* data; |
| + }; |
| - int fXTileCount, fYTileCount, fTileCount; |
| + const int fXTiles, fYTiles; |
| SkTileGridFactory::TileGridInfo fInfo; |
| - SkTDArray<void*>* fTileData; |
| - int fInsertionCount; |
| - SkIRect fGridBounds; |
| + size_t fCount; |
|
robertphillips
2014/08/12 12:44:38
// fXTiles by fYTiles - with each array holding th
|
| + SkTDArray<Entry>* fTiles; |
| typedef SkBBoxHierarchy INHERITED; |
| }; |