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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/filters/FETile.cpp

Issue 1463513002: Move application of filter effect boundaries to a helper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make method "functional". Created 5 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/filters/FilterEffect.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/filters/FilterEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698