| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> | 2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> |
| 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 5 * Copyright (C) 2012 University of Szeged | 5 * Copyright (C) 2012 University of Szeged |
| 6 * Copyright (C) 2013 Google Inc. All rights reserved. | 6 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 m_premultipliedImageResult.clear(); | 430 m_premultipliedImageResult.clear(); |
| 431 } | 431 } |
| 432 | 432 |
| 433 TextStream& FilterEffect::externalRepresentation(TextStream& ts, int) const | 433 TextStream& FilterEffect::externalRepresentation(TextStream& ts, int) const |
| 434 { | 434 { |
| 435 // FIXME: We should dump the subRegions of the filter primitives here later.
This isn't | 435 // FIXME: We should dump the subRegions of the filter primitives here later.
This isn't |
| 436 // possible at the moment, because we need more detailed informations from t
he target object. | 436 // possible at the moment, because we need more detailed informations from t
he target object. |
| 437 return ts; | 437 return ts; |
| 438 } | 438 } |
| 439 | 439 |
| 440 FloatRect FilterEffect::determineFilterPrimitiveSubregion() | 440 FloatRect FilterEffect::determineFilterPrimitiveSubregion(bool mapRectForward, b
ool clipToFilterRegion) |
| 441 { | 441 { |
| 442 ASSERT(filter()); | 442 ASSERT(filter()); |
| 443 | 443 |
| 444 // FETile, FETurbulence, FEFlood don't have input effects, take the filter r
egion as unite rect. | 444 // FETile, FETurbulence, FEFlood don't have input effects, take the filter r
egion as unite rect. |
| 445 FloatRect subregion; | 445 FloatRect subregion; |
| 446 if (unsigned numberOfInputEffects = inputEffects().size()) { | 446 if (unsigned numberOfInputEffects = inputEffects().size()) { |
| 447 subregion = inputEffect(0)->determineFilterPrimitiveSubregion(); | 447 subregion = inputEffect(0)->determineFilterPrimitiveSubregion(mapRectFor
ward, clipToFilterRegion); |
| 448 for (unsigned i = 1; i < numberOfInputEffects; ++i) | 448 for (unsigned i = 1; i < numberOfInputEffects; ++i) |
| 449 subregion.unite(inputEffect(i)->determineFilterPrimitiveSubregion())
; | 449 subregion.unite(inputEffect(i)->determineFilterPrimitiveSubregion(ma
pRectForward, clipToFilterRegion)); |
| 450 } else | 450 } else |
| 451 subregion = filter()->filterRegion(); | 451 subregion = filter()->filterRegion(); |
| 452 | 452 |
| 453 // After calling determineFilterPrimitiveSubregion on the target effect, res
et the subregion again for <feTile>. | 453 // After calling determineFilterPrimitiveSubregion on the target effect, res
et the subregion again for <feTile>. |
| 454 if (filterEffectType() == FilterEffectTypeTile) | 454 if (filterEffectType() == FilterEffectTypeTile) |
| 455 subregion = filter()->filterRegion(); | 455 subregion = filter()->filterRegion(); |
| 456 | 456 |
| 457 subregion = mapRect(subregion); | 457 if (mapRectForward) |
| 458 subregion = mapRect(subregion); |
| 458 | 459 |
| 459 FloatRect boundaries = effectBoundaries(); | 460 FloatRect boundaries = effectBoundaries(); |
| 460 if (hasX()) | 461 if (hasX()) |
| 461 subregion.setX(boundaries.x()); | 462 subregion.setX(boundaries.x()); |
| 462 if (hasY()) | 463 if (hasY()) |
| 463 subregion.setY(boundaries.y()); | 464 subregion.setY(boundaries.y()); |
| 464 if (hasWidth()) | 465 if (hasWidth()) |
| 465 subregion.setWidth(boundaries.width()); | 466 subregion.setWidth(boundaries.width()); |
| 466 if (hasHeight()) | 467 if (hasHeight()) |
| 467 subregion.setHeight(boundaries.height()); | 468 subregion.setHeight(boundaries.height()); |
| 468 | 469 |
| 469 setFilterPrimitiveSubregion(subregion); | 470 setFilterPrimitiveSubregion(subregion); |
| 470 | 471 |
| 471 FloatRect absoluteSubregion = filter()->absoluteTransform().mapRect(subregio
n); | 472 FloatRect absoluteSubregion = filter()->absoluteTransform().mapRect(subregio
n); |
| 472 FloatSize filterResolution = filter()->filterResolution(); | 473 FloatSize filterResolution = filter()->filterResolution(); |
| 473 absoluteSubregion.scale(filterResolution.width(), filterResolution.height())
; | 474 absoluteSubregion.scale(filterResolution.width(), filterResolution.height())
; |
| 474 | 475 |
| 476 // Clip every filter effect to the filter region. |
| 477 if (clipToFilterRegion) { |
| 478 FloatRect absoluteScaledFilterRegion = filter()->absoluteFilterRegion(); |
| 479 absoluteScaledFilterRegion.scale(filterResolution.width(), filterResolut
ion.height()); |
| 480 absoluteSubregion.intersect(absoluteScaledFilterRegion); |
| 481 } |
| 482 |
| 475 setMaxEffectRect(absoluteSubregion); | 483 setMaxEffectRect(absoluteSubregion); |
| 476 return subregion; | 484 return subregion; |
| 477 } | 485 } |
| 478 | 486 |
| 479 PassRefPtr<SkImageFilter> FilterEffect::createImageFilter(SkiaImageFilterBuilder
* builder) | 487 PassRefPtr<SkImageFilter> FilterEffect::createImageFilter(SkiaImageFilterBuilder
* builder) |
| 480 { | 488 { |
| 481 return 0; | 489 return 0; |
| 482 } | 490 } |
| 483 | 491 |
| 484 SkImageFilter::CropRect FilterEffect::getCropRect(const FloatSize& cropOffset) c
onst | 492 SkImageFilter::CropRect FilterEffect::getCropRect(const FloatSize& cropOffset) c
onst |
| (...skipping 17 matching lines...) Expand all Loading... |
| 502 flags |= SkImageFilter::CropRect::kHasRight_CropEdge; | 510 flags |= SkImageFilter::CropRect::kHasRight_CropEdge; |
| 503 } | 511 } |
| 504 if (hasHeight()) { | 512 if (hasHeight()) { |
| 505 rect.fBottom = rect.fTop + boundaries.height(); | 513 rect.fBottom = rect.fTop + boundaries.height(); |
| 506 flags |= SkImageFilter::CropRect::kHasBottom_CropEdge; | 514 flags |= SkImageFilter::CropRect::kHasBottom_CropEdge; |
| 507 } | 515 } |
| 508 return SkImageFilter::CropRect(rect, flags); | 516 return SkImageFilter::CropRect(rect, flags); |
| 509 } | 517 } |
| 510 | 518 |
| 511 } // namespace WebCore | 519 } // namespace WebCore |
| OLD | NEW |