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" |
11 #include "GrDrawTargetCaps.h" | 11 #include "GrDrawTargetCaps.h" |
12 #include "GrGpu.h" | 12 #include "GrGpu.h" |
13 #include "GrProcOptInfo.h" | 13 #include "GrProcOptInfo.h" |
14 #include "GrXferProcessor.h" | 14 #include "GrXferProcessor.h" |
15 | 15 |
16 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, | 16 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
17 const GrGeometryProcessor* gp, | 17 const GrPrimitiveProcessor* primProc, |
18 const GrPathProcessor* pathProc, | |
19 const GrDrawTargetCaps& caps, | 18 const GrDrawTargetCaps& caps, |
20 const GrScissorState& scissorState, | 19 const GrScissorState& scissorState, |
21 const GrDeviceCoordTexture* dstCopy, | 20 const GrDeviceCoordTexture* dstCopy, |
22 GrGpu::DrawType drawType) | 21 GrGpu::DrawType drawType) |
23 : fFinalized(false) { | 22 : fFinalized(false) { |
24 fDrawType = drawType; | 23 fDrawType = drawType; |
25 | 24 |
26 // Copy GeometryProcesssor from DS or ODS | 25 fPrimitiveProcessor.reset(primProc); |
27 if (gp) { | |
28 SkASSERT(!pathProc); | |
29 SkASSERT(!GrGpu::IsPathRenderingDrawType(drawType)); | |
30 fGeometryProcessor.reset(gp); | |
31 fPrimitiveProcessor.reset(gp); | |
32 } else { | |
33 SkASSERT(!gp && pathProc && GrGpu::IsPathRenderingDrawType(drawType)); | |
34 fPrimitiveProcessor.reset(pathProc); | |
35 } | |
36 | 26 |
37 | 27 |
38 const GrProcOptInfo& colorPOI = drawState.colorProcInfo(fPrimitiveProcessor)
; | 28 const GrProcOptInfo& colorPOI = drawState.colorProcInfo(fPrimitiveProcessor)
; |
39 const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(fPrimitiveProc
essor); | 29 const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(fPrimitiveProc
essor); |
40 | 30 |
41 // Create XferProcessor from DS's XPFactory | 31 // Create XferProcessor from DS's XPFactory |
42 SkAutoTUnref<GrXferProcessor> xferProcessor( | 32 SkAutoTUnref<GrXferProcessor> xferProcessor( |
43 drawState.getXPFactory()->createXferProcessor(colorPOI, coveragePOI)); | 33 drawState.getXPFactory()->createXferProcessor(colorPOI, coveragePOI)); |
44 | 34 |
45 GrColor overrideColor = GrColor_ILLEGAL; | 35 GrColor overrideColor = GrColor_ILLEGAL; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 188 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
199 return false; | 189 return false; |
200 } | 190 } |
201 } | 191 } |
202 | 192 |
203 // Now update the GrPrimitiveProcessor's batch tracker | 193 // Now update the GrPrimitiveProcessor's batch tracker |
204 fPrimitiveProcessor->makeEqual(&fBatchTracker, that.getBatchTracker()); | 194 fPrimitiveProcessor->makeEqual(&fBatchTracker, that.getBatchTracker()); |
205 return true; | 195 return true; |
206 } | 196 } |
207 | 197 |
OLD | NEW |