OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkShader_DEFINED | 8 #ifndef SkShader_DEFINED |
9 #define SkShader_DEFINED | 9 #define SkShader_DEFINED |
10 | 10 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 */ | 303 */ |
304 | 304 |
305 struct ComposeRec { | 305 struct ComposeRec { |
306 const SkShader* fShaderA; | 306 const SkShader* fShaderA; |
307 const SkShader* fShaderB; | 307 const SkShader* fShaderB; |
308 const SkXfermode* fMode; | 308 const SkXfermode* fMode; |
309 }; | 309 }; |
310 | 310 |
311 virtual bool asACompose(ComposeRec*) const { return false; } | 311 virtual bool asACompose(ComposeRec*) const { return false; } |
312 | 312 |
313 | 313 #if SK_SUPPORT_GPU |
314 /** | 314 /** |
315 * Returns a GrFragmentProcessor that implements the shader for the GPU bac
kend. NULL is | 315 * Returns a GrFragmentProcessor that implements the shader for the GPU bac
kend. NULL is |
316 * returned if there is no GPU implementation. | 316 * returned if there is no GPU implementation. |
317 * | 317 * |
318 * The GPU device does not call SkShader::createContext(), instead we pass
the view matrix, | 318 * The GPU device does not call SkShader::createContext(), instead we pass
the view matrix, |
319 * local matrix, and filter quality directly. | 319 * local matrix, and filter quality directly. |
320 * | 320 * |
321 * The GrContext may be used by the to create textures that are required by
the returned | 321 * The GrContext may be used by the to create textures that are required by
the returned |
322 * processor. | 322 * processor. |
323 * | 323 * |
324 * The returned GrFragmentProcessor should expect an unpremultiplied input
color and | 324 * The returned GrFragmentProcessor should expect an unpremultiplied input
color and |
325 * produce a premultiplied output. | 325 * produce a premultiplied output. |
326 */ | 326 */ |
327 virtual const GrFragmentProcessor* asFragmentProcessor(GrContext*, | 327 virtual sk_sp<GrFragmentProcessor> asFragmentProcessor(GrContext*, |
328 const SkMatrix& viewM
atrix, | 328 const SkMatrix& viewM
atrix, |
329 const SkMatrix* local
Matrix, | 329 const SkMatrix* local
Matrix, |
330 SkFilterQuality, | 330 SkFilterQuality, |
331 SkSourceGammaTreatmen
t) const; | 331 SkSourceGammaTreatmen
t) const; |
| 332 #endif |
332 | 333 |
333 /** | 334 /** |
334 * If the shader can represent its "average" luminance in a single color, r
eturn true and | 335 * If the shader can represent its "average" luminance in a single color, r
eturn true and |
335 * if color is not NULL, return that color. If it cannot, return false and
ignore the color | 336 * if color is not NULL, return that color. If it cannot, return false and
ignore the color |
336 * parameter. | 337 * parameter. |
337 * | 338 * |
338 * Note: if this returns true, the returned color will always be opaque, as
only the RGB | 339 * Note: if this returns true, the returned color will always be opaque, as
only the RGB |
339 * components are used to compute luminance. | 340 * components are used to compute luminance. |
340 */ | 341 */ |
341 bool asLuminanceColor(SkColor*) const; | 342 bool asLuminanceColor(SkColor*) const; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 SkMatrix fLocalMatrix; | 500 SkMatrix fLocalMatrix; |
500 | 501 |
501 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. | 502 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. |
502 friend class SkLocalMatrixShader; | 503 friend class SkLocalMatrixShader; |
503 friend class SkBitmapProcShader; // for computeTotalInverse() | 504 friend class SkBitmapProcShader; // for computeTotalInverse() |
504 | 505 |
505 typedef SkFlattenable INHERITED; | 506 typedef SkFlattenable INHERITED; |
506 }; | 507 }; |
507 | 508 |
508 #endif | 509 #endif |
OLD | NEW |