| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 if (colorPOI.firstEffectiveStageIndex() != 0) { | 46 if (colorPOI.firstEffectiveStageIndex() != 0) { |
| 47 overrideColor = colorPOI.inputColorToEffectiveStage(); | 47 overrideColor = colorPOI.inputColorToEffectiveStage(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 GrXferProcessor::OptFlags optFlags; | 50 GrXferProcessor::OptFlags optFlags; |
| 51 if (xferProcessor) { | 51 if (xferProcessor) { |
| 52 fXferProcessor.reset(xferProcessor.get()); | 52 fXferProcessor.reset(xferProcessor.get()); |
| 53 | 53 |
| 54 optFlags = xferProcessor->getOptimizations(colorPOI, | 54 optFlags = xferProcessor->getOptimizations(colorPOI, |
| 55 coveragePOI, | 55 coveragePOI, |
| 56 drawState.isColorWriteDisable
d(), | |
| 57 drawState.getStencil().doesWr
ite(), | 56 drawState.getStencil().doesWr
ite(), |
| 58 &overrideColor, | 57 &overrideColor, |
| 59 caps); | 58 caps); |
| 60 } | 59 } |
| 61 | 60 |
| 62 // When path rendering the stencil settings are not always set on the draw s
tate | 61 // When path rendering the stencil settings are not always set on the draw s
tate |
| 63 // so we must check the draw type. In cases where we will skip drawing we si
mply return a | 62 // so we must check the draw type. In cases where we will skip drawing we si
mply return a |
| 64 // null GrOptDrawState. | 63 // null GrOptDrawState. |
| 65 if (!xferProcessor || (GrXferProcessor::kSkipDraw_OptFlag & optFlags)) { | 64 if (!xferProcessor || (GrXferProcessor::kSkipDraw_OptFlag & optFlags)) { |
| 66 // Set the fields that don't default init and return. The lack of a rend
er target will | 65 // Set the fields that don't default init and return. The lack of a rend
er target will |
| (...skipping 12 matching lines...) Expand all Loading... |
| 79 fDrawFace = drawState.getDrawFace(); | 78 fDrawFace = drawState.getDrawFace(); |
| 80 // TODO move this out of optDrawState | 79 // TODO move this out of optDrawState |
| 81 if (dstCopy) { | 80 if (dstCopy) { |
| 82 fDstCopy = *dstCopy; | 81 fDstCopy = *dstCopy; |
| 83 } | 82 } |
| 84 | 83 |
| 85 fFlags = 0; | 84 fFlags = 0; |
| 86 if (drawState.isHWAntialias()) { | 85 if (drawState.isHWAntialias()) { |
| 87 fFlags |= kHWAA_Flag; | 86 fFlags |= kHWAA_Flag; |
| 88 } | 87 } |
| 89 if (drawState.isColorWriteDisabled()) { | |
| 90 fFlags |= kDisableColorWrite_Flag; | |
| 91 } | |
| 92 if (drawState.isDither()) { | 88 if (drawState.isDither()) { |
| 93 fFlags |= kDither_Flag; | 89 fFlags |= kDither_Flag; |
| 94 } | 90 } |
| 95 | 91 |
| 96 // TODO move local coords completely into GP | 92 // TODO move local coords completely into GP |
| 97 bool hasLocalCoords = gp && gp->hasLocalCoords(); | 93 bool hasLocalCoords = gp && gp->hasLocalCoords(); |
| 98 | 94 |
| 99 int firstColorStageIdx = colorPOI.firstEffectiveStageIndex(); | 95 int firstColorStageIdx = colorPOI.firstEffectiveStageIndex(); |
| 100 | 96 |
| 101 // TODO: Once we can handle single or four channel input into coverage stage
s then we can use | 97 // TODO: Once we can handle single or four channel input into coverage stage
s then we can use |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 199 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
| 204 return false; | 200 return false; |
| 205 } | 201 } |
| 206 } | 202 } |
| 207 | 203 |
| 208 // Now update the GrPrimitiveProcessor's batch tracker | 204 // Now update the GrPrimitiveProcessor's batch tracker |
| 209 fPrimitiveProcessor->makeEqual(&fBatchTracker, that.getBatchTracker()); | 205 fPrimitiveProcessor->makeEqual(&fBatchTracker, that.getBatchTracker()); |
| 210 return true; | 206 return true; |
| 211 } | 207 } |
| 212 | 208 |
| OLD | NEW |