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 | 8 |
9 #ifndef SkShader_DEFINED | 9 #ifndef SkShader_DEFINED |
10 #define SkShader_DEFINED | 10 #define SkShader_DEFINED |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 * On success an implementation of this method must inspect the SkPaint and
set paintColor to | 377 * On success an implementation of this method must inspect the SkPaint and
set paintColor to |
378 * the color the effect expects as its input color. If the SkShader wishes
to emit a solid | 378 * the color the effect expects as its input color. If the SkShader wishes
to emit a solid |
379 * color then it should set paintColor to that color and not create an effe
ct. Note that | 379 * color then it should set paintColor to that color and not create an effe
ct. Note that |
380 * GrColor is always premul. The common patterns are to convert paint's SkC
olor to GrColor or | 380 * GrColor is always premul. The common patterns are to convert paint's SkC
olor to GrColor or |
381 * to extract paint's alpha and replicate it to all channels in paintColor.
Upon failure | 381 * to extract paint's alpha and replicate it to all channels in paintColor.
Upon failure |
382 * paintColor should not be modified. It is not recommended to specialize t
he effect to | 382 * paintColor should not be modified. It is not recommended to specialize t
he effect to |
383 * the paint's color as then many GPU shaders may be generated. | 383 * the paint's color as then many GPU shaders may be generated. |
384 * | 384 * |
385 * The GrContext may be used by the effect to create textures. The GPU devi
ce does not | 385 * The GrContext may be used by the effect to create textures. The GPU devi
ce does not |
386 * call createContext. Instead we pass the SkPaint here in case the shader
needs paint info. | 386 * call createContext. Instead we pass the SkPaint here in case the shader
needs paint info. |
| 387 * |
| 388 * A view matrix is always required to create the correct GrFragmentProcess
or. Some shaders |
| 389 * may also use the optional localMatrix to define a matrix relevant only f
or sampling. |
387 */ | 390 */ |
388 virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix*
, GrColor*, | 391 virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&
viewM, |
| 392 const SkMatrix* localMatrix, GrColor*, |
389 GrFragmentProcessor**) const; | 393 GrFragmentProcessor**) const; |
390 | 394 |
391 /** | 395 /** |
392 * If the shader can represent its "average" luminance in a single color, r
eturn true and | 396 * If the shader can represent its "average" luminance in a single color, r
eturn true and |
393 * if color is not NULL, return that color. If it cannot, return false and
ignore the color | 397 * if color is not NULL, return that color. If it cannot, return false and
ignore the color |
394 * parameter. | 398 * parameter. |
395 * | 399 * |
396 * Note: if this returns true, the returned color will always be opaque, as
only the RGB | 400 * Note: if this returns true, the returned color will always be opaque, as
only the RGB |
397 * components are used to compute luminance. | 401 * components are used to compute luminance. |
398 */ | 402 */ |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 // constructors. | 500 // constructors. |
497 SkMatrix fLocalMatrix; | 501 SkMatrix fLocalMatrix; |
498 | 502 |
499 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. | 503 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. |
500 friend class SkLocalMatrixShader; | 504 friend class SkLocalMatrixShader; |
501 | 505 |
502 typedef SkFlattenable INHERITED; | 506 typedef SkFlattenable INHERITED; |
503 }; | 507 }; |
504 | 508 |
505 #endif | 509 #endif |
OLD | NEW |