OLD | NEW |
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 * | 4 * |
4 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
7 * 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. |
8 * | 9 * |
9 * 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, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 13 * Library General Public License for more details. |
(...skipping 11 matching lines...) Expand all Loading... |
24 #include "core/platform/graphics/FloatSize.h" | 25 #include "core/platform/graphics/FloatSize.h" |
25 #include "core/platform/graphics/ImageBuffer.h" | 26 #include "core/platform/graphics/ImageBuffer.h" |
26 #include <wtf/RefCounted.h> | 27 #include <wtf/RefCounted.h> |
27 | 28 |
28 namespace WebCore { | 29 namespace WebCore { |
29 | 30 |
30 class FilterEffect; | 31 class FilterEffect; |
31 | 32 |
32 class Filter : public RefCounted<Filter> { | 33 class Filter : public RefCounted<Filter> { |
33 public: | 34 public: |
34 Filter() : m_renderingMode(Unaccelerated) { } | 35 Filter(const AffineTransform& absoluteTransform) : m_absoluteTransform(absol
uteTransform), m_renderingMode(Unaccelerated) { } |
35 virtual ~Filter() { } | 36 virtual ~Filter() { } |
36 | 37 |
37 void setSourceImage(PassOwnPtr<ImageBuffer> sourceImage) { m_sourceImage = s
ourceImage; } | 38 void setSourceImage(PassOwnPtr<ImageBuffer> sourceImage) { m_sourceImage = s
ourceImage; } |
38 ImageBuffer* sourceImage() { return m_sourceImage.get(); } | 39 ImageBuffer* sourceImage() { return m_sourceImage.get(); } |
39 | 40 |
40 FloatSize filterResolution() const { return m_filterResolution; } | 41 FloatSize filterResolution() const { return m_filterResolution; } |
41 void setFilterResolution(const FloatSize& filterResolution) { m_filterResolu
tion = filterResolution; } | 42 void setFilterResolution(const FloatSize& filterResolution) { m_filterResolu
tion = filterResolution; } |
42 | 43 |
| 44 const AffineTransform& absoluteTransform() const { return m_absoluteTransfor
m; } |
| 45 FloatPoint mapAbsolutePointToLocalPoint(const FloatPoint& point) const { ret
urn m_absoluteTransform.inverse().mapPoint(point); } |
| 46 |
43 RenderingMode renderingMode() const { return m_renderingMode; } | 47 RenderingMode renderingMode() const { return m_renderingMode; } |
44 void setRenderingMode(RenderingMode renderingMode) { m_renderingMode = rende
ringMode; } | 48 void setRenderingMode(RenderingMode renderingMode) { m_renderingMode = rende
ringMode; } |
45 | 49 |
46 virtual float applyHorizontalScale(float value) const { return value * m_fil
terResolution.width(); } | 50 virtual float applyHorizontalScale(float value) const { return value * m_fil
terResolution.width(); } |
47 virtual float applyVerticalScale(float value) const { return value * m_filte
rResolution.height(); } | 51 virtual float applyVerticalScale(float value) const { return value * m_filte
rResolution.height(); } |
48 | 52 |
49 virtual FloatRect sourceImageRect() const = 0; | 53 virtual FloatRect sourceImageRect() const = 0; |
50 virtual FloatRect filterRegion() const = 0; | 54 virtual FloatRect filterRegion() const = 0; |
51 | 55 |
52 virtual FloatPoint mapAbsolutePointToLocalPoint(const FloatPoint&) const { r
eturn FloatPoint(); } | |
53 | 56 |
54 private: | 57 private: |
55 OwnPtr<ImageBuffer> m_sourceImage; | 58 OwnPtr<ImageBuffer> m_sourceImage; |
56 FloatSize m_filterResolution; | 59 FloatSize m_filterResolution; |
57 RenderingMode m_renderingMode; | 60 RenderingMode m_renderingMode; |
| 61 AffineTransform m_absoluteTransform; |
58 }; | 62 }; |
59 | 63 |
60 } // namespace WebCore | 64 } // namespace WebCore |
61 | 65 |
62 #endif // Filter_h | 66 #endif // Filter_h |
OLD | NEW |