Cleanup Macros arround static initializers for SkFlattenable.
authordjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 23 Mar 2012 19:00:34 +0000 (19:00 +0000)
committerdjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 23 Mar 2012 19:00:34 +0000 (19:00 +0000)
This CL also removes an unused debugging function from the class
Review URL: https://codereview.appspot.com/5890043

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

42 files changed:
experimental/Debugger/SkDebugDumper.cpp
gm/gmmain.cpp
gyp/effects.gyp
include/core/SkColorFilter.h
include/core/SkColorShader.h
include/core/SkEmptyShader.h
include/core/SkFlattenable.h
include/core/SkPathEffect.h
include/core/SkShape.h
include/core/SkXfermode.h
include/effects/Sk1DPathEffect.h
include/effects/Sk2DPathEffect.h
include/effects/SkAvoidXfermode.h
include/effects/SkBlurDrawLooper.h
include/effects/SkBlurImageFilter.h
include/effects/SkBlurMaskFilter.h
include/effects/SkColorMatrixFilter.h
include/effects/SkCornerPathEffect.h
include/effects/SkDashPathEffect.h
include/effects/SkDiscretePathEffect.h
include/effects/SkEffects.h [deleted file]
include/effects/SkEmbossMaskFilter.h
include/effects/SkGradientShader.h
include/effects/SkGroupShape.h
include/effects/SkLayerDrawLooper.h
include/effects/SkLayerRasterizer.h
include/effects/SkMorphologyImageFilter.h
include/effects/SkPixelXorXfermode.h
include/effects/SkRectShape.h
include/effects/SkTableColorFilter.h
src/core/SkBitmapProcShader.h
src/core/SkFlattenable.cpp
src/core/SkPathEffect.cpp
src/core/SkShader.cpp
src/effects/Sk2DPathEffect.cpp
src/effects/SkEffects.cpp [deleted file]
src/effects/SkGradientShader.cpp
src/effects/SkTableColorFilter.cpp
src/effects/SkTestImageFilters.cpp
src/ports/SkGlobalInitialization_chromium.cpp
src/ports/SkGlobalInitialization_default.cpp
src/utils/SkDumpCanvas.cpp

index 8ecbec1005898698ec321090c12bbab8a4b769fa..64ac2eb4596528e2ed703ab54bf80fb65557ea6b 100644 (file)
@@ -35,12 +35,7 @@ static void appendPtr(SkString* str, const void* ptr, const char name[]) {
 static void appendFlattenable(SkString* str, const SkFlattenable* ptr,
                               const char name[]) {
     if (ptr) {
-        SkString info;
-        if (ptr->toDumpString(&info)) {
-            str->appendf("%s\n", info.c_str());
-        } else {
-            str->appendf("%s: %p\n", name, ptr);
-        }
+        str->appendf("%s: %p\n", name, ptr);
     }
 }
 
index bcceb727c2741ecf0bfe7d3c02cb2c1f4ed6137a..a8aa49cb9faebbd4169316efba2bd0f57f8c8950 100644 (file)
@@ -877,7 +877,8 @@ int main(int argc, char * const argv[]) {
                                                     readPath, diffPath);
             }
 
