add DEF_BENCH marco to make it easy to register new benches
extend bitmaprect bench to include drawing with non-opaque alpha



git-svn-id: http://skia.googlecode.com/svn/trunk@5965 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/bench/SkBenchmark.h b/bench/SkBenchmark.h
index 5cfbdab2..b72162f 100644
--- a/bench/SkBenchmark.h
+++ b/bench/SkBenchmark.h
@@ -13,6 +13,26 @@
 #include "SkTDict.h"
 #include "SkTRegistry.h"
 
+
+#define SK_MACRO_CONCAT(X, Y)       SK_MACRO_CONCAT_IMPL(X, Y)
+#define SK_MACRO_CONCAT_IMPL(X, Y)  X ## Y
+
+#define SK_MACRO_APPEND_LINE(name)  SK_MACRO_CONCAT(name, __LINE__)
+
+#define DEF_BENCH(code) \
+static SkBenchmark* SK_MACRO_APPEND_LINE(F_)(void* p) { code; } \
+static BenchRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_));
+
+/*
+ *  With the above macros, you can register benches as follows (at the bottom
+ *  of your .cpp)
+ *
+ *  DEF_BENCH(new MyBenchmark(p, ...))
+ *  DEF_BENCH(new MyBenchmark(p, ...))
+ *  DEF_BENCH(new MyBenchmark(p, ...))
+ */
+
+
 #ifdef SK_DEBUG
     #define SkBENCHLOOP(n) 1
 #else