| 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 |
| 11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
| 12 #include "SkFlattenable.h" | 12 #include "SkFlattenable.h" |
| 13 #include "SkMask.h" | 13 #include "SkMask.h" |
| 14 #include "SkMatrix.h" | 14 #include "SkMatrix.h" |
| 15 #include "SkPaint.h" | 15 #include "SkPaint.h" |
| 16 #include "../gpu/GrColor.h" | 16 #include "../gpu/GrColor.h" |
| 17 | 17 |
| 18 class SkPath; | 18 class SkPath; |
| 19 class SkPicture; | 19 class SkPicture; |
| 20 class SkXfermode; | 20 class SkXfermode; |
| 21 class GrContext; | 21 class GrContext; |
| 22 class GrFragmentProcessor; | 22 class GrFragmentProcessor; |
| 23 class GrProcessorDataManager; | |
| 24 | 23 |
| 25 /** \class SkShader | 24 /** \class SkShader |
| 26 * | 25 * |
| 27 * Shaders specify the source color(s) for what is being drawn. If a paint | 26 * Shaders specify the source color(s) for what is being drawn. If a paint |
| 28 * has no shader, then the paint's color is used. If the paint has a | 27 * has no shader, then the paint's color is used. If the paint has a |
| 29 * shader, then the shader's color(s) are use instead, but they are | 28 * shader, then the shader's color(s) are use instead, but they are |
| 30 * modulated by the paint's alpha. This makes it easy to create a shader | 29 * modulated by the paint's alpha. This makes it easy to create a shader |
| 31 * once (e.g. bitmap tiling or gradient) and then change its transparency | 30 * once (e.g. bitmap tiling or gradient) and then change its transparency |
| 32 * w/o having to modify the original shader... only the paint's alpha needs | 31 * w/o having to modify the original shader... only the paint's alpha needs |
| 33 * to be modified. | 32 * to be modified. |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 * | 314 * |
| 316 * The GrContext may be used by the to create textures that are required by
the returned | 315 * The GrContext may be used by the to create textures that are required by
the returned |
| 317 * processor. | 316 * processor. |
| 318 * | 317 * |
| 319 * The returned GrFragmentProcessor should expect an unpremultiplied input
color and | 318 * The returned GrFragmentProcessor should expect an unpremultiplied input
color and |
| 320 * produce a premultiplied output. | 319 * produce a premultiplied output. |
| 321 */ | 320 */ |
| 322 virtual const GrFragmentProcessor* asFragmentProcessor(GrContext*, | 321 virtual const GrFragmentProcessor* asFragmentProcessor(GrContext*, |
| 323 const SkMatrix& viewM
atrix, | 322 const SkMatrix& viewM
atrix, |
| 324 const SkMatrix* local
Matrix, | 323 const SkMatrix* local
Matrix, |
| 325 SkFilterQuality, | 324 SkFilterQuality) cons
t; |
| 326 GrProcessorDataManage
r*) const; | |
| 327 | 325 |
| 328 /** | 326 /** |
| 329 * If the shader can represent its "average" luminance in a single color, r
eturn true and | 327 * If the shader can represent its "average" luminance in a single color, r
eturn true and |
| 330 * if color is not NULL, return that color. If it cannot, return false and
ignore the color | 328 * if color is not NULL, return that color. If it cannot, return false and
ignore the color |
| 331 * parameter. | 329 * parameter. |
| 332 * | 330 * |
| 333 * Note: if this returns true, the returned color will always be opaque, as
only the RGB | 331 * Note: if this returns true, the returned color will always be opaque, as
only the RGB |
| 334 * components are used to compute luminance. | 332 * components are used to compute luminance. |
| 335 */ | 333 */ |
| 336 bool asLuminanceColor(SkColor*) const; | 334 bool asLuminanceColor(SkColor*) const; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 SkMatrix fLocalMatrix; | 439 SkMatrix fLocalMatrix; |
| 442 | 440 |
| 443 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. | 441 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. |
| 444 friend class SkLocalMatrixShader; | 442 friend class SkLocalMatrixShader; |
| 445 friend class SkBitmapProcShader; // for computeTotalInverse() | 443 friend class SkBitmapProcShader; // for computeTotalInverse() |
| 446 | 444 |
| 447 typedef SkFlattenable INHERITED; | 445 typedef SkFlattenable INHERITED; |
| 448 }; | 446 }; |
| 449 | 447 |
| 450 #endif | 448 #endif |
| OLD | NEW |