-            if ((ERROR_NONE == testErrors) && doSerialize) {
+            if ((ERROR_NONE == testErrors) && doSerialize  &&
+                !(gmFlags & GM::kSkipPicture_Flag)) {
                 testErrors |= test_picture_serialization(gm, gRec[i],
                                                          forwardRenderedBitmap,
                                                          readPath, diffPath);
index d23d7efc80d3846281d9835ece5b7ca812f0483a..397596551e76fd9f2d11a195f7cebe76e3a5e1c8 100644 (file)
@@ -22,7 +22,6 @@
         '../include/effects/SkDashPathEffect.h',
         '../include/effects/SkDiscretePathEffect.h',
         '../include/effects/SkDrawExtraPathEffect.h',
-        '../include/effects/SkEffects.h',
         '../include/effects/SkEmbossMaskFilter.h',
         '../include/effects/SkGradientShader.h',
         '../include/effects/SkGroupShape.h',
@@ -56,7 +55,6 @@
         '../src/effects/SkCornerPathEffect.cpp',
         '../src/effects/SkDashPathEffect.cpp',
         '../src/effects/SkDiscretePathEffect.cpp',
-        '../src/effects/SkEffects.cpp',
         '../src/effects/SkEmbossMask.cpp',
         '../src/effects/SkEmbossMask.h',
         '../src/effects/SkEmbossMask_Table.h',
index 97db5cc54685f9a546eed1e27151c086b6e8027b..2151106859e6174c984a7874c612499e8700a405 100644 (file)
@@ -118,7 +118,7 @@ public:
     */
     static SkColorFilter* CreateLightingFilter(SkColor mul, SkColor add);
     
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
+    SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
 protected:
     SkColorFilter() {}
     SkColorFilter(SkFlattenableReadBuffer& rb) : INHERITED(rb) {}
index 9b1fed3d7269ad4ad4425989a1e4e7bdd33f9f2b..6c6e11d7673d5ae1ad2fb99b3a7fccf9a5e3fca1 100644 (file)
@@ -49,6 +49,8 @@ public:
 
     virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
 
+    static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+
 protected:
     SkColorShader(SkFlattenableReadBuffer&);
 
@@ -56,7 +58,6 @@ protected:
     virtual Factory getFactory() SK_OVERRIDE;
 
 private:
-    static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
 
     SkColor     fColor;         // ignored if fInheritColor is true
     SkPMColor   fPMColor;       // cached after setContext()
index bf270bf642ffee6cace2fdfb09575078d1e62f65..1541c8961179d5632aa9e118263ea5457cf0851b 100644 (file)
@@ -30,6 +30,10 @@ public:
     virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
     virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) SK_OVERRIDE;
 
+    static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
+        return SkNEW_ARGS(SkEmptyShader, (buffer));
+    }
+
 protected:
     SkEmptyShader(SkFlattenableReadBuffer&);
 
index a66638eb4e9c0dba31931ff56c36bb84e6a17252..4170e260bb65354c059a04a72b2d5fba9d6673f0 100644 (file)
@@ -22,33 +22,28 @@ class SkString;
 
 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
 
-#define SK_DECLARE_FLATTENABLE_REGISTRAR() 
-
 #define SK_DEFINE_FLATTENABLE_REGISTRAR(flattenable) \
     static SkFlattenable::Registrar g##flattenable##Reg(#flattenable, \
-                                                      flattenable::CreateProc);
-                                                      
-#define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(flattenable)
+                                                       flattenable::CreateProc);
 #define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \
     static SkFlattenable::Registrar g##flattenable##Reg(#flattenable, \
-                                                      flattenable::CreateProc);
+                                                       flattenable::CreateProc);
+
+#define SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
+#define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(flattenable)
 #define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
 
 #else
 
-#define SK_DECLARE_FLATTENABLE_REGISTRAR() static void Init();
+#define SK_DEFINE_FLATTENABLE_REGISTRAR(flattenable)
+#define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \
+        SkFlattenable::Registrar(#flattenable, flattenable::CreateProc);
 
-#define SK_DEFINE_FLATTENABLE_REGISTRAR(flattenable) \
-    void flattenable::Init() { \
-        SkFlattenable::Registrar(#flattenable, CreateProc); \
-    }
+#define SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() static void InitializeFlattenables();
 
 #define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(flattenable) \
-    void flattenable::Init() {
-    
-#define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \
-        SkFlattenable::Registrar(#flattenable, flattenable::CreateProc);
-    
+    void flattenable::InitializeFlattenables() {
+
 #define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END \
     }
 
@@ -77,22 +72,17 @@ public:
      */
     virtual void flatten(SkFlattenableWriteBuffer&);
     
-    /** Set the string to describe the sublass and return true. If this is not
-        overridden, ignore the string param and return false.
-     */
-    virtual bool toDumpString(SkString*) const;
-
     static Factory NameToFactory(const char name[]);
     static const char* FactoryToName(Factory);
     static void Register(const char name[], Factory);
-    
+
     class Registrar {
     public:
         Registrar(const char name[], Factory factory) {
             SkFlattenable::Register(name, factory);
         }
     };
-    
+
 protected:
     SkFlattenable(SkFlattenableReadBuffer&) {}
 
index 1b4cd5f52296f5b66629c8abc3ad81e468031a47..880219feadc62b5b93deb6a0c36c374d2c0308e0 100644 (file)
@@ -34,7 +34,6 @@ public:
     */
     virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width) = 0;
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
 private:
     // illegal
     SkPathEffect(const SkPathEffect&);
index c7cf9ec3cfdbf1c849dd320f3b43f6536f2801f9..b40d886083650fb49ab906e1ca5d97e6248891c3 100644 (file)
@@ -38,8 +38,6 @@ public:
     // public for Registrar
     static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     virtual void onDraw(SkCanvas*);
 
index 0d1c207b68b503589ef3d4daa96c321705bb14b0..4f28bb2f50046c5e2c58cc05d7f10d37903b034b 100644 (file)
@@ -172,7 +172,7 @@ public:
         return AsMode(xfer, mode);
     }
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
+    SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
 protected:
     SkXfermode(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {}
 
index 814e54715352b81531b640b5f9f149b9d410d663..51a5a786867aec4e901807fa177a8d02461cbd74 100644 (file)
@@ -63,8 +63,6 @@ public:
         return SkNEW_ARGS(SkPath1DPathEffect, (buffer));
     }
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     SkPath1DPathEffect(SkFlattenableReadBuffer& buffer);
 
index b5d7fbb1b8cc8c90bcefdaaf20fa0c00d6195a3e..f0d60ca5788c63016392fe1e7d944d730caaaeb5 100644 (file)
@@ -47,8 +47,6 @@ protected:
     // protected so that subclasses can call this during unflattening
     Sk2DPathEffect(SkFlattenableReadBuffer&);
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 private:
     SkMatrix    fMatrix, fInverse;
     // illegal
@@ -71,8 +69,6 @@ public:
     
     static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     SkPath2DPathEffect(SkFlattenableReadBuffer& buffer);
 
index 398eaeaf295029c6c4a36f0ec64cbe3f5cc4f3d5..8497265ded40e241c9e1d7b64006a80e188c96f8 100644 (file)
@@ -59,8 +59,6 @@ public:
         return SkNEW_ARGS(SkAvoidXfermode, (buffer));
     }
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     SkAvoidXfermode(SkFlattenableReadBuffer&);
 
index be1a78edd5aca289aaa50df5608e0b026dd651cd..46f72b95945cff91dd7d2f36a7e529be44480f10 100644 (file)
@@ -48,8 +48,6 @@ public:
         return SkNEW_ARGS(SkBlurDrawLooper, (buffer));
     }
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     SkBlurDrawLooper(SkFlattenableReadBuffer&);
     // overrides from SkFlattenable
