OLD | NEW |
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 FilterEffectVector& inputEffects() { return m_inputEffects; } | 59 FilterEffectVector& inputEffects() { return m_inputEffects; } |
60 FilterEffect* inputEffect(unsigned) const; | 60 FilterEffect* inputEffect(unsigned) const; |
61 unsigned numberOfEffectInputs() const { return m_inputEffects.size(); } | 61 unsigned numberOfEffectInputs() const { return m_inputEffects.size(); } |
62 | 62 |
63 inline bool hasImageFilter() const | 63 inline bool hasImageFilter() const |
64 { | 64 { |
65 return m_imageFilters[0] || m_imageFilters[1] || m_imageFilters[2] || m_
imageFilters[3]; | 65 return m_imageFilters[0] || m_imageFilters[1] || m_imageFilters[2] || m_
imageFilters[3]; |
66 } | 66 } |
67 | 67 |
68 IntRect absolutePaintRect() const { return m_absolutePaintRect; } | |
69 | |
70 // Clipped primitive subregion in the coordinate space of the target. | 68 // Clipped primitive subregion in the coordinate space of the target. |
71 FloatRect absoluteBounds() const; | 69 FloatRect absoluteBounds() const; |
72 | 70 |
73 virtual sk_sp<SkImageFilter> createImageFilter(); | 71 virtual sk_sp<SkImageFilter> createImageFilter(); |
74 virtual sk_sp<SkImageFilter> createImageFilterWithoutValidation(); | 72 virtual sk_sp<SkImageFilter> createImageFilterWithoutValidation(); |
75 | 73 |
76 // Mapping a rect forwards determines which which destination pixels a | 74 // Mapping a rect forwards determines which which destination pixels a |
77 // given source rect would affect. Mapping a rect backwards determines | 75 // given source rect would affect. Mapping a rect backwards determines |
78 // which pixels from the source rect would be required to fill a given | 76 // which pixels from the source rect would be required to fill a given |
79 // destination rect. Note that these are not necessarily the inverse of | 77 // destination rect. Note that these are not necessarily the inverse of |
(...skipping 19 matching lines...) Expand all Loading... |
99 | 97 |
100 Filter* getFilter() { return m_filter; } | 98 Filter* getFilter() { return m_filter; } |
101 const Filter* getFilter() const { return m_filter; } | 99 const Filter* getFilter() const { return m_filter; } |
102 | 100 |
103 bool clipsToBounds() const { return m_clipsToBounds; } | 101 bool clipsToBounds() const { return m_clipsToBounds; } |
104 void setClipsToBounds(bool value) { m_clipsToBounds = value; } | 102 void setClipsToBounds(bool value) { m_clipsToBounds = value; } |
105 | 103 |
106 ColorSpace operatingColorSpace() const { return m_operatingColorSpace; } | 104 ColorSpace operatingColorSpace() const { return m_operatingColorSpace; } |
107 virtual void setOperatingColorSpace(ColorSpace colorSpace) { m_operatingColo
rSpace = colorSpace; } | 105 virtual void setOperatingColorSpace(ColorSpace colorSpace) { m_operatingColo
rSpace = colorSpace; } |
108 | 106 |
109 virtual FloatRect determineAbsolutePaintRect(const FloatRect& requestedAbsol
uteRect); | 107 // Compute the "paint rect" (which destination pixels will be affected) for |
110 virtual bool affectsTransparentPixels() { return false; } | 108 // the given rect. In the coordinate space of the target. |
| 109 virtual FloatRect determineAbsolutePaintRect(const FloatRect& requestedAbsol
uteRect) const; |
| 110 virtual bool affectsTransparentPixels() const { return false; } |
111 | 111 |
112 // Return false if the filter will only operate correctly on valid RGBA valu
es, with | 112 // Return false if the filter will only operate correctly on valid RGBA valu
es, with |
113 // alpha in [0,255] and each color component in [0, alpha]. | 113 // alpha in [0,255] and each color component in [0, alpha]. |
114 virtual bool mayProduceInvalidPreMultipliedPixels() { return false; } | 114 virtual bool mayProduceInvalidPreMultipliedPixels() { return false; } |
115 | 115 |
116 SkImageFilter* getImageFilter(ColorSpace, bool requiresPMColorValidation) co
nst; | 116 SkImageFilter* getImageFilter(ColorSpace, bool requiresPMColorValidation) co
nst; |
117 void setImageFilter(ColorSpace, bool requiresPMColorValidation, sk_sp<SkImag
eFilter>); | 117 void setImageFilter(ColorSpace, bool requiresPMColorValidation, sk_sp<SkImag
eFilter>); |
118 | 118 |
119 bool originTainted() const { return m_originTainted; } | 119 bool originTainted() const { return m_originTainted; } |
120 void setOriginTainted() { m_originTainted = true; } | 120 void setOriginTainted() { m_originTainted = true; } |
121 | 121 |
122 bool inputsTaintOrigin() const; | 122 bool inputsTaintOrigin() const; |
123 | 123 |
124 protected: | 124 protected: |
125 FilterEffect(Filter*); | 125 FilterEffect(Filter*); |
126 | 126 |
127 sk_sp<SkImageFilter> createTransparentBlack() const; | 127 sk_sp<SkImageFilter> createTransparentBlack() const; |
128 | 128 |
129 Color adaptColorToOperatingColorSpace(const Color& deviceColor); | 129 Color adaptColorToOperatingColorSpace(const Color& deviceColor); |
130 | 130 |
131 SkImageFilter::CropRect getCropRect() const; | 131 SkImageFilter::CropRect getCropRect() const; |
132 | 132 |
133 void addAbsolutePaintRect(const FloatRect& absolutePaintRect); | |
134 | |
135 private: | 133 private: |
136 FilterEffectVector m_inputEffects; | 134 FilterEffectVector m_inputEffects; |
137 | 135 |
138 IntRect m_absolutePaintRect; | |
139 | |
140 Member<Filter> m_filter; | 136 Member<Filter> m_filter; |
141 | 137 |
142 // The following member variables are SVG specific and will move to LayoutSV
GResourceFilterPrimitive. | 138 // The following member variables are SVG specific and will move to LayoutSV
GResourceFilterPrimitive. |
143 // See bug https://bugs.webkit.org/show_bug.cgi?id=45614. | 139 // See bug https://bugs.webkit.org/show_bug.cgi?id=45614. |
144 | 140 |
145 // The subregion of a filter primitive according to the SVG Filter specifica
tion in local coordinates. | 141 // The subregion of a filter primitive according to the SVG Filter specifica
tion in local coordinates. |
146 // This is SVG specific and needs to move to LayoutSVGResourceFilterPrimitiv
e. | 142 // This is SVG specific and needs to move to LayoutSVGResourceFilterPrimitiv
e. |
147 FloatRect m_filterPrimitiveSubregion; | 143 FloatRect m_filterPrimitiveSubregion; |
148 | 144 |
149 // Should the effect clip to its primitive region, or expand to use the comb
ined region of its inputs. | 145 // Should the effect clip to its primitive region, or expand to use the comb
ined region of its inputs. |
150 bool m_clipsToBounds; | 146 bool m_clipsToBounds; |
151 | 147 |
152 bool m_originTainted; | 148 bool m_originTainted; |
153 | 149 |
154 ColorSpace m_operatingColorSpace; | 150 ColorSpace m_operatingColorSpace; |
155 | 151 |
156 sk_sp<SkImageFilter> m_imageFilters[4]; | 152 sk_sp<SkImageFilter> m_imageFilters[4]; |
157 }; | 153 }; |
158 | 154 |
159 } // namespace blink | 155 } // namespace blink |
160 | 156 |
161 #endif // FilterEffect_h | 157 #endif // FilterEffect_h |
OLD | NEW |