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 = filter()->filterRegion(); |
67 FloatRect dstRect = getRect(this); | 52 inputEffect(0)->applyEffectBoundaries(srcRect); |
Stephen White
2015/11/19 14:54:34
Can inputEffect(0) not be null here?
fs
2015/11/19 15:48:09
Nope. (That should even hold generally - at least
| |
53 FloatRect dstRect = filter()->filterRegion(); | |
54 applyEffectBoundaries(dstRect); | |
68 return adoptRef(SkTileImageFilter::Create(srcRect, dstRect, input.get())); | 55 return adoptRef(SkTileImageFilter::Create(srcRect, dstRect, input.get())); |
69 } | 56 } |
70 | 57 |
71 TextStream& FETile::externalRepresentation(TextStream& ts, int indent) const | 58 TextStream& FETile::externalRepresentation(TextStream& ts, int indent) const |
72 { | 59 { |
73 writeIndent(ts, indent); | 60 writeIndent(ts, indent); |
74 ts << "[feTile"; | 61 ts << "[feTile"; |
75 FilterEffect::externalRepresentation(ts); | 62 FilterEffect::externalRepresentation(ts); |
76 ts << "]\n"; | 63 ts << "]\n"; |
77 inputEffect(0)->externalRepresentation(ts, indent + 1); | 64 inputEffect(0)->externalRepresentation(ts, indent + 1); |
78 | 65 |
79 return ts; | 66 return ts; |
80 } | 67 } |
81 | 68 |
82 } // namespace blink | 69 } // namespace blink |
OLD | NEW |