aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-22 17:31:22 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-22 17:31:22 +0000
commit4fa9c9f9b42c22bffff3b2eb3fcf7f16a2ab2948 (patch)
treeede6f57c7ef982367559a0a2e3e23b60d4f9de66
parentcfe57e520e1cf47974bb896a509297644f931e03 (diff)
Fixed instance counting for templated classes
-rw-r--r--include/core/SkInstCnt.h8
-rw-r--r--src/core/SkMaskGamma.h8
-rw-r--r--src/core/SkScalerContext.cpp1
3 files changed, 15 insertions, 2 deletions
diff --git a/include/core/SkInstCnt.h b/include/core/SkInstCnt.h
index 9be51ea634..db6e273e9f 100644
--- a/include/core/SkInstCnt.h
+++ b/include/core/SkInstCnt.h
@@ -113,11 +113,19 @@ extern bool gPrintInstCount;
SkTArray<className::SkInstanceCountHelper::PFCheckInstCnt>* \
className::SkInstanceCountHelper::gChildren = NULL;
+#define SK_DEFINE_INST_COUNT_TEMPLATE(templateInfo, className) \
+ templateInfo int32_t className::SkInstanceCountHelper::gInstanceCount = 0;\
+ templateInfo bool className::SkInstanceCountHelper::gInited = false; \
+ templateInfo \
+ SkTArray<typename className::SkInstanceCountHelper::PFCheckInstCnt>*\
+ className::SkInstanceCountHelper::gChildren = NULL;
+
#else
#define SK_DECLARE_INST_COUNT(className)
#define SK_DECLARE_INST_COUNT_TEMPLATE(className)
#define SK_DECLARE_INST_COUNT_ROOT(className)
#define SK_DEFINE_INST_COUNT(className)
+#define SK_DEFINE_INST_COUNT_TEMPLATE(templateInfo, className)
#endif
#endif // SkInstCnt_DEFINED
diff --git a/src/core/SkMaskGamma.h b/src/core/SkMaskGamma.h
index 369127ad49..7d8b9e310b 100644
--- a/src/core/SkMaskGamma.h
+++ b/src/core/SkMaskGamma.h
@@ -105,7 +105,7 @@ void SkTMaskGamma_build_correcting_lut(uint8_t table[256], U8CPU srcI, SkScalar
*/
template <int R_LUM_BITS, int G_LUM_BITS, int B_LUM_BITS> class SkTMaskGamma : public SkRefCnt {
public:
- //SK_DECLARE_INST_COUNT_TEMPLATE(SkTMaskGamma)
+ SK_DECLARE_INST_COUNT_TEMPLATE(SkTMaskGamma)
/**
* Creates tables to convert linear alpha values to gamma correcting alpha
@@ -157,6 +157,12 @@ private:
typedef SkRefCnt INHERITED;
};
+
+#define MacroComma ,
+SK_DEFINE_INST_COUNT_TEMPLATE(
+ template <int R_LUM_BITS MacroComma int G_LUM_BITS MacroComma int B_LUM_BITS>,
+ SkTMaskGamma<R_LUM_BITS MacroComma G_LUM_BITS MacroComma B_LUM_BITS>);
+
/**
* SkTMaskPreBlend is a tear-off of SkTMaskGamma. It provides the tables to
* convert a linear alpha value for a given channel to a gamma correcting alpha
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 0a06965e95..a1473be55c 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -22,7 +22,6 @@
#include "SkStroke.h"
#include "SkThread.h"
-//SK_DEFINE_INST_COUNT(SkMaskGamma)
#define ComputeBWRowBytes(width) (((unsigned)(width) + 7) >> 3)