OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrDrawState_DEFINED | 8 #ifndef GrDrawState_DEFINED |
9 #define GrDrawState_DEFINED | 9 #define GrDrawState_DEFINED |
10 | 10 |
11 #include "GrBackendEffectFactory.h" | 11 #include "GrBackendEffectFactory.h" |
| 12 #include "GrBlend.h" |
12 #include "GrColor.h" | 13 #include "GrColor.h" |
13 #include "GrEffectStage.h" | 14 #include "GrEffectStage.h" |
14 #include "GrPaint.h" | 15 #include "GrPaint.h" |
15 #include "GrPoint.h" | 16 #include "GrPoint.h" |
16 #include "GrRefCnt.h" | 17 #include "GrRefCnt.h" |
17 #include "GrRenderTarget.h" | 18 #include "GrRenderTarget.h" |
18 #include "GrStencil.h" | 19 #include "GrStencil.h" |
19 #include "GrTemplates.h" | 20 #include "GrTemplates.h" |
20 #include "GrTexture.h" | 21 #include "GrTexture.h" |
21 #include "GrTypesPriv.h" | 22 #include "GrTypesPriv.h" |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 * color, and D' is the new destination color that will be written. sat() | 463 * color, and D' is the new destination color that will be written. sat() |
463 * is the saturation function. | 464 * is the saturation function. |
464 * | 465 * |
465 * @param srcCoef coefficient applied to the src color. | 466 * @param srcCoef coefficient applied to the src color. |
466 * @param dstCoef coefficient applied to the dst color. | 467 * @param dstCoef coefficient applied to the dst color. |
467 */ | 468 */ |
468 void setBlendFunc(GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff) { | 469 void setBlendFunc(GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff) { |
469 fCommon.fSrcBlend = srcCoeff; | 470 fCommon.fSrcBlend = srcCoeff; |
470 fCommon.fDstBlend = dstCoeff; | 471 fCommon.fDstBlend = dstCoeff; |
471 #if GR_DEBUG | 472 #if GR_DEBUG |
472 switch (dstCoeff) { | 473 if (GrBlendCoeffRefsDst(dstCoeff)) { |
473 case kDC_GrBlendCoeff: | 474 GrPrintf("Unexpected dst blend coeff. Won't work correctly with cove
rage stages.\n"); |
474 case kIDC_GrBlendCoeff: | |
475 case kDA_GrBlendCoeff: | |
476 case kIDA_GrBlendCoeff: | |
477 GrPrintf("Unexpected dst blend coeff. Won't work correctly with" | |
478 "coverage stages.\n"); | |
479 break; | |
480 default: | |
481 break; | |
482 } | 475 } |
483 switch (srcCoeff) { | 476 if (GrBlendCoeffRefsSrc(srcCoeff)) { |
484 case kSC_GrBlendCoeff: | 477 GrPrintf("Unexpected src blend coeff. Won't work correctly with cove
rage stages.\n"); |
485 case kISC_GrBlendCoeff: | |
486 case kSA_GrBlendCoeff: | |
487 case kISA_GrBlendCoeff: | |
488 GrPrintf("Unexpected src blend coeff. Won't work correctly with" | |
489 "coverage stages.\n"); | |
490 break; | |
491 default: | |
492 break; | |
493 } | 478 } |
494 #endif | 479 #endif |
495 } | 480 } |
496 | 481 |
497 GrBlendCoeff getSrcBlendCoeff() const { return fCommon.fSrcBlend; } | 482 GrBlendCoeff getSrcBlendCoeff() const { return fCommon.fSrcBlend; } |
498 GrBlendCoeff getDstBlendCoeff() const { return fCommon.fDstBlend; } | 483 GrBlendCoeff getDstBlendCoeff() const { return fCommon.fDstBlend; } |
499 | 484 |
500 void getDstBlendCoeff(GrBlendCoeff* srcBlendCoeff, | 485 void getDstBlendCoeff(GrBlendCoeff* srcBlendCoeff, |
501 GrBlendCoeff* dstBlendCoeff) const { | 486 GrBlendCoeff* dstBlendCoeff) const { |
502 *srcBlendCoeff = fCommon.fSrcBlend; | 487 *srcBlendCoeff = fCommon.fSrcBlend; |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 * @param count the number of attributes being set, limited to kMaxVer
texAttribCnt. | 1076 * @param count the number of attributes being set, limited to kMaxVer
texAttribCnt. |
1092 */ | 1077 */ |
1093 void setVertexAttribs(const GrVertexAttrib attribs[], int count); | 1078 void setVertexAttribs(const GrVertexAttrib attribs[], int count); |
1094 | 1079 |
1095 typedef GrRefCnt INHERITED; | 1080 typedef GrRefCnt INHERITED; |
1096 }; | 1081 }; |
1097 | 1082 |
1098 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); | 1083 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); |
1099 | 1084 |
1100 #endif | 1085 #endif |
OLD | NEW |