index 4c9798b1f49f74bba4c70fb47858784d04dbdbea..2af31e86d194fc71172bdb481dc4e16c776ee342 100644 (file)
@@ -21,8 +21,6 @@ public:
         return SkNEW_ARGS(SkBlurImageFilter, (buffer));
     }
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     explicit SkBlurImageFilter(SkFlattenableReadBuffer& buffer);
 
index 9e85d877a5f007a1a9d07ee9e22460e29285c1a2..9a1c9cecff39a692c2b15e8b54b125a638ca7ef4 100644 (file)
@@ -55,8 +55,7 @@ public:
                                         SkScalar ambient, SkScalar specular,
                                         SkScalar blurRadius);
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
+    SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
 private:
     SkBlurMaskFilter(); // can't be instantiated
 };
index 14752580558ddd7e955ab88426cfdb0c64cffb9e..62e8d3d26744b963cd52ddfd8d7c26f29b7c4634 100644 (file)
@@ -39,8 +39,6 @@ public:
 
     static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer);
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     // overrides for SkFlattenable
     virtual Factory getFactory();
index 990bad0ee382af08a20a1c8947929f5cac319138..b4d7f860f588f6d2dd87e8976e9b71534cfe6db1 100644 (file)
@@ -37,8 +37,6 @@ public:
 
     static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     SkCornerPathEffect(SkFlattenableReadBuffer&);
 
index 6d34910b8b62c747a4544e1ffadbc1db91ed58bf..29a6d1b59a4da9c655751e5b3f8a9efee0084433 100644 (file)
@@ -39,8 +39,6 @@ public:
 
     static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     SkDashPathEffect(SkFlattenableReadBuffer&);
     
index 5369ddbe339154fabe05655312352298088843c1..02ef39108618bb1708592337f7399bea1ddfabe2 100644 (file)
@@ -36,8 +36,6 @@ public:
 
     static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     SkDiscretePathEffect(SkFlattenableReadBuffer&);
 
diff --git a/include/effects/SkEffects.h b/include/effects/SkEffects.h
deleted file mode 100644 (file)
index 04091de..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkEffects_DEFINED
-#define SkEffects_DEFINED
-
-class SkEffects {
-public:
-    static void Init();
-};
-
-#endif
index 257e19ac785b610156698b4a453815cbdec81f24..c0e6b7e1a10da890999906c6b988d0e3de6fae02 100644 (file)
@@ -41,8 +41,6 @@ public:
     //  This method is not exported to java.
     virtual void flatten(SkFlattenableWriteBuffer&);
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     SkEmbossMaskFilter(SkFlattenableReadBuffer&);
 
