• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2011 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #include "SkTypes.h"
9 
10 #include "SkBitmapProcShader.h"
11 #include "SkMallocPixelRef.h"
12 #include "SkPathEffect.h"
13 #include "SkPixelRef.h"
14 #include "SkXfermode.h"
15 
16 #include "Sk1DPathEffect.h"
17 #include "Sk2DPathEffect.h"
18 #include "SkArithmeticMode.h"
19 #include "SkArcToPathEffect.h"
20 #include "SkBitmapSource.h"
21 #include "SkBlurDrawLooper.h"
22 #include "SkBlurImageFilter.h"
23 #include "SkBlurMaskFilter.h"
24 #include "SkColorCubeFilter.h"
25 #include "SkColorFilter.h"
26 #include "SkColorFilterImageFilter.h"
27 #include "SkColorMatrixFilter.h"
28 #include "SkColorShader.h"
29 #include "SkComposeImageFilter.h"
30 #include "SkComposeShader.h"
31 #include "SkCornerPathEffect.h"
32 #include "SkDashPathEffect.h"
33 #include "SkDiscretePathEffect.h"
34 #include "SkDisplacementMapEffect.h"
35 #include "SkDropShadowImageFilter.h"
36 #include "SkEmptyShader.h"
37 #include "SkEmbossMaskFilter.h"
38 #include "SkFlattenable.h"
39 #include "SkGradientShader.h"
40 #include "SkLayerDrawLooper.h"
41 #include "SkLayerRasterizer.h"
42 #include "SkLerpXfermode.h"
43 #include "SkLightingImageFilter.h"
44 #include "SkLocalMatrixShader.h"
45 #include "SkLumaColorFilter.h"
46 #include "SkMagnifierImageFilter.h"
47 #include "SkMatrixConvolutionImageFilter.h"
48 #include "SkMergeImageFilter.h"
49 #include "SkModeColorFilter.h"
50 #include "SkMorphologyImageFilter.h"
51 #include "SkOffsetImageFilter.h"
52 #include "SkOnce.h"
53 #include "SkPerlinNoiseShader.h"
54 #include "SkPictureImageFilter.h"
55 #include "SkPictureShader.h"
56 #include "SkPixelXorXfermode.h"
57 #include "SkRectShaderImageFilter.h"
58 #include "SkTableColorFilter.h"
59 #include "SkTestImageFilters.h"
60 #include "SkTileImageFilter.h"
61 #include "SkMatrixImageFilter.h"
62 #include "SkXfermodeImageFilter.h"
63 
64 class SkPrivateEffectInitializer {
65 public:
Init()66     static void Init() {
67         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArcToPathEffect)
68         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapProcShader)
69         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapSource)
70         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurDrawLooper)
71         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurImageFilter)
72         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorCubeFilter)
73         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorMatrixFilter)
74         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorShader)
75         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposePathEffect)
76         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeShader)
77         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkCornerPathEffect)
78         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDashPathEffect)
79         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDilateImageFilter)
80         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiscretePathEffect)
81         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDisplacementMapEffect)
82         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDropShadowImageFilter)
83         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmbossMaskFilter)
84         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmptyShader)
85         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkErodeImageFilter)
86         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerDrawLooper)
87         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerRasterizer)
88         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLerpXfermode)
89         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLocalMatrixShader)
90         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLumaColorFilter)
91         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath1DPathEffect)
92         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLine2DPathEffect)
93         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkModeColorFilter)
94         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath2DPathEffect)
95         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPerlinNoiseShader)
96         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPictureImageFilter)
97         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPictureShader)
98         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPixelXorXfermode)
99         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkRectShaderImageFilter)
100         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSumPathEffect)
101         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTileImageFilter)
102         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMatrixImageFilter)
103         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkXfermodeImageFilter)
104         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMagnifierImageFilter)
105         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMatrixConvolutionImageFilter)
106 
107         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkOffsetImageFilter)
108         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeImageFilter)
109         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMergeImageFilter)
110         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorFilterImageFilter)
111         SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDownSampleImageFilter)
112 
113         SkArithmeticMode::InitializeFlattenables();
114         SkBlurMaskFilter::InitializeFlattenables();
115         SkColorFilter::InitializeFlattenables();
116         SkGradientShader::InitializeFlattenables();
117         SkLightingImageFilter::InitializeFlattenables();
118         SkTableColorFilter::InitializeFlattenables();
119         SkXfermode::InitializeFlattenables();
120     }
121 };
122 
123 SK_DECLARE_STATIC_ONCE(once);
InitializeFlattenablesIfNeeded()124 void SkFlattenable::InitializeFlattenablesIfNeeded() {
125     SkOnce(&once, SkPrivateEffectInitializer::Init);
126 }
127