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