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) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 27 matching lines...) Expand all Loading... |
38 PassRefPtrWillBeRawPtr<FETile> FETile::create(Filter* filter) | 38 PassRefPtrWillBeRawPtr<FETile> FETile::create(Filter* filter) |
39 { | 39 { |
40 return adoptRefWillBeNoop(new FETile(filter)); | 40 return adoptRefWillBeNoop(new FETile(filter)); |
41 } | 41 } |
42 | 42 |
43 FloatRect FETile::mapPaintRect(const FloatRect& rect, bool forward) | 43 FloatRect FETile::mapPaintRect(const FloatRect& rect, bool forward) |
44 { | 44 { |
45 return forward ? maxEffectRect() : inputEffect(0)->maxEffectRect(); | 45 return forward ? maxEffectRect() : inputEffect(0)->maxEffectRect(); |
46 } | 46 } |
47 | 47 |
48 static FloatRect getRect(FilterEffect* effect) | |
49 { | |
50 FloatRect result = effect->filter()->filterRegion(); | |
51 FloatRect boundaries = effect->effectBoundaries(); | |
52 if (effect->hasX()) | |
53 result.setX(boundaries.x()); | |
54 if (effect->hasY()) | |
55 result.setY(boundaries.y()); | |
56 if (effect->hasWidth()) | |
57 result.setWidth(boundaries.width()); | |
58 if (effect->hasHeight()) | |
59 result.setHeight(boundaries.height()); | |
60 return result; | |
61 } | |
62 | |
63 PassRefPtr<SkImageFilter> FETile::createImageFilter(SkiaImageFilterBuilder& buil
der) | 48 PassRefPtr<SkImageFilter> FETile::createImageFilter(SkiaImageFilterBuilder& buil
der) |
64 { | 49 { |
65 RefPtr<SkImageFilter> input(builder.build(inputEffect(0), operatingColorSpac
e())); | 50 RefPtr<SkImageFilter> input(builder.build(inputEffect(0), operatingColorSpac
e())); |
66 FloatRect srcRect = inputEffect(0) ? getRect(inputEffect(0)) : filter()->fil
terRegion(); | 51 FloatRect srcRect = inputEffect(0)->applyEffectBoundaries(filter()->filterRe
gion()); |
67 FloatRect dstRect = getRect(this); | 52 FloatRect dstRect = applyEffectBoundaries(filter()->filterRegion()); |
68 return adoptRef(SkTileImageFilter::Create(srcRect, dstRect, input.get())); | 53 return adoptRef(SkTileImageFilter::Create(srcRect, dstRect, input.get())); |
69 } | 54 } |
70 | 55 |
71 TextStream& FETile::externalRepresentation(TextStream& ts, int indent) const | 56 TextStream& FETile::externalRepresentation(TextStream& ts, int indent) const |
72 { | 57 { |
73 writeIndent(ts, indent); | 58 writeIndent(ts, indent); |
74 ts << "[feTile"; | 59 ts << "[feTile"; |
75 FilterEffect::externalRepresentation(ts); | 60 FilterEffect::externalRepresentation(ts); |
76 ts << "]\n"; | 61 ts << "]\n"; |
77 inputEffect(0)->externalRepresentation(ts, indent + 1); | 62 inputEffect(0)->externalRepresentation(ts, indent + 1); |
78 | 63 |
79 return ts; | 64 return ts; |
80 } | 65 } |
81 | 66 |
82 } // namespace blink | 67 } // namespace blink |
OLD | NEW |