OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrDrawTarget.h" | 9 #include "GrDrawTarget.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... | |
25 #include "batches/GrDiscardBatch.h" | 25 #include "batches/GrDiscardBatch.h" |
26 #include "batches/GrDrawBatch.h" | 26 #include "batches/GrDrawBatch.h" |
27 #include "batches/GrDrawPathBatch.h" | 27 #include "batches/GrDrawPathBatch.h" |
28 #include "batches/GrRectBatchFactory.h" | 28 #include "batches/GrRectBatchFactory.h" |
29 #include "batches/GrStencilPathBatch.h" | 29 #include "batches/GrStencilPathBatch.h" |
30 | 30 |
31 #include "SkStrokeRec.h" | 31 #include "SkStrokeRec.h" |
32 | 32 |
33 //////////////////////////////////////////////////////////////////////////////// | 33 //////////////////////////////////////////////////////////////////////////////// |
34 | 34 |
35 GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider) | 35 GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider, |
36 const Options& options) | |
36 : fGpu(SkRef(gpu)) | 37 : fGpu(SkRef(gpu)) |
37 , fResourceProvider(resourceProvider) | 38 , fResourceProvider(resourceProvider) |
38 , fFlushState(fGpu, fResourceProvider, 0) | 39 , fFlushState(fGpu, fResourceProvider, 0) |
39 , fFlushing(false) | 40 , fFlushing(false) |
40 , fFirstUnpreparedBatch(0) | 41 , fFirstUnpreparedBatch(0) |
41 , fFlags(0) { | 42 , fFlags(0) |
43 , fOptions(options) { | |
42 // TODO: Stop extracting the context (currently needed by GrClipMaskManager) | 44 // TODO: Stop extracting the context (currently needed by GrClipMaskManager) |
43 fContext = fGpu->getContext(); | 45 fContext = fGpu->getContext(); |
44 fClipMaskManager.reset(new GrClipMaskManager(this)); | 46 fClipMaskManager.reset(new GrClipMaskManager(this)); |
45 | 47 |
46 #ifdef SK_DEBUG | 48 #ifdef SK_DEBUG |
47 static int debugID = 0; | 49 static int debugID = 0; |
48 fDebugID = debugID++; | 50 fDebugID = debugID++; |
49 #endif | 51 #endif |
50 } | 52 } |
51 | 53 |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
517 } | 519 } |
518 } | 520 } |
519 } else { | 521 } else { |
520 GrBATCH_INFO("\t\tFirstBatch\n"); | 522 GrBATCH_INFO("\t\tFirstBatch\n"); |
521 } | 523 } |
522 fBatches.push_back().reset(SkRef(batch)); | 524 fBatches.push_back().reset(SkRef(batch)); |
523 if (fBatches.count() > kMaxLookback) { | 525 if (fBatches.count() > kMaxLookback) { |
524 SkASSERT(fBatches.count() - kMaxLookback - fFirstUnpreparedBatch == 1); | 526 SkASSERT(fBatches.count() - kMaxLookback - fFirstUnpreparedBatch == 1); |
525 fBatches[fFirstUnpreparedBatch++]->prepare(&fFlushState); | 527 fBatches[fFirstUnpreparedBatch++]->prepare(&fFlushState); |
526 } | 528 } |
529 if (fOptions.fImmediateMode) { | |
joshualitt
2015/10/23 15:41:46
In immediate mode we also want to set maxCandidate
| |
530 this->flush(); | |
531 } | |
527 } | 532 } |
528 | 533 |
529 /////////////////////////////////////////////////////////////////////////////// | 534 /////////////////////////////////////////////////////////////////////////////// |
530 | 535 |
531 bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineB uilder, | 536 bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineB uilder, |
532 const GrScissorState* scissor, | 537 const GrScissorState* scissor, |
533 GrDrawBatch* batch) { | 538 GrDrawBatch* batch) { |
534 GrPipeline::CreateArgs args; | 539 GrPipeline::CreateArgs args; |
535 args.fPipelineBuilder = pipelineBuilder; | 540 args.fPipelineBuilder = pipelineBuilder; |
536 args.fCaps = this->caps(); | 541 args.fCaps = this->caps(); |
(...skipping 11 matching lines...) Expand all Loading... | |
548 } | 553 } |
549 | 554 |
550 return true; | 555 return true; |
551 } | 556 } |
552 | 557 |
553 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { | 558 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { |
554 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 559 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
555 this->recordBatch(batch); | 560 this->recordBatch(batch); |
556 batch->unref(); | 561 batch->unref(); |
557 } | 562 } |
OLD | NEW |