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
12 void SkFlattenable::PrivateInitializer::InitEffects() {}
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/SkHighContrastFilter.h"
26 #include "include/effects/SkLayerDrawLooper.h"
27 #include "include/effects/SkLumaColorFilter.h"
28 #include "include/effects/SkOverdrawColorFilter.h"
29 #include "include/effects/SkPerlinNoiseShader.h"
30 #include "include/effects/SkRuntimeEffect.h"
31 #include "include/effects/SkShaderMaskFilter.h"
32 #include "include/effects/SkTableColorFilter.h"
33 #include "src/core/SkColorFilter_Matrix.h"
34 #include "src/core/SkRecordedDrawable.h"
35 #include "src/effects/SkDashImpl.h"
36 #include "src/effects/SkEmbossMaskFilter.h"
37 #include "src/effects/SkOpPE.h"
38 #include "src/effects/SkTrimPE.h"
39 #include "src/shaders/SkBitmapProcShader.h"
40 #include "src/shaders/SkColorFilterShader.h"
41 #include "src/shaders/SkColorShader.h"
42 #include "src/shaders/SkComposeShader.h"
43 #include "src/shaders/SkEmptyShader.h"
44 #include "src/shaders/SkImageShader.h"
45 #include "src/shaders/SkLocalMatrixShader.h"
46 #include "src/shaders/SkPictureShader.h"
47 #include "src/shaders/SkShaderBase.h"
48
49 #include "include/effects/SkImageFilters.h"
50 #include "src/core/SkLocalMatrixImageFilter.h"
51 #include "src/core/SkMatrixImageFilter.h"
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 */
60 void SkFlattenable::PrivateInitializer::InitEffects() {
61 // Shaders.
62 SK_REGISTER_FLATTENABLE(SkColor4Shader);
63 SK_REGISTER_FLATTENABLE(SkColorFilterShader);
64 SK_REGISTER_FLATTENABLE(SkColorShader);
65 SK_REGISTER_FLATTENABLE(SkShader_Blend);
66 SK_REGISTER_FLATTENABLE(SkShader_Lerp);
67 SK_REGISTER_FLATTENABLE(SkEmptyShader);
68 SK_REGISTER_FLATTENABLE(SkLocalMatrixShader);
69 SK_REGISTER_FLATTENABLE(SkPictureShader);
70 SkGradientShader::RegisterFlattenables();
71 SkPerlinNoiseShader::RegisterFlattenables();
72 SkShaderBase::RegisterFlattenables();
73
74 // Color filters.
75 SkColorFilter_Matrix::RegisterFlattenables();
76 SK_REGISTER_FLATTENABLE(SkLumaColorFilter);
77 SkColorFilter::RegisterFlattenables();
78 SkHighContrastFilter::RegisterFlattenables();
79 SkOverdrawColorFilter::RegisterFlattenables();
80 SkTableColorFilter::RegisterFlattenables();
81
82 // Shader & color filter.
83 SkRuntimeEffect::RegisterFlattenables();
84
85 // Mask filters.
86 SK_REGISTER_FLATTENABLE(SkEmbossMaskFilter);
87 SkMaskFilter::RegisterFlattenables();
88 SkShaderMaskFilter::RegisterFlattenables();
89
90 // Path effects.
91 SK_REGISTER_FLATTENABLE(SkCornerPathEffect);
92 SK_REGISTER_FLATTENABLE(SkDashImpl);
93 SK_REGISTER_FLATTENABLE(SkDiscretePathEffect);
94 SK_REGISTER_FLATTENABLE(SkLine2DPathEffect);
95 SK_REGISTER_FLATTENABLE(SkMatrixPE);
96 SK_REGISTER_FLATTENABLE(SkOpPE);
97 SK_REGISTER_FLATTENABLE(SkPath1DPathEffect);
98 SK_REGISTER_FLATTENABLE(SkPath2DPathEffect);
99 SK_REGISTER_FLATTENABLE(SkStrokePE);
100 SK_REGISTER_FLATTENABLE(SkTrimPE);
101 SkPathEffect::RegisterFlattenables();
102
103 // Misc.
104 SK_REGISTER_FLATTENABLE(SkLayerDrawLooper);
105 SK_REGISTER_FLATTENABLE(SkRecordedDrawable);
106 }
107
108 /*
109 * Register SkImageFilters for deserialization.
110 *
111 * None of these are strictly required for Skia to operate, so if you're
112 * not using deserialization yourself, you can define
113 * SK_DISABLE_EFFECT_SERIALIZATION, or modify/replace this file as needed.
114 */
115 void SkFlattenable::PrivateInitializer::InitImageFilters() {
116 SkImageFilters::RegisterFlattenables();
117 SK_REGISTER_FLATTENABLE(SkLocalMatrixImageFilter);
118 SK_REGISTER_FLATTENABLE(SkMatrixImageFilter);
119 }
120
121#endif
122