| 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef FilterOperation_h | 26 #ifndef FilterOperation_h |
| 27 #define FilterOperation_h | 27 #define FilterOperation_h |
| 28 | 28 |
| 29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
| 30 #include "core/style/ShadowData.h" |
| 30 #include "platform/Length.h" | 31 #include "platform/Length.h" |
| 31 #include "platform/geometry/FloatRect.h" | 32 #include "platform/geometry/FloatRect.h" |
| 32 #include "platform/graphics/BoxReflection.h" | 33 #include "platform/graphics/BoxReflection.h" |
| 33 #include "platform/graphics/Color.h" | 34 #include "platform/graphics/Color.h" |
| 34 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
| 35 #include "wtf/Noncopyable.h" | 36 #include "wtf/Noncopyable.h" |
| 36 #include "wtf/text/WTFString.h" | 37 #include "wtf/text/WTFString.h" |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 BlurFilterOperation(const Length& stdDeviation) | 282 BlurFilterOperation(const Length& stdDeviation) |
| 282 : FilterOperation(BLUR), m_stdDeviation(stdDeviation) {} | 283 : FilterOperation(BLUR), m_stdDeviation(stdDeviation) {} |
| 283 | 284 |
| 284 Length m_stdDeviation; | 285 Length m_stdDeviation; |
| 285 }; | 286 }; |
| 286 | 287 |
| 287 DEFINE_FILTER_OPERATION_TYPE_CASTS(BlurFilterOperation, BLUR); | 288 DEFINE_FILTER_OPERATION_TYPE_CASTS(BlurFilterOperation, BLUR); |
| 288 | 289 |
| 289 class CORE_EXPORT DropShadowFilterOperation : public FilterOperation { | 290 class CORE_EXPORT DropShadowFilterOperation : public FilterOperation { |
| 290 public: | 291 public: |
| 291 static DropShadowFilterOperation* create(const IntPoint& location, | 292 static DropShadowFilterOperation* create(const ShadowData& shadow) { |
| 292 int stdDeviation, | 293 return new DropShadowFilterOperation(shadow); |
| 293 Color color) { | |
| 294 return new DropShadowFilterOperation(location, stdDeviation, color); | |
| 295 } | 294 } |
| 296 | 295 |
| 297 int x() const { return m_location.x(); } | 296 const ShadowData& shadow() const { return m_shadow; } |
| 298 int y() const { return m_location.y(); } | |
| 299 IntPoint location() const { return m_location; } | |
| 300 int stdDeviation() const { return m_stdDeviation; } | |
| 301 Color getColor() const { return m_color; } | |
| 302 | 297 |
| 303 bool affectsOpacity() const override { return true; } | 298 bool affectsOpacity() const override { return true; } |
| 304 bool movesPixels() const override { return true; } | 299 bool movesPixels() const override { return true; } |
| 305 FloatRect mapRect(const FloatRect&) const override; | 300 FloatRect mapRect(const FloatRect&) const override; |
| 306 | 301 |
| 307 private: | 302 private: |
| 308 FilterOperation* blend(const FilterOperation* from, | 303 FilterOperation* blend(const FilterOperation* from, |
| 309 double progress) const override; | 304 double progress) const override; |
| 310 bool operator==(const FilterOperation& o) const override { | 305 bool operator==(const FilterOperation& o) const override { |
| 311 if (!isSameType(o)) | 306 if (!isSameType(o)) |
| 312 return false; | 307 return false; |
| 313 const DropShadowFilterOperation* other = | 308 const DropShadowFilterOperation* other = |
| 314 static_cast<const DropShadowFilterOperation*>(&o); | 309 static_cast<const DropShadowFilterOperation*>(&o); |
| 315 return m_location == other->m_location && | 310 return m_shadow == other->m_shadow; |
| 316 m_stdDeviation == other->m_stdDeviation && m_color == other->m_color; | |
| 317 } | 311 } |
| 318 | 312 |
| 319 DropShadowFilterOperation(const IntPoint& location, | 313 DropShadowFilterOperation(const ShadowData& shadow) |
| 320 int stdDeviation, | 314 : FilterOperation(DROP_SHADOW), m_shadow(shadow) {} |
| 321 Color color) | |
| 322 : FilterOperation(DROP_SHADOW), | |
| 323 m_location(location), | |
| 324 m_stdDeviation(stdDeviation), | |
| 325 m_color(color) {} | |
| 326 | 315 |
| 327 IntPoint m_location; // FIXME: should location be in Lengths? | 316 ShadowData m_shadow; |
| 328 int m_stdDeviation; | |
| 329 Color m_color; | |
| 330 }; | 317 }; |
| 331 | 318 |
| 332 DEFINE_FILTER_OPERATION_TYPE_CASTS(DropShadowFilterOperation, DROP_SHADOW); | 319 DEFINE_FILTER_OPERATION_TYPE_CASTS(DropShadowFilterOperation, DROP_SHADOW); |
| 333 | 320 |
| 334 class CORE_EXPORT BoxReflectFilterOperation : public FilterOperation { | 321 class CORE_EXPORT BoxReflectFilterOperation : public FilterOperation { |
| 335 public: | 322 public: |
| 336 static BoxReflectFilterOperation* create(const BoxReflection& reflection) { | 323 static BoxReflectFilterOperation* create(const BoxReflection& reflection) { |
| 337 return new BoxReflectFilterOperation(reflection); | 324 return new BoxReflectFilterOperation(reflection); |
| 338 } | 325 } |
| 339 | 326 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 351 BoxReflectFilterOperation(const BoxReflection& reflection) | 338 BoxReflectFilterOperation(const BoxReflection& reflection) |
| 352 : FilterOperation(BOX_REFLECT), m_reflection(reflection) {} | 339 : FilterOperation(BOX_REFLECT), m_reflection(reflection) {} |
| 353 | 340 |
| 354 BoxReflection m_reflection; | 341 BoxReflection m_reflection; |
| 355 }; | 342 }; |
| 356 DEFINE_FILTER_OPERATION_TYPE_CASTS(BoxReflectFilterOperation, BOX_REFLECT); | 343 DEFINE_FILTER_OPERATION_TYPE_CASTS(BoxReflectFilterOperation, BOX_REFLECT); |
| 357 | 344 |
| 358 } // namespace blink | 345 } // namespace blink |
| 359 | 346 |
| 360 #endif // FilterOperation_h | 347 #endif // FilterOperation_h |
| OLD | NEW |