blob: 30d41daf37a45a7bb7daf702e8ba922322b273aa [file] [log] [blame]
caryclark@google.comd26147a2011-12-15 14:16:43 +00001/*
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 */
rmistry@google.comd6176b02012-08-23 18:14:13 +00007
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "include/core/SkFlattenable.h"
reed50b98b42016-02-03 16:31:35 -08009
Mike Klein54378232018-11-08 12:08:05 +000010#if defined(SK_DISABLE_EFFECT_DESERIALIZATION)
djsollen@google.com5370cd92012-03-28 20:47:01 +000011
Mike Klein54378232018-11-08 12:08:05 +000012 void SkFlattenable::PrivateInitializer::InitEffects() {}
13 void SkFlattenable::PrivateInitializer::InitImageFilters() {}
reed6054d682016-01-13 08:47:54 -080014
Mike Klein54378232018-11-08 12:08:05 +000015#else
reed6054d682016-01-13 08:47:54 -080016
Mike Klein508fd322020-02-12 09:45:41 -060017 #include "include/core/SkBBHFactory.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050018 #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/SkShaderMaskFilter.h"
31 #include "include/effects/SkTableColorFilter.h"
32 #include "src/core/SkColorFilter_Matrix.h"
33 #include "src/core/SkNormalSource.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/SkLightingShader.h"
46 #include "src/shaders/SkLocalMatrixShader.h"
47 #include "src/shaders/SkPictureShader.h"
Brian Osman7281a862020-02-18 19:30:51 +000048 #include "src/shaders/SkRTShader.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050049 #include "src/shaders/SkShaderBase.h"
Mike Klein6ed2a382018-10-20 07:57:07 -040050
Michael Ludwig06eacf42019-08-01 16:02:27 -040051 #include "include/effects/SkImageFilters.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050052 #include "src/core/SkLocalMatrixImageFilter.h"
53 #include "src/core/SkMatrixImageFilter.h"
Mike Klein54378232018-11-08 12:08:05 +000054
55 /*
56 * Register most effects for deserialization.
57 *
58 * None of these are strictly required for Skia to operate, so if you're
59 * not using deserialization yourself, you can define
60 * SK_DISABLE_EFFECT_SERIALIZATION, or modify/replace this file as needed.
61 */
62 void SkFlattenable::PrivateInitializer::InitEffects() {
63 // Shaders.
Brian Salomon23356442018-11-30 15:33:19 -050064 SK_REGISTER_FLATTENABLE(SkColor4Shader);
65 SK_REGISTER_FLATTENABLE(SkColorFilterShader);
66 SK_REGISTER_FLATTENABLE(SkColorShader);
Mike Reed9b2c4e92019-04-02 09:54:14 -040067 SK_REGISTER_FLATTENABLE(SkShader_Blend);
68 SK_REGISTER_FLATTENABLE(SkShader_Lerp);
Mike Reedc8bea7d2019-04-09 13:55:36 -040069 SK_REGISTER_FLATTENABLE(SkShader_LerpRed);
Brian Salomon23356442018-11-30 15:33:19 -050070 SK_REGISTER_FLATTENABLE(SkEmptyShader);
71 SK_REGISTER_FLATTENABLE(SkLocalMatrixShader);
72 SK_REGISTER_FLATTENABLE(SkPictureShader);
Brian Osman7281a862020-02-18 19:30:51 +000073 SK_REGISTER_FLATTENABLE(SkRTShader);
Mike Klein54378232018-11-08 12:08:05 +000074 SkGradientShader::RegisterFlattenables();
75 SkLightingShader::RegisterFlattenables();
76 SkPerlinNoiseShader::RegisterFlattenables();
77 SkShaderBase::RegisterFlattenables();
78
79 // Color filters.
Mike Reed361a6402019-04-23 12:19:00 -040080 SkColorFilter_Matrix::RegisterFlattenables();
Brian Salomon23356442018-11-30 15:33:19 -050081 SK_REGISTER_FLATTENABLE(SkLumaColorFilter);
Mike Klein54378232018-11-08 12:08:05 +000082 SkColorFilter::RegisterFlattenables();
83 SkHighContrastFilter::RegisterFlattenables();
84 SkOverdrawColorFilter::RegisterFlattenables();
85 SkTableColorFilter::RegisterFlattenables();
86
87 // Mask filters.
Brian Salomon23356442018-11-30 15:33:19 -050088 SK_REGISTER_FLATTENABLE(SkEmbossMaskFilter);
Mike Klein54378232018-11-08 12:08:05 +000089 SkMaskFilter::RegisterFlattenables();
90 SkShaderMaskFilter::RegisterFlattenables();
91
92 // Path effects.
Brian Salomon23356442018-11-30 15:33:19 -050093 SK_REGISTER_FLATTENABLE(SkCornerPathEffect);
94 SK_REGISTER_FLATTENABLE(SkDashImpl);
95 SK_REGISTER_FLATTENABLE(SkDiscretePathEffect);
96 SK_REGISTER_FLATTENABLE(SkLine2DPathEffect);
97 SK_REGISTER_FLATTENABLE(SkMatrixPE);
98 SK_REGISTER_FLATTENABLE(SkOpPE);
99 SK_REGISTER_FLATTENABLE(SkPath1DPathEffect);
100 SK_REGISTER_FLATTENABLE(SkPath2DPathEffect);
101 SK_REGISTER_FLATTENABLE(SkStrokePE);
102 SK_REGISTER_FLATTENABLE(SkTrimPE);
Mike Klein54378232018-11-08 12:08:05 +0000103 SkPathEffect::RegisterFlattenables();
104
105 // Misc.
Brian Salomon23356442018-11-30 15:33:19 -0500106 SK_REGISTER_FLATTENABLE(SkLayerDrawLooper);
107 SK_REGISTER_FLATTENABLE(SkRecordedDrawable);
Mike Klein54378232018-11-08 12:08:05 +0000108 SkNormalSource::RegisterFlattenables();
109 }
110
111 /*
112 * Register SkImageFilters for deserialization.
113 *
114 * None of these are strictly required for Skia to operate, so if you're
115 * not using deserialization yourself, you can define
116 * SK_DISABLE_EFFECT_SERIALIZATION, or modify/replace this file as needed.
117 */
118 void SkFlattenable::PrivateInitializer::InitImageFilters() {
Michael Ludwig06eacf42019-08-01 16:02:27 -0400119 SkImageFilters::RegisterFlattenables();
Michael Ludwigd668f7f2019-07-30 10:03:16 -0400120 SK_REGISTER_FLATTENABLE(SkLocalMatrixImageFilter);
121 SK_REGISTER_FLATTENABLE(SkMatrixImageFilter);
Mike Klein54378232018-11-08 12:08:05 +0000122 }
123
124#endif