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 | 9 |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 if (di.fDevBounds) { | 36 if (di.fDevBounds) { |
37 SkASSERT(di.fDevBounds == &di.fDevBoundsStorage); | 37 SkASSERT(di.fDevBounds == &di.fDevBoundsStorage); |
38 fDevBoundsStorage = di.fDevBoundsStorage; | 38 fDevBoundsStorage = di.fDevBoundsStorage; |
39 fDevBounds = &fDevBoundsStorage; | 39 fDevBounds = &fDevBoundsStorage; |
40 } else { | 40 } else { |
41 fDevBounds = NULL; | 41 fDevBounds = NULL; |
42 } | 42 } |
43 | 43 |
44 fDstCopy = di.fDstCopy; | 44 fDstCopy = di.fDstCopy; |
45 | 45 |
| 46 this->setVertexBuffer(di.vertexBuffer()); |
| 47 this->setIndexBuffer(di.indexBuffer()); |
| 48 |
46 return *this; | 49 return *this; |
47 } | 50 } |
48 | 51 |
49 #ifdef SK_DEBUG | 52 #ifdef SK_DEBUG |
50 bool GrDrawTarget::DrawInfo::isInstanced() const { | 53 bool GrDrawTarget::DrawInfo::isInstanced() const { |
51 if (fInstanceCount > 0) { | 54 if (fInstanceCount > 0) { |
52 SkASSERT(0 == fIndexCount % fIndicesPerInstance); | 55 SkASSERT(0 == fIndexCount % fIndicesPerInstance); |
53 SkASSERT(0 == fVertexCount % fVerticesPerInstance); | 56 SkASSERT(0 == fVertexCount % fVerticesPerInstance); |
54 SkASSERT(fIndexCount / fIndicesPerInstance == fInstanceCount); | 57 SkASSERT(fIndexCount / fIndicesPerInstance == fInstanceCount); |
55 SkASSERT(fVertexCount / fVerticesPerInstance == fInstanceCount); | 58 SkASSERT(fVertexCount / fVerticesPerInstance == fInstanceCount); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 info.fVerticesPerInstance = 0; | 465 info.fVerticesPerInstance = 0; |
463 info.fIndicesPerInstance = 0; | 466 info.fIndicesPerInstance = 0; |
464 | 467 |
465 if (devBounds) { | 468 if (devBounds) { |
466 info.setDevBounds(*devBounds); | 469 info.setDevBounds(*devBounds); |
467 } | 470 } |
468 // TODO: We should continue with incorrect blending. | 471 // TODO: We should continue with incorrect blending. |
469 if (!this->setupDstReadIfNecessary(ds, &info)) { | 472 if (!this->setupDstReadIfNecessary(ds, &info)) { |
470 return; | 473 return; |
471 } | 474 } |
| 475 |
| 476 this->setDrawBuffers(&info); |
| 477 |
472 this->onDraw(*ds, info, scissorState); | 478 this->onDraw(*ds, info, scissorState); |
473 } | 479 } |
474 } | 480 } |
475 | 481 |
476 void GrDrawTarget::drawNonIndexed(GrDrawState* ds, | 482 void GrDrawTarget::drawNonIndexed(GrDrawState* ds, |
477 GrPrimitiveType type, | 483 GrPrimitiveType type, |
478 int startVertex, | 484 int startVertex, |
479 int vertexCount, | 485 int vertexCount, |
480 const SkRect* devBounds) { | 486 const SkRect* devBounds) { |
481 SkASSERT(ds); | 487 SkASSERT(ds); |
(...skipping 19 matching lines...) Expand all Loading... |
501 info.fIndicesPerInstance = 0; | 507 info.fIndicesPerInstance = 0; |
502 | 508 |
503 if (devBounds) { | 509 if (devBounds) { |
504 info.setDevBounds(*devBounds); | 510 info.setDevBounds(*devBounds); |
505 } | 511 } |
506 | 512 |
507 // TODO: We should continue with incorrect blending. | 513 // TODO: We should continue with incorrect blending. |
508 if (!this->setupDstReadIfNecessary(ds, &info)) { | 514 if (!this->setupDstReadIfNecessary(ds, &info)) { |
509 return; | 515 return; |
510 } | 516 } |
| 517 |
| 518 this->setDrawBuffers(&info); |
| 519 |
511 this->onDraw(*ds, info, scissorState); | 520 this->onDraw(*ds, info, scissorState); |
512 } | 521 } |
513 } | 522 } |
514 | 523 |
515 static const GrStencilSettings& winding_path_stencil_settings() { | 524 static const GrStencilSettings& winding_path_stencil_settings() { |
516 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, | 525 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, |
517 kIncClamp_StencilOp, | 526 kIncClamp_StencilOp, |
518 kIncClamp_StencilOp, | 527 kIncClamp_StencilOp, |
519 kAlwaysIfInClip_StencilFunc, | 528 kAlwaysIfInClip_StencilFunc, |
520 0xFFFF, 0xFFFF, 0xFFFF); | 529 0xFFFF, 0xFFFF, 0xFFFF); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 info.fVerticesPerInstance = verticesPerInstance; | 756 info.fVerticesPerInstance = verticesPerInstance; |
748 | 757 |
749 // Set the same bounds for all the draws. | 758 // Set the same bounds for all the draws. |
750 if (devBounds) { | 759 if (devBounds) { |
751 info.setDevBounds(*devBounds); | 760 info.setDevBounds(*devBounds); |
752 } | 761 } |
753 // TODO: We should continue with incorrect blending. | 762 // TODO: We should continue with incorrect blending. |
754 if (!this->setupDstReadIfNecessary(ds, &info)) { | 763 if (!this->setupDstReadIfNecessary(ds, &info)) { |
755 return; | 764 return; |
756 } | 765 } |
| 766 |
757 while (instanceCount) { | 767 while (instanceCount) { |
758 info.fInstanceCount = SkTMin(instanceCount, maxInstancesPerDraw); | 768 info.fInstanceCount = SkTMin(instanceCount, maxInstancesPerDraw); |
759 info.fVertexCount = info.fInstanceCount * verticesPerInstance; | 769 info.fVertexCount = info.fInstanceCount * verticesPerInstance; |
760 info.fIndexCount = info.fInstanceCount * indicesPerInstance; | 770 info.fIndexCount = info.fInstanceCount * indicesPerInstance; |
761 | 771 |
| 772 this->setDrawBuffers(&info); |
| 773 |
762 if (this->checkDraw(*ds, | 774 if (this->checkDraw(*ds, |
763 type, | 775 type, |
764 info.fStartVertex, | 776 info.fStartVertex, |
765 info.fStartIndex, | 777 info.fStartIndex, |
766 info.fVertexCount, | 778 info.fVertexCount, |
767 info.fIndexCount)) { | 779 info.fIndexCount)) { |
768 this->onDraw(*ds, info, scissorState); | 780 this->onDraw(*ds, info, scissorState); |
769 } | 781 } |
770 info.fStartVertex += info.fVertexCount; | 782 info.fStartVertex += info.fVertexCount; |
771 instanceCount -= info.fInstanceCount; | 783 instanceCount -= info.fInstanceCount; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 GrDrawState::AutoRestoreStencil* ars, | 1151 GrDrawState::AutoRestoreStencil* ars, |
1140 GrDrawState* ds, | 1152 GrDrawState* ds, |
1141 GrClipMaskManager::ScissorState* scissorState) { | 1153 GrClipMaskManager::ScissorState* scissorState) { |
1142 return fClipMaskManager.setupClipping(ds, | 1154 return fClipMaskManager.setupClipping(ds, |
1143 are, | 1155 are, |
1144 ars, | 1156 ars, |
1145 scissorState, | 1157 scissorState, |
1146 this->getClip(), | 1158 this->getClip(), |
1147 devBounds); | 1159 devBounds); |
1148 } | 1160 } |
OLD | NEW |