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" |
| 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 Osman | 7281a86 | 2020-02-18 19:30:51 +0000 | [diff] [blame] | 48 | #include "src/shaders/SkRTShader.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 49 | #include "src/shaders/SkShaderBase.h" |
Mike Klein | 6ed2a38 | 2018-10-20 07:57:07 -0400 | [diff] [blame] | 50 | |
Michael Ludwig | 06eacf4 | 2019-08-01 16:02:27 -0400 | [diff] [blame] | 51 | #include "include/effects/SkImageFilters.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 52 | #include "src/core/SkLocalMatrixImageFilter.h" |
| 53 | #include "src/core/SkMatrixImageFilter.h" |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 54 | |
| 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 Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 64 | SK_REGISTER_FLATTENABLE(SkColor4Shader); |
| 65 | SK_REGISTER_FLATTENABLE(SkColorFilterShader); |
| 66 | SK_REGISTER_FLATTENABLE(SkColorShader); |
Mike Reed | 9b2c4e9 | 2019-04-02 09:54:14 -0400 | [diff] [blame] | 67 | SK_REGISTER_FLATTENABLE(SkShader_Blend); |
| 68 | SK_REGISTER_FLATTENABLE(SkShader_Lerp); |
Mike Reed | c8bea7d | 2019-04-09 13:55:36 -0400 | [diff] [blame] | 69 | SK_REGISTER_FLATTENABLE(SkShader_LerpRed); |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 70 | SK_REGISTER_FLATTENABLE(SkEmptyShader); |
| 71 | SK_REGISTER_FLATTENABLE(SkLocalMatrixShader); |
| 72 | SK_REGISTER_FLATTENABLE(SkPictureShader); |
Brian Osman | 7281a86 | 2020-02-18 19:30:51 +0000 | [diff] [blame] | 73 | SK_REGISTER_FLATTENABLE(SkRTShader); |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 74 | SkGradientShader::RegisterFlattenables(); |
| 75 | SkLightingShader::RegisterFlattenables(); |
| 76 | SkPerlinNoiseShader::RegisterFlattenables(); |
| 77 | SkShaderBase::RegisterFlattenables(); |
| 78 | |
| 79 | // Color filters. |
Mike Reed | 361a640 | 2019-04-23 12:19:00 -0400 | [diff] [blame] | 80 | SkColorFilter_Matrix::RegisterFlattenables(); |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 81 | SK_REGISTER_FLATTENABLE(SkLumaColorFilter); |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 82 | SkColorFilter::RegisterFlattenables(); |
| 83 | SkHighContrastFilter::RegisterFlattenables(); |
| 84 | SkOverdrawColorFilter::RegisterFlattenables(); |
| 85 | SkTableColorFilter::RegisterFlattenables(); |
| 86 | |
| 87 | // Mask filters. |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 88 | SK_REGISTER_FLATTENABLE(SkEmbossMaskFilter); |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 89 | SkMaskFilter::RegisterFlattenables(); |
| 90 | SkShaderMaskFilter::RegisterFlattenables(); |
| 91 | |
| 92 | // Path effects. |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 93 | 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 Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 103 | SkPathEffect::RegisterFlattenables(); |
| 104 | |
| 105 | // Misc. |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 106 | SK_REGISTER_FLATTENABLE(SkLayerDrawLooper); |
| 107 | SK_REGISTER_FLATTENABLE(SkRecordedDrawable); |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 108 | 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 Ludwig | 06eacf4 | 2019-08-01 16:02:27 -0400 | [diff] [blame] | 119 | SkImageFilters::RegisterFlattenables(); |
Michael Ludwig | d668f7f | 2019-07-30 10:03:16 -0400 | [diff] [blame] | 120 | SK_REGISTER_FLATTENABLE(SkLocalMatrixImageFilter); |
| 121 | SK_REGISTER_FLATTENABLE(SkMatrixImageFilter); |
Mike Klein | 5437823 | 2018-11-08 12:08:05 +0000 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | #endif |