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 "Sk1DPathEffect.h" 9 #include "Sk2DPathEffect.h" 10 #include "SkAlphaThresholdFilter.h" 11 #include "../../src/effects/SkArithmeticModePriv.h" 12 #include "SkArcToPathEffect.h" 13 #include "SkBitmapSourceDeserializer.h" 14 #include "SkBlurImageFilter.h" 15 #include "SkBlurMaskFilter.h" 16 #include "SkColorFilterImageFilter.h" 17 #include "SkColorMatrixFilterRowMajor255.h" 18 #include "SkComposeImageFilter.h" 19 #include "SkCornerPathEffect.h" 20 #include "SkDashPathEffect.h" 21 #include "SkDiscretePathEffect.h" 22 #include "SkDisplacementMapEffect.h" 23 #include "SkDropShadowImageFilter.h" 24 #include "../../src/effects/SkEmbossMaskFilter.h" 25 #include "SkGaussianEdgeShader.h" 26 #include "SkRRectsGaussianEdgeMaskFilter.h" 27 #include "SkGradientShader.h" 28 #include "SkHighContrastFilter.h" 29 #include "SkImageSource.h" 30 #include "SkLayerDrawLooper.h" 31 #include "SkLayerRasterizer.h" 32 #include "SkLightingImageFilter.h" 33 #include "SkLightingShader.h" 34 #include "SkLocalMatrixImageFilter.h" 35 #include "SkLumaColorFilter.h" 36 #include "SkMagnifierImageFilter.h" 37 #include "SkMatrixConvolutionImageFilter.h" 38 #include "SkMergeImageFilter.h" 39 #include "SkMorphologyImageFilter.h" 40 #include "SkNormalSource.h" 41 #include "SkOffsetImageFilter.h" 42 #include "../../src/effects/SkOverdrawColorFilter.h" 43 #include "SkPaintImageFilter.h" 44 #include "SkPerlinNoiseShader.h" 45 #include "SkPictureImageFilter.h" 46 #include "SkTableColorFilter.h" 47 #include "SkTileImageFilter.h" 48 #include "SkXfermodeImageFilter.h" 49 50 // Security note: 51 // 52 // As new subclasses are added here, they should be reviewed by chrome security before they 53 // support deserializing cross-process: chrome-security (at) google.com. SampleFilterFuzz.cpp should 54 // also be amended to exercise the new subclass. 55 // 56 // See SkReadBuffer::isCrossProcess() and SkPicture::PictureIOSecurityPrecautionsEnabled() 57 // 58 59 /* 60 * None of these are strictly "required" for Skia to operate. 61 * 62 * These are the bulk of our "effects" -- subclasses of various effects on SkPaint. 63 * 64 * Clients should feel free to dup this file and modify it as needed. This function "InitEffects" 65 * will automatically be called before any of skia's effects are asked to be deserialized. 66 */ 67 void SkFlattenable::PrivateInitializer::InitEffects() { 68 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapSourceDeserializer) 69 70 // MaskFilter 71 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmbossMaskFilter) 72 SkBlurMaskFilter::InitializeFlattenables(); 73 SkRRectsGaussianEdgeMaskFilter::InitializeFlattenables(); 74 75 // DrawLooper 76 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerDrawLooper) 77 78 // Rasterizer 79 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerRasterizer) 80 81 // ColorFilter 82 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorMatrixFilterRowMajor255) 83 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLumaColorFilter) 84 SkAlphaThresholdFilter::InitializeFlattenables(); 85 SkArithmeticMode::InitializeFlattenables(); 86 SkTableColorFilter::InitializeFlattenables(); 87 SkOverdrawColorFilter::InitializeFlattenables(); 88 SkHighContrastFilter::InitializeFlattenables(); 89 90 // Shader 91 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPerlinNoiseShader) 92 SkGradientShader::InitializeFlattenables(); 93 SkLightingShader::InitializeFlattenables(); 94 SkNormalSource::InitializeFlattenables(); 95 SkGaussianEdgeShader::InitializeFlattenables(); 96 97 // PathEffect 98 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArcToPathEffect) 99 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkCornerPathEffect) 100 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDashPathEffect) 101 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiscretePathEffect) 102 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath1DPathEffect) 103 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLine2DPathEffect) 104 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath2DPathEffect) 105 106 // ImageFilter 107 SkImageFilter::InitializeFlattenables(); 108 SkArithmeticImageFilter::InitializeFlattenables(); 109 SkXfermodeImageFilter::InitializeFlattenables(); 110 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDilateImageFilter) 111 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDisplacementMapEffect) 112 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDropShadowImageFilter) 113 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkErodeImageFilter) 114 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageSource) 115 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLocalMatrixImageFilter) 116 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPaintImageFilter) 117 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPictureImageFilter) 118 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTileImageFilter) 119 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMagnifierImageFilter) 120 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMatrixConvolutionImageFilter) 121 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkOffsetImageFilter) 122 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeImageFilter) 123 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMergeImageFilter) 124 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorFilterImageFilter) 125 SkLightingImageFilter::InitializeFlattenables(); 126 } 127