Index: src/ports/SkGlobalInitialization_default.cpp |
diff --git a/src/ports/SkGlobalInitialization_default.cpp b/src/ports/SkGlobalInitialization_default.cpp |
index 337f8b9e6727645dfdaaad0a00018e0d99fd0eb9..9471f01c8828fb14913d8c8d6a6ead249052a7ce 100644 |
--- a/src/ports/SkGlobalInitialization_default.cpp |
+++ b/src/ports/SkGlobalInitialization_default.cpp |
@@ -5,10 +5,6 @@ |
* found in the LICENSE file. |
*/ |
-#include "SkBitmapProcShader.h" |
-#include "SkPathEffect.h" |
-#include "SkXfermode.h" |
- |
#include "Sk1DPathEffect.h" |
#include "Sk2DPathEffect.h" |
#include "SkAlphaThresholdFilter.h" |
@@ -19,112 +15,103 @@ |
#include "SkBlurImageFilter.h" |
#include "SkBlurMaskFilter.h" |
#include "SkColorCubeFilter.h" |
-#include "SkColorFilter.h" |
#include "SkColorFilterImageFilter.h" |
-#include "SkColorFilterShader.h" |
#include "SkColorMatrixFilter.h" |
-#include "SkColorShader.h" |
#include "SkComposeImageFilter.h" |
-#include "SkComposeShader.h" |
#include "SkCornerPathEffect.h" |
#include "SkDashPathEffect.h" |
#include "SkDiscretePathEffect.h" |
#include "SkDisplacementMapEffect.h" |
#include "SkDropShadowImageFilter.h" |
-#include "SkEmptyShader.h" |
#include "SkEmbossMaskFilter.h" |
-#include "SkFlattenable.h" |
#include "SkGradientShader.h" |
-#include "SkImageShader.h" |
#include "SkImageSource.h" |
#include "SkLayerDrawLooper.h" |
#include "SkLayerRasterizer.h" |
#include "SkLerpXfermode.h" |
#include "SkLightingImageFilter.h" |
#include "SkLightingShader.h" |
-#include "SkLocalMatrixShader.h" |
#include "SkLumaColorFilter.h" |
#include "SkMagnifierImageFilter.h" |
#include "SkMatrixConvolutionImageFilter.h" |
#include "SkMergeImageFilter.h" |
#include "SkMorphologyImageFilter.h" |
#include "SkOffsetImageFilter.h" |
-#include "SkOnce.h" |
#include "SkPaintImageFilter.h" |
#include "SkPerlinNoiseShader.h" |
#include "SkPictureImageFilter.h" |
-#include "SkPictureShader.h" |
#include "SkPixelXorXfermode.h" |
#include "SkTableColorFilter.h" |
#include "SkTestImageFilters.h" |
#include "SkTileImageFilter.h" |
-#include "SkMatrixImageFilter.h" |
#include "SkXfermodeImageFilter.h" |
-class SkPrivateEffectInitializer { |
-public: |
- static void Init() { |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArcToPathEffect) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapProcShader) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapSourceDeserializer) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurDrawLooper) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurImageFilter) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorCubeFilter) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorMatrixFilter) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorFilterShader) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorShader) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposePathEffect) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeShader) |
- 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(SkDisplacementMapEffect) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDropShadowImageFilter) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmbossMaskFilter) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmptyShader) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkErodeImageFilter) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageShader) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageSource) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerDrawLooper) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerRasterizer) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLerpXfermode) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLocalMatrixShader) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLumaColorFilter) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath1DPathEffect) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLine2DPathEffect) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPaintImageFilter) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath2DPathEffect) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPerlinNoiseShader) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPictureImageFilter) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPictureShader) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPixelXorXfermode) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSumPathEffect) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTileImageFilter) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMatrixImageFilter) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkXfermodeImageFilter) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMagnifierImageFilter) |
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMatrixConvolutionImageFilter) |
+/* |
+ * None of these are strictly "required" for Skia to operate. |
+ * |
+ * These are the bulk of our "effects" -- subclasses of various effects on SkPaint. |
+ * |
+ * Clients should feel free to dup this file and modify it as needed. This function "InitEffects" |
+ * will automatically be called before any of skia's effects are asked to be deserialized. |
+ */ |
+void SkFlattenable::PrivateInitializer::InitEffects() { |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapSourceDeserializer) |
+ |
+ // MaskFilter |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmbossMaskFilter) |
+ SkBlurMaskFilter::InitializeFlattenables(); |
+ |
+ // DrawLooper |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurDrawLooper) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerDrawLooper) |
+ |
+ // Rasterizer |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerRasterizer) |
+ |
+ // ColorFilter |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorCubeFilter) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorMatrixFilter) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLumaColorFilter) |
+ SkAlphaThresholdFilter::InitializeFlattenables(); |
+ SkArithmeticMode::InitializeFlattenables(); |
+ SkTableColorFilter::InitializeFlattenables(); |
+ |
+ // Shader |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPerlinNoiseShader) |
+ SkGradientShader::InitializeFlattenables(); |
+ SkLightingShader::InitializeFlattenables(); |
- 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) |
+ // Xfermode |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLerpXfermode) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPixelXorXfermode) |
- SkAlphaThresholdFilter::InitializeFlattenables(); |
- SkArithmeticMode::InitializeFlattenables(); |
- SkBlurMaskFilter::InitializeFlattenables(); |
- SkColorFilter::InitializeFlattenables(); |
- SkGradientShader::InitializeFlattenables(); |
- SkLightingImageFilter::InitializeFlattenables(); |
- SkLightingShader::InitializeFlattenables(); |
- SkTableColorFilter::InitializeFlattenables(); |
- SkXfermode::InitializeFlattenables(); |
- } |
-}; |
+ // PathEffect |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArcToPathEffect) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkCornerPathEffect) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDashPathEffect) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiscretePathEffect) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath1DPathEffect) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLine2DPathEffect) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath2DPathEffect) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSumPathEffect) |
-SK_DECLARE_STATIC_ONCE(once); |
-void SkFlattenable::InitializeFlattenablesIfNeeded() { |
- SkOnce(&once, SkPrivateEffectInitializer::Init); |
+ // ImageFilter |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurImageFilter) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDilateImageFilter) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDisplacementMapEffect) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDropShadowImageFilter) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkErodeImageFilter) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageSource) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPaintImageFilter) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPictureImageFilter) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTileImageFilter) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkXfermodeImageFilter) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMagnifierImageFilter) |
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMatrixConvolutionImageFilter) |
+ 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) |
+ SkLightingImageFilter::InitializeFlattenables(); |
} |