OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 virtual bool operator==(const FilterOperation&) const = 0; | 92 virtual bool operator==(const FilterOperation&) const = 0; |
93 bool operator!=(const FilterOperation& o) const { return !(*this == o); } | 93 bool operator!=(const FilterOperation& o) const { return !(*this == o); } |
94 | 94 |
95 OperationType type() const { return m_type; } | 95 OperationType type() const { return m_type; } |
96 virtual bool isSameType(const FilterOperation& o) const { | 96 virtual bool isSameType(const FilterOperation& o) const { |
97 return o.type() == m_type; | 97 return o.type() == m_type; |
98 } | 98 } |
99 | 99 |
100 // True if the alpha channel of any pixel can change under this operation. | 100 // True if the alpha channel of any pixel can change under this operation. |
101 virtual bool affectsOpacity() const { return false; } | 101 virtual bool affectsOpacity() const { return false; } |
102 // True if the the value of one pixel can affect the value of another pixel un
der this operation, such as blur. | 102 // True if the the value of one pixel can affect the value of another pixel |
| 103 // under this operation, such as blur. |
103 virtual bool movesPixels() const { return false; } | 104 virtual bool movesPixels() const { return false; } |
104 | 105 |
105 // Maps "forward" to determine which pixels in a destination rect are | 106 // Maps "forward" to determine which pixels in a destination rect are |
106 // affected by pixels in the source rect. | 107 // affected by pixels in the source rect. |
107 // See also FilterEffect::mapRect. | 108 // See also FilterEffect::mapRect. |
108 virtual FloatRect mapRect(const FloatRect& rect) const { return rect; } | 109 virtual FloatRect mapRect(const FloatRect& rect) const { return rect; } |
109 | 110 |
110 protected: | 111 protected: |
111 FilterOperation(OperationType type) : m_type(type) {} | 112 FilterOperation(OperationType type) : m_type(type) {} |
112 | 113 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 ReferenceFilterOperation(const String& url, const AtomicString& fragment) | 160 ReferenceFilterOperation(const String& url, const AtomicString& fragment) |
160 : FilterOperation(REFERENCE), m_url(url), m_fragment(fragment) {} | 161 : FilterOperation(REFERENCE), m_url(url), m_fragment(fragment) {} |
161 | 162 |
162 String m_url; | 163 String m_url; |
163 AtomicString m_fragment; | 164 AtomicString m_fragment; |
164 Member<Filter> m_filter; | 165 Member<Filter> m_filter; |
165 }; | 166 }; |
166 | 167 |
167 DEFINE_FILTER_OPERATION_TYPE_CASTS(ReferenceFilterOperation, REFERENCE); | 168 DEFINE_FILTER_OPERATION_TYPE_CASTS(ReferenceFilterOperation, REFERENCE); |
168 | 169 |
169 // GRAYSCALE, SEPIA, SATURATE and HUE_ROTATE are variations on a basic color mat
rix effect. | 170 // GRAYSCALE, SEPIA, SATURATE and HUE_ROTATE are variations on a basic color |
170 // For HUE_ROTATE, the angle of rotation is stored in m_amount. | 171 // matrix effect. For HUE_ROTATE, the angle of rotation is stored in m_amount. |
171 class CORE_EXPORT BasicColorMatrixFilterOperation : public FilterOperation { | 172 class CORE_EXPORT BasicColorMatrixFilterOperation : public FilterOperation { |
172 public: | 173 public: |
173 static BasicColorMatrixFilterOperation* create(double amount, | 174 static BasicColorMatrixFilterOperation* create(double amount, |
174 OperationType type) { | 175 OperationType type) { |
175 return new BasicColorMatrixFilterOperation(amount, type); | 176 return new BasicColorMatrixFilterOperation(amount, type); |
176 } | 177 } |
177 | 178 |
178 double amount() const { return m_amount; } | 179 double amount() const { return m_amount; } |
179 | 180 |
180 private: | 181 private: |
(...skipping 20 matching lines...) Expand all Loading... |
201 type == FilterOperation::SATURATE || | 202 type == FilterOperation::SATURATE || |
202 type == FilterOperation::HUE_ROTATE; | 203 type == FilterOperation::HUE_ROTATE; |
203 } | 204 } |
204 | 205 |
205 DEFINE_TYPE_CASTS(BasicColorMatrixFilterOperation, | 206 DEFINE_TYPE_CASTS(BasicColorMatrixFilterOperation, |
206 FilterOperation, | 207 FilterOperation, |
207 op, | 208 op, |
208 isBasicColorMatrixFilterOperation(*op), | 209 isBasicColorMatrixFilterOperation(*op), |
209 isBasicColorMatrixFilterOperation(op)); | 210 isBasicColorMatrixFilterOperation(op)); |
210 | 211 |
211 // INVERT, BRIGHTNESS, CONTRAST and OPACITY are variations on a basic component
transfer effect. | 212 // INVERT, BRIGHTNESS, CONTRAST and OPACITY are variations on a basic component |
| 213 // transfer effect. |
212 class CORE_EXPORT BasicComponentTransferFilterOperation | 214 class CORE_EXPORT BasicComponentTransferFilterOperation |
213 : public FilterOperation { | 215 : public FilterOperation { |
214 public: | 216 public: |
215 static BasicComponentTransferFilterOperation* create(double amount, | 217 static BasicComponentTransferFilterOperation* create(double amount, |
216 OperationType type) { | 218 OperationType type) { |
217 return new BasicComponentTransferFilterOperation(amount, type); | 219 return new BasicComponentTransferFilterOperation(amount, type); |
218 } | 220 } |
219 | 221 |
220 double amount() const { return m_amount; } | 222 double amount() const { return m_amount; } |
221 | 223 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 BoxReflectFilterOperation(const BoxReflection& reflection) | 350 BoxReflectFilterOperation(const BoxReflection& reflection) |
349 : FilterOperation(BOX_REFLECT), m_reflection(reflection) {} | 351 : FilterOperation(BOX_REFLECT), m_reflection(reflection) {} |
350 | 352 |
351 BoxReflection m_reflection; | 353 BoxReflection m_reflection; |
352 }; | 354 }; |
353 DEFINE_FILTER_OPERATION_TYPE_CASTS(BoxReflectFilterOperation, BOX_REFLECT); | 355 DEFINE_FILTER_OPERATION_TYPE_CASTS(BoxReflectFilterOperation, BOX_REFLECT); |
354 | 356 |
355 } // namespace blink | 357 } // namespace blink |
356 | 358 |
357 #endif // FilterOperation_h | 359 #endif // FilterOperation_h |
OLD | NEW |