Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: src/gpu/GrDrawState.h

Issue 25023003: Implement color filter as GrGLEffect (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 * Sets the color to be used for the next draw to be 259 * Sets the color to be used for the next draw to be
260 * (r,g,b,a) = (alpha, alpha, alpha, alpha). 260 * (r,g,b,a) = (alpha, alpha, alpha, alpha).
261 * 261 *
262 * @param alpha The alpha value to set as the color. 262 * @param alpha The alpha value to set as the color.
263 */ 263 */
264 void setAlpha(uint8_t a) { 264 void setAlpha(uint8_t a) {
265 this->setColor((a << 24) | (a << 16) | (a << 8) | a); 265 this->setColor((a << 24) | (a << 16) | (a << 8) | a);
266 } 266 }
267 267
268 /** 268 /**
269 * Add a color filter that can be represented by a color and a mode. Applied
270 * after color-computing effect stages.
271 */
272 void setColorFilter(GrColor c, SkXfermode::Mode mode) {
273 fCommon.fColorFilterColor = c;
274 fCommon.fColorFilterMode = mode;
275 }
276
277 GrColor getColorFilterColor() const { return fCommon.fColorFilterColor; }
278 SkXfermode::Mode getColorFilterMode() const { return fCommon.fColorFilterMod e; }
279
280 /**
281 * Constructor sets the color to be 'color' which is undone by the destructo r. 269 * Constructor sets the color to be 'color' which is undone by the destructo r.
282 */ 270 */
283 class AutoColorRestore : public ::SkNoncopyable { 271 class AutoColorRestore : public ::SkNoncopyable {
284 public: 272 public:
285 AutoColorRestore() : fDrawState(NULL), fOldColor(0) {} 273 AutoColorRestore() : fDrawState(NULL), fOldColor(0) {}
286 274
287 AutoColorRestore(GrDrawState* drawState, GrColor color) { 275 AutoColorRestore(GrDrawState* drawState, GrColor color) {
288 fDrawState = NULL; 276 fDrawState = NULL;
289 this->set(drawState, color); 277 this->set(drawState, color);
290 } 278 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 /// The input color to the first color-stage is either the constant color or interpolated 341 /// The input color to the first color-stage is either the constant color or interpolated
354 /// per-vertex colors. The input to the first coverage stage is either a con stant coverage 342 /// per-vertex colors. The input to the first coverage stage is either a con stant coverage
355 /// (usually full-coverage) or interpolated per-vertex coverage. 343 /// (usually full-coverage) or interpolated per-vertex coverage.
356 /// 344 ///
357 /// See the documentation of kCoverageDrawing_StateBit for information about disabling the 345 /// See the documentation of kCoverageDrawing_StateBit for information about disabling the
358 /// the color / coverage distinction. 346 /// the color / coverage distinction.
359 //// 347 ////
360 348
361 const GrEffectRef* addColorEffect(const GrEffectRef* effect, int attr0 = -1, int attr1 = -1) { 349 const GrEffectRef* addColorEffect(const GrEffectRef* effect, int attr0 = -1, int attr1 = -1) {
362 SkASSERT(NULL != effect); 350 SkASSERT(NULL != effect);
363 SkNEW_APPEND_TO_TARRAY(&fColorStages, GrEffectStage, (effect, attr0, att r1)); 351 fColorStages.appendStage(effect, attr0, attr1);
364 return effect; 352 return effect;
365 } 353 }
366 354
367 const GrEffectRef* addCoverageEffect(const GrEffectRef* effect, int attr0 = -1, int attr1 = -1) { 355 const GrEffectRef* addCoverageEffect(const GrEffectRef* effect, int attr0 = -1, int attr1 = -1) {
368 SkASSERT(NULL != effect); 356 SkASSERT(NULL != effect);
369 SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrEffectStage, (effect, attr0, attr1)); 357 fCoverageStages.appendStage(effect, attr0, attr1);
370 return effect; 358 return effect;
371 } 359 }
372 360
373 /** 361 /**
374 * Creates a GrSimpleTextureEffect that uses local coords as texture coordin ates. 362 * Creates a GrSimpleTextureEffect that uses local coords as texture coordin ates.
375 */ 363 */
376 void addColorTextureEffect(GrTexture* texture, const SkMatrix& matrix) { 364 void addColorTextureEffect(GrTexture* texture, const SkMatrix& matrix) {
377 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix); 365 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix);
378 this->addColorEffect(effect)->unref(); 366 this->addColorEffect(effect)->unref();
379 } 367 }
(...skipping 16 matching lines...) Expand all
396 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, par ams); 384 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, par ams);
397 this->addCoverageEffect(effect)->unref(); 385 this->addCoverageEffect(effect)->unref();
398 } 386 }
399 387
400 /** 388 /**
401 * When this object is destroyed it will remove any effects from the draw st ate that were added 389 * When this object is destroyed it will remove any effects from the draw st ate that were added
402 * after its constructor. 390 * after its constructor.
403 */ 391 */
404 class AutoRestoreEffects : public ::SkNoncopyable { 392 class AutoRestoreEffects : public ::SkNoncopyable {
405 public: 393 public:
406 AutoRestoreEffects() : fDrawState(NULL), fColorEffectCnt(0), fCoverageEf fectCnt(0) {} 394 AutoRestoreEffects()
395 : fDrawState(NULL),
396 fFirstEffectiveColorEffect(0),
397 fColorEffectCnt(0),
398 fFirstEffectiveCoverageEffect(0),
399 fCoverageEffectCnt(0) {
400 }
407 401
408 AutoRestoreEffects(GrDrawState* ds) : fDrawState(NULL), fColorEffectCnt( 0), fCoverageEffectCnt(0) { 402 AutoRestoreEffects(GrDrawState* ds)
403 : fDrawState(NULL),
404 fFirstEffectiveColorEffect(0),
405 fColorEffectCnt(0),
406 fFirstEffectiveCoverageEffect(0),
407 fCoverageEffectCnt(0) {
409 this->set(ds); 408 this->set(ds);
410 } 409 }
411 410
412 ~AutoRestoreEffects() { this->set(NULL); } 411 ~AutoRestoreEffects() { this->set(NULL); }
413 412
414 void set(GrDrawState* ds) { 413 void set(GrDrawState* ds) {
415 if (NULL != fDrawState) { 414 if (NULL != fDrawState) {
416 int n = fDrawState->fColorStages.count() - fColorEffectCnt; 415 int n = fDrawState->fColorStages.count() - fColorEffectCnt;
417 SkASSERT(n >= 0); 416 SkASSERT(n >= 0);
418 fDrawState->fColorStages.pop_back_n(n); 417 fDrawState->fColorStages.removeLastStages(n, fFirstEffectiveColo rEffect);
419 n = fDrawState->fCoverageStages.count() - fCoverageEffectCnt; 418 n = fDrawState->fCoverageStages.count() - fCoverageEffectCnt;
420 SkASSERT(n >= 0); 419 SkASSERT(n >= 0);
421 fDrawState->fCoverageStages.pop_back_n(n); 420 fDrawState->fCoverageStages.removeLastStages(n, fFirstEffectiveC overageEffect);
422 SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;) 421 SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;)
423 } 422 }
424 fDrawState = ds; 423 fDrawState = ds;
425 if (NULL != ds) { 424 if (NULL != ds) {
425 fFirstEffectiveColorEffect = ds->fColorStages.getFirstEffectiveS tageIndex();
426 fColorEffectCnt = ds->fColorStages.count(); 426 fColorEffectCnt = ds->fColorStages.count();
427 fFirstEffectiveCoverageEffect = ds->fCoverageStages.getFirstEffe ctiveStageIndex();
427 fCoverageEffectCnt = ds->fCoverageStages.count(); 428 fCoverageEffectCnt = ds->fCoverageStages.count();
428 SkDEBUGCODE(++ds->fBlockEffectRemovalCnt;) 429 SkDEBUGCODE(++ds->fBlockEffectRemovalCnt;)
429 } 430 }
430 } 431 }
431 432
432 private: 433 private:
433 GrDrawState* fDrawState; 434 GrDrawState* fDrawState;
435 int fFirstEffectiveColorEffect;
434 int fColorEffectCnt; 436 int fColorEffectCnt;
437 int fFirstEffectiveCoverageEffect;
435 int fCoverageEffectCnt; 438 int fCoverageEffectCnt;
436 }; 439 };
437 440
438 int numColorStages() const { return fColorStages.count(); } 441 int totalStageCount() const { return fColorStages.count() + fCoverageStages. count(); }
439 int numCoverageStages() const { return fCoverageStages.count(); }
440 int numTotalStages() const { return this->numColorStages() + this->numCovera geStages(); }
441 442
442 const GrEffectStage& getColorStage(int stageIdx) const { return fColorStages [stageIdx]; } 443 int effectiveColorStageCount() const { return fColorStages.effectiveStageCou nt(); }
443 const GrEffectStage& getCoverageStage(int stageIdx) const { return fCoverage Stages[stageIdx]; } 444 int effectiveCoverageStageCount() const { return fCoverageStages.effectiveSt ageCount(); }
445 int totalEffectiveStageCount() const { return this->effectiveColorStageCount () + this->effectiveCoverageStageCount(); }
446
447 const GrEffectStage& getEffectiveColorStage(int stageIdx) const { return fCo lorStages.getEffectiveStage(stageIdx); }
448 const GrEffectStage& getEffectiveCoverageStage(int stageIdx) const { return fCoverageStages.getEffectiveStage(stageIdx); }
444 449
445 /** 450 /**
446 * Checks whether any of the effects will read the dst pixel color. 451 * Checks whether any of the effects will read the dst pixel color.
447 */ 452 */
448 bool willEffectReadDstColor() const; 453 bool willEffectReadDstColor() const;
449 454
450 /// @} 455 /// @}
451 456
452 /////////////////////////////////////////////////////////////////////////// 457 ///////////////////////////////////////////////////////////////////////////
453 /// @name Blending 458 /// @name Blending
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 for (int i = 0; i < fCoverageStages.count(); i++) { 882 for (int i = 0; i < fCoverageStages.count(); i++) {
878 if (fCoverageStages[i] != s.fCoverageStages[i]) { 883 if (fCoverageStages[i] != s.fCoverageStages[i]) {
879 return false; 884 return false;
880 } 885 }
881 } 886 }
882 return true; 887 return true;
883 } 888 }
884 bool operator !=(const GrDrawState& s) const { return !(*this == s); } 889 bool operator !=(const GrDrawState& s) const { return !(*this == s); }
885 890
886 GrDrawState& operator= (const GrDrawState& s) { 891 GrDrawState& operator= (const GrDrawState& s) {
887 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages()); 892 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->totalStageCount());
888 this->setRenderTarget(s.fRenderTarget.get()); 893 this->setRenderTarget(s.fRenderTarget.get());
889 fCommon = s.fCommon; 894 fCommon = s.fCommon;
890 fColorStages = s.fColorStages; 895 fColorStages = s.fColorStages;
891 fCoverageStages = s.fCoverageStages; 896 fCoverageStages = s.fCoverageStages;
897
892 return *this; 898 return *this;
893 } 899 }
894 900
895 private: 901 private:
896 902
897 void onReset(const SkMatrix* initialViewMatrix) { 903 void onReset(const SkMatrix* initialViewMatrix) {
898 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages()); 904 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->totalStageCount());
899 fColorStages.reset(); 905 fColorStages.reset();
900 fCoverageStages.reset(); 906 fCoverageStages.reset();
901 907
902 fRenderTarget.reset(NULL); 908 fRenderTarget.reset(NULL);
903 909
904 this->setDefaultVertexAttribs(); 910 this->setDefaultVertexAttribs();
905 911
906 fCommon.fColor = 0xffffffff; 912 fCommon.fColor = 0xffffffff;
907 if (NULL == initialViewMatrix) { 913 if (NULL == initialViewMatrix) {
908 fCommon.fViewMatrix.reset(); 914 fCommon.fViewMatrix.reset();
909 } else { 915 } else {
910 fCommon.fViewMatrix = *initialViewMatrix; 916 fCommon.fViewMatrix = *initialViewMatrix;
911 } 917 }
912 fCommon.fSrcBlend = kOne_GrBlendCoeff; 918 fCommon.fSrcBlend = kOne_GrBlendCoeff;
913 fCommon.fDstBlend = kZero_GrBlendCoeff; 919 fCommon.fDstBlend = kZero_GrBlendCoeff;
914 fCommon.fBlendConstant = 0x0; 920 fCommon.fBlendConstant = 0x0;
915 fCommon.fFlagBits = 0x0; 921 fCommon.fFlagBits = 0x0;
916 fCommon.fStencilSettings.setDisabled(); 922 fCommon.fStencilSettings.setDisabled();
917 fCommon.fCoverage = 0xffffffff; 923 fCommon.fCoverage = 0xffffffff;
918 fCommon.fColorFilterMode = SkXfermode::kDst_Mode;
919 fCommon.fColorFilterColor = 0x0;
920 fCommon.fDrawFace = kBoth_DrawFace; 924 fCommon.fDrawFace = kBoth_DrawFace;
921 } 925 }
922 926
923 /** Fields that are identical in GrDrawState and GrDrawState::DeferredState. */ 927 /** Fields that are identical in GrDrawState and GrDrawState::DeferredState. */
924 struct CommonState { 928 struct CommonState {
925 // These fields are roughly sorted by decreasing likelihood of being dif ferent in op== 929 // These fields are roughly sorted by decreasing likelihood of being dif ferent in op==
926 GrColor fColor; 930 GrColor fColor;
927 SkMatrix fViewMatrix; 931 SkMatrix fViewMatrix;
928 GrBlendCoeff fSrcBlend; 932 GrBlendCoeff fSrcBlend;
929 GrBlendCoeff fDstBlend; 933 GrBlendCoeff fDstBlend;
930 GrColor fBlendConstant; 934 GrColor fBlendConstant;
931 uint32_t fFlagBits; 935 uint32_t fFlagBits;
932 const GrVertexAttrib* fVAPtr; 936 const GrVertexAttrib* fVAPtr;
933 int fVACount; 937 int fVACount;
934 GrStencilSettings fStencilSettings; 938 GrStencilSettings fStencilSettings;
935 GrColor fCoverage; 939 GrColor fCoverage;
936 SkXfermode::Mode fColorFilterMode;
937 GrColor fColorFilterColor;
938 DrawFace fDrawFace; 940 DrawFace fDrawFace;
939 941
940 // This is simply a different representation of info in fVertexAttribs a nd thus does 942 // This is simply a different representation of info in fVertexAttribs a nd thus does
941 // not need to be compared in op==. 943 // not need to be compared in op==.
942 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindin gCnt]; 944 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindin gCnt];
943 945
944 bool operator== (const CommonState& other) const { 946 bool operator== (const CommonState& other) const {
945 bool result = fColor == other.fColor && 947 bool result = fColor == other.fColor &&
946 fViewMatrix.cheapEqualTo(other.fViewMatrix) && 948 fViewMatrix.cheapEqualTo(other.fViewMatrix) &&
947 fSrcBlend == other.fSrcBlend && 949 fSrcBlend == other.fSrcBlend &&
948 fDstBlend == other.fDstBlend && 950 fDstBlend == other.fDstBlend &&
949 fBlendConstant == other.fBlendConstant && 951 fBlendConstant == other.fBlendConstant &&
950 fFlagBits == other.fFlagBits && 952 fFlagBits == other.fFlagBits &&
951 fVACount == other.fVACount && 953 fVACount == other.fVACount &&
952 !memcmp(fVAPtr, other.fVAPtr, fVACount * sizeof(GrVert exAttrib)) && 954 !memcmp(fVAPtr, other.fVAPtr, fVACount * sizeof(GrVert exAttrib)) &&
953 fStencilSettings == other.fStencilSettings && 955 fStencilSettings == other.fStencilSettings &&
954 fCoverage == other.fCoverage && 956 fCoverage == other.fCoverage &&
955 fColorFilterMode == other.fColorFilterMode &&
956 fColorFilterColor == other.fColorFilterColor &&
957 fDrawFace == other.fDrawFace; 957 fDrawFace == other.fDrawFace;
958 SkASSERT(!result || 0 == memcmp(fFixedFunctionVertexAttribIndices, 958 SkASSERT(!result || 0 == memcmp(fFixedFunctionVertexAttribIndices,
959 other.fFixedFunctionVertexAttribIndi ces, 959 other.fFixedFunctionVertexAttribIndi ces,
960 sizeof(fFixedFunctionVertexAttribInd ices))); 960 sizeof(fFixedFunctionVertexAttribInd ices)));
961 return result; 961 return result;
962 } 962 }
963 bool operator!= (const CommonState& other) const { return !(*this == oth er); } 963 bool operator!= (const CommonState& other) const { return !(*this == oth er); }
964 }; 964 };
965 965
966 /** GrDrawState uses GrEffectStages to hold stage state which holds a ref on GrEffectRef. 966 /** GrDrawState uses GrEffectStages to hold stage state which holds a ref on GrEffectRef.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 SkDEBUGCODE(fInitialized = true;) 1005 SkDEBUGCODE(fInitialized = true;)
1006 } 1006 }
1007 1007
1008 void restoreTo(GrDrawState* drawState) { 1008 void restoreTo(GrDrawState* drawState) {
1009 SkASSERT(fInitialized); 1009 SkASSERT(fInitialized);
1010 drawState->fCommon = fCommon; 1010 drawState->fCommon = fCommon;
1011 drawState->setRenderTarget(fRenderTarget); 1011 drawState->setRenderTarget(fRenderTarget);
1012 // reinflate color/cov stage arrays. 1012 // reinflate color/cov stage arrays.
1013 drawState->fColorStages.reset(); 1013 drawState->fColorStages.reset();
1014 for (int i = 0; i < fColorStageCnt; ++i) { 1014 for (int i = 0; i < fColorStageCnt; ++i) {
1015 SkNEW_APPEND_TO_TARRAY(&drawState->fColorStages, GrEffectStage, (fStages[i])); 1015 drawState->fColorStages.appendStage(fStages[i]);
1016 } 1016 }
1017 int coverageStageCnt = fStages.count() - fColorStageCnt; 1017 int coverageStageCnt = fStages.count() - fColorStageCnt;
1018 drawState->fCoverageStages.reset(); 1018 drawState->fCoverageStages.reset();
1019 for (int i = 0; i < coverageStageCnt; ++i) { 1019 for (int i = 0; i < coverageStageCnt; ++i) {
1020 SkNEW_APPEND_TO_TARRAY(&drawState->fCoverageStages, 1020 drawState->fCoverageStages.appendStage(fStages[i + fColorStageCn t]);
1021 GrEffectStage, (fStages[i + fColorStageC nt]));
1022 } 1021 }
1023 } 1022 }
1024 1023
1025 bool isEqual(const GrDrawState& state) const { 1024 bool isEqual(const GrDrawState& state) const {
1026 int numCoverageStages = fStages.count() - fColorStageCnt; 1025 int numCoverageStages = fStages.count() - fColorStageCnt;
1027 if (fRenderTarget != state.fRenderTarget.get() || 1026 if (fRenderTarget != state.fRenderTarget.get() ||
1028 fColorStageCnt != state.fColorStages.count() || 1027 fColorStageCnt != state.fColorStages.count() ||
1029 numCoverageStages != state.fCoverageStages.count() || 1028 numCoverageStages != state.fCoverageStages.count() ||
1030 fCommon != state.fCommon) { 1029 fCommon != state.fCommon) {
1031 return false; 1030 return false;
(...skipping 22 matching lines...) Expand all
1054 DeferredStageArray fStages; 1053 DeferredStageArray fStages;
1055 1054
1056 SkDEBUGCODE(bool fInitialized;) 1055 SkDEBUGCODE(bool fInitialized;)
1057 }; 1056 };
1058 1057
1059 private: 1058 private:
1060 1059
1061 SkAutoTUnref<GrRenderTarget> fRenderTarget; 1060 SkAutoTUnref<GrRenderTarget> fRenderTarget;
1062 CommonState fCommon; 1061 CommonState fCommon;
1063 1062
1064 typedef SkSTArray<4, GrEffectStage> EffectStageArray; 1063 class EffectStageArray {
bsalomon 2013/10/07 14:05:00 It seems like we'd be adding a fair amount of comp
Kimmo Kinnunen 2013/10/10 08:12:29 Done.
1064 public:
1065 EffectStageArray()
1066 : fFirstEffectiveStage(0) {
1067 }
1068
1069 int getFirstEffectiveStageIndex() const { return fFirstEffectiveStage; }
1070
1071 const GrEffectStage& getEffectiveStage(int i) const { return fArray[i + fFirstEffectiveStage]; }
1072
1073 int effectiveStageCount() const { return fArray.count() - fFirstEffectiv eStage; }
1074
1075 void appendStage(const GrEffectRef* effect, int attr0, int attr1) {
1076 GrEffectStage* newStage = SkNEW_APPEND_TO_TARRAY(&fArray, GrEffectSt age, (effect, attr0, attr1));
1077 if (!(*newStage->getEffect())->willUseInputColor()) {
1078 fFirstEffectiveStage = fArray.count() - 1;
1079 }
1080 }
1081
1082 void appendStage(const GrEffectStage::DeferredStage& effect) {
1083 GrEffectStage* newStage = SkNEW_APPEND_TO_TARRAY(&fArray, GrEffectSt age, (effect));
1084 if (!(*newStage->getEffect())->willUseInputColor()) {
1085 fFirstEffectiveStage = fArray.count() - 1;
1086 }
1087 }
1088
1089 void appendStage(const GrEffectStage& effect) {
1090 GrEffectStage& newStage = fArray.push_back(effect);
1091 if (!(*newStage.getEffect())->willUseInputColor()) {
1092 fFirstEffectiveStage = fArray.count() - 1;
1093 }
1094 }
1095
1096 void removeLastStages(int n, int newFirstEffectiveStage) {
1097 fArray.pop_back_n(n);
1098 fFirstEffectiveStage = newFirstEffectiveStage;
1099 }
1100
1101 const GrEffectStage& operator[](int i) const { return fArray[i]; }
1102 GrEffectStage& operator[](int i) { return fArray[i]; }
1103
1104 void reset() {
1105 fArray.reset();
1106 fFirstEffectiveStage = 0;
1107 }
1108
1109 int count() const { return fArray.count(); }
1110
1111 private:
1112 SkSTArray<4, GrEffectStage> fArray;
1113 int fFirstEffectiveStage;
1114 };
1115
1065 EffectStageArray fColorStages; 1116 EffectStageArray fColorStages;
1066 EffectStageArray fCoverageStages; 1117 EffectStageArray fCoverageStages;
1067 1118
1068 // Some of the auto restore objects assume that no effects are removed durin g their lifetime. 1119 // Some of the auto restore objects assume that no effects are removed durin g their lifetime.
1069 // This is used to assert that this condition holds. 1120 // This is used to assert that this condition holds.
1070 SkDEBUGCODE(int fBlockEffectRemovalCnt;) 1121 SkDEBUGCODE(int fBlockEffectRemovalCnt;)
1071 1122
1072 /** 1123 /**
1073 * Sets vertex attributes for next draw. 1124 * Sets vertex attributes for next draw.
1074 * 1125 *
1075 * @param attribs the array of vertex attributes to set. 1126 * @param attribs the array of vertex attributes to set.
1076 * @param count the number of attributes being set, limited to kMaxVer texAttribCnt. 1127 * @param count the number of attributes being set, limited to kMaxVer texAttribCnt.
1077 */ 1128 */
1078 void setVertexAttribs(const GrVertexAttrib attribs[], int count); 1129 void setVertexAttribs(const GrVertexAttrib attribs[], int count);
1079 1130
1080 typedef SkRefCnt INHERITED; 1131 typedef SkRefCnt INHERITED;
1081 }; 1132 };
1082 1133
1083 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); 1134 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags);
1084 1135
1085 #endif 1136 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698