| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 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 GrXferProcessor_DEFINED | 8 #ifndef GrXferProcessor_DEFINED |
| 9 #define GrXferProcessor_DEFINED | 9 #define GrXferProcessor_DEFINED |
| 10 | 10 |
| 11 #include "GrColor.h" | 11 #include "GrColor.h" |
| 12 #include "GrProcessor.h" | 12 #include "GrProcessor.h" |
| 13 #include "GrTexture.h" | 13 #include "GrTexture.h" |
| 14 #include "GrTypes.h" | 14 #include "GrTypes.h" |
| 15 #include "SkXfermode.h" | 15 #include "SkXfermode.h" |
| 16 | 16 |
| 17 class GrDrawTargetCaps; | 17 class GrDrawTargetCaps; |
| 18 class GrGLCaps; | 18 class GrGLCaps; |
| 19 class GrGLXferProcessor; | 19 class GrGLXferProcessor; |
| 20 class GrProcOptInfo; | 20 class GrProcOptInfo; |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * Coeffecients for alpha-blending. |
| 24 */ |
| 25 enum GrBlendCoeff { |
| 26 kInvalid_GrBlendCoeff = -1, |
| 27 |
| 28 kZero_GrBlendCoeff, //<! 0 |
| 29 kOne_GrBlendCoeff, //<! 1 |
| 30 kSC_GrBlendCoeff, //<! src color |
| 31 kISC_GrBlendCoeff, //<! one minus src color |
| 32 kDC_GrBlendCoeff, //<! dst color |
| 33 kIDC_GrBlendCoeff, //<! one minus dst color |
| 34 kSA_GrBlendCoeff, //<! src alpha |
| 35 kISA_GrBlendCoeff, //<! one minus src alpha |
| 36 kDA_GrBlendCoeff, //<! dst alpha |
| 37 kIDA_GrBlendCoeff, //<! one minus dst alpha |
| 38 kConstC_GrBlendCoeff, //<! constant color |
| 39 kIConstC_GrBlendCoeff, //<! one minus constant color |
| 40 kConstA_GrBlendCoeff, //<! constant color alpha |
| 41 kIConstA_GrBlendCoeff, //<! one minus constant color alpha |
| 42 kS2C_GrBlendCoeff, |
| 43 kIS2C_GrBlendCoeff, |
| 44 kS2A_GrBlendCoeff, |
| 45 kIS2A_GrBlendCoeff, |
| 46 |
| 47 kTotalGrBlendCoeffCount |
| 48 }; |
| 49 |
| 50 /** |
| 23 * GrXferProcessor is responsible for implementing the xfer mode that blends the
src color and dst | 51 * GrXferProcessor is responsible for implementing the xfer mode that blends the
src color and dst |
| 24 * color. It does this by emitting fragment shader code and controlling the fixe
d-function blend | 52 * color. It does this by emitting fragment shader code and controlling the fixe
d-function blend |
| 25 * state. The inputs to its shader code are the final computed src color and fra
ctional pixel | 53 * state. The inputs to its shader code are the final computed src color and fra
ctional pixel |
| 26 * coverage. The GrXferProcessor's shader code writes the fragment shader output
color that goes | 54 * coverage. The GrXferProcessor's shader code writes the fragment shader output
color that goes |
| 27 * into the fixed-function blend. When dual-source blending is available, it may
also write a | 55 * into the fixed-function blend. When dual-source blending is available, it may
also write a |
| 28 * seconday fragment shader output color. When allowed by the backend API, the G
rXferProcessor may | 56 * seconday fragment shader output color. When allowed by the backend API, the G
rXferProcessor may |
| 29 * read the destination color. The GrXferProcessor is responsible for setting th
e blend coefficients | 57 * read the destination color. The GrXferProcessor is responsible for setting th
e blend coefficients |
| 30 * and blend constant color. | 58 * and blend constant color. |
| 31 * | 59 * |
| 32 * A GrXferProcessor is never installed directly into our draw state, but instea
d is created from a | 60 * A GrXferProcessor is never installed directly into our draw state, but instea
d is created from a |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 enum { | 320 enum { |
| 293 kIllegalXPFClassID = 0, | 321 kIllegalXPFClassID = 0, |
| 294 }; | 322 }; |
| 295 static int32_t gCurrXPFClassID; | 323 static int32_t gCurrXPFClassID; |
| 296 | 324 |
| 297 typedef GrProgramElement INHERITED; | 325 typedef GrProgramElement INHERITED; |
| 298 }; | 326 }; |
| 299 | 327 |
| 300 #endif | 328 #endif |
| 301 | 329 |
| OLD | NEW |