index 3232703c920cd90a1d9a82667715fa7b1bfe11d0..427b3da35cbab8364de7d88dd27e64d0d1dd829c 100644 (file)
@@ -113,7 +113,7 @@ public:
                                  const SkColor colors[], const SkScalar pos[],
                                  int count, SkUnitMapper* mapper = NULL);
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
+    SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
 };
 
 #endif
index 7764003c87e533c7f201b54921d671206ae10152..76dd13d696f16335ded39f0776c222679574104d 100644 (file)
@@ -138,8 +138,6 @@ public:
     // public for Registrar
     static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     // overrides
     virtual void onDraw(SkCanvas*);
index 697d7b2f566639b99c89d66a0e2a6443ca424091..b9b080232da1b7aa22638dc0251c31e21789a6b5 100644 (file)
@@ -106,8 +106,6 @@ public:
         return SkNEW_ARGS(SkLayerDrawLooper, (buffer));
     }
     
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     SkLayerDrawLooper(SkFlattenableReadBuffer&);
 
index 91deb61ff6f01605bc8b534fca30b90257259b9e..50758b16dc4e1661fc84d51b87033d4d78d6825b 100644 (file)
@@ -38,8 +38,6 @@ public:
 
     static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     SkLayerRasterizer(SkFlattenableReadBuffer&);
 
index 2297938cef7a9b10be62d600d1cb8cd09ca8bfe0..8d9f453478802fab740a41e6be767165e9ae1b97 100644 (file)
@@ -37,7 +37,6 @@ public:
         return SkNEW_ARGS(SkDilateImageFilter, (buffer));
     }
     virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
 
     typedef SkMorphologyImageFilter INHERITED;
 };
@@ -55,7 +54,6 @@ public:
         return SkNEW_ARGS(SkErodeImageFilter, (buffer));
     }
     virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
 
 private:
     typedef SkMorphologyImageFilter INHERITED;
index a7197abe9af79408c3e0a35ed208262397630e30..b9975cffa53aaa203179c8062e81381480079a22 100644 (file)
@@ -29,8 +29,6 @@ public:
         return SkNEW_ARGS(SkPixelXorXfermode, (buffer));
     }
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     // override from SkXfermode
     virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst);
index 519398c460496232ca242fd93ce70dcdb1d1b49b..b521846ad521a31e338adad13a1005b44d1704bb 100644 (file)
@@ -47,8 +47,6 @@ public:
     // public for Registrar
     static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     SkRectShape(SkFlattenableReadBuffer&);
 
index b442197bdab45912daa1b4651017c44373b0726a..9fec68c25eb7be7d8980743f8d71ac017931a392 100644 (file)
@@ -29,6 +29,8 @@ public:
                                      const uint8_t tableR[256],
                                      const uint8_t tableG[256],
                                      const uint8_t tableB[256]);
+
+    SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
 };
 
 #endif
index 4f8d0c566708bf3c7578aeba3eb3f0763be7f9a7..cd702793d13bf6d893243a936fa23102f56b47b2 100644 (file)
@@ -37,7 +37,6 @@ public:
     // override from flattenable
     virtual bool toDumpString(SkString* str) const;
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
 protected:
     SkBitmapProcShader(SkFlattenableReadBuffer& );
     virtual void flatten(SkFlattenableWriteBuffer& );
index 59a262ada9c754d340c78ad12ed5243ef8c8c88d..9d8c215a8c9d745975d899406503bb3016d90c28 100644 (file)
@@ -383,7 +383,3 @@ const char* SkFlattenable::FactoryToName(Factory fact) {
     }
     return NULL;
 }
-
-bool SkFlattenable::toDumpString(SkString* str) const {
-    return false;
-}
index d81ac9ff3d48205cd9a8d813b3eec3dc85d1ef3c..852c25f9da5a59dd5e4678edc9b69966f6eb9b51 100644 (file)
@@ -134,9 +134,7 @@ SkStrokePathEffect::SkStrokePathEffect(SkFlattenableReadBuffer& buffer) {
 
 ///////////////////////////////////////////////////////////////////////////////
 
-SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkPathEffect)
-    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposePathEffect)
-    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkStrokePathEffect)
-    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSumPathEffect)
-SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkComposePathEffect)
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkStrokePathEffect)
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkSumPathEffect)
 
index ce7ff9ef66faf2149f19dd877e3a9d2d734231c5..618b8d274533e72b9610101359d64fafc3cf6764 100644 (file)
@@ -333,6 +333,8 @@ SkShader::GradientType SkColorShader::asAGradient(GradientInfo* info) const {
     return kColor_GradientType;
 }
 
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkColorShader)
+
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "SkEmptyShader.h"
@@ -363,3 +365,4 @@ void SkEmptyShader::flatten(SkFlattenableWriteBuffer& buffer) {
     this->INHERITED::flatten(buffer);
 }
 
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkEmptyShader)
index 37296108cb255725cfc17c233674fe195620889e..23037f7abc7dee07ab919ef98177ce2b886ebad8 100644 (file)
@@ -117,5 +117,6 @@ void SkPath2DPathEffect::next(const SkPoint& loc, int u, int v, SkPath* dst) {
     dst->addPath(fPath, loc.fX, loc.fY);
 }
 
-SK_DEFINE_FLATTENABLE_REGISTRAR(SkPath2DPathEffect)
+///////////////////////////////////////////////////////////////////////////////
 
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkPath2DPathEffect)
diff --git a/src/effects/SkEffects.cpp b/src/effects/SkEffects.cpp
deleted file mode 100644 (file)
index d4ccac0..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkTypes.h"
-
-#if !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
-
-#include "Sk1DPathEffect.h"
-#include "Sk2DPathEffect.h"
-#include "SkAvoidXfermode.h"
-#include "SkBlurDrawLooper.h"
-#include "SkBlurImageFilter.h"
-#include "SkBlurMaskFilter.h"
-#include "SkColorFilter.h"
-#include "SkColorMatrixFilter.h"
-#include "SkCornerPathEffect.h"
-#include "SkDashPathEffect.h"
-#include "SkDiscretePathEffect.h"
-#include "SkEffects.h"
-#include "SkFlattenable.h"
-#include "SkGradientShader.h"
-#include "SkGroupShape.h"
-#include "SkLayerDrawLooper.h"
-#include "SkLayerRasterizer.h"
-#include "SkPathEffect.h"
-#include "SkPixelXorXfermode.h"
-#include "SkRectShape.h"
-
-void SkEffects::Init() {
-    SkAvoidXfermode::Init();
-    SkBlurDrawLooper::Init();
-    SkBlurImageFilter::Init();
-    SkBlurMaskFilter::Init();
-    SkColorFilter::Init();
-    SkColorMatrixFilter::Init();
-    SkCornerPathEffect::Init();
-    SkDashPathEffect::Init();
-    SkDiscretePathEffect::Init();
-    SkGradientShader::Init();
-    SkGroupShape::Init();
-    SkLayerDrawLooper::Init();
-    SkLayerRasterizer::Init();
-    SkPath1DPathEffect::Init();
-    SkPath2DPathEffect::Init();
-    SkPixelXorXfermode::Init();
-    SkRectShape::Init();
-}
-
-#endif
index 4bbc96c42f43b7aa8e2a7c532ecda71d538c0a34..c9929b4180ad4b17962f16388ec8ae626ba777f9 100644 (file)
@@ -861,8 +861,6 @@ public:
         buffer.writeScalar(fEnd.fY);
     }
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR()
-
 protected:
     Linear_Gradient(SkFlattenableReadBuffer& buffer)
         : Gradient_Shader(buffer),
@@ -2559,8 +2557,6 @@ SkShader* SkGradientShader::CreateSweep(SkScalar cx, SkScalar cy,
 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkGradientShader)
     SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(Linear_Gradient)
     SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(Radial_Gradient)
-
     SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(Sweep_Gradient)
-
     SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(Two_Point_Radial_Gradient)
 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
index 800d4a9ce41e36e02c321b9aba3ad9b4f45f41e1..5d71e239e995c28403ddc8c3843fda93d7217bd2 100644 (file)
@@ -218,3 +218,7 @@ SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256],
                                               const uint8_t tableB[256]) {
     return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB));
 }
+
+SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter)
+SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
index a772f64510c137dba9ef7d5b213848e01d509583..6378bc68b85002c7d182baf05952092bfe6b8f61 100755 (executable)
@@ -399,3 +399,8 @@ SkFlattenable::Factory SkDownSampleImageFilter::getFactory() {
     return CreateProc;
 }
 
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkOffsetImageFilter)
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkComposeImageFilter)
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkMergeImageFilter)
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkColorFilterImageFilter)
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkDownSampleImageFilter)
index 6a7b2139444078779c3b9616ff8962bb53a04d85..5a2119e5dd0e9a9411265ddf9371c92a13233999 100644 (file)
 #include "SkXfermode.h"
 
 void SkFlattenable::InitializeFlattenables() {
-    SkBitmapProcShader::Init();
-    SkBlurImageFilter::Init();
-    SkBlurMaskFilter::Init();
-    SkColorFilter::Init();
-    SkCornerPathEffect::Init();
-    SkDashPathEffect::Init();
-    SkGradientShader::Init();
-    SkLayerDrawLooper::Init();
-    SkXfermode::Init();
+
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapProcShader)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurImageFilter)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkCornerPathEffect)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDashPathEffect)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerDrawLooper)
+
+    SkBlurMaskFilter::InitializeFlattenables();
+    SkColorFilter::InitializeFlattenables();
+    SkGradientShader::InitializeFlattenables();
+    SkXfermode::InitializeFlattenables();
 }
 
 void SkPixelRef::InitializeFlattenables() {
index 6be776a0fd71b2029fb6dd30976e25eda5d03628..a03b922000cbce25b989ee1c2d7a0f1dd74394e1 100644 (file)
@@ -10,7 +10,6 @@
 #if !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
 
 #include "SkBitmapProcShader.h"
-#include "SkEffects.h"
 #include "SkFlipPixelRef.h"
 #include "SkImageRef_ashmem.h"
 #include "SkImageRef_GlobalPool.h"
 #include "SkShape.h"
 #include "SkXfermode.h"
 
+#include "Sk1DPathEffect.h"
+#include "Sk2DPathEffect.h"
+#include "SkAvoidXfermode.h"
+#include "SkBlurDrawLooper.h"
+#include "SkBlurImageFilter.h"
+#include "SkBlurMaskFilter.h"
+#include "SkColorFilter.h"
+#include "SkColorMatrixFilter.h"
+#include "SkColorShader.h"
+#include "SkCornerPathEffect.h"
+#include "SkDashPathEffect.h"
+#include "SkDiscretePathEffect.h"
+#include "SkEmptyShader.h"
+#include "SkFlattenable.h"
+#include "SkGradientShader.h"
+#include "SkGroupShape.h"
+#include "SkLayerDrawLooper.h"
+#include "SkLayerRasterizer.h"
+#include "SkMorphologyImageFilter.h"
+#include "SkPathEffect.h"
+#include "SkPixelXorXfermode.h"
+#include "SkRectShape.h"
+#include "SkTableColorFilter.h"
+#include "SkTestImageFilters.h"
+
 void SkFlattenable::InitializeFlattenables() {
-    SkBitmapProcShader::Init();
-    SkEffects::Init();
-    SkPathEffect::Init();
-    SkShape::Init();
-    SkXfermode::Init();
+
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkAvoidXfermode)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapProcShader)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurDrawLooper)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurImageFilter)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorMatrixFilter)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorShader)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposePathEffect)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkCornerPathEffect)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDashPathEffect)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDilateImageFilter)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiscretePathEffect)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmptyShader)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkErodeImageFilter)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkGroupShape)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerDrawLooper)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerRasterizer)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath1DPathEffect)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath2DPathEffect)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPixelXorXfermode)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkRectShape)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkStrokePathEffect)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSumPathEffect)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkShape)
+
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkOffsetImageFilter)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeImageFilter)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMergeImageFilter)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorFilterImageFilter)
+    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDownSampleImageFilter)
+
+    SkBlurMaskFilter::InitializeFlattenables();
+    SkColorFilter::InitializeFlattenables();
+    SkGradientShader::InitializeFlattenables();
+    SkTableColorFilter::InitializeFlattenables();
+    SkXfermode::InitializeFlattenables();
+
+
 }
 
 void SkPixelRef::InitializeFlattenables() {
index 3b28fe766d7346749a0f2354b58804d8324b5111..72a5c9299c3b55a2a2ceb4038c9577ab679af48a 100644 (file)
@@ -415,12 +415,7 @@ static void appendPtr(SkString* str, const void* ptr, const char name[]) {
 static void appendFlattenable(SkString* str, const SkFlattenable* ptr,
                               const char name[]) {
     if (ptr) {
-        SkString info;
-        if (ptr->toDumpString(&info)) {
-            str->appendf(" %s", info.c_str());
-        } else {
-            str->appendf(" %s:%p", name, ptr);
-        }
+        str->appendf(" %s:%p", name, ptr);
     }
 }