diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkBBoxHierarchy.cpp | 12 | ||||
-rw-r--r-- | src/core/SkBBoxHierarchy.h | 8 | ||||
-rw-r--r-- | src/core/SkRTree.cpp | 2 | ||||
-rw-r--r-- | src/core/SkRTree.h | 2 |
4 files changed, 22 insertions, 2 deletions
diff --git a/src/core/SkBBoxHierarchy.cpp b/src/core/SkBBoxHierarchy.cpp new file mode 100644 index 0000000000..a99bb9d97c --- /dev/null +++ b/src/core/SkBBoxHierarchy.cpp @@ -0,0 +1,12 @@ +
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkBBoxHierarchy.h"
+
+SK_DEFINE_INST_COUNT(SkBBoxHierarchy)
+
diff --git a/src/core/SkBBoxHierarchy.h b/src/core/SkBBoxHierarchy.h index 347871f87b..6625a846fe 100644 --- a/src/core/SkBBoxHierarchy.h +++ b/src/core/SkBBoxHierarchy.h @@ -11,14 +11,15 @@ #include "SkRect.h" #include "SkTDArray.h" +#include "SkRefCnt.h" /** * Interface for a spatial data structure that associates user data pointers with axis-aligned * bounding boxes, and allows efficient retrieval of intersections with query rectangles. */ -class SkBBoxHierarchy { +class SkBBoxHierarchy : public SkRefCnt { public: - virtual ~SkBBoxHierarchy() { } + SK_DECLARE_INST_COUNT(SkBBoxHierarchy) /** * Insert a data pointer and corresponding bounding box @@ -47,6 +48,9 @@ public: * Gets the number of insertions */ virtual int getCount() const = 0; + +private: + typedef SkRefCnt INHERITED; }; #endif diff --git a/src/core/SkRTree.cpp b/src/core/SkRTree.cpp index b6ff29b8c4..96f6b18c81 100644 --- a/src/core/SkRTree.cpp +++ b/src/core/SkRTree.cpp @@ -19,6 +19,8 @@ static inline void join_no_empty_check(const SkIRect& joinWith, SkIRect* out); /////////////////////////////////////////////////////////////////////////////////////////////////// +SK_DEFINE_INST_COUNT(SkRTree) + SkRTree* SkRTree::Create(int minChildren, int maxChildren, SkScalar aspectRatio) { if (minChildren < maxChildren && (maxChildren + 1) / 2 >= minChildren && minChildren > 0 && maxChildren < static_cast<int>(SK_MaxU16)) { diff --git a/src/core/SkRTree.h b/src/core/SkRTree.h index 96881596c3..1f166489a1 100644 --- a/src/core/SkRTree.h +++ b/src/core/SkRTree.h @@ -42,6 +42,7 @@ */ class SkRTree : public SkBBoxHierarchy { public: + SK_DECLARE_INST_COUNT(SkRTree) /** * Create a new R-Tree with specified min/max child counts. @@ -175,6 +176,7 @@ private: Node* allocateNode(uint16_t level); + typedef SkBBoxHierarchy INHERITED; }; #endif |