OLD | NEW |
| (Empty) |
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 "SkTypes.h" | |
9 | |
10 #include "SkBitmapProcShader.h" | |
11 #include "SkMallocPixelRef.h" | |
12 #include "SkPathEffect.h" | |
13 #include "SkPixelRef.h" | |
14 #include "SkXfermode.h" | |
15 | |
16 #include "Sk1DPathEffect.h" | |
17 #include "Sk2DPathEffect.h" | |
18 #include "SkAlphaThresholdFilter.h" | |
19 #include "SkArithmeticMode.h" | |
20 #include "SkArcToPathEffect.h" | |
21 #include "SkBitmapSourceDeserializer.h" | |
22 #include "SkBlurDrawLooper.h" | |
23 #include "SkBlurImageFilter.h" | |
24 #include "SkBlurMaskFilter.h" | |
25 #include "SkColorCubeFilter.h" | |
26 #include "SkColorFilter.h" | |
27 #include "SkColorFilterImageFilter.h" | |
28 #include "SkColorFilterShader.h" | |
29 #include "SkColorMatrixFilter.h" | |
30 #include "SkColorShader.h" | |
31 #include "SkComposeImageFilter.h" | |
32 #include "SkComposeShader.h" | |
33 #include "SkCornerPathEffect.h" | |
34 #include "SkDashPathEffect.h" | |
35 #include "SkDiscretePathEffect.h" | |
36 #include "SkDisplacementMapEffect.h" | |
37 #include "SkDropShadowImageFilter.h" | |
38 #include "SkEmptyShader.h" | |
39 #include "SkEmbossMaskFilter.h" | |
40 #include "SkFlattenable.h" | |
41 #include "SkGradientShader.h" | |
42 #include "SkImageShader.h" | |
43 #include "SkImageSource.h" | |
44 #include "SkLayerDrawLooper.h" | |
45 #include "SkLayerRasterizer.h" | |
46 #include "SkLerpXfermode.h" | |
47 #include "SkLightingImageFilter.h" | |
48 #include "SkLightingShader.h" | |
49 #include "SkLocalMatrixShader.h" | |
50 #include "SkLumaColorFilter.h" | |
51 #include "SkMagnifierImageFilter.h" | |
52 #include "SkMatrixConvolutionImageFilter.h" | |
53 #include "SkMergeImageFilter.h" | |
54 #include "SkMorphologyImageFilter.h" | |
55 #include "SkOffsetImageFilter.h" | |
56 #include "SkOnce.h" | |
57 #include "SkPaintImageFilter.h" | |
58 #include "SkPerlinNoiseShader.h" | |
59 #include "SkPictureImageFilter.h" | |
60 #include "SkPictureShader.h" | |
61 #include "SkPixelXorXfermode.h" | |
62 #include "SkTableColorFilter.h" | |
63 #include "SkTestImageFilters.h" | |
64 #include "SkTileImageFilter.h" | |
65 #include "SkMatrixImageFilter.h" | |
66 #include "SkXfermodeImageFilter.h" | |
67 | |
68 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
69 // | |
70 // Adding new classes to Init() below has security consequences in Chrome. | |
71 // | |
72 // In particular, it is important that we don't create code paths that | |
73 // deserialize untrusted data as SkImageFilters; SkImageFilters are sent from | |
74 // Chrome renderers (untrusted) to the main (trusted) process. | |
75 // | |
76 // If you add a new SkImageFilter here _or_ other effect that can be part of | |
77 // an SkImageFilter, it's a good idea to have chrome-security@google.com sign | |
78 // off on the CL, and at minimum extend SampleFilterFuzz.cpp to fuzz it. | |
79 // | |
80 // SkPictures are untrusted data. Please be extremely careful not to allow | |
81 // SkPictures created in a Chrome renderer to be deserialized in the main proce
ss. | |
82 // | |
83 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
84 | |
85 class SkPrivateEffectInitializer { | |
86 public: | |
87 static void Init() { | |
88 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArcToPathEffect) | |
89 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapProcShader) | |
90 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapSourceDeserializer) | |
91 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurDrawLooper) | |
92 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurImageFilter) | |
93 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorCubeFilter) | |
94 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorFilterShader) | |
95 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorMatrixFilter) | |
96 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorShader) | |
97 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposePathEffect) | |
98 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeShader) | |
99 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkCornerPathEffect) | |
100 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDashPathEffect) | |
101 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDilateImageFilter) | |
102 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiscretePathEffect) | |
103 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDisplacementMapEffect) | |
104 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDropShadowImageFilter) | |
105 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmbossMaskFilter) | |
106 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmptyShader) | |
107 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkErodeImageFilter) | |
108 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageShader) | |
109 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageSource) | |
110 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerDrawLooper) | |
111 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerRasterizer) | |
112 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLerpXfermode) | |
113 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLocalMatrixShader) | |
114 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLumaColorFilter) | |
115 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath1DPathEffect) | |
116 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLine2DPathEffect) | |
117 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPaintImageFilter) | |
118 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath2DPathEffect) | |
119 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPerlinNoiseShader) | |
120 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPictureImageFilter) | |
121 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPictureShader) | |
122 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPixelXorXfermode) | |
123 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSumPathEffect) | |
124 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTileImageFilter) | |
125 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMatrixImageFilter) | |
126 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkXfermodeImageFilter) | |
127 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMagnifierImageFilter) | |
128 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMatrixConvolutionImageFilter) | |
129 | |
130 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkOffsetImageFilter) | |
131 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeImageFilter) | |
132 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMergeImageFilter) | |
133 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorFilterImageFilter) | |
134 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDownSampleImageFilter) | |
135 | |
136 SkAlphaThresholdFilter::InitializeFlattenables(); | |
137 SkArithmeticMode::InitializeFlattenables(); | |
138 SkBlurMaskFilter::InitializeFlattenables(); | |
139 SkColorFilter::InitializeFlattenables(); | |
140 SkGradientShader::InitializeFlattenables(); | |
141 SkLightingImageFilter::InitializeFlattenables(); | |
142 SkLightingShader::InitializeFlattenables(); | |
143 SkTableColorFilter::InitializeFlattenables(); | |
144 SkXfermode::InitializeFlattenables(); | |
145 } | |
146 }; | |
147 | |
148 SK_DECLARE_STATIC_ONCE(once); | |
149 void SkFlattenable::InitializeFlattenablesIfNeeded() { | |
150 SkOnce(&once, SkPrivateEffectInitializer::Init); | |
151 } | |
OLD | NEW |