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

Side by Side Diff: Source/platform/graphics/filters/Filter.cpp

Issue 1326183002: Merge ReferenceFilter into Filter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Touchups; Rebase. Created 5 years, 3 months 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2013 Adobe Systems Incorporated. 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 * 8 *
9 * 1. Redistributions of source code must retain the above 9 * 1. Redistributions of source code must retain the above
10 * copyright notice, this list of conditions and the following 10 * copyright notice, this list of conditions and the following
(...skipping 11 matching lines...) Expand all
22 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
26 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 26 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 32 #include "platform/graphics/filters/Filter.h"
33 #include "platform/graphics/filters/ReferenceFilter.h"
34 33
35 #include "platform/graphics/filters/FilterEffect.h" 34 #include "platform/graphics/filters/FilterEffect.h"
36 #include "platform/graphics/filters/SourceGraphic.h" 35 #include "platform/graphics/filters/SourceGraphic.h"
37 36
38 namespace blink { 37 namespace blink {
39 38
40 ReferenceFilter::ReferenceFilter(const FloatRect& targetBoundingBox, const Float Rect& filterRegion, float scale) 39 Filter::Filter(const FloatRect& referenceBox, const FloatRect& filterRegion, flo at scale)
41 : Filter(targetBoundingBox, filterRegion, scale) 40 : m_referenceBox(referenceBox)
41 , m_filterRegion(filterRegion)
42 , m_scale(scale)
42 , m_sourceGraphic(SourceGraphic::create(this)) 43 , m_sourceGraphic(SourceGraphic::create(this))
43 { 44 {
44 } 45 }
45 46
46 ReferenceFilter::~ReferenceFilter() 47 Filter::~Filter()
47 { 48 {
48 } 49 }
49 50
50 DEFINE_TRACE(ReferenceFilter) 51 DEFINE_TRACE(Filter)
51 { 52 {
52 visitor->trace(m_sourceGraphic); 53 visitor->trace(m_sourceGraphic);
53 visitor->trace(m_lastEffect); 54 visitor->trace(m_lastEffect);
54 Filter::trace(visitor);
55 } 55 }
56 56
57 void ReferenceFilter::setLastEffect(PassRefPtrWillBeRawPtr<FilterEffect> effect) 57 FloatRect Filter::mapLocalRectToAbsoluteRect(const FloatRect& rect) const
58 {
59 FloatRect result(rect);
60 result.scale(m_scale);
61 return result;
62 }
63
64 FloatRect Filter::mapAbsoluteRectToLocalRect(const FloatRect& rect) const
65 {
66 FloatRect result(rect);
67 result.scale(1.0f / m_scale);
68 return result;
69 }
70
71 void Filter::setLastEffect(PassRefPtrWillBeRawPtr<FilterEffect> effect)
58 { 72 {
59 m_lastEffect = effect; 73 m_lastEffect = effect;
60 } 74 }
61 75
62 } // namespace blink 76 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/filters/Filter.h ('k') | Source/platform/graphics/filters/FilterOperation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698