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