| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 "GrDrawTarget.h" | 8 #include "GrDrawTarget.h" |
| 9 | 9 |
| 10 #include "GrAuditTrail.h" | 10 #include "GrAuditTrail.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // Experimentally we have found that most batching occurs within the first 10 co
mparisons. | 41 // Experimentally we have found that most batching occurs within the first 10 co
mparisons. |
| 42 static const int kDefaultMaxBatchLookback = 10; | 42 static const int kDefaultMaxBatchLookback = 10; |
| 43 static const int kDefaultMaxBatchLookahead = 10; | 43 static const int kDefaultMaxBatchLookahead = 10; |
| 44 | 44 |
| 45 GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* r
esourceProvider, | 45 GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* r
esourceProvider, |
| 46 GrAuditTrail* auditTrail, const Options& options) | 46 GrAuditTrail* auditTrail, const Options& options) |
| 47 : fGpu(SkRef(gpu)) | 47 : fGpu(SkRef(gpu)) |
| 48 , fResourceProvider(resourceProvider) | 48 , fResourceProvider(resourceProvider) |
| 49 , fAuditTrail(auditTrail) | 49 , fAuditTrail(auditTrail) |
| 50 , fFlags(0) | 50 , fFlags(0) |
| 51 , fRenderTarget(rt) | 51 , fRenderTarget(rt) { |
| 52 , fInstancedRendering(fGpu->createInstancedRenderingIfSupported()) { | |
| 53 // TODO: Stop extracting the context (currently needed by GrClipMaskManager) | 52 // TODO: Stop extracting the context (currently needed by GrClipMaskManager) |
| 54 fContext = fGpu->getContext(); | 53 fContext = fGpu->getContext(); |
| 55 | 54 |
| 56 fClipBatchToBounds = options.fClipBatchToBounds; | 55 fClipBatchToBounds = options.fClipBatchToBounds; |
| 57 fDrawBatchBounds = options.fDrawBatchBounds; | 56 fDrawBatchBounds = options.fDrawBatchBounds; |
| 58 fMaxBatchLookback = (options.fMaxBatchLookback < 0) ? kDefaultMaxBatchLookba
ck : | 57 fMaxBatchLookback = (options.fMaxBatchLookback < 0) ? kDefaultMaxBatchLookba
ck : |
| 59 options.fMaxBatchLookb
ack; | 58 options.fMaxBatchLookb
ack; |
| 60 fMaxBatchLookahead = (options.fMaxBatchLookahead < 0) ? kDefaultMaxBatchLook
ahead : | 59 fMaxBatchLookahead = (options.fMaxBatchLookahead < 0) ? kDefaultMaxBatchLook
ahead : |
| 61 options.fMaxBatchLook
ahead; | 60 options.fMaxBatchLook
ahead; |
| 62 | 61 |
| 62 if (GrCaps::InstancedSupport::kNone != this->caps()->instancedSupport()) { |
| 63 fInstancedRendering.reset(fGpu->createInstancedRendering()); |
| 64 } |
| 65 |
| 63 rt->setLastDrawTarget(this); | 66 rt->setLastDrawTarget(this); |
| 64 | 67 |
| 65 #ifdef SK_DEBUG | 68 #ifdef SK_DEBUG |
| 66 static int debugID = 0; | 69 static int debugID = 0; |
| 67 fDebugID = debugID++; | 70 fDebugID = debugID++; |
| 68 #endif | 71 #endif |
| 69 } | 72 } |
| 70 | 73 |
| 71 GrDrawTarget::~GrDrawTarget() { | 74 GrDrawTarget::~GrDrawTarget() { |
| 72 if (fRenderTarget && this == fRenderTarget->getLastDrawTarget()) { | 75 if (fRenderTarget && this == fRenderTarget->getLastDrawTarget()) { |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 } | 599 } |
| 597 } | 600 } |
| 598 | 601 |
| 599 /////////////////////////////////////////////////////////////////////////////// | 602 /////////////////////////////////////////////////////////////////////////////// |
| 600 | 603 |
| 601 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 604 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
| 602 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 605 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
| 603 this->recordBatch(batch, batch->bounds()); | 606 this->recordBatch(batch, batch->bounds()); |
| 604 batch->unref(); | 607 batch->unref(); |
| 605 } | 608 } |
| OLD | NEW |