• 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 "include/core/SkFlattenable.h"
9 
10 #if defined(SK_DISABLE_EFFECT_DESERIALIZATION)
11 
InitEffects()12     void SkFlattenable::PrivateInitializer::InitEffects() {}
InitImageFilters()13     void SkFlattenable::PrivateInitializer::InitImageFilters() {}
14 
15 #else
16 
17     #include "include/core/SkBBHFactory.h"
18     #include "include/core/SkColorFilter.h"
19     #include "include/core/SkPathEffect.h"
20     #include "include/effects/Sk1DPathEffect.h"
21     #include "include/effects/Sk2DPathEffect.h"
22     #include "include/effects/SkCornerPathEffect.h"
23     #include "include/effects/SkDiscretePathEffect.h"
24     #include "include/effects/SkGradientShader.h"
25     #include "include/effects/SkOverdrawColorFilter.h"
26     #include "include/effects/SkPerlinNoiseShader.h"
27     #include "include/effects/SkShaderMaskFilter.h"
28     #include "include/effects/SkTableColorFilter.h"
29     #include "src/core/SkBlendModeBlender.h"
30     #include "src/core/SkColorFilter_Matrix.h"
31     #include "src/core/SkImageFilter_Base.h"
32     #include "src/core/SkRecordedDrawable.h"
33     #include "src/effects/SkDashImpl.h"
34     #include "src/effects/SkEmbossMaskFilter.h"
35     #include "src/effects/SkOpPE.h"
36     #include "src/effects/SkTrimPE.h"
37     #include "src/shaders/SkBitmapProcShader.h"
38     #include "src/shaders/SkColorFilterShader.h"
39     #include "src/shaders/SkColorShader.h"
40     #include "src/shaders/SkComposeShader.h"
41     #include "src/shaders/SkEmptyShader.h"
42     #include "src/shaders/SkImageShader.h"
43     #include "src/shaders/SkLocalMatrixShader.h"
44     #include "src/shaders/SkPictureShader.h"
45     #include "src/shaders/SkShaderBase.h"
46 
47     #include "include/effects/SkImageFilters.h"
48     #include "src/core/SkLocalMatrixImageFilter.h"
49     #include "src/core/SkMatrixImageFilter.h"
50 
51 #ifdef SK_ENABLE_SKSL
52     #include "include/effects/SkRuntimeEffect.h"
53 #endif
54 
55 #ifdef SK_SUPPORT_LEGACY_DRAWLOOPER
56     #include "include/effects/SkLayerDrawLooper.h"
57 #endif
58 
59     /**
60      *  Register most effects for deserialization.
61      *
62      *  None of these are strictly required for Skia to operate, so if you're
63      *  not using deserialization yourself, you can define
64      *  SK_DISABLE_EFFECT_SERIALIZATION, or modify/replace this file as needed.
65      */
InitEffects()66     void SkFlattenable::PrivateInitializer::InitEffects() {
67         // Shaders.
68         SK_REGISTER_FLATTENABLE(SkColor4Shader);
69         SK_REGISTER_FLATTENABLE(SkColorFilterShader);
70         SK_REGISTER_FLATTENABLE(SkColorShader);
71         SK_REGISTER_FLATTENABLE(SkShader_Blend);
72         SK_REGISTER_FLATTENABLE(SkEmptyShader);
73         SK_REGISTER_FLATTENABLE(SkLocalMatrixShader);
74         SK_REGISTER_FLATTENABLE(SkPictureShader);
75         SkGradientShader::RegisterFlattenables();
76         SkPerlinNoiseShader::RegisterFlattenables();
77         SkShaderBase::RegisterFlattenables();
78 
79         // Color filters.
80         SkColorFilter_Matrix::RegisterFlattenables();
81         SkColorFilterBase::RegisterFlattenables();
82         SkTableColorFilter::RegisterFlattenables();
83 
84         // Blenders.
85         SK_REGISTER_FLATTENABLE(SkBlendModeBlender);
86 
87 #ifdef SK_ENABLE_SKSL
88         // Runtime shaders, color filters, and blenders.
89         SkRuntimeEffect::RegisterFlattenables();
90 #endif
91 
92         // Mask filters.
93         SK_REGISTER_FLATTENABLE(SkEmbossMaskFilter);
94         SkMaskFilter::RegisterFlattenables();
95         SkShaderMaskFilter::RegisterFlattenables();
96 
97         // Path effects.
98         SkCornerPathEffect::RegisterFlattenables();
99         SK_REGISTER_FLATTENABLE(SkDashImpl);
100         SkDiscretePathEffect::RegisterFlattenables();
101         SkLine2DPathEffect::RegisterFlattenables();
102         SkPath2DPathEffect::RegisterFlattenables();
103         SK_REGISTER_FLATTENABLE(SkMatrixPE);
104         SK_REGISTER_FLATTENABLE(SkOpPE);
105         SkPath1DPathEffect::RegisterFlattenables();
106         SK_REGISTER_FLATTENABLE(SkStrokePE);
107         SK_REGISTER_FLATTENABLE(SkStrokeAndFillPE);
108         SK_REGISTER_FLATTENABLE(SkTrimPE);
109         SkPathEffectBase::RegisterFlattenables();
110 
111         // Misc.
112 #ifdef SK_SUPPORT_LEGACY_DRAWLOOPER
113         SK_REGISTER_FLATTENABLE(SkLayerDrawLooper);
114 #endif
115         SK_REGISTER_FLATTENABLE(SkRecordedDrawable);
116     }
117 
118     /*
119      *  Register SkImageFilters for deserialization.
120      *
121      *  None of these are strictly required for Skia to operate, so if you're
122      *  not using deserialization yourself, you can define
123      *  SK_DISABLE_EFFECT_SERIALIZATION, or modify/replace this file as needed.
124      */
InitImageFilters()125     void SkFlattenable::PrivateInitializer::InitImageFilters() {
126         SkRegisterAlphaThresholdImageFilterFlattenable();
127         SkRegisterArithmeticImageFilterFlattenable();
128         SkRegisterBlendImageFilterFlattenable();
129         SkRegisterBlurImageFilterFlattenable();
130         SkRegisterColorFilterImageFilterFlattenable();
131         SkRegisterComposeImageFilterFlattenable();
132         SkRegisterCropImageFilterFlattenable();
133         SkRegisterDisplacementMapImageFilterFlattenable();
134         SkRegisterDropShadowImageFilterFlattenable();
135         SkRegisterImageImageFilterFlattenable();
136         SkRegisterLightingImageFilterFlattenables();
137         SkRegisterMagnifierImageFilterFlattenable();
138         SkRegisterMatrixConvolutionImageFilterFlattenable();
139         SkRegisterMergeImageFilterFlattenable();
140         SkRegisterMorphologyImageFilterFlattenables();
141         SkRegisterOffsetImageFilterFlattenable();
142         SkRegisterPictureImageFilterFlattenable();
143 #ifdef SK_ENABLE_SKSL
144         SkRegisterRuntimeImageFilterFlattenable();
145 #endif
146         SkRegisterShaderImageFilterFlattenable();
147         SkRegisterTileImageFilterFlattenable();
148         SK_REGISTER_FLATTENABLE(SkLocalMatrixImageFilter);
149         SK_REGISTER_FLATTENABLE(SkMatrixImageFilter);
150     }
151 
152 #endif
153