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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 #define DEFINE_FILTER_OPERATION_TYPE_CASTS(thisType, operationType) \ | 109 #define DEFINE_FILTER_OPERATION_TYPE_CASTS(thisType, operationType) \ |
110 DEFINE_TYPE_CASTS(thisType, FilterOperation, op, op->type() == FilterOperati
on::operationType, op.type() == FilterOperation::operationType); | 110 DEFINE_TYPE_CASTS(thisType, FilterOperation, op, op->type() == FilterOperati
on::operationType, op.type() == FilterOperation::operationType); |
111 | 111 |
112 class PLATFORM_EXPORT ReferenceFilterOperation : public FilterOperation { | 112 class PLATFORM_EXPORT ReferenceFilterOperation : public FilterOperation { |
113 public: | 113 public: |
114 static PassRefPtr<ReferenceFilterOperation> create(const String& url, const
AtomicString& fragment) | 114 static PassRefPtr<ReferenceFilterOperation> create(const String& url, const
AtomicString& fragment) |
115 { | 115 { |
116 return adoptRef(new ReferenceFilterOperation(url, fragment)); | 116 return adoptRef(new ReferenceFilterOperation(url, fragment)); |
117 } | 117 } |
118 | 118 |
119 virtual bool affectsOpacity() const OVERRIDE { return true; } | 119 virtual bool affectsOpacity() const override { return true; } |
120 virtual bool movesPixels() const OVERRIDE { return true; } | 120 virtual bool movesPixels() const override { return true; } |
121 | 121 |
122 const String& url() const { return m_url; } | 122 const String& url() const { return m_url; } |
123 const AtomicString& fragment() const { return m_fragment; } | 123 const AtomicString& fragment() const { return m_fragment; } |
124 | 124 |
125 ReferenceFilter* filter() const { return m_filter.get(); } | 125 ReferenceFilter* filter() const { return m_filter.get(); } |
126 void setFilter(PassRefPtr<ReferenceFilter> filter) { m_filter = filter; } | 126 void setFilter(PassRefPtr<ReferenceFilter> filter) { m_filter = filter; } |
127 | 127 |
128 private: | 128 private: |
129 virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, doubl
e progress) const OVERRIDE | 129 virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, doubl
e progress) const override |
130 { | 130 { |
131 ASSERT_NOT_REACHED(); | 131 ASSERT_NOT_REACHED(); |
132 return nullptr; | 132 return nullptr; |
133 } | 133 } |
134 | 134 |
135 virtual bool operator==(const FilterOperation& o) const OVERRIDE | 135 virtual bool operator==(const FilterOperation& o) const override |
136 { | 136 { |
137 if (!isSameType(o)) | 137 if (!isSameType(o)) |
138 return false; | 138 return false; |
139 const ReferenceFilterOperation* other = static_cast<const ReferenceFilte
rOperation*>(&o); | 139 const ReferenceFilterOperation* other = static_cast<const ReferenceFilte
rOperation*>(&o); |
140 return m_url == other->m_url; | 140 return m_url == other->m_url; |
141 } | 141 } |
142 | 142 |
143 ReferenceFilterOperation(const String& url, const AtomicString& fragment) | 143 ReferenceFilterOperation(const String& url, const AtomicString& fragment) |
144 : FilterOperation(REFERENCE) | 144 : FilterOperation(REFERENCE) |
145 , m_url(url) | 145 , m_url(url) |
(...skipping 14 matching lines...) Expand all Loading... |
160 public: | 160 public: |
161 static PassRefPtr<BasicColorMatrixFilterOperation> create(double amount, Ope
rationType type) | 161 static PassRefPtr<BasicColorMatrixFilterOperation> create(double amount, Ope
rationType type) |
162 { | 162 { |
163 return adoptRef(new BasicColorMatrixFilterOperation(amount, type)); | 163 return adoptRef(new BasicColorMatrixFilterOperation(amount, type)); |
164 } | 164 } |
165 | 165 |
166 double amount() const { return m_amount; } | 166 double amount() const { return m_amount; } |
167 | 167 |
168 | 168 |
169 private: | 169 private: |
170 virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, doubl
e progress) const OVERRIDE; | 170 virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, doubl
e progress) const override; |
171 virtual bool operator==(const FilterOperation& o) const OVERRIDE | 171 virtual bool operator==(const FilterOperation& o) const override |
172 { | 172 { |
173 if (!isSameType(o)) | 173 if (!isSameType(o)) |
174 return false; | 174 return false; |
175 const BasicColorMatrixFilterOperation* other = static_cast<const BasicCo
lorMatrixFilterOperation*>(&o); | 175 const BasicColorMatrixFilterOperation* other = static_cast<const BasicCo
lorMatrixFilterOperation*>(&o); |
176 return m_amount == other->m_amount; | 176 return m_amount == other->m_amount; |
177 } | 177 } |
178 | 178 |
179 BasicColorMatrixFilterOperation(double amount, OperationType type) | 179 BasicColorMatrixFilterOperation(double amount, OperationType type) |
180 : FilterOperation(type) | 180 : FilterOperation(type) |
181 , m_amount(amount) | 181 , m_amount(amount) |
(...skipping 14 matching lines...) Expand all Loading... |
196 // INVERT, BRIGHTNESS, CONTRAST and OPACITY are variations on a basic component
transfer effect. | 196 // INVERT, BRIGHTNESS, CONTRAST and OPACITY are variations on a basic component
transfer effect. |
197 class PLATFORM_EXPORT BasicComponentTransferFilterOperation : public FilterOpera
tion { | 197 class PLATFORM_EXPORT BasicComponentTransferFilterOperation : public FilterOpera
tion { |
198 public: | 198 public: |
199 static PassRefPtr<BasicComponentTransferFilterOperation> create(double amoun
t, OperationType type) | 199 static PassRefPtr<BasicComponentTransferFilterOperation> create(double amoun
t, OperationType type) |
200 { | 200 { |
201 return adoptRef(new BasicComponentTransferFilterOperation(amount, type))
; | 201 return adoptRef(new BasicComponentTransferFilterOperation(amount, type))
; |
202 } | 202 } |
203 | 203 |
204 double amount() const { return m_amount; } | 204 double amount() const { return m_amount; } |
205 | 205 |
206 virtual bool affectsOpacity() const OVERRIDE { return m_type == OPACITY; } | 206 virtual bool affectsOpacity() const override { return m_type == OPACITY; } |
207 | 207 |
208 | 208 |
209 private: | 209 private: |
210 virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, doubl
e progress) const OVERRIDE; | 210 virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, doubl
e progress) const override; |
211 virtual bool operator==(const FilterOperation& o) const OVERRIDE | 211 virtual bool operator==(const FilterOperation& o) const override |
212 { | 212 { |
213 if (!isSameType(o)) | 213 if (!isSameType(o)) |
214 return false; | 214 return false; |
215 const BasicComponentTransferFilterOperation* other = static_cast<const B
asicComponentTransferFilterOperation*>(&o); | 215 const BasicComponentTransferFilterOperation* other = static_cast<const B
asicComponentTransferFilterOperation*>(&o); |
216 return m_amount == other->m_amount; | 216 return m_amount == other->m_amount; |
217 } | 217 } |
218 | 218 |
219 BasicComponentTransferFilterOperation(double amount, OperationType type) | 219 BasicComponentTransferFilterOperation(double amount, OperationType type) |
220 : FilterOperation(type) | 220 : FilterOperation(type) |
221 , m_amount(amount) | 221 , m_amount(amount) |
(...skipping 13 matching lines...) Expand all Loading... |
235 | 235 |
236 class PLATFORM_EXPORT BlurFilterOperation : public FilterOperation { | 236 class PLATFORM_EXPORT BlurFilterOperation : public FilterOperation { |
237 public: | 237 public: |
238 static PassRefPtr<BlurFilterOperation> create(const Length& stdDeviation) | 238 static PassRefPtr<BlurFilterOperation> create(const Length& stdDeviation) |
239 { | 239 { |
240 return adoptRef(new BlurFilterOperation(stdDeviation)); | 240 return adoptRef(new BlurFilterOperation(stdDeviation)); |
241 } | 241 } |
242 | 242 |
243 const Length& stdDeviation() const { return m_stdDeviation; } | 243 const Length& stdDeviation() const { return m_stdDeviation; } |
244 | 244 |
245 virtual bool affectsOpacity() const OVERRIDE { return true; } | 245 virtual bool affectsOpacity() const override { return true; } |
246 virtual bool movesPixels() const OVERRIDE { return true; } | 246 virtual bool movesPixels() const override { return true; } |
247 | 247 |
248 | 248 |
249 private: | 249 private: |
250 virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, doubl
e progress) const OVERRIDE; | 250 virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, doubl
e progress) const override; |
251 virtual bool operator==(const FilterOperation& o) const OVERRIDE | 251 virtual bool operator==(const FilterOperation& o) const override |
252 { | 252 { |
253 if (!isSameType(o)) | 253 if (!isSameType(o)) |
254 return false; | 254 return false; |
255 const BlurFilterOperation* other = static_cast<const BlurFilterOperation
*>(&o); | 255 const BlurFilterOperation* other = static_cast<const BlurFilterOperation
*>(&o); |
256 return m_stdDeviation == other->m_stdDeviation; | 256 return m_stdDeviation == other->m_stdDeviation; |
257 } | 257 } |
258 | 258 |
259 BlurFilterOperation(const Length& stdDeviation) | 259 BlurFilterOperation(const Length& stdDeviation) |
260 : FilterOperation(BLUR) | 260 : FilterOperation(BLUR) |
261 , m_stdDeviation(stdDeviation) | 261 , m_stdDeviation(stdDeviation) |
(...skipping 11 matching lines...) Expand all Loading... |
273 { | 273 { |
274 return adoptRef(new DropShadowFilterOperation(location, stdDeviation, co
lor)); | 274 return adoptRef(new DropShadowFilterOperation(location, stdDeviation, co
lor)); |
275 } | 275 } |
276 | 276 |
277 int x() const { return m_location.x(); } | 277 int x() const { return m_location.x(); } |
278 int y() const { return m_location.y(); } | 278 int y() const { return m_location.y(); } |
279 IntPoint location() const { return m_location; } | 279 IntPoint location() const { return m_location; } |
280 int stdDeviation() const { return m_stdDeviation; } | 280 int stdDeviation() const { return m_stdDeviation; } |
281 Color color() const { return m_color; } | 281 Color color() const { return m_color; } |
282 | 282 |
283 virtual bool affectsOpacity() const OVERRIDE { return true; } | 283 virtual bool affectsOpacity() const override { return true; } |
284 virtual bool movesPixels() const OVERRIDE { return true; } | 284 virtual bool movesPixels() const override { return true; } |
285 | 285 |
286 | 286 |
287 private: | 287 private: |
288 virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, doubl
e progress) const OVERRIDE; | 288 virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, doubl
e progress) const override; |
289 virtual bool operator==(const FilterOperation& o) const OVERRIDE | 289 virtual bool operator==(const FilterOperation& o) const override |
290 { | 290 { |
291 if (!isSameType(o)) | 291 if (!isSameType(o)) |
292 return false; | 292 return false; |
293 const DropShadowFilterOperation* other = static_cast<const DropShadowFil
terOperation*>(&o); | 293 const DropShadowFilterOperation* other = static_cast<const DropShadowFil
terOperation*>(&o); |
294 return m_location == other->m_location && m_stdDeviation == other->m_std
Deviation && m_color == other->m_color; | 294 return m_location == other->m_location && m_stdDeviation == other->m_std
Deviation && m_color == other->m_color; |
295 } | 295 } |
296 | 296 |
297 DropShadowFilterOperation(const IntPoint& location, int stdDeviation, Color
color) | 297 DropShadowFilterOperation(const IntPoint& location, int stdDeviation, Color
color) |
298 : FilterOperation(DROP_SHADOW) | 298 : FilterOperation(DROP_SHADOW) |
299 , m_location(location) | 299 , m_location(location) |
300 , m_stdDeviation(stdDeviation) | 300 , m_stdDeviation(stdDeviation) |
301 , m_color(color) | 301 , m_color(color) |
302 { | 302 { |
303 } | 303 } |
304 | 304 |
305 IntPoint m_location; // FIXME: should location be in Lengths? | 305 IntPoint m_location; // FIXME: should location be in Lengths? |
306 int m_stdDeviation; | 306 int m_stdDeviation; |
307 Color m_color; | 307 Color m_color; |
308 }; | 308 }; |
309 | 309 |
310 DEFINE_FILTER_OPERATION_TYPE_CASTS(DropShadowFilterOperation, DROP_SHADOW); | 310 DEFINE_FILTER_OPERATION_TYPE_CASTS(DropShadowFilterOperation, DROP_SHADOW); |
311 | 311 |
312 } // namespace blink | 312 } // namespace blink |
313 | 313 |
314 | 314 |
315 #endif // FilterOperation_h | 315 #endif // FilterOperation_h |
OLD | NEW |