blob: 559ff0a814cc81a6bec868be04e4c32a63262758 [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"
Brian Osmand3b3bf32020-02-19 09:47:05 -050030 #include "include/effects/SkRuntimeEffect.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050031 #include "include/effects/SkShaderMaskFilter.h"
32 #include "include/effects/SkTableColorFilter.h"
33 #include "src/core/SkColorFilter_Matrix.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050034 #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"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050045 #include "src/shaders/SkLocalMatrixShader.h"
46 #include "src/shaders/SkPictureShader.h"
47 #include "src/shaders/SkShaderBase.h"
Mike Klein6ed2a382018-10-20 07:57:07 -040048
Michael Ludwig06eacf42019-08-01 16:02:27 -040049 #include "include/effects/SkImageFilters.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050050 #include "src/core/SkLocalMatrixImageFilter.h"
51 #include "src/core/SkMatrixImageFilter.h"
Mike Klein54378232018-11-08 12:08:05 +000052
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.
Brian Salomon23356442018-11-30 15:33:19 -050062 SK_REGISTER_FLATTENABLE(SkColor4Shader);
63 SK_REGISTER_FLATTENABLE(SkColorFilterShader);
64 SK_REGISTER_FLATTENABLE(SkColorShader);
Mike Reed9b2c4e92019-04-02 09:54:14 -040065 SK_REGISTER_FLATTENABLE(SkShader_Blend);
66 SK_REGISTER_FLATTENABLE(SkShader_Lerp);
Brian Salomon23356442018-11-30 15:33:19 -050067 SK_REGISTER_FLATTENABLE(SkEmptyShader);
68 SK_REGISTER_FLATTENABLE(SkLocalMatrixShader);
69 SK_REGISTER_FLATTENABLE(SkPictureShader);
Mike Klein54378232018-11-08 12:08:05 +000070 SkGradientShader::RegisterFlattenables();
Mike Klein54378232018-11-08 12:08:05 +000071 SkPerlinNoiseShader::RegisterFlattenables();
72 SkShaderBase::RegisterFlattenables();
73
74 // Color filters.
Mike Reed361a6402019-04-23 12:19:00 -040075 SkColorFilter_Matrix::RegisterFlattenables();
Brian Salomon23356442018-11-30 15:33:19 -050076 SK_REGISTER_FLATTENABLE(SkLumaColorFilter);
Mike Klein54378232018-11-08 12:08:05 +000077 SkColorFilter::RegisterFlattenables();
78 SkHighContrastFilter::RegisterFlattenables();
Mike Klein54378232018-11-08 12:08:05 +000079 SkTableColorFilter::RegisterFlattenables();
80
Brian Osmand3b3bf32020-02-19 09:47:05 -050081 // Shader & color filter.
82 SkRuntimeEffect::RegisterFlattenables();
83
Mike Klein54378232018-11-08 12:08:05 +000084 // Mask filters.
Brian Salomon23356442018-11-30 15:33:19 -050085 SK_REGISTER_FLATTENABLE(SkEmbossMaskFilter);
Mike Klein54378232018-11-08 12:08:05 +000086 SkMaskFilter::RegisterFlattenables();
87 SkShaderMaskFilter::RegisterFlattenables();
88
89 // Path effects.
Brian Salomon23356442018-11-30 15:33:19 -050090 SK_REGISTER_FLATTENABLE(SkCornerPathEffect);
91 SK_REGISTER_FLATTENABLE(SkDashImpl);
92 SK_REGISTER_FLATTENABLE(SkDiscretePathEffect);
93 SK_REGISTER_FLATTENABLE(SkLine2DPathEffect);
94 SK_REGISTER_FLATTENABLE(SkMatrixPE);
95 SK_REGISTER_FLATTENABLE(SkOpPE);
96 SK_REGISTER_FLATTENABLE(SkPath1DPathEffect);
97 SK_REGISTER_FLATTENABLE(SkPath2DPathEffect);
98 SK_REGISTER_FLATTENABLE(SkStrokePE);
Mike Reed3e843122020-05-20 09:55:58 -040099 SK_REGISTER_FLATTENABLE(SkStrokeAndFillPE);
Brian Salomon23356442018-11-30 15:33:19 -0500100 SK_REGISTER_FLATTENABLE(SkTrimPE);
Mike Klein54378232018-11-08 12:08:05 +0000101 SkPathEffect::RegisterFlattenables();
102
103 // Misc.
Brian Salomon23356442018-11-30 15:33:19 -0500104 SK_REGISTER_FLATTENABLE(SkLayerDrawLooper);
105 SK_REGISTER_FLATTENABLE(SkRecordedDrawable);
Mike Klein54378232018-11-08 12:08:05 +0000106 }
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() {
Michael Ludwig06eacf42019-08-01 16:02:27 -0400116 SkImageFilters::RegisterFlattenables();
Michael Ludwigd668f7f2019-07-30 10:03:16 -0400117 SK_REGISTER_FLATTENABLE(SkLocalMatrixImageFilter);
118 SK_REGISTER_FLATTENABLE(SkMatrixImageFilter);
Mike Klein54378232018-11-08 12:08:05 +0000119 }
120
121#endif