OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 break; | 251 break; |
252 } | 252 } |
253 case FilterOperation::BLUR: { | 253 case FilterOperation::BLUR: { |
254 float stdDeviation = floatValueForLength( | 254 float stdDeviation = floatValueForLength( |
255 toBlurFilterOperation(filterOperation)->stdDeviation(), 0); | 255 toBlurFilterOperation(filterOperation)->stdDeviation(), 0); |
256 effect = | 256 effect = |
257 FEGaussianBlur::create(parentFilter, stdDeviation, stdDeviation); | 257 FEGaussianBlur::create(parentFilter, stdDeviation, stdDeviation); |
258 break; | 258 break; |
259 } | 259 } |
260 case FilterOperation::DROP_SHADOW: { | 260 case FilterOperation::DROP_SHADOW: { |
261 DropShadowFilterOperation* dropShadowOperation = | 261 const ShadowData& shadow = |
262 toDropShadowFilterOperation(filterOperation); | 262 toDropShadowFilterOperation(*filterOperation).shadow(); |
263 float stdDeviation = dropShadowOperation->stdDeviation(); | 263 effect = FEDropShadow::create(parentFilter, shadow.blur(), |
264 float x = dropShadowOperation->x(); | 264 shadow.blur(), shadow.x(), shadow.y(), |
265 float y = dropShadowOperation->y(); | 265 shadow.color().getColor(), 1); |
266 effect = FEDropShadow::create(parentFilter, stdDeviation, stdDeviation, | |
267 x, y, dropShadowOperation->getColor(), 1); | |
268 break; | 266 break; |
269 } | 267 } |
270 case FilterOperation::BOX_REFLECT: { | 268 case FilterOperation::BOX_REFLECT: { |
271 BoxReflectFilterOperation* boxReflectOperation = | 269 BoxReflectFilterOperation* boxReflectOperation = |
272 toBoxReflectFilterOperation(filterOperation); | 270 toBoxReflectFilterOperation(filterOperation); |
273 effect = FEBoxReflect::create(parentFilter, | 271 effect = FEBoxReflect::create(parentFilter, |
274 boxReflectOperation->reflection()); | 272 boxReflectOperation->reflection()); |
275 break; | 273 break; |
276 } | 274 } |
277 default: | 275 default: |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 } | 362 } |
365 break; | 363 break; |
366 } | 364 } |
367 case FilterOperation::BLUR: { | 365 case FilterOperation::BLUR: { |
368 float pixelRadius = | 366 float pixelRadius = |
369 toBlurFilterOperation(*op).stdDeviation().getFloatValue(); | 367 toBlurFilterOperation(*op).stdDeviation().getFloatValue(); |
370 filters.appendBlurFilter(pixelRadius); | 368 filters.appendBlurFilter(pixelRadius); |
371 break; | 369 break; |
372 } | 370 } |
373 case FilterOperation::DROP_SHADOW: { | 371 case FilterOperation::DROP_SHADOW: { |
374 const DropShadowFilterOperation& drop = | 372 const ShadowData& shadow = toDropShadowFilterOperation(*op).shadow(); |
375 toDropShadowFilterOperation(*op); | 373 filters.appendDropShadowFilter(WebPoint(shadow.x(), shadow.y()), |
376 filters.appendDropShadowFilter(WebPoint(drop.x(), drop.y()), | 374 shadow.blur(), |
377 drop.stdDeviation(), | 375 shadow.color().getColor()); |
378 drop.getColor().rgb()); | |
379 break; | 376 break; |
380 } | 377 } |
381 case FilterOperation::BOX_REFLECT: { | 378 case FilterOperation::BOX_REFLECT: { |
382 // TODO(jbroman): Consider explaining box reflect to the compositor, | 379 // TODO(jbroman): Consider explaining box reflect to the compositor, |
383 // instead of calling this a "reference filter". | 380 // instead of calling this a "reference filter". |
384 const auto& reflection = toBoxReflectFilterOperation(*op).reflection(); | 381 const auto& reflection = toBoxReflectFilterOperation(*op).reflection(); |
385 filters.appendReferenceFilter( | 382 filters.appendReferenceFilter( |
386 SkiaImageFilterBuilder::buildBoxReflectFilter(reflection, nullptr)); | 383 SkiaImageFilterBuilder::buildBoxReflectFilter(reflection, nullptr)); |
387 break; | 384 break; |
388 } | 385 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 Filter::create(m_referenceBox, filterRegion, m_zoom, unitScaling); | 430 Filter::create(m_referenceBox, filterRegion, m_zoom, unitScaling); |
434 if (!previousEffect) | 431 if (!previousEffect) |
435 previousEffect = result->getSourceGraphic(); | 432 previousEffect = result->getSourceGraphic(); |
436 SVGFilterBuilder builder(previousEffect, nodeMap, m_fillPaint, m_strokePaint); | 433 SVGFilterBuilder builder(previousEffect, nodeMap, m_fillPaint, m_strokePaint); |
437 builder.buildGraph(result, filterElement, m_referenceBox); | 434 builder.buildGraph(result, filterElement, m_referenceBox); |
438 result->setLastEffect(builder.lastEffect()); | 435 result->setLastEffect(builder.lastEffect()); |
439 return result; | 436 return result; |
440 } | 437 } |
441 | 438 |
442 } // namespace blink | 439 } // namespace blink |
OLD | NEW |