Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: third_party/WebKit/Source/core/style/FilterOperation.cpp

Issue 2609803002: Use ShadowData in DropShadowFilterOperation (Closed)
Patch Set: Fix blend(...) order Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 if (!from) 167 if (!from)
168 return BlurFilterOperation::create(m_stdDeviation.blend( 168 return BlurFilterOperation::create(m_stdDeviation.blend(
169 Length(lengthType), progress, ValueRangeNonNegative)); 169 Length(lengthType), progress, ValueRangeNonNegative));
170 170
171 const BlurFilterOperation* fromOp = toBlurFilterOperation(from); 171 const BlurFilterOperation* fromOp = toBlurFilterOperation(from);
172 return BlurFilterOperation::create(m_stdDeviation.blend( 172 return BlurFilterOperation::create(m_stdDeviation.blend(
173 fromOp->m_stdDeviation, progress, ValueRangeNonNegative)); 173 fromOp->m_stdDeviation, progress, ValueRangeNonNegative));
174 } 174 }
175 175
176 FloatRect DropShadowFilterOperation::mapRect(const FloatRect& rect) const { 176 FloatRect DropShadowFilterOperation::mapRect(const FloatRect& rect) const {
177 float stdDeviation = m_stdDeviation; 177 float stdDeviation = m_shadow.blur();
178 return FEDropShadow::mapEffect(FloatSize(stdDeviation, stdDeviation), 178 return FEDropShadow::mapEffect(FloatSize(stdDeviation, stdDeviation),
179 FloatPoint(m_location), rect); 179 m_shadow.location(), rect);
180 } 180 }
181 181
182 FilterOperation* DropShadowFilterOperation::blend(const FilterOperation* from, 182 FilterOperation* DropShadowFilterOperation::blend(const FilterOperation* from,
183 double progress) const { 183 double progress) const {
184 if (!from) { 184 if (!from) {
185 return DropShadowFilterOperation::create( 185 return create(m_shadow.blend(ShadowData::neutralValue(), progress,
186 blink::blend(IntPoint(), m_location, progress), 186 Color::transparent));
187 blink::blend(0, m_stdDeviation, progress),
188 blink::blend(Color(Color::transparent), m_color, progress));
189 } 187 }
190 188
191 const DropShadowFilterOperation* fromOp = toDropShadowFilterOperation(from); 189 const auto& fromOp = toDropShadowFilterOperation(*from);
192 return DropShadowFilterOperation::create( 190 return create(m_shadow.blend(fromOp.m_shadow, progress, Color::transparent));
193 blink::blend(fromOp->location(), m_location, progress),
194 blink::blend(fromOp->stdDeviation(), m_stdDeviation, progress),
195 blink::blend(fromOp->getColor(), m_color, progress));
196 } 191 }
197 192
198 FloatRect BoxReflectFilterOperation::mapRect(const FloatRect& rect) const { 193 FloatRect BoxReflectFilterOperation::mapRect(const FloatRect& rect) const {
199 return m_reflection.mapRect(rect); 194 return m_reflection.mapRect(rect);
200 } 195 }
201 196
202 FilterOperation* BoxReflectFilterOperation::blend(const FilterOperation* from, 197 FilterOperation* BoxReflectFilterOperation::blend(const FilterOperation* from,
203 double progress) const { 198 double progress) const {
204 NOTREACHED(); 199 NOTREACHED();
205 return nullptr; 200 return nullptr;
206 } 201 }
207 202
208 bool BoxReflectFilterOperation::operator==(const FilterOperation& o) const { 203 bool BoxReflectFilterOperation::operator==(const FilterOperation& o) const {
209 if (!isSameType(o)) 204 if (!isSameType(o))
210 return false; 205 return false;
211 const auto& other = static_cast<const BoxReflectFilterOperation&>(o); 206 const auto& other = static_cast<const BoxReflectFilterOperation&>(o);
212 return m_reflection == other.m_reflection; 207 return m_reflection == other.m_reflection;
213 } 208 }
214 209
215 } // namespace blink 210 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/FilterOperation.h ('k') | third_party/WebKit/Source/core/style/FilterOperationsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698