| 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 #include "GrOptDrawState.h" | 8 #include "GrOptDrawState.h" |
| 9 | 9 |
| 10 #include "GrDrawState.h" | 10 #include "GrDrawState.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 &firstColorStageIdx, &firstCoverageStag
eIdx); | 105 &firstColorStageIdx, &firstCoverageStag
eIdx); |
| 106 | 106 |
| 107 fDescInfo.fRequiresLocalCoordAttrib = hasLocalCoords; | 107 fDescInfo.fRequiresLocalCoordAttrib = hasLocalCoords; |
| 108 | 108 |
| 109 bool usesLocalCoords = false; | 109 bool usesLocalCoords = false; |
| 110 | 110 |
| 111 // Copy Stages from DS to ODS | 111 // Copy Stages from DS to ODS |
| 112 for (int i = firstColorStageIdx; i < drawState.numColorStages(); ++i) { | 112 for (int i = firstColorStageIdx; i < drawState.numColorStages(); ++i) { |
| 113 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, | 113 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, |
| 114 GrPendingFragmentStage, | 114 GrPendingFragmentStage, |
| 115 (drawState.fColorStages[i], hasLocalCoords)); | 115 (drawState.fColorStages[i])); |
| 116 usesLocalCoords = usesLocalCoords || | 116 usesLocalCoords = usesLocalCoords || |
| 117 drawState.fColorStages[i].getProcessor()->usesLocalCoo
rds(); | 117 drawState.fColorStages[i].processor()->usesLocalCoords
(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 fNumColorStages = fFragmentStages.count(); | 120 fNumColorStages = fFragmentStages.count(); |
| 121 for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i)
{ | 121 for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i)
{ |
| 122 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, | 122 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, |
| 123 GrPendingFragmentStage, | 123 GrPendingFragmentStage, |
| 124 (drawState.fCoverageStages[i], hasLocalCoords)); | 124 (drawState.fCoverageStages[i])); |
| 125 usesLocalCoords = usesLocalCoords || | 125 usesLocalCoords = usesLocalCoords || |
| 126 drawState.fCoverageStages[i].getProcessor()->usesLocal
Coords(); | 126 drawState.fCoverageStages[i].processor()->usesLocalCoo
rds(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // let the GP init the batch tracker | 129 // let the GP init the batch tracker |
| 130 GrGeometryProcessor::InitBT init; | 130 GrGeometryProcessor::InitBT init; |
| 131 init.fColorIgnored = SkToBool(optFlags & GrXferProcessor::kIgnoreColor_OptFl
ag); | 131 init.fColorIgnored = SkToBool(optFlags & GrXferProcessor::kIgnoreColor_OptFl
ag); |
| 132 init.fOverrideColor = init.fColorIgnored ? GrColor_ILLEGAL : overrideColor; | 132 init.fOverrideColor = init.fColorIgnored ? GrColor_ILLEGAL : overrideColor; |
| 133 init.fCoverageIgnored = SkToBool(optFlags & GrXferProcessor::kIgnoreCoverage
_OptFlag); | 133 init.fCoverageIgnored = SkToBool(optFlags & GrXferProcessor::kIgnoreCoverage
_OptFlag); |
| 134 init.fUsesLocalCoords = usesLocalCoords; | 134 init.fUsesLocalCoords = usesLocalCoords; |
| 135 fPrimitiveProcessor->initBatchTracker(&fBatchTracker, init); | 135 fPrimitiveProcessor->initBatchTracker(&fBatchTracker, init); |
| 136 } | 136 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 206 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
| 207 return false; | 207 return false; |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Now update the GrPrimitiveProcessor's batch tracker | 211 // Now update the GrPrimitiveProcessor's batch tracker |
| 212 fPrimitiveProcessor->makeEqual(&fBatchTracker, that.getBatchTracker()); | 212 fPrimitiveProcessor->makeEqual(&fBatchTracker, that.getBatchTracker()); |
| 213 return true; | 213 return true; |
| 214 } | 214 } |
| 215 | 215 |
| OLD | NEW |