Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: Source/platform/graphics/filters/FilterEffect.h

Issue 1097053004: Drop some dead code from FilterEffect (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> 2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 * Copyright (C) 2013 Google Inc. All rights reserved. 5 * Copyright (C) 2013 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 }; 59 };
60 60
61 typedef int DetermineSubregionFlags; 61 typedef int DetermineSubregionFlags;
62 62
63 class PLATFORM_EXPORT FilterEffect : public RefCountedWillBeGarbageCollectedFina lized<FilterEffect> { 63 class PLATFORM_EXPORT FilterEffect : public RefCountedWillBeGarbageCollectedFina lized<FilterEffect> {
64 public: 64 public:
65 virtual ~FilterEffect(); 65 virtual ~FilterEffect();
66 DECLARE_VIRTUAL_TRACE(); 66 DECLARE_VIRTUAL_TRACE();
67 67
68 void clearResult(); 68 void clearResult();
69 void clearResultsRecursive();
70 69
71 FilterEffectVector& inputEffects() { return m_inputEffects; } 70 FilterEffectVector& inputEffects() { return m_inputEffects; }
72 FilterEffect* inputEffect(unsigned) const; 71 FilterEffect* inputEffect(unsigned) const;
73 unsigned numberOfEffectInputs() const { return m_inputEffects.size(); } 72 unsigned numberOfEffectInputs() const { return m_inputEffects.size(); }
74 73
75 inline bool hasImageFilter() const 74 inline bool hasImageFilter() const
76 { 75 {
77 return m_imageFilters[0] || m_imageFilters[1] || m_imageFilters[2] || m_ imageFilters[3]; 76 return m_imageFilters[0] || m_imageFilters[1] || m_imageFilters[2] || m_ imageFilters[3];
78 } 77 }
79 78
80 // Solid black image with different alpha values.
81 bool isAlphaImage() const { return m_alphaImage; }
82 void setIsAlphaImage(bool alphaImage) { m_alphaImage = alphaImage; }
83
84 IntRect absolutePaintRect() const { return m_absolutePaintRect; } 79 IntRect absolutePaintRect() const { return m_absolutePaintRect; }
85 80
86 FloatRect maxEffectRect() const { return m_maxEffectRect; } 81 FloatRect maxEffectRect() const { return m_maxEffectRect; }
87 void setMaxEffectRect(const FloatRect& maxEffectRect) { m_maxEffectRect = ma xEffectRect; } 82 void setMaxEffectRect(const FloatRect& maxEffectRect) { m_maxEffectRect = ma xEffectRect; }
88 83
89 virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) ; 84 virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) ;
90 virtual PassRefPtr<SkImageFilter> createImageFilterWithoutValidation(SkiaIma geFilterBuilder*); 85 virtual PassRefPtr<SkImageFilter> createImageFilterWithoutValidation(SkiaIma geFilterBuilder*);
91 86
92 // Mapping a rect forwards determines which which destination pixels a 87 // Mapping a rect forwards determines which which destination pixels a
93 // given source rect would affect. Mapping a rect backwards determines 88 // given source rect would affect. Mapping a rect backwards determines
94 // which pixels from the source rect would be required to fill a given 89 // which pixels from the source rect would be required to fill a given
95 // destination rect. Note that these are not necessarily the inverse of 90 // destination rect. Note that these are not necessarily the inverse of
96 // each other. For example, for FEGaussianBlur, they are the same 91 // each other. For example, for FEGaussianBlur, they are the same
97 // transformation. 92 // transformation.
98 virtual FloatRect mapRect(const FloatRect& rect, bool forward = true) { retu rn rect; } 93 virtual FloatRect mapRect(const FloatRect& rect, bool forward = true) { retu rn rect; }
99 // A version of the above that is used for calculating paint rects. We can't 94 // A version of the above that is used for calculating paint rects. We can't
100 // use mapRect above for that, because that is also used for calculating eff ect 95 // use mapRect above for that, because that is also used for calculating eff ect
101 // regions for CSS filters and has undesirable effects for tile and 96 // regions for CSS filters and has undesirable effects for tile and
102 // displacement map. 97 // displacement map.
103 virtual FloatRect mapPaintRect(const FloatRect& rect, bool forward) 98 virtual FloatRect mapPaintRect(const FloatRect& rect, bool forward)
104 { 99 {
105 return mapRect(rect, forward); 100 return mapRect(rect, forward);
106 } 101 }
107 FloatRect mapRectRecursive(const FloatRect&); 102 FloatRect mapRectRecursive(const FloatRect&);
108 103
109 // This is a recursive version of a backwards mapRect(), which also takes
110 // into account the filter primitive subregion of each effect.
111 // Note: This works in absolute coordinates!
112 FloatRect getSourceRect(const FloatRect& destRect, const FloatRect& clipRect );
113
114 virtual FilterEffectType filterEffectType() const { return FilterEffectTypeU nknown; } 104 virtual FilterEffectType filterEffectType() const { return FilterEffectTypeU nknown; }
115 105
116 virtual TextStream& externalRepresentation(TextStream&, int indention = 0) c onst; 106 virtual TextStream& externalRepresentation(TextStream&, int indention = 0) c onst;
117 107
118 // The following functions are SVG specific and will move to LayoutSVGResour ceFilterPrimitive. 108 // The following functions are SVG specific and will move to LayoutSVGResour ceFilterPrimitive.
119 // See bug https://bugs.webkit.org/show_bug.cgi?id=45614. 109 // See bug https://bugs.webkit.org/show_bug.cgi?id=45614.
120 bool hasX() const { return m_hasX; } 110 bool hasX() const { return m_hasX; }
121 void setHasX(bool value) { m_hasX = value; } 111 void setHasX(bool value) { m_hasX = value; }
122 112
123 bool hasY() const { return m_hasY; } 113 bool hasY() const { return m_hasY; }
(...skipping 12 matching lines...) Expand all
136 void setEffectBoundaries(const FloatRect& effectBoundaries) { m_effectBounda ries = effectBoundaries; } 126 void setEffectBoundaries(const FloatRect& effectBoundaries) { m_effectBounda ries = effectBoundaries; }
137 127
138 Filter* filter() { return m_filter; } 128 Filter* filter() { return m_filter; }
139 const Filter* filter() const { return m_filter; } 129 const Filter* filter() const { return m_filter; }
140 130
141 bool clipsToBounds() const { return m_clipsToBounds; } 131 bool clipsToBounds() const { return m_clipsToBounds; }
142 void setClipsToBounds(bool value) { m_clipsToBounds = value; } 132 void setClipsToBounds(bool value) { m_clipsToBounds = value; }
143 133
144 ColorSpace operatingColorSpace() const { return m_operatingColorSpace; } 134 ColorSpace operatingColorSpace() const { return m_operatingColorSpace; }
145 virtual void setOperatingColorSpace(ColorSpace colorSpace) { m_operatingColo rSpace = colorSpace; } 135 virtual void setOperatingColorSpace(ColorSpace colorSpace) { m_operatingColo rSpace = colorSpace; }
146 ColorSpace resultColorSpace() const { return m_resultColorSpace; }
147 virtual void setResultColorSpace(ColorSpace colorSpace) { m_resultColorSpace = colorSpace; }
148 136
149 FloatRect determineFilterPrimitiveSubregion(DetermineSubregionFlags = Determ ineSubregionNone); 137 FloatRect determineFilterPrimitiveSubregion(DetermineSubregionFlags = Determ ineSubregionNone);
150 void determineAllAbsolutePaintRects();
151 138
152 virtual FloatRect determineAbsolutePaintRect(const FloatRect& requestedAbsol uteRect); 139 virtual FloatRect determineAbsolutePaintRect(const FloatRect& requestedAbsol uteRect);
153 virtual bool affectsTransparentPixels() { return false; } 140 virtual bool affectsTransparentPixels() { return false; }
154 141
155 // Return false if the filter will only operate correctly on valid RGBA valu es, with 142 // Return false if the filter will only operate correctly on valid RGBA valu es, with
156 // alpha in [0,255] and each color component in [0, alpha]. 143 // alpha in [0,255] and each color component in [0, alpha].
157 virtual bool mayProduceInvalidPreMultipliedPixels() { return false; } 144 virtual bool mayProduceInvalidPreMultipliedPixels() { return false; }
158 145
159 SkImageFilter* getImageFilter(ColorSpace, bool requiresPMColorValidation) co nst; 146 SkImageFilter* getImageFilter(ColorSpace, bool requiresPMColorValidation) co nst;
160 void setImageFilter(ColorSpace, bool requiresPMColorValidation, PassRefPtr<S kImageFilter>); 147 void setImageFilter(ColorSpace, bool requiresPMColorValidation, PassRefPtr<S kImageFilter>);
161 148
162 protected: 149 protected:
163 FilterEffect(Filter*); 150 FilterEffect(Filter*);
164 151
165 Color adaptColorToOperatingColorSpace(const Color& deviceColor); 152 Color adaptColorToOperatingColorSpace(const Color& deviceColor);
166 153
167 SkImageFilter::CropRect getCropRect(const FloatSize& cropOffset) const; 154 SkImageFilter::CropRect getCropRect(const FloatSize& cropOffset) const;
168 155
169 void addAbsolutePaintRect(const FloatRect& absolutePaintRect); 156 void addAbsolutePaintRect(const FloatRect& absolutePaintRect);
170 157
171 private: 158 private:
172 FilterEffectVector m_inputEffects; 159 FilterEffectVector m_inputEffects;
173 160
174 bool m_alphaImage;
175
176 IntRect m_absolutePaintRect; 161 IntRect m_absolutePaintRect;
177 162
178 // The maximum size of a filter primitive. In SVG this is the primitive subr egion in absolute coordinate space. 163 // The maximum size of a filter primitive. In SVG this is the primitive subr egion in absolute coordinate space.
179 // The absolute paint rect should never be bigger than m_maxEffectRect. 164 // The absolute paint rect should never be bigger than m_maxEffectRect.
180 FloatRect m_maxEffectRect; 165 FloatRect m_maxEffectRect;
181 RawPtrWillBeMember<Filter> m_filter; 166 RawPtrWillBeMember<Filter> m_filter;
182 167
183 // The following member variables are SVG specific and will move to LayoutSV GResourceFilterPrimitive. 168 // The following member variables are SVG specific and will move to LayoutSV GResourceFilterPrimitive.
184 // See bug https://bugs.webkit.org/show_bug.cgi?id=45614. 169 // See bug https://bugs.webkit.org/show_bug.cgi?id=45614.
185 170
186 // The subregion of a filter primitive according to the SVG Filter specifica tion in local coordinates. 171 // The subregion of a filter primitive according to the SVG Filter specifica tion in local coordinates.
187 // This is SVG specific and needs to move to LayoutSVGResourceFilterPrimitiv e. 172 // This is SVG specific and needs to move to LayoutSVGResourceFilterPrimitiv e.
188 FloatRect m_filterPrimitiveSubregion; 173 FloatRect m_filterPrimitiveSubregion;
189 174
190 // x, y, width and height of the actual SVGFE*Element. Is needed to determin e the subregion of the 175 // x, y, width and height of the actual SVGFE*Element. Is needed to determin e the subregion of the
191 // filter primitive on a later step. 176 // filter primitive on a later step.
192 FloatRect m_effectBoundaries; 177 FloatRect m_effectBoundaries;
193 bool m_hasX; 178 bool m_hasX;
194 bool m_hasY; 179 bool m_hasY;
195 bool m_hasWidth; 180 bool m_hasWidth;
196 bool m_hasHeight; 181 bool m_hasHeight;
197 182
198 // Should the effect clip to its primitive region, or expand to use the comb ined region of its inputs. 183 // Should the effect clip to its primitive region, or expand to use the comb ined region of its inputs.
199 bool m_clipsToBounds; 184 bool m_clipsToBounds;
200 185
201 ColorSpace m_operatingColorSpace; 186 ColorSpace m_operatingColorSpace;
202 ColorSpace m_resultColorSpace;
203 187
204 RefPtr<SkImageFilter> m_imageFilters[4]; 188 RefPtr<SkImageFilter> m_imageFilters[4];
205 }; 189 };
206 190
207 } // namespace blink 191 } // namespace blink
208 192
209 #endif // FilterEffect_h 193 #endif // FilterEffect_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698