| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 | 81 |
| 82 fFlags = 0; | 82 fFlags = 0; |
| 83 if (drawState.isHWAntialias()) { | 83 if (drawState.isHWAntialias()) { |
| 84 fFlags |= kHWAA_Flag; | 84 fFlags |= kHWAA_Flag; |
| 85 } | 85 } |
| 86 if (drawState.isDither()) { | 86 if (drawState.isDither()) { |
| 87 fFlags |= kDither_Flag; | 87 fFlags |= kDither_Flag; |
| 88 } | 88 } |
| 89 | 89 |
| 90 // TODO move local coords completely into GP | |
| 91 bool hasLocalCoords = gp && gp->hasLocalCoords(); | |
| 92 | |
| 93 int firstColorStageIdx = colorPOI.firstEffectiveStageIndex(); | 90 int firstColorStageIdx = colorPOI.firstEffectiveStageIndex(); |
| 94 | 91 |
| 95 // TODO: Once we can handle single or four channel input into coverage stage
s then we can use | 92 // TODO: Once we can handle single or four channel input into coverage stage
s then we can use |
| 96 // drawState's coverageProcInfo (like color above) to set this initial infor
mation. | 93 // drawState's coverageProcInfo (like color above) to set this initial infor
mation. |
| 97 int firstCoverageStageIdx = 0; | 94 int firstCoverageStageIdx = 0; |
| 98 | 95 |
| 99 GrXferProcessor::BlendInfo blendInfo; | 96 GrXferProcessor::BlendInfo blendInfo; |
| 100 fXferProcessor->getBlendInfo(&blendInfo); | 97 fXferProcessor->getBlendInfo(&blendInfo); |
| 101 | 98 |
| 102 this->adjustProgramFromOptimizations(drawState, optFlags, colorPOI, coverage
POI, | 99 this->adjustProgramFromOptimizations(drawState, optFlags, colorPOI, coverage
POI, |
| 103 &firstColorStageIdx, &firstCoverageStag
eIdx); | 100 &firstColorStageIdx, &firstCoverageStag
eIdx); |
| 104 | 101 |
| 105 fDescInfo.fRequiresLocalCoordAttrib = hasLocalCoords; | |
| 106 | |
| 107 bool usesLocalCoords = false; | 102 bool usesLocalCoords = false; |
| 108 | 103 |
| 109 // Copy Stages from DS to ODS | 104 // Copy Stages from DS to ODS |
| 110 for (int i = firstColorStageIdx; i < drawState.numColorStages(); ++i) { | 105 for (int i = firstColorStageIdx; i < drawState.numColorStages(); ++i) { |
| 111 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, | 106 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, |
| 112 GrPendingFragmentStage, | 107 GrPendingFragmentStage, |
| 113 (drawState.fColorStages[i])); | 108 (drawState.fColorStages[i])); |
| 114 usesLocalCoords = usesLocalCoords || | 109 usesLocalCoords = usesLocalCoords || |
| 115 drawState.fColorStages[i].processor()->usesLocalCoords
(); | 110 drawState.fColorStages[i].processor()->usesLocalCoords
(); |
| 116 } | 111 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 198 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
| 204 return false; | 199 return false; |
| 205 } | 200 } |
| 206 } | 201 } |
| 207 | 202 |
| 208 // Now update the GrPrimitiveProcessor's batch tracker | 203 // Now update the GrPrimitiveProcessor's batch tracker |
| 209 fPrimitiveProcessor->makeEqual(&fBatchTracker, that.getBatchTracker()); | 204 fPrimitiveProcessor->makeEqual(&fBatchTracker, that.getBatchTracker()); |
| 210 return true; | 205 return true; |
| 211 } | 206 } |
| 212 | 207 |
| OLD | NEW |