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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 #if SK_SUPPORT_GPU | 313 #if SK_SUPPORT_GPU |
| 314 struct AsFPArgs { |
| 315 AsFPArgs(GrContext* context, |
| 316 const SkMatrix* viewMatrix, |
| 317 const SkMatrix* localMatrix, |
| 318 SkFilterQuality filterQuality, |
| 319 SkSourceGammaTreatment gammaTreatment) |
| 320 : fContext(context) |
| 321 , fViewMatrix(viewMatrix) |
| 322 , fLocalMatrix(localMatrix) |
| 323 , fFilterQuality(filterQuality) |
| 324 , fGammaTreatment(gammaTreatment) {} |
| 325 |
| 326 GrContext* fContext; |
| 327 const SkMatrix* fViewMatrix; |
| 328 const SkMatrix* fLocalMatrix; |
| 329 SkFilterQuality fFilterQuality; |
| 330 SkSourceGammaTreatment fGammaTreatment; |
| 331 }; |
| 332 |
314 /** | 333 /** |
315 * Returns a GrFragmentProcessor that implements the shader for the GPU bac
kend. NULL is | 334 * Returns a GrFragmentProcessor that implements the shader for the GPU bac
kend. NULL is |
316 * returned if there is no GPU implementation. | 335 * returned if there is no GPU implementation. |
317 * | 336 * |
318 * The GPU device does not call SkShader::createContext(), instead we pass
the view matrix, | 337 * The GPU device does not call SkShader::createContext(), instead we pass
the view matrix, |
319 * local matrix, and filter quality directly. | 338 * local matrix, and filter quality directly. |
320 * | 339 * |
321 * The GrContext may be used by the to create textures that are required by
the returned | 340 * The GrContext may be used by the to create textures that are required by
the returned |
322 * processor. | 341 * processor. |
323 * | 342 * |
324 * The returned GrFragmentProcessor should expect an unpremultiplied input
color and | 343 * The returned GrFragmentProcessor should expect an unpremultiplied input
color and |
325 * produce a premultiplied output. | 344 * produce a premultiplied output. |
326 */ | 345 */ |
327 virtual sk_sp<GrFragmentProcessor> asFragmentProcessor(GrContext*, | 346 virtual sk_sp<GrFragmentProcessor> asFragmentProcessor(const AsFPArgs&) cons
t; |
328 const SkMatrix& viewM
atrix, | |
329 const SkMatrix* local
Matrix, | |
330 SkFilterQuality, | |
331 SkSourceGammaTreatmen
t) const; | |
332 #endif | 347 #endif |
333 | 348 |
334 /** | 349 /** |
335 * If the shader can represent its "average" luminance in a single color, r
eturn true and | 350 * If the shader can represent its "average" luminance in a single color, r
eturn true and |
336 * if color is not NULL, return that color. If it cannot, return false and
ignore the color | 351 * if color is not NULL, return that color. If it cannot, return false and
ignore the color |
337 * parameter. | 352 * parameter. |
338 * | 353 * |
339 * Note: if this returns true, the returned color will always be opaque, as
only the RGB | 354 * Note: if this returns true, the returned color will always be opaque, as
only the RGB |
340 * components are used to compute luminance. | 355 * components are used to compute luminance. |
341 */ | 356 */ |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 SkMatrix fLocalMatrix; | 515 SkMatrix fLocalMatrix; |
501 | 516 |
502 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. | 517 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. |
503 friend class SkLocalMatrixShader; | 518 friend class SkLocalMatrixShader; |
504 friend class SkBitmapProcShader; // for computeTotalInverse() | 519 friend class SkBitmapProcShader; // for computeTotalInverse() |
505 | 520 |
506 typedef SkFlattenable INHERITED; | 521 typedef SkFlattenable INHERITED; |
507 }; | 522 }; |
508 | 523 |
509 #endif | 524 #endif |
OLD | NEW |