OLD | NEW |
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) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
5 * Copyright (C) 2013 Google Inc. All rights reserved. | 5 * Copyright (C) 2013 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 13 matching lines...) Expand all Loading... |
24 #define FilterEffect_h | 24 #define FilterEffect_h |
25 | 25 |
26 #include "platform/PlatformExport.h" | 26 #include "platform/PlatformExport.h" |
27 #include "platform/geometry/FloatRect.h" | 27 #include "platform/geometry/FloatRect.h" |
28 #include "platform/geometry/IntRect.h" | 28 #include "platform/geometry/IntRect.h" |
29 #include "platform/graphics/Color.h" | 29 #include "platform/graphics/Color.h" |
30 #include "platform/graphics/ColorSpace.h" | 30 #include "platform/graphics/ColorSpace.h" |
31 #include "platform/heap/Handle.h" | 31 #include "platform/heap/Handle.h" |
32 #include "third_party/skia/include/core/SkImageFilter.h" | 32 #include "third_party/skia/include/core/SkImageFilter.h" |
33 #include "wtf/Noncopyable.h" | 33 #include "wtf/Noncopyable.h" |
34 #include "wtf/PassRefPtr.h" | |
35 #include "wtf/RefPtr.h" | |
36 #include "wtf/Vector.h" | 34 #include "wtf/Vector.h" |
37 | 35 |
38 namespace blink { | 36 namespace blink { |
39 | 37 |
40 class Filter; | 38 class Filter; |
41 class FilterEffect; | 39 class FilterEffect; |
42 class TextStream; | 40 class TextStream; |
43 | 41 |
44 typedef HeapVector<Member<FilterEffect>> FilterEffectVector; | 42 typedef HeapVector<Member<FilterEffect>> FilterEffectVector; |
45 | 43 |
46 enum FilterEffectType { | 44 enum FilterEffectType { |
47 FilterEffectTypeUnknown, | 45 FilterEffectTypeUnknown, |
48 FilterEffectTypeImage, | 46 FilterEffectTypeImage, |
49 FilterEffectTypeTile, | 47 FilterEffectTypeTile, |
50 FilterEffectTypeSourceInput | 48 FilterEffectTypeSourceInput |
51 }; | 49 }; |
52 | 50 |
53 enum DetermineMaxEffectRectFlag { | |
54 DetermineMaxEffectRectNone = 0, | |
55 MapRectForward = 1, | |
56 ClipToFilterRegion = 1 << 1 | |
57 }; | |
58 | |
59 typedef int DetermineMaxEffectRectFlags; | |
60 | |
61 class PLATFORM_EXPORT FilterEffect : public GarbageCollectedFinalized<FilterEffe
ct> { | 51 class PLATFORM_EXPORT FilterEffect : public GarbageCollectedFinalized<FilterEffe
ct> { |
62 WTF_MAKE_NONCOPYABLE(FilterEffect); | 52 WTF_MAKE_NONCOPYABLE(FilterEffect); |
63 public: | 53 public: |
64 virtual ~FilterEffect(); | 54 virtual ~FilterEffect(); |
65 DECLARE_VIRTUAL_TRACE(); | 55 DECLARE_VIRTUAL_TRACE(); |
66 | 56 |
67 void clearResult(); | 57 void clearResult(); |
68 | 58 |
69 FilterEffectVector& inputEffects() { return m_inputEffects; } | 59 FilterEffectVector& inputEffects() { return m_inputEffects; } |
70 FilterEffect* inputEffect(unsigned) const; | 60 FilterEffect* inputEffect(unsigned) const; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 98 |
109 Filter* getFilter() { return m_filter; } | 99 Filter* getFilter() { return m_filter; } |
110 const Filter* getFilter() const { return m_filter; } | 100 const Filter* getFilter() const { return m_filter; } |
111 | 101 |
112 bool clipsToBounds() const { return m_clipsToBounds; } | 102 bool clipsToBounds() const { return m_clipsToBounds; } |
113 void setClipsToBounds(bool value) { m_clipsToBounds = value; } | 103 void setClipsToBounds(bool value) { m_clipsToBounds = value; } |
114 | 104 |
115 ColorSpace operatingColorSpace() const { return m_operatingColorSpace; } | 105 ColorSpace operatingColorSpace() const { return m_operatingColorSpace; } |
116 virtual void setOperatingColorSpace(ColorSpace colorSpace) { m_operatingColo
rSpace = colorSpace; } | 106 virtual void setOperatingColorSpace(ColorSpace colorSpace) { m_operatingColo
rSpace = colorSpace; } |
117 | 107 |
118 FloatRect determineMaximumEffectRect(DetermineMaxEffectRectFlags); | 108 FloatRect determineMaximumEffectRect(); |
119 | 109 |
120 virtual FloatRect determineAbsolutePaintRect(const FloatRect& requestedAbsol
uteRect); | 110 virtual FloatRect determineAbsolutePaintRect(const FloatRect& requestedAbsol
uteRect); |
121 virtual bool affectsTransparentPixels() { return false; } | 111 virtual bool affectsTransparentPixels() { return false; } |
122 | 112 |
123 // Return false if the filter will only operate correctly on valid RGBA valu
es, with | 113 // Return false if the filter will only operate correctly on valid RGBA valu
es, with |
124 // alpha in [0,255] and each color component in [0, alpha]. | 114 // alpha in [0,255] and each color component in [0, alpha]. |
125 virtual bool mayProduceInvalidPreMultipliedPixels() { return false; } | 115 virtual bool mayProduceInvalidPreMultipliedPixels() { return false; } |
126 | 116 |
127 SkImageFilter* getImageFilter(ColorSpace, bool requiresPMColorValidation) co
nst; | 117 SkImageFilter* getImageFilter(ColorSpace, bool requiresPMColorValidation) co
nst; |
128 void setImageFilter(ColorSpace, bool requiresPMColorValidation, sk_sp<SkImag
eFilter>); | 118 void setImageFilter(ColorSpace, bool requiresPMColorValidation, sk_sp<SkImag
eFilter>); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 bool m_originTainted; | 156 bool m_originTainted; |
167 | 157 |
168 ColorSpace m_operatingColorSpace; | 158 ColorSpace m_operatingColorSpace; |
169 | 159 |
170 sk_sp<SkImageFilter> m_imageFilters[4]; | 160 sk_sp<SkImageFilter> m_imageFilters[4]; |
171 }; | 161 }; |
172 | 162 |
173 } // namespace blink | 163 } // namespace blink |
174 | 164 |
175 #endif // FilterEffect_h | 165 #endif // FilterEffect_h |
OLD | NEW |