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

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

Issue 99103006: Moving GraphicsContext and dependencies from core to platform. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final patch - fixes Android Created 7 years 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
(Empty)
1 /*
2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #ifndef Filter_h
22 #define Filter_h
23
24 #include "core/platform/graphics/ImageBuffer.h"
25 #include "platform/geometry/FloatRect.h"
26 #include "platform/geometry/FloatSize.h"
27 #include "wtf/RefCounted.h"
28
29 namespace WebCore {
30
31 class FilterEffect;
32
33 class Filter : public RefCounted<Filter> {
34 public:
35 Filter(const AffineTransform& absoluteTransform) : m_renderingMode(Unacceler ated), m_absoluteTransform(absoluteTransform) { }
36 virtual ~Filter() { }
37
38 void setSourceImage(PassOwnPtr<ImageBuffer> sourceImage) { m_sourceImage = s ourceImage; }
39 ImageBuffer* sourceImage() { return m_sourceImage.get(); }
40
41 FloatSize filterResolution() const { return m_filterResolution; }
42 void setFilterResolution(const FloatSize& filterResolution) { m_filterResolu tion = filterResolution; }
43
44 const AffineTransform& absoluteTransform() const { return m_absoluteTransfor m; }
45 void setAbsoluteTransform(const AffineTransform& absoluteTransform) { m_abso luteTransform = absoluteTransform; }
46 FloatPoint mapAbsolutePointToLocalPoint(const FloatPoint& point) const { ret urn m_absoluteTransform.inverse().mapPoint(point); }
47
48 RenderingMode renderingMode() const { return m_renderingMode; }
49 void setRenderingMode(RenderingMode renderingMode) { m_renderingMode = rende ringMode; }
50
51 virtual float applyHorizontalScale(float value) const
52 {
53 float filterRegionScale = absoluteFilterRegion().isEmpty() || filterRegi on().isEmpty() ?
54 1.0f : absoluteFilterRegion().width() / filterRegion().width();
55 return value * m_filterResolution.width() * filterRegionScale;
56 }
57 virtual float applyVerticalScale(float value) const
58 {
59 float filterRegionScale = absoluteFilterRegion().isEmpty() || filterRegi on().isEmpty() ?
60 1.0f : absoluteFilterRegion().height() / filterRegion().height();
61 return value * m_filterResolution.height() * filterRegionScale;
62 }
63
64 virtual FloatRect sourceImageRect() const = 0;
65
66 FloatRect absoluteFilterRegion() const { return m_absoluteFilterRegion; }
67 void setAbsoluteFilterRegion(const FloatRect& rect) { m_absoluteFilterRegion = rect; }
68
69 FloatRect filterRegion() const { return m_filterRegion; }
70 void setFilterRegion(const FloatRect& rect) { m_filterRegion = rect; }
71
72 private:
73 OwnPtr<ImageBuffer> m_sourceImage;
74 FloatSize m_filterResolution;
75 RenderingMode m_renderingMode;
76 AffineTransform m_absoluteTransform;
77 FloatRect m_absoluteFilterRegion;
78 FloatRect m_filterRegion;
79 };
80
81 } // namespace WebCore
82
83 #endif // Filter_h
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/filters/FETurbulence.cpp ('k') | Source/core/platform/graphics/filters/FilterEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698