diff options
author | mtklein <mtklein@chromium.org> | 2014-10-02 09:53:04 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-02 09:53:04 -0700 |
commit | 8f8c25eabb97da8eda488895f04f2d12cb5ea4cf (patch) | |
tree | b72d7effb991556b669b9ccadba9ab33e43ff7e6 /src | |
parent | ed48ebe39e7f06ed00b851abea1270318947c2b8 (diff) |
Demote getCount, getDepth, and clear to RTree-only methods.
We use them only to test RTree.
BUG=skia:
Review URL: https://codereview.chromium.org/622773003
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkBBoxHierarchy.h | 17 | ||||
-rw-r--r-- | src/core/SkRTree.h | 20 | ||||
-rw-r--r-- | src/core/SkTileGrid.cpp | 7 | ||||
-rw-r--r-- | src/core/SkTileGrid.h | 7 |
4 files changed, 6 insertions, 45 deletions
diff --git a/src/core/SkBBoxHierarchy.h b/src/core/SkBBoxHierarchy.h index 53eabc8b88..3382ac154e 100644 --- a/src/core/SkBBoxHierarchy.h +++ b/src/core/SkBBoxHierarchy.h @@ -44,23 +44,6 @@ public: */ virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const = 0; - virtual void clear() = 0; - - /** - * Gets the number of insertions actually made (does not include deferred insertions) - */ - virtual int getCount() const = 0; - - /** - * Returns the depth of the currently allocated tree. The root node counts for 1 level, - * so it should be 1 or more if there's a root node. This information provides details - * about the underlying structure, which is useful mainly for testing purposes. - * - * Returns 0 if there are currently no nodes in the tree. - * Returns -1 if the structure isn't a tree. - */ - virtual int getDepth() const = 0; - private: typedef SkRefCnt INHERITED; }; diff --git a/src/core/SkRTree.h b/src/core/SkRTree.h index 85469ccc4c..0d88804c30 100644 --- a/src/core/SkRTree.h +++ b/src/core/SkRTree.h @@ -79,22 +79,14 @@ public: */ virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVERRIDE; - virtual void clear() SK_OVERRIDE; - bool isEmpty() const { return 0 == fCount; } - - /** - * Gets the depth of the tree structure - */ - virtual int getDepth() const SK_OVERRIDE { - return this->isEmpty() ? 0 : fRoot.fChild.subtree->fLevel + 1; - } - - /** - * This gets the insertion count (rather than the node count) - */ - virtual int getCount() const SK_OVERRIDE { return fCount; } + void clear(); + // Return the depth of the tree structure. + int getDepth() const { return this->isEmpty() ? 0 : fRoot.fChild.subtree->fLevel + 1; } + // Insertion count (not overall node count, which may be greater). + int getCount() const { return fCount; } private: + bool isEmpty() const { return 0 == this->getCount(); } struct Node; diff --git a/src/core/SkTileGrid.cpp b/src/core/SkTileGrid.cpp index 317d74a2d7..ea51797f53 100644 --- a/src/core/SkTileGrid.cpp +++ b/src/core/SkTileGrid.cpp @@ -11,7 +11,6 @@ SkTileGrid::SkTileGrid(int xTiles, int yTiles, const SkTileGridFactory::TileGrid : fXTiles(xTiles) , fYTiles(yTiles) , fInfo(info) - , fCount(0) , fTiles(SkNEW_ARRAY(SkTDArray<unsigned>, xTiles * yTiles)) { // Margin is offset by 1 as a provision for AA and // to cancel-out the outset applied by getClipDeviceBounds. @@ -146,9 +145,3 @@ void SkTileGrid::search(const SkRect& query, SkTDArray<unsigned>* results) const } } -void SkTileGrid::clear() { - for (int i = 0; i < fXTiles * fYTiles; i++) { - fTiles[i].reset(); - } -} - diff --git a/src/core/SkTileGrid.h b/src/core/SkTileGrid.h index 97564c64ad..df0a746a3c 100644 --- a/src/core/SkTileGrid.h +++ b/src/core/SkTileGrid.h @@ -38,19 +38,12 @@ public: */ virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVERRIDE; - virtual void clear() SK_OVERRIDE; - - virtual int getCount() const SK_OVERRIDE { return fCount; } - - virtual int getDepth() const SK_OVERRIDE { return -1; } - // For testing. int tileCount(int x, int y) { return fTiles[y * fXTiles + x].count(); } private: const int fXTiles, fYTiles; SkTileGridFactory::TileGridInfo fInfo; - size_t fCount; // (fXTiles * fYTiles) SkTDArrays, each listing ops overlapping that tile in order. SkTDArray<unsigned>* fTiles; |