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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 unsigned numberOfEffectInputs() const { return m_inputEffects.size(); } | 61 unsigned numberOfEffectInputs() const { return m_inputEffects.size(); } |
62 | 62 |
63 inline bool hasImageFilter() const | 63 inline bool hasImageFilter() const |
64 { | 64 { |
65 return m_imageFilters[0] || m_imageFilters[1] || m_imageFilters[2] || m_ imageFilters[3]; | 65 return m_imageFilters[0] || m_imageFilters[1] || m_imageFilters[2] || m_ imageFilters[3]; |
66 } | 66 } |
67 | 67 |
68 // Clipped primitive subregion in the coordinate space of the target. | 68 // Clipped primitive subregion in the coordinate space of the target. |
69 FloatRect absoluteBounds() const; | 69 FloatRect absoluteBounds() const; |
70 | 70 |
71 // Mapping a rect forwards to determine which which destination pixels a | |
72 // given source rect would affect. | |
73 FloatRect mapRect(const FloatRect&) const; | |
74 | |
71 virtual sk_sp<SkImageFilter> createImageFilter(); | 75 virtual sk_sp<SkImageFilter> createImageFilter(); |
72 virtual sk_sp<SkImageFilter> createImageFilterWithoutValidation(); | 76 virtual sk_sp<SkImageFilter> createImageFilterWithoutValidation(); |
73 | 77 |
74 // Mapping a rect forwards determines which which destination pixels a | |
75 // given source rect would affect. Mapping a rect backwards determines | |
76 // which pixels from the source rect would be required to fill a given | |
77 // destination rect. Note that these are not necessarily the inverse of | |
78 // each other. For example, for FEGaussianBlur, they are the same | |
79 // transformation. | |
80 virtual FloatRect mapRect(const FloatRect& rect, bool forward = true) const { return rect; } | |
81 // A version of the above that is used for calculating paint rects. We can't | |
82 // use mapRect above for that, because that is also used for calculating eff ect | |
83 // regions for CSS filters and has undesirable effects for tile and | |
84 // displacement map. | |
85 virtual FloatRect mapPaintRect(const FloatRect& rect, bool forward) const | |
86 { | |
87 return mapRect(rect, forward); | |
88 } | |
89 FloatRect mapRectRecursive(const FloatRect&) const; | |
90 | |
91 virtual FilterEffectType getFilterEffectType() const { return FilterEffectTy peUnknown; } | 78 virtual FilterEffectType getFilterEffectType() const { return FilterEffectTy peUnknown; } |
92 | 79 |
93 virtual TextStream& externalRepresentation(TextStream&, int indention = 0) c onst; | 80 virtual TextStream& externalRepresentation(TextStream&, int indention = 0) c onst; |
94 | 81 |
95 FloatRect filterPrimitiveSubregion() const { return m_filterPrimitiveSubregi on; } | 82 FloatRect filterPrimitiveSubregion() const { return m_filterPrimitiveSubregi on; } |
96 void setFilterPrimitiveSubregion(const FloatRect& filterPrimitiveSubregion) { m_filterPrimitiveSubregion = filterPrimitiveSubregion; } | 83 void setFilterPrimitiveSubregion(const FloatRect& filterPrimitiveSubregion) { m_filterPrimitiveSubregion = filterPrimitiveSubregion; } |
97 | 84 |
98 Filter* getFilter() { return m_filter; } | 85 Filter* getFilter() { return m_filter; } |
99 const Filter* getFilter() const { return m_filter; } | 86 const Filter* getFilter() const { return m_filter; } |
100 | 87 |
101 bool clipsToBounds() const { return m_clipsToBounds; } | 88 bool clipsToBounds() const { return m_clipsToBounds; } |
102 void setClipsToBounds(bool value) { m_clipsToBounds = value; } | 89 void setClipsToBounds(bool value) { m_clipsToBounds = value; } |
103 | 90 |
104 ColorSpace operatingColorSpace() const { return m_operatingColorSpace; } | 91 ColorSpace operatingColorSpace() const { return m_operatingColorSpace; } |
105 virtual void setOperatingColorSpace(ColorSpace colorSpace) { m_operatingColo rSpace = colorSpace; } | 92 virtual void setOperatingColorSpace(ColorSpace colorSpace) { m_operatingColo rSpace = colorSpace; } |
106 | 93 |
107 // Compute the "paint rect" (which destination pixels will be affected) for | |
108 // the given rect. In the coordinate space of the target. | |
109 virtual FloatRect determineAbsolutePaintRect(const FloatRect& requestedAbsol uteRect) const; | |
110 virtual bool affectsTransparentPixels() const { return false; } | 94 virtual bool affectsTransparentPixels() const { return false; } |
111 | 95 |
112 // Return false if the filter will only operate correctly on valid RGBA valu es, with | 96 // Return false if the filter will only operate correctly on valid RGBA valu es, with |
113 // alpha in [0,255] and each color component in [0, alpha]. | 97 // alpha in [0,255] and each color component in [0, alpha]. |
114 virtual bool mayProduceInvalidPreMultipliedPixels() { return false; } | 98 virtual bool mayProduceInvalidPreMultipliedPixels() { return false; } |
115 | 99 |
116 SkImageFilter* getImageFilter(ColorSpace, bool requiresPMColorValidation) co nst; | 100 SkImageFilter* getImageFilter(ColorSpace, bool requiresPMColorValidation) co nst; |
117 void setImageFilter(ColorSpace, bool requiresPMColorValidation, sk_sp<SkImag eFilter>); | 101 void setImageFilter(ColorSpace, bool requiresPMColorValidation, sk_sp<SkImag eFilter>); |
118 | 102 |
119 bool originTainted() const { return m_originTainted; } | 103 bool originTainted() const { return m_originTainted; } |
120 void setOriginTainted() { m_originTainted = true; } | 104 void setOriginTainted() { m_originTainted = true; } |
121 | 105 |
122 bool inputsTaintOrigin() const; | 106 bool inputsTaintOrigin() const; |
123 | 107 |
124 protected: | 108 protected: |
125 FilterEffect(Filter*); | 109 FilterEffect(Filter*); |
126 | 110 |
111 virtual FloatRect mapInputs(const FloatRect&) const; | |
pdr.
2016/09/16 18:29:18
Can you add comments above these like you did for
fs
2016/09/16 20:16:21
Added.
| |
112 virtual FloatRect mapEffect(const FloatRect&) const; | |
113 FloatRect applyBounds(const FloatRect&) const; | |
114 | |
127 sk_sp<SkImageFilter> createTransparentBlack() const; | 115 sk_sp<SkImageFilter> createTransparentBlack() const; |
128 | 116 |
129 Color adaptColorToOperatingColorSpace(const Color& deviceColor); | 117 Color adaptColorToOperatingColorSpace(const Color& deviceColor); |
130 | 118 |
131 SkImageFilter::CropRect getCropRect() const; | 119 SkImageFilter::CropRect getCropRect() const; |
132 | 120 |
133 private: | 121 private: |
134 FilterEffectVector m_inputEffects; | 122 FilterEffectVector m_inputEffects; |
135 | 123 |
136 Member<Filter> m_filter; | 124 Member<Filter> m_filter; |
(...skipping 11 matching lines...) Expand all Loading... | |
148 bool m_originTainted; | 136 bool m_originTainted; |
149 | 137 |
150 ColorSpace m_operatingColorSpace; | 138 ColorSpace m_operatingColorSpace; |
151 | 139 |
152 sk_sp<SkImageFilter> m_imageFilters[4]; | 140 sk_sp<SkImageFilter> m_imageFilters[4]; |
153 }; | 141 }; |
154 | 142 |
155 } // namespace blink | 143 } // namespace blink |
156 | 144 |
157 #endif // FilterEffect_h | 145 #endif // FilterEffect_h |
OLD | NEW |