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

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

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
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/graphics/filters/Filter.cpp » ('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) 2009 Dirk Schulze <krit@webkit.org> 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 12 matching lines...) Expand all
23 23
24 #include "platform/PlatformExport.h" 24 #include "platform/PlatformExport.h"
25 #include "platform/geometry/FloatPoint3D.h" 25 #include "platform/geometry/FloatPoint3D.h"
26 #include "platform/geometry/FloatRect.h" 26 #include "platform/geometry/FloatRect.h"
27 #include "platform/geometry/IntRect.h" 27 #include "platform/geometry/IntRect.h"
28 #include "platform/heap/Handle.h" 28 #include "platform/heap/Handle.h"
29 #include "wtf/RefCounted.h" 29 #include "wtf/RefCounted.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 class SourceGraphic;
34 class FilterEffect;
35
33 class PLATFORM_EXPORT Filter : public RefCountedWillBeGarbageCollectedFinalized< Filter> { 36 class PLATFORM_EXPORT Filter : public RefCountedWillBeGarbageCollectedFinalized< Filter> {
34 public: 37 public:
35 virtual ~Filter() { } 38 static PassRefPtrWillBeRawPtr<Filter> create(const FloatRect& referenceBox, const FloatRect& filterRegion, float scale)
36 DEFINE_INLINE_VIRTUAL_TRACE() { } 39 {
40 return adoptRefWillBeNoop(new Filter(referenceBox, filterRegion, scale)) ;
41 }
42
43 static PassRefPtrWillBeRawPtr<Filter> create(float scale)
44 {
45 return adoptRefWillBeNoop(new Filter(FloatRect(), FloatRect(), scale));
46 }
47
48 virtual ~Filter();
49 DECLARE_VIRTUAL_TRACE();
37 50
38 float scale() const { return m_scale; } 51 float scale() const { return m_scale; }
39 FloatRect mapLocalRectToAbsoluteRect(const FloatRect& rect) const { FloatRec t result(rect); result.scale(m_scale); return result; } 52 FloatRect mapLocalRectToAbsoluteRect(const FloatRect&) const;
40 FloatRect mapAbsoluteRectToLocalRect(const FloatRect& rect) const { FloatRec t result(rect); result.scale(1.0f / m_scale); return result; } 53 FloatRect mapAbsoluteRectToLocalRect(const FloatRect&) const;
54
41 virtual float applyHorizontalScale(float value) const { return m_scale * val ue; } 55 virtual float applyHorizontalScale(float value) const { return m_scale * val ue; }
42 virtual float applyVerticalScale(float value) const { return m_scale * value ; } 56 virtual float applyVerticalScale(float value) const { return m_scale * value ; }
43 57
44 virtual FloatPoint3D resolve3dPoint(const FloatPoint3D& point) const { retur n point; } 58 virtual FloatPoint3D resolve3dPoint(const FloatPoint3D& point) const { retur n point; }
45 59
46 virtual IntRect sourceImageRect() const = 0; 60 virtual IntRect sourceImageRect() const { return IntRect(); }
47 61
48 FloatRect absoluteFilterRegion() const { FloatRect result = m_filterRegion; result.scale(m_scale); return result; } 62 FloatRect absoluteFilterRegion() const { return mapLocalRectToAbsoluteRect(m _filterRegion); }
49 63
50 const FloatRect& filterRegion() const { return m_filterRegion; } 64 const FloatRect& filterRegion() const { return m_filterRegion; }
51 const FloatRect& targetBoundingBox() const { return m_targetBoundingBox; } 65 const FloatRect& referenceBox() const { return m_referenceBox; }
66
67 void setLastEffect(PassRefPtrWillBeRawPtr<FilterEffect>);
68 FilterEffect* lastEffect() const { return m_lastEffect.get(); }
69
70 SourceGraphic* sourceGraphic() const { return m_sourceGraphic.get(); }
52 71
53 protected: 72 protected:
54 Filter(const FloatRect& targetBoundingBox, const FloatRect& filterRegion, fl oat scale) 73 Filter(const FloatRect& referenceBox, const FloatRect& filterRegion, float s cale);
55 : m_targetBoundingBox(targetBoundingBox)
56 , m_filterRegion(filterRegion)
57 , m_scale(scale)
58 {
59 }
60 74
61 private: 75 private:
62 FloatRect m_targetBoundingBox; 76 FloatRect m_referenceBox;
63 FloatRect m_filterRegion; 77 FloatRect m_filterRegion;
64 float m_scale; 78 float m_scale;
79
80 RefPtrWillBeMember<SourceGraphic> m_sourceGraphic;
81 RefPtrWillBeMember<FilterEffect> m_lastEffect;
65 }; 82 };
66 83
67 } // namespace blink 84 } // namespace blink
68 85
69 #endif // Filter_h 86 #endif // Filter_h
OLDNEW
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/graphics/filters/Filter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698