OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "GrDrawState.h" | 8 #include "GrDrawState.h" |
9 #include "GrPaint.h" | 9 #include "GrPaint.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 fCommon.fViewMatrix.reset(); | 25 fCommon.fViewMatrix.reset(); |
26 return true; | 26 return true; |
27 } | 27 } |
28 | 28 |
29 void GrDrawState::setFromPaint(const GrPaint& paint, const SkMatrix& vm, GrRende
rTarget* rt) { | 29 void GrDrawState::setFromPaint(const GrPaint& paint, const SkMatrix& vm, GrRende
rTarget* rt) { |
30 GrAssert(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages()); | 30 GrAssert(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages()); |
31 | 31 |
32 fColorStages.reset(); | 32 fColorStages.reset(); |
33 fCoverageStages.reset(); | 33 fCoverageStages.reset(); |
34 | 34 |
35 for (int i = 0; i < GrPaint::kMaxColorStages; ++i) { | 35 for (int i = 0; i < paint.numColorStages(); ++i) { |
36 if (paint.isColorStageEnabled(i)) { | 36 fColorStages.push_back(paint.getColorStage(i)); |
37 fColorStages.push_back(paint.getColorStage(i)); | |
38 } | |
39 } | 37 } |
40 | 38 |
41 for (int i = 0; i < GrPaint::kMaxCoverageStages; ++i) { | 39 for (int i = 0; i < paint.numCoverageStages(); ++i) { |
42 if (paint.isCoverageStageEnabled(i)) { | 40 fCoverageStages.push_back(paint.getCoverageStage(i)); |
43 fCoverageStages.push_back(paint.getCoverageStage(i)); | |
44 } | |
45 } | 41 } |
46 | 42 |
47 this->setRenderTarget(rt); | 43 this->setRenderTarget(rt); |
48 | 44 |
49 fCommon.fViewMatrix = vm; | 45 fCommon.fViewMatrix = vm; |
50 | 46 |
51 // These have no equivalent in GrPaint, set them to defaults | 47 // These have no equivalent in GrPaint, set them to defaults |
52 fCommon.fBlendConstant = 0x0; | 48 fCommon.fBlendConstant = 0x0; |
53 fCommon.fCoverage = 0xffffffff; | 49 fCommon.fCoverage = 0xffffffff; |
54 fCommon.fDrawFace = kBoth_DrawFace; | 50 fCommon.fDrawFace = kBoth_DrawFace; |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 fDrawState->fColorStages[s].saveCoordChange(&fSavedCoordChanges[i]); | 475 fDrawState->fColorStages[s].saveCoordChange(&fSavedCoordChanges[i]); |
480 fDrawState->fColorStages[s].localCoordChange(coordChangeMatrix); | 476 fDrawState->fColorStages[s].localCoordChange(coordChangeMatrix); |
481 } | 477 } |
482 | 478 |
483 int numCoverageStages = fDrawState->numCoverageStages(); | 479 int numCoverageStages = fDrawState->numCoverageStages(); |
484 for (int s = 0; s < numCoverageStages; ++s, ++i) { | 480 for (int s = 0; s < numCoverageStages; ++s, ++i) { |
485 fDrawState->fCoverageStages[s].saveCoordChange(&fSavedCoordChanges[i]); | 481 fDrawState->fCoverageStages[s].saveCoordChange(&fSavedCoordChanges[i]); |
486 fDrawState->fCoverageStages[s].localCoordChange(coordChangeMatrix); | 482 fDrawState->fCoverageStages[s].localCoordChange(coordChangeMatrix); |
487 } | 483 } |
488 } | 484 } |
OLD | NEW |