caryclark@google.com | d26147a | 2011-12-15 14:16:43 +0000 | [diff] [blame] | 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 | */ |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 7 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "include/core/SkFlattenable.h" |
reed | 50b98b4 | 2016-02-03 16:31:35 -0800 | [diff] [blame] | 9 | |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 10 | #if defined(SK_DISABLE_EFFECT_DESERIALIZATION) |
djsollen@google.com | 5370cd9 | 2012-03-28 20:47:01 +0000 | [diff] [blame] | 11 | |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 12 | void SkFlattenable::PrivateInitializer::InitEffects() {} |
| 13 | void SkFlattenable::PrivateInitializer::InitImageFilters() {} |
reed | 6054d68 | 2016-01-13 08:47:54 -0800 | [diff] [blame] | 14 | |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 15 | #else |
reed | 6054d68 | 2016-01-13 08:47:54 -0800 | [diff] [blame] | 16 | |
Mike Klein | 508fd32 | 2020-02-12 09:45:41 -0600 | [diff] [blame] | 17 | #include "include/core/SkBBHFactory.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 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" |
Brian Osman | d3b3bf3 | 2020-02-19 09:47:05 -0500 | [diff] [blame] | 30 | #include "include/effects/SkRuntimeEffect.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 31 | #include "include/effects/SkShaderMaskFilter.h" |
| 32 | #include "include/effects/SkTableColorFilter.h" |
| 33 | #include "src/core/SkColorFilter_Matrix.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 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" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 45 | #include "src/shaders/SkLocalMatrixShader.h" |
| 46 | #include "src/shaders/SkPictureShader.h" |
| 47 | #include "src/shaders/SkShaderBase.h" |
Mike Klein | 6ed2a38 | 2018-10-20 07:57:07 -0400 | [diff] [blame] | 48 | |
Michael Ludwig | 06eacf4 | 2019-08-01 16:02:27 -0400 | [diff] [blame] | 49 | #include "include/effects/SkImageFilters.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 50 | #include "src/core/SkLocalMatrixImageFilter.h" |
| 51 | #include "src/core/SkMatrixImageFilter.h" |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 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. |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 62 | SK_REGISTER_FLATTENABLE(SkColor4Shader); |
| 63 | SK_REGISTER_FLATTENABLE(SkColorFilterShader); |
| 64 | SK_REGISTER_FLATTENABLE(SkColorShader); |
Mike Reed | 9b2c4e9 | 2019-04-02 09:54:14 -0400 | [diff] [blame] | 65 | SK_REGISTER_FLATTENABLE(SkShader_Blend); |
| 66 | SK_REGISTER_FLATTENABLE(SkShader_Lerp); |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 67 | SK_REGISTER_FLATTENABLE(SkEmptyShader); |
| 68 | SK_REGISTER_FLATTENABLE(SkLocalMatrixShader); |
| 69 | SK_REGISTER_FLATTENABLE(SkPictureShader); |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 70 | SkGradientShader::RegisterFlattenables(); |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 71 | SkPerlinNoiseShader::RegisterFlattenables(); |
| 72 | SkShaderBase::RegisterFlattenables(); |
| 73 | |
| 74 | // Color filters. |
Mike Reed | 361a640 | 2019-04-23 12:19:00 -0400 | [diff] [blame] | 75 | SkColorFilter_Matrix::RegisterFlattenables(); |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 76 | SK_REGISTER_FLATTENABLE(SkLumaColorFilter); |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 77 | SkColorFilter::RegisterFlattenables(); |
| 78 | SkHighContrastFilter::RegisterFlattenables(); |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 79 | SkTableColorFilter::RegisterFlattenables(); |
| 80 | |
Brian Osman | d3b3bf3 | 2020-02-19 09:47:05 -0500 | [diff] [blame] | 81 | // Shader & color filter. |
| 82 | SkRuntimeEffect::RegisterFlattenables(); |
| 83 | |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 84 | // Mask filters. |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 85 | SK_REGISTER_FLATTENABLE(SkEmbossMaskFilter); |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 86 | SkMaskFilter::RegisterFlattenables(); |
| 87 | SkShaderMaskFilter::RegisterFlattenables(); |
| 88 | |
| 89 | // Path effects. |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 90 | 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 Reed | 3e84312 | 2020-05-20 09:55:58 -0400 | [diff] [blame] | 99 | SK_REGISTER_FLATTENABLE(SkStrokeAndFillPE); |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 100 | SK_REGISTER_FLATTENABLE(SkTrimPE); |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 101 | SkPathEffect::RegisterFlattenables(); |
| 102 | |
| 103 | // Misc. |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 104 | SK_REGISTER_FLATTENABLE(SkLayerDrawLooper); |
| 105 | SK_REGISTER_FLATTENABLE(SkRecordedDrawable); |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 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() { |
Michael Ludwig | 06eacf4 | 2019-08-01 16:02:27 -0400 | [diff] [blame] | 116 | SkImageFilters::RegisterFlattenables(); |
Michael Ludwig | d668f7f | 2019-07-30 10:03:16 -0400 | [diff] [blame] | 117 | SK_REGISTER_FLATTENABLE(SkLocalMatrixImageFilter); |
| 118 | SK_REGISTER_FLATTENABLE(SkMatrixImageFilter); |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | #endif |