Added Inst counting to SkFlattenable-derived classes
authorrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 27 Jun 2012 14:03:26 +0000 (14:03 +0000)
committerrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 27 Jun 2012 14:03:26 +0000 (14:03 +0000)
http://codereview.appspot.com/6355043/

git-svn-id: http://skia.googlecode.com/svn/trunk@4359 2bbb7eff-a529-9590-31e7-b0007b416f81

26 files changed:
include/core/SkColorFilter.h
include/core/SkColorTable.h
include/core/SkDrawLooper.h
include/core/SkImageFilter.h
include/core/SkMaskFilter.h
include/core/SkPathEffect.h
include/core/SkPixelRef.h
include/core/SkRasterizer.h
include/core/SkShader.h
include/core/SkShape.h
include/core/SkUnitMapper.h
include/core/SkXfermode.h
include/effects/SkLayerDrawLooper.h
src/core/SkColorFilter.cpp
src/core/SkColorTable.cpp
src/core/SkMaskFilter.cpp
src/core/SkPaint.cpp
src/core/SkPathEffect.cpp
src/core/SkPixelRef.cpp
src/core/SkRasterizer.cpp
src/core/SkShader.cpp
src/core/SkShape.cpp
src/core/SkXfermode.cpp
src/effects/SkLayerDrawLooper.cpp
src/effects/SkLightingImageFilter.cpp
src/utils/SkUnitMappers.cpp

index 8c67054..2fc9d6e 100644 (file)
@@ -16,6 +16,8 @@
 
 class SK_API SkColorFilter : public SkFlattenable {
 public:
+    SK_DECLARE_INST_COUNT(SkColorFilter)
+
     /**
      *  If the filter can be represented by a source color plus Mode, this
      *  returns true, and sets (if not NULL) the color and mode appropriately.
index de6cb83..01d6ac1 100644 (file)
@@ -20,6 +20,8 @@
 */
 class SkColorTable : public SkFlattenable {
 public:
+    SK_DECLARE_INST_COUNT(SkColorTable)
+
     /** Makes a deep copy of colors.
      */
     SkColorTable(const SkColorTable& src);
index e8265db..0e99651 100644 (file)
@@ -25,6 +25,8 @@ class SkPaint;
 */
 class SK_API SkDrawLooper : public SkFlattenable {
 public:
+    SK_DECLARE_INST_COUNT(SkDrawLooper)
+
     /**
      *  Called right before something is being drawn. This will be followed by
      *  calls to next() until next() returns false.
index 1b282d2..c27f698 100644 (file)
@@ -38,6 +38,8 @@ struct SkPoint;
  */
 class SK_API SkImageFilter : public SkFlattenable {
 public:
+    SK_DECLARE_INST_COUNT(SkImageFilter)
+
     class Proxy {
     public:
         virtual ~Proxy() {};
index 3422e27..6652f40 100644 (file)
@@ -33,6 +33,8 @@ class SkRasterClip;
 */
 class SkMaskFilter : public SkFlattenable {
 public:
+    SK_DECLARE_INST_COUNT(SkMaskFilter)
+
     SkMaskFilter() {}
 
     /** Returns the format of the resulting mask that this subclass will return
index 8a129fe..accdc39 100644 (file)
@@ -102,6 +102,8 @@ private:
 */
 class SK_API SkPathEffect : public SkFlattenable {
 public:
+    SK_DECLARE_INST_COUNT(SkPathEffect)
+
     SkPathEffect() {}
 
     /**
index 5c24d67..c8e1b2c 100644 (file)
@@ -32,6 +32,8 @@ class SkGpuTexture;
 */
 class SK_API SkPixelRef : public SkFlattenable {
 public:
+    SK_DECLARE_INST_COUNT(SkPixelRef)
+
     explicit SkPixelRef(SkBaseMutex* mutex = NULL);
 
     /** Return the pixel memory returned from lockPixels, or null if the
index 923028f..0791713 100644 (file)
@@ -20,6 +20,8 @@ struct SkIRect;
 
 class SkRasterizer : public SkFlattenable {
 public:
+    SK_DECLARE_INST_COUNT(SkRasterizer)
+
     SkRasterizer() {}
 
     /** Turn the path into a mask, respecting the specified local->device matrix.
index 8a4e252..e842062 100644 (file)
@@ -30,7 +30,9 @@ class SkPath;
  */
 class SK_API SkShader : public SkFlattenable {
 public:
-            SkShader();
+    SK_DECLARE_INST_COUNT(SkShader)
+
+    SkShader();
     virtual ~SkShader();
 
     /**
index 0196156..4f2bd98 100644 (file)
@@ -16,6 +16,8 @@ class SkWStream;
 
 class SkShape : public SkFlattenable {
 public:
+    SK_DECLARE_INST_COUNT(SkShape)
+
     SkShape();
     virtual ~SkShape();
 
index 2bd482b..47a4dad 100644 (file)
@@ -17,6 +17,8 @@
 
 class SkUnitMapper : public SkFlattenable {
 public:
+    SK_DECLARE_INST_COUNT(SkUnitMapper)
+
     SkUnitMapper() {}
 
     /** Given a value in [0..0xFFFF], return a value in the same range.
@@ -25,6 +27,9 @@ public:
     
 protected:
     SkUnitMapper(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {}
+
+private:
+    typedef SkFlattenable INHERITED;
 };
 
 #endif
index 86bafea..2b7c11e 100644 (file)
@@ -23,6 +23,8 @@
 */
 class SK_API SkXfermode : public SkFlattenable {
 public:
+    SK_DECLARE_INST_COUNT(SkXfermode)
+
     SkXfermode() {}
 
     virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
index 6cb8ef6..d00c1e5 100644 (file)
@@ -15,6 +15,8 @@ struct SkPoint;
 
 class SK_API SkLayerDrawLooper : public SkDrawLooper {
 public:
+    SK_DECLARE_INST_COUNT(SkLayerDrawLooper)
+
             SkLayerDrawLooper();
     virtual ~SkLayerDrawLooper();
 
index b96b77e..74e1db1 100644 (file)
@@ -11,6 +11,8 @@
 #include "SkShader.h"
 #include "SkUnPreMultiply.h"
 
+SK_DEFINE_INST_COUNT(SkColorFilter)
+
 bool SkColorFilter::asColorMode(SkColor* color, SkXfermode::Mode* mode) {
     return false;
 }
index 3797fbd..3711de5 100644 (file)
@@ -11,6 +11,8 @@
 #include "SkStream.h"
 #include "SkTemplates.h"
 
+SK_DEFINE_INST_COUNT(SkColorTable)
+
 SkColorTable::SkColorTable(int count)
     : f16BitCache(NULL), fFlags(0)
 {
index 75e38ce..96e14a1 100644 (file)
@@ -14,6 +14,8 @@
 #include "SkDraw.h"
 #include "SkRasterClip.h"
 
+SK_DEFINE_INST_COUNT(SkMaskFilter)
+
 bool SkMaskFilter::filterMask(SkMask*, const SkMask&, const SkMatrix&,
                               SkIPoint*) {
     return false;
index 8ed1ce6..cba7930 100644 (file)
@@ -2159,6 +2159,8 @@ bool SkPaint::nothingToDraw() const {
 
 //////////// Move these to their own file soon.
 
+SK_DEFINE_INST_COUNT(SkImageFilter)
+
 bool SkImageFilter::filterImage(Proxy* proxy, const SkBitmap& src,
                                 const SkMatrix& ctm,
                                 SkBitmap* result, SkIPoint* loc) {
@@ -2205,6 +2207,8 @@ bool SkImageFilter::asADilate(SkISize* radius) const {
 
 //////
 
+SK_DEFINE_INST_COUNT(SkDrawLooper)
+
 bool SkDrawLooper::canComputeFastBounds(const SkPaint& paint) {
     SkCanvas canvas;
 
index 6b95d9b..8708e7e 100644 (file)
@@ -110,6 +110,8 @@ bool SkStrokeRec::applyToPath(SkPath* dst, const SkPath& src) const {
 
 ///////////////////////////////////////////////////////////////////////////////
 
+SK_DEFINE_INST_COUNT(SkPathEffect)
+
 void SkPathEffect::computeFastBounds(SkRect* dst, const SkRect& src) {
     *dst = src;
 }
index 1317829..96c991c 100644 (file)
@@ -9,6 +9,8 @@
 #include "SkFlattenable.h"
 #include "SkThread.h"
 
+SK_DEFINE_INST_COUNT(SkPixelRef)
+
 // must be a power-of-2. undef to just use 1 mutex
 #define PIXELREF_MUTEX_RING_COUNT       32
 
index 0a0a959..e5625bf 100644 (file)
@@ -12,6 +12,8 @@
 #include "SkMaskFilter.h"
 #include "SkPath.h"
 
+SK_DEFINE_INST_COUNT(SkRasterizer)
+
 bool SkRasterizer::rasterize(const SkPath& fillPath, const SkMatrix& matrix,
                              const SkIRect* clipBounds, SkMaskFilter* filter,
                              SkMask* mask, SkMask::CreateMode mode) {
index 6953612..cd40b7f 100644 (file)
@@ -12,6 +12,8 @@
 #include "SkPaint.h"
 #include "SkMallocPixelRef.h"
 
+SK_DEFINE_INST_COUNT(SkShader)
+
 SkShader::SkShader() : fLocalMatrix(NULL) {
     SkDEBUGCODE(fInSession = false;)
 }
index c386af8..146e74c 100644 (file)
@@ -9,6 +9,8 @@
 #include "SkShape.h"
 #include "SkMatrix.h"
 
+SK_DEFINE_INST_COUNT(SkShape)
+
 #if 0
 static int gShapeCounter;
 static void inc_shape(const SkShape* s) {
index bb9dc79..03f996a 100644 (file)
@@ -10,6 +10,8 @@
 #include "SkXfermode.h"
 #include "SkColorPriv.h"
 
+SK_DEFINE_INST_COUNT(SkXfermode)
+
 #define SkAlphaMulAlpha(a, b)   SkMulDiv255Round(a, b)
 
 #if 0
index 250306c..3a2685c 100644 (file)
@@ -11,6 +11,8 @@
 #include "SkPaint.h"
 #include "SkUnPreMultiply.h"
 
+SK_DEFINE_INST_COUNT(SkLayerDrawLooper)
+
 SkLayerDrawLooper::LayerInfo::LayerInfo() {
     fFlagsMask = 0;                     // ignore our paint flags
     fPaintBits = 0;                     // ignore our paint fields
index 84cb291..25c92b7 100644 (file)
@@ -271,6 +271,8 @@ private:
 
 class SkLight : public SkFlattenable {
 public:
+    SK_DECLARE_INST_COUNT(SkLight)
+
     enum LightType {
         kDistant_LightType,
         kPoint_LightType,
@@ -289,6 +291,8 @@ private:
     typedef SkFlattenable INHERITED;
 };
 
+SK_DEFINE_INST_COUNT(SkLight)
+
 class SkDistantLight : public SkLight {
 public:
     SkDistantLight(const SkPoint3& direction) : fDirection(direction) {
index 929447e..b2ab02b 100644 (file)
@@ -7,6 +7,8 @@
  */
 #include "SkUnitMappers.h"
 
+SK_DEFINE_INST_COUNT(SkUnitMapper)
+
 SkDiscreteMapper::SkDiscreteMapper(int segments) {
     if (segments < 2) {
         fSegments = 0;