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