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 19 matching lines...) Expand all Loading... |
30 #include "platform/graphics/ColorSpace.h" | 30 #include "platform/graphics/ColorSpace.h" |
31 | 31 |
32 #include "third_party/skia/include/core/SkImageFilter.h" | 32 #include "third_party/skia/include/core/SkImageFilter.h" |
33 | 33 |
34 #include "wtf/PassOwnPtr.h" | 34 #include "wtf/PassOwnPtr.h" |
35 #include "wtf/RefCounted.h" | 35 #include "wtf/RefCounted.h" |
36 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
37 #include "wtf/Uint8ClampedArray.h" | 37 #include "wtf/Uint8ClampedArray.h" |
38 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
39 | 39 |
40 static const float kMaxFilterSize = 5000.0f; | |
41 | |
42 namespace WebCore { | 40 namespace WebCore { |
43 | 41 |
44 class Filter; | 42 class Filter; |
45 class FilterEffect; | 43 class FilterEffect; |
46 class ImageBuffer; | 44 class ImageBuffer; |
47 class TextStream; | 45 class TextStream; |
48 | 46 |
49 class SkiaImageFilterBuilder; | 47 class SkiaImageFilterBuilder; |
50 | 48 |
51 typedef Vector<RefPtr<FilterEffect> > FilterEffectVector; | 49 typedef Vector<RefPtr<FilterEffect> > FilterEffectVector; |
(...skipping 10 matching lines...) Expand all Loading... |
62 MapRectForward = 1, | 60 MapRectForward = 1, |
63 ClipToFilterRegion = 1 << 1 | 61 ClipToFilterRegion = 1 << 1 |
64 }; | 62 }; |
65 | 63 |
66 typedef int DetermineSubregionFlags; | 64 typedef int DetermineSubregionFlags; |
67 | 65 |
68 class PLATFORM_EXPORT FilterEffect : public RefCounted<FilterEffect> { | 66 class PLATFORM_EXPORT FilterEffect : public RefCounted<FilterEffect> { |
69 public: | 67 public: |
70 virtual ~FilterEffect(); | 68 virtual ~FilterEffect(); |
71 | 69 |
| 70 static bool isFilterSizeValid(const IntRect&); |
| 71 static bool isFilterSizeValid(const FloatRect&); |
| 72 static float maxFilterArea(); |
| 73 |
72 void clearResult(); | 74 void clearResult(); |
73 void clearResultsRecursive(); | 75 void clearResultsRecursive(); |
74 | 76 |
75 ImageBuffer* asImageBuffer(); | 77 ImageBuffer* asImageBuffer(); |
76 PassRefPtr<Uint8ClampedArray> asUnmultipliedImage(const IntRect&); | 78 PassRefPtr<Uint8ClampedArray> asUnmultipliedImage(const IntRect&); |
77 PassRefPtr<Uint8ClampedArray> asPremultipliedImage(const IntRect&); | 79 PassRefPtr<Uint8ClampedArray> asPremultipliedImage(const IntRect&); |
78 void copyUnmultipliedImage(Uint8ClampedArray* destination, const IntRect&); | 80 void copyUnmultipliedImage(Uint8ClampedArray* destination, const IntRect&); |
79 void copyPremultipliedImage(Uint8ClampedArray* destination, const IntRect&); | 81 void copyPremultipliedImage(Uint8ClampedArray* destination, const IntRect&); |
80 | 82 |
81 FilterEffectVector& inputEffects() { return m_inputEffects; } | 83 FilterEffectVector& inputEffects() { return m_inputEffects; } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 void transformResultColorSpace(ColorSpace); | 174 void transformResultColorSpace(ColorSpace); |
173 | 175 |
174 FloatRect determineFilterPrimitiveSubregion(DetermineSubregionFlags = Determ
ineSubregionNone); | 176 FloatRect determineFilterPrimitiveSubregion(DetermineSubregionFlags = Determ
ineSubregionNone); |
175 void determineAllAbsolutePaintRects(); | 177 void determineAllAbsolutePaintRects(); |
176 | 178 |
177 virtual FloatRect determineAbsolutePaintRect(const FloatRect& requestedAbsol
uteRect); | 179 virtual FloatRect determineAbsolutePaintRect(const FloatRect& requestedAbsol
uteRect); |
178 virtual bool affectsTransparentPixels() { return false; } | 180 virtual bool affectsTransparentPixels() { return false; } |
179 | 181 |
180 protected: | 182 protected: |
181 FilterEffect(Filter*); | 183 FilterEffect(Filter*); |
182 | |
183 ImageBuffer* createImageBufferResult(); | 184 ImageBuffer* createImageBufferResult(); |
184 Uint8ClampedArray* createUnmultipliedImageResult(); | 185 Uint8ClampedArray* createUnmultipliedImageResult(); |
185 Uint8ClampedArray* createPremultipliedImageResult(); | 186 Uint8ClampedArray* createPremultipliedImageResult(); |
186 | 187 |
187 Color adaptColorToOperatingColorSpace(const Color& deviceColor); | 188 Color adaptColorToOperatingColorSpace(const Color& deviceColor); |
188 | 189 |
189 // Return true if the filter will only operate correctly on valid RGBA value
s, with | 190 // Return true if the filter will only operate correctly on valid RGBA value
s, with |
190 // alpha in [0,255] and each color component in [0, alpha]. | 191 // alpha in [0,255] and each color component in [0, alpha]. |
191 virtual bool requiresValidPreMultipliedPixels() { return true; } | 192 virtual bool requiresValidPreMultipliedPixels() { return true; } |
192 | 193 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // Should the effect clip to its primitive region, or expand to use the comb
ined region of its inputs. | 236 // Should the effect clip to its primitive region, or expand to use the comb
ined region of its inputs. |
236 bool m_clipsToBounds; | 237 bool m_clipsToBounds; |
237 | 238 |
238 ColorSpace m_operatingColorSpace; | 239 ColorSpace m_operatingColorSpace; |
239 ColorSpace m_resultColorSpace; | 240 ColorSpace m_resultColorSpace; |
240 }; | 241 }; |
241 | 242 |
242 } // namespace WebCore | 243 } // namespace WebCore |
243 | 244 |
244 #endif // FilterEffect_h | 245 #endif // FilterEffect_h |
OLD | NEW |