Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkXfermode_DEFINED | 10 #ifndef SkXfermode_DEFINED |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 * that will be given to the xfer mode. | 186 * that will be given to the xfer mode. |
| 187 */ | 187 */ |
| 188 virtual bool isOpaque(SrcColorOpacity opacityType) const; | 188 virtual bool isOpaque(SrcColorOpacity opacityType) const; |
| 189 | 189 |
| 190 /** | 190 /** |
| 191 * The same as calling xfermode->isOpaque(...), except that this also check s if | 191 * The same as calling xfermode->isOpaque(...), except that this also check s if |
| 192 * the xfermode is NULL, and if so, treats it as kSrcOver_Mode. | 192 * the xfermode is NULL, and if so, treats it as kSrcOver_Mode. |
| 193 */ | 193 */ |
| 194 static bool IsOpaque(const SkXfermode* xfer, SrcColorOpacity opacityType); | 194 static bool IsOpaque(const SkXfermode* xfer, SrcColorOpacity opacityType); |
| 195 | 195 |
| 196 /** Used to do in-shader blending between two colors computed in the shader via a | 196 #if SK_SUPPORT_GPU |
| 197 GrFragmentProcessor. The input to the returned FP is the src color. The dst color is | 197 /** Used by the SkXfermodeImageFilter to blend two colors via a GrFragmentPr ocessor. |
| 198 provided by the dst param which becomes a child FP of the returned FP. I f the params are | 198 The input to the returned FP is the src color. The dst color is |
| 199 null then this is just a query of whether the SkXfermode could support t his functionality. | 199 provided by the dst param which becomes a child FP of the returned FP. |
| 200 It is legal for the function to succeed but return a null output. This i ndicates that | 200 It is legal for the function to return a null output. This indicates tha t |
| 201 the output of the blend is simply the src color. | 201 the output of the blend is simply the src color. |
| 202 */ | 202 */ |
| 203 virtual bool asFragmentProcessor(const GrFragmentProcessor** output, | 203 virtual const GrFragmentProcessor* asFragmentProcessor(const GrFragmentProce ssor* dst) const; |
|
egdaniel
2016/02/08 15:32:11
change name to have image filter in name, getFragm
robertphillips
2016/02/08 15:54:53
Done.
| |
| 204 const GrFragmentProcessor* dst) const; | |
| 205 | 204 |
| 206 /** A subclass may implement this factory function to work with the GPU back end. It is legal | 205 /** A subclass must implement this factory function to work with the GPU bac kend. |
| 207 to call this with xpf NULL to simply test the return value. If xpf is non- NULL then the | 206 The xfermode will return a factory for which the caller will get a ref. It is up |
| 208 xfermode may optionally allocate a factory to return to the caller as *xpf . The caller | 207 to the caller to install it. XferProcessors cannot use a background text ure. |
| 209 will install it and own a ref to it. Since the xfermode may or may not ass ign *xpf, the | |
| 210 caller should set *xpf to NULL beforehand. XferProcessors cannot use a bac kground texture. | |
| 211 */ | 208 */ |
| 212 virtual bool asXPFactory(GrXPFactory** xpf) const; | 209 virtual GrXPFactory* asXPFactory() const; |
| 213 | 210 #endif |
| 214 /** Returns true if the xfermode can be expressed as an xfer processor facto ry (xpFactory). | |
| 215 This helper calls the asXPFactory() virtual. If the xfermode is NULL, it i s treated as | |
| 216 kSrcOver_Mode. It is legal to call this with xpf param NULL to simply test the return value. | |
| 217 */ | |
| 218 static inline bool AsXPFactory(SkXfermode* xfermode, GrXPFactory** xpf) { | |
| 219 if (nullptr == xfermode) { | |
| 220 if (xpf) { | |
| 221 *xpf = nullptr; | |
| 222 } | |
| 223 return true; | |
| 224 } | |
| 225 return xfermode->asXPFactory(xpf); | |
| 226 } | |
| 227 | 211 |
| 228 SK_TO_STRING_PUREVIRT() | 212 SK_TO_STRING_PUREVIRT() |
| 229 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 213 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
| 230 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) | 214 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) |
| 231 | 215 |
| 232 enum PM4fFlags { | 216 enum PM4fFlags { |
| 233 kSrcIsOpaque_PM4fFlag = 1 << 0, | 217 kSrcIsOpaque_PM4fFlag = 1 << 0, |
| 234 kDstIsSRGB_PM4fFlag = 1 << 1, | 218 kDstIsSRGB_PM4fFlag = 1 << 1, |
| 235 }; | 219 }; |
| 236 struct PM4fState { | 220 struct PM4fState { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 260 | 244 |
| 261 private: | 245 private: |
| 262 enum { | 246 enum { |
| 263 kModeCount = kLastMode + 1 | 247 kModeCount = kLastMode + 1 |
| 264 }; | 248 }; |
| 265 | 249 |
| 266 typedef SkFlattenable INHERITED; | 250 typedef SkFlattenable INHERITED; |
| 267 }; | 251 }; |
| 268 | 252 |
| 269 #endif | 253 #endif |
| OLD | NEW |