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 "SkFlattenable.h" 9 10 #if defined(SK_DISABLE_EFFECT_DESERIALIZATION) 11 InitEffects()12 void SkFlattenable::PrivateInitializer::InitEffects() {} InitImageFilters()13 void SkFlattenable::PrivateInitializer::InitImageFilters() {} 14 15 #else 16 17 #include "../../src/effects/SkDashImpl.h" 18 #include "../../src/effects/SkEmbossMaskFilter.h" 19 #include "../../src/effects/SkOpPE.h" 20 #include "../../src/effects/SkTrimPE.h" 21 #include "Sk1DPathEffect.h" 22 #include "Sk2DPathEffect.h" 23 #include "SkBitmapProcShader.h" 24 #include "SkColorFilter.h" 25 #include "SkColorFilterShader.h" 26 #include "SkColorMatrixFilterRowMajor255.h" 27 #include "SkColorShader.h" 28 #include "SkComposeShader.h" 29 #include "SkCornerPathEffect.h" 30 #include "SkDiscretePathEffect.h" 31 #include "SkEmptyShader.h" 32 #include "SkGradientShader.h" 33 #include "SkHighContrastFilter.h" 34 #include "SkImageShader.h" 35 #include "SkLayerDrawLooper.h" 36 #include "SkLightingShader.h" 37 #include "SkLocalMatrixShader.h" 38 #include "SkLumaColorFilter.h" 39 #include "SkNormalSource.h" 40 #include "SkOverdrawColorFilter.h" 41 #include "SkPathEffect.h" 42 #include "SkPerlinNoiseShader.h" 43 #include "SkPictureShader.h" 44 #include "SkRecordedDrawable.h" 45 #include "SkShaderBase.h" 46 #include "SkShaderMaskFilter.h" 47 #include "SkTableColorFilter.h" 48 #include "SkToSRGBColorFilter.h" 49 50 #include "SkAlphaThresholdFilter.h" 51 #include "SkBlurImageFilter.h" 52 #include "SkColorFilterImageFilter.h" 53 #include "SkComposeImageFilter.h" 54 #include "SkDisplacementMapEffect.h" 55 #include "SkDropShadowImageFilter.h" 56 #include "SkImageSource.h" 57 #include "SkLightingImageFilter.h" 58 #include "SkLocalMatrixImageFilter.h" 59 #include "SkMagnifierImageFilter.h" 60 #include "SkMatrixConvolutionImageFilter.h" 61 #include "SkMatrixImageFilter.h" 62 #include "SkMergeImageFilter.h" 63 #include "SkMorphologyImageFilter.h" 64 #include "SkOffsetImageFilter.h" 65 #include "SkPaintImageFilter.h" 66 #include "SkPictureImageFilter.h" 67 #include "SkTileImageFilter.h" 68 #include "SkXfermodeImageFilter.h" 69 70 /* 71 * Register most effects for deserialization. 72 * 73 * None of these are strictly required for Skia to operate, so if you're 74 * not using deserialization yourself, you can define 75 * SK_DISABLE_EFFECT_SERIALIZATION, or modify/replace this file as needed. 76 */ InitEffects()77 void SkFlattenable::PrivateInitializer::InitEffects() { 78 // Shaders. 79 SK_REGISTER_FLATTENABLE(SkColor4Shader); 80 SK_REGISTER_FLATTENABLE(SkColorFilterShader); 81 SK_REGISTER_FLATTENABLE(SkColorShader); 82 SK_REGISTER_FLATTENABLE(SkComposeShader); 83 SK_REGISTER_FLATTENABLE(SkEmptyShader); 84 SK_REGISTER_FLATTENABLE(SkLocalMatrixShader); 85 SK_REGISTER_FLATTENABLE(SkPictureShader); 86 SkGradientShader::RegisterFlattenables(); 87 SkLightingShader::RegisterFlattenables(); 88 SkPerlinNoiseShader::RegisterFlattenables(); 89 SkShaderBase::RegisterFlattenables(); 90 91 // Color filters. 92 SK_REGISTER_FLATTENABLE(SkColorMatrixFilterRowMajor255); 93 SK_REGISTER_FLATTENABLE(SkLumaColorFilter); 94 SK_REGISTER_FLATTENABLE(SkToSRGBColorFilter); 95 SkColorFilter::RegisterFlattenables(); 96 SkHighContrastFilter::RegisterFlattenables(); 97 SkOverdrawColorFilter::RegisterFlattenables(); 98 SkTableColorFilter::RegisterFlattenables(); 99 100 // Mask filters. 101 SK_REGISTER_FLATTENABLE(SkEmbossMaskFilter); 102 SkMaskFilter::RegisterFlattenables(); 103 SkShaderMaskFilter::RegisterFlattenables(); 104 105 // Path effects. 106 SK_REGISTER_FLATTENABLE(SkCornerPathEffect); 107 SK_REGISTER_FLATTENABLE(SkDashImpl); 108 SK_REGISTER_FLATTENABLE(SkDiscretePathEffect); 109 SK_REGISTER_FLATTENABLE(SkLine2DPathEffect); 110 SK_REGISTER_FLATTENABLE(SkMatrixPE); 111 SK_REGISTER_FLATTENABLE(SkOpPE); 112 SK_REGISTER_FLATTENABLE(SkPath1DPathEffect); 113 SK_REGISTER_FLATTENABLE(SkPath2DPathEffect); 114 SK_REGISTER_FLATTENABLE(SkStrokePE); 115 SK_REGISTER_FLATTENABLE(SkTrimPE); 116 SkPathEffect::RegisterFlattenables(); 117 118 // Misc. 119 SK_REGISTER_FLATTENABLE(SkLayerDrawLooper); 120 SK_REGISTER_FLATTENABLE(SkRecordedDrawable); 121 SkNormalSource::RegisterFlattenables(); 122 } 123 124 /* 125 * Register SkImageFilters for deserialization. 126 * 127 * None of these are strictly required for Skia to operate, so if you're 128 * not using deserialization yourself, you can define 129 * SK_DISABLE_EFFECT_SERIALIZATION, or modify/replace this file as needed. 130 */ InitImageFilters()131 void SkFlattenable::PrivateInitializer::InitImageFilters() { 132 SkAlphaThresholdFilter::RegisterFlattenables(); 133 SkImageFilter::RegisterFlattenables(); 134 SkArithmeticImageFilter::RegisterFlattenables(); 135 SkXfermodeImageFilter::RegisterFlattenables(); 136 SK_REGISTER_FLATTENABLE(SkDilateImageFilter); 137 SK_REGISTER_FLATTENABLE(SkDisplacementMapEffect); 138 SK_REGISTER_FLATTENABLE(SkDropShadowImageFilter); 139 SK_REGISTER_FLATTENABLE(SkErodeImageFilter); 140 SK_REGISTER_FLATTENABLE(SkImageSource); 141 SK_REGISTER_FLATTENABLE(SkLocalMatrixImageFilter); 142 SK_REGISTER_FLATTENABLE(SkPaintImageFilter); 143 SK_REGISTER_FLATTENABLE(SkPictureImageFilter); 144 SK_REGISTER_FLATTENABLE(SkTileImageFilter); 145 SK_REGISTER_FLATTENABLE(SkMagnifierImageFilter); 146 SK_REGISTER_FLATTENABLE(SkMatrixConvolutionImageFilter); 147 SK_REGISTER_FLATTENABLE(SkMatrixImageFilter); 148 SK_REGISTER_FLATTENABLE(SkOffsetImageFilter); 149 SK_REGISTER_FLATTENABLE(SkComposeImageFilter); 150 SK_REGISTER_FLATTENABLE(SkMergeImageFilter); 151 SK_REGISTER_FLATTENABLE(SkColorFilterImageFilter); 152 SkLightingImageFilter::RegisterFlattenables(); 153 } 154 155 #endif 156