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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 private: | 109 private: |
110 virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, doubl
e progress) const = 0; | 110 virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, doubl
e progress) const = 0; |
111 }; | 111 }; |
112 | 112 |
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
String& 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 { return true; } |
124 virtual bool movesPixels() const { return true; } | 124 virtual bool movesPixels() const { return true; } |
125 | 125 |
126 const String& url() const { return m_url; } | 126 const String& url() const { return m_url; } |
127 const String& 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 |
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 String& fragment) | 147 ReferenceFilterOperation(const String& url, const AtomicString& fragment) |
148 : FilterOperation(REFERENCE) | 148 : FilterOperation(REFERENCE) |
149 , m_url(url) | 149 , m_url(url) |
150 , m_fragment(fragment) | 150 , m_fragment(fragment) |
151 { | 151 { |
152 } | 152 } |
153 | 153 |
154 String m_url; | 154 String m_url; |
155 String m_fragment; | 155 AtomicString m_fragment; |
156 RefPtr<ReferenceFilter> m_filter; | 156 RefPtr<ReferenceFilter> m_filter; |
157 }; | 157 }; |
158 | 158 |
159 DEFINE_FILTER_OPERATION_TYPE_CASTS(ReferenceFilterOperation, REFERENCE); | 159 DEFINE_FILTER_OPERATION_TYPE_CASTS(ReferenceFilterOperation, REFERENCE); |
160 | 160 |
161 // GRAYSCALE, SEPIA, SATURATE and HUE_ROTATE are variations on a basic color mat
rix effect. | 161 // GRAYSCALE, SEPIA, SATURATE and HUE_ROTATE are variations on a basic color mat
rix effect. |
162 // For HUE_ROTATE, the angle of rotation is stored in m_amount. | 162 // For HUE_ROTATE, the angle of rotation is stored in m_amount. |
163 class PLATFORM_EXPORT BasicColorMatrixFilterOperation : public FilterOperation { | 163 class PLATFORM_EXPORT BasicColorMatrixFilterOperation : public FilterOperation { |
164 public: | 164 public: |
165 static PassRefPtr<BasicColorMatrixFilterOperation> create(double amount, Ope
rationType type) | 165 static PassRefPtr<BasicColorMatrixFilterOperation> create(double amount, Ope
rationType type) |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |