| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 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 GrPaint_DEFINED | 10 #ifndef GrPaint_DEFINED |
| 11 #define GrPaint_DEFINED | 11 #define GrPaint_DEFINED |
| 12 | 12 |
| 13 #include "GrColor.h" | 13 #include "GrColor.h" |
| 14 #include "GrFragmentStage.h" | 14 #include "GrFragmentStage.h" |
| 15 #include "GrXferProcessor.h" | 15 #include "GrXferProcessor.h" |
| 16 #include "effects/GrPorterDuffXferProcessor.h" | 16 #include "effects/GrPorterDuffXferProcessor.h" |
| 17 | 17 |
| 18 #include "SkXfermode.h" | 18 #include "SkXfermode.h" |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * The paint describes how color and coverage are computed at each pixel by GrCo
ntext draw | 21 * The paint describes how color and coverage are computed at each pixel by GrCo
ntext draw |
| 22 * functions and the how color is blended with the destination pixel. | 22 * functions and the how color is blended with the destination pixel. |
| 23 * | 23 * |
| 24 * The paint allows installation of custom color and coverage stages. New types
of stages are | 24 * The paint allows installation of custom color and coverage stages. New types
of stages are |
| 25 * created by subclassing GrProcessor. | 25 * created by subclassing GrProcessor. |
| 26 * | 26 * |
| 27 * The primitive color computation starts with the color specified by setColor()
. This color is the | 27 * The primitive color computation starts with the color specified by setColor()
. This color is the |
| 28 * input to the first color stage. Each color stage feeds its output to the next
color stage. The | 28 * input to the first color stage. Each color stage feeds its output to the next
color stage. |
| 29 * final color stage's output color is input to the color filter specified by | |
| 30 * setXfermodeColorFilter which produces the final source color, S. | |
| 31 * | 29 * |
| 32 * Fractional pixel coverage follows a similar flow. The coverage is initially t
he value specified | 30 * Fractional pixel coverage follows a similar flow. The coverage is initially t
he value specified |
| 33 * by setCoverage(). This is input to the first coverage stage. Coverage stages
are chained | 31 * by setCoverage(). This is input to the first coverage stage. Coverage stages
are chained |
| 34 * together in the same manner as color stages. The output of the last stage is
modulated by any | 32 * together in the same manner as color stages. The output of the last stage is
modulated by any |
| 35 * fractional coverage produced by anti-aliasing. This last step produces the fi
nal coverage, C. | 33 * fractional coverage produced by anti-aliasing. This last step produces the fi
nal coverage, C. |
| 36 * | 34 * |
| 37 * setBlendFunc() specifies blending coefficients for S (described above) and D,
the initial value | 35 * setXPFactory is used to control blending between the output color and dest. I
t also implements |
| 38 * of the destination pixel, labeled Bs and Bd respectively. The final value of
the destination | 36 * the application of fractional coverage from the coverage pipeline. |
| 39 * pixel is then D' = (1-C)*D + C*(Bd*D + Bs*S). | |
| 40 * | |
| 41 * Note that the coverage is applied after the blend. This is why they are compu
ted as distinct | |
| 42 * values. | |
| 43 * | |
| 44 * TODO: Encapsulate setXfermodeColorFilter in a GrProcessor and remove from GrP
aint. | |
| 45 */ | 37 */ |
| 46 class GrPaint { | 38 class GrPaint { |
| 47 public: | 39 public: |
| 48 GrPaint(); | 40 GrPaint(); |
| 49 | 41 |
| 50 GrPaint(const GrPaint& paint) { *this = paint; } | 42 GrPaint(const GrPaint& paint) { *this = paint; } |
| 51 | 43 |
| 52 ~GrPaint() {} | 44 ~GrPaint() {} |
| 53 | 45 |
| 54 /** | 46 /** |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 SkSTArray<4, GrFragmentStage> fColorStages; | 140 SkSTArray<4, GrFragmentStage> fColorStages; |
| 149 SkSTArray<2, GrFragmentStage> fCoverageStages; | 141 SkSTArray<2, GrFragmentStage> fCoverageStages; |
| 150 | 142 |
| 151 bool fAntiAlias; | 143 bool fAntiAlias; |
| 152 bool fDither; | 144 bool fDither; |
| 153 | 145 |
| 154 GrColor fColor; | 146 GrColor fColor; |
| 155 }; | 147 }; |
| 156 | 148 |
| 157 #endif | 149 #endif |
| OLD | NEW |