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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 } | 376 } |
377 | 377 |
378 #endif | 378 #endif |
379 if (NULL == drawState.getRenderTarget()) { | 379 if (NULL == drawState.getRenderTarget()) { |
380 return false; | 380 return false; |
381 } | 381 } |
382 return true; | 382 return true; |
383 } | 383 } |
384 | 384 |
385 bool GrDrawTarget::setupDstReadIfNecessary(GrDrawState* ds, | 385 bool GrDrawTarget::setupDstReadIfNecessary(GrDrawState* ds, |
386 const GrPrimitiveProcessor* primProc, | |
387 GrDeviceCoordTexture* dstCopy, | 386 GrDeviceCoordTexture* dstCopy, |
388 const SkRect* drawBounds) { | 387 const SkRect* drawBounds) { |
389 if (this->caps()->dstReadInShaderSupport() || !ds->willEffectReadDstColor(pr
imProc)) { | 388 if (this->caps()->dstReadInShaderSupport() || !ds->willEffectReadDstColor())
{ |
390 return true; | 389 return true; |
391 } | 390 } |
392 SkIRect copyRect; | 391 SkIRect copyRect; |
393 const GrClipData* clip = this->getClip(); | 392 const GrClipData* clip = this->getClip(); |
394 GrRenderTarget* rt = ds->getRenderTarget(); | 393 GrRenderTarget* rt = ds->getRenderTarget(); |
395 clip->getConservativeBounds(rt, ©Rect); | 394 clip->getConservativeBounds(rt, ©Rect); |
396 | 395 |
397 if (drawBounds) { | 396 if (drawBounds) { |
398 SkIRect drawIBounds; | 397 SkIRect drawIBounds; |
399 drawBounds->roundOut(&drawIBounds); | 398 drawBounds->roundOut(&drawIBounds); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 info.fInstanceCount = 0; | 462 info.fInstanceCount = 0; |
464 info.fVerticesPerInstance = 0; | 463 info.fVerticesPerInstance = 0; |
465 info.fIndicesPerInstance = 0; | 464 info.fIndicesPerInstance = 0; |
466 | 465 |
467 if (devBounds) { | 466 if (devBounds) { |
468 info.setDevBounds(*devBounds); | 467 info.setDevBounds(*devBounds); |
469 } | 468 } |
470 | 469 |
471 // TODO: We should continue with incorrect blending. | 470 // TODO: We should continue with incorrect blending. |
472 GrDeviceCoordTexture dstCopy; | 471 GrDeviceCoordTexture dstCopy; |
473 if (!this->setupDstReadIfNecessary(ds, gp, &dstCopy, devBounds)) { | 472 if (!this->setupDstReadIfNecessary(ds, &dstCopy, devBounds)) { |
474 return; | 473 return; |
475 } | 474 } |
476 this->setDrawBuffers(&info, gp->getVertexStride()); | 475 this->setDrawBuffers(&info, gp->getVertexStride()); |
477 | 476 |
478 this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy :
NULL); | 477 this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy :
NULL); |
479 } | 478 } |
480 } | 479 } |
481 | 480 |
482 void GrDrawTarget::drawNonIndexed(GrDrawState* ds, | 481 void GrDrawTarget::drawNonIndexed(GrDrawState* ds, |
483 const GrGeometryProcessor* gp, | 482 const GrGeometryProcessor* gp, |
(...skipping 22 matching lines...) Expand all Loading... |
506 info.fInstanceCount = 0; | 505 info.fInstanceCount = 0; |
507 info.fVerticesPerInstance = 0; | 506 info.fVerticesPerInstance = 0; |
508 info.fIndicesPerInstance = 0; | 507 info.fIndicesPerInstance = 0; |
509 | 508 |
510 if (devBounds) { | 509 if (devBounds) { |
511 info.setDevBounds(*devBounds); | 510 info.setDevBounds(*devBounds); |
512 } | 511 } |
513 | 512 |
514 // TODO: We should continue with incorrect blending. | 513 // TODO: We should continue with incorrect blending. |
515 GrDeviceCoordTexture dstCopy; | 514 GrDeviceCoordTexture dstCopy; |
516 if (!this->setupDstReadIfNecessary(ds, gp, &dstCopy, devBounds)) { | 515 if (!this->setupDstReadIfNecessary(ds, &dstCopy, devBounds)) { |
517 return; | 516 return; |
518 } | 517 } |
519 | 518 |
520 this->setDrawBuffers(&info, gp->getVertexStride()); | 519 this->setDrawBuffers(&info, gp->getVertexStride()); |
521 | 520 |
522 this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy :
NULL); | 521 this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy :
NULL); |
523 } | 522 } |
524 } | 523 } |
525 | 524 |
526 static const GrStencilSettings& winding_path_stencil_settings() { | 525 static const GrStencilSettings& winding_path_stencil_settings() { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 return; | 603 return; |
605 } | 604 } |
606 | 605 |
607 // set stencil settings for path | 606 // set stencil settings for path |
608 GrStencilSettings stencilSettings; | 607 GrStencilSettings stencilSettings; |
609 this->getPathStencilSettingsForFilltype(fill, | 608 this->getPathStencilSettingsForFilltype(fill, |
610 ds->getRenderTarget()->getStencilBuf
fer(), | 609 ds->getRenderTarget()->getStencilBuf
fer(), |
611 &stencilSettings); | 610 &stencilSettings); |
612 | 611 |
613 GrDeviceCoordTexture dstCopy; | 612 GrDeviceCoordTexture dstCopy; |
614 if (!this->setupDstReadIfNecessary(ds, pathProc, &dstCopy, &devBounds)) { | 613 if (!this->setupDstReadIfNecessary(ds, &dstCopy, &devBounds)) { |
615 return; | 614 return; |
616 } | 615 } |
617 | 616 |
618 this->onDrawPath(*ds, pathProc, path, scissorState, stencilSettings, dstCopy
.texture() ? &dstCopy : | 617 this->onDrawPath(*ds, pathProc, path, scissorState, stencilSettings, dstCopy
.texture() ? &dstCopy : |
619
NULL); | 618
NULL); |
620 } | 619 } |
621 | 620 |
622 void GrDrawTarget::drawPaths(GrDrawState* ds, | 621 void GrDrawTarget::drawPaths(GrDrawState* ds, |
623 const GrPathProcessor* pathProc, | 622 const GrPathProcessor* pathProc, |
624 const GrPathRange* pathRange, | 623 const GrPathRange* pathRange, |
(...skipping 23 matching lines...) Expand all Loading... |
648 GrStencilSettings stencilSettings; | 647 GrStencilSettings stencilSettings; |
649 this->getPathStencilSettingsForFilltype(fill, | 648 this->getPathStencilSettingsForFilltype(fill, |
650 ds->getRenderTarget()->getStencilBuf
fer(), | 649 ds->getRenderTarget()->getStencilBuf
fer(), |
651 &stencilSettings); | 650 &stencilSettings); |
652 | 651 |
653 // Don't compute a bounding box for setupDstReadIfNecessary(), we'll opt | 652 // Don't compute a bounding box for setupDstReadIfNecessary(), we'll opt |
654 // instead for it to just copy the entire dst. Realistically this is a moot | 653 // instead for it to just copy the entire dst. Realistically this is a moot |
655 // point, because any context that supports NV_path_rendering will also | 654 // point, because any context that supports NV_path_rendering will also |
656 // support NV_blend_equation_advanced. | 655 // support NV_blend_equation_advanced. |
657 GrDeviceCoordTexture dstCopy; | 656 GrDeviceCoordTexture dstCopy; |
658 if (!this->setupDstReadIfNecessary(ds, pathProc, &dstCopy, NULL)) { | 657 if (!this->setupDstReadIfNecessary(ds, &dstCopy, NULL)) { |
659 return; | 658 return; |
660 } | 659 } |
661 | 660 |
662 this->onDrawPaths(*ds, pathProc, pathRange, indices, indexType, transformVal
ues, transformType, | 661 this->onDrawPaths(*ds, pathProc, pathRange, indices, indexType, transformVal
ues, transformType, |
663 count, scissorState, stencilSettings, dstCopy.texture() ?
&dstCopy : NULL); | 662 count, scissorState, stencilSettings, dstCopy.texture() ?
&dstCopy : NULL); |
664 } | 663 } |
665 | 664 |
666 void GrDrawTarget::clear(const SkIRect* rect, | 665 void GrDrawTarget::clear(const SkIRect* rect, |
667 GrColor color, | 666 GrColor color, |
668 bool canIgnoreRect, | 667 bool canIgnoreRect, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 info.fIndicesPerInstance = indicesPerInstance; | 760 info.fIndicesPerInstance = indicesPerInstance; |
762 info.fVerticesPerInstance = verticesPerInstance; | 761 info.fVerticesPerInstance = verticesPerInstance; |
763 | 762 |
764 // Set the same bounds for all the draws. | 763 // Set the same bounds for all the draws. |
765 if (devBounds) { | 764 if (devBounds) { |
766 info.setDevBounds(*devBounds); | 765 info.setDevBounds(*devBounds); |
767 } | 766 } |
768 | 767 |
769 // TODO: We should continue with incorrect blending. | 768 // TODO: We should continue with incorrect blending. |
770 GrDeviceCoordTexture dstCopy; | 769 GrDeviceCoordTexture dstCopy; |
771 if (!this->setupDstReadIfNecessary(ds, gp, &dstCopy, devBounds)) { | 770 if (!this->setupDstReadIfNecessary(ds, &dstCopy, devBounds)) { |
772 return; | 771 return; |
773 } | 772 } |
774 | 773 |
775 while (instanceCount) { | 774 while (instanceCount) { |
776 info.fInstanceCount = SkTMin(instanceCount, maxInstancesPerDraw); | 775 info.fInstanceCount = SkTMin(instanceCount, maxInstancesPerDraw); |
777 info.fVertexCount = info.fInstanceCount * verticesPerInstance; | 776 info.fVertexCount = info.fInstanceCount * verticesPerInstance; |
778 info.fIndexCount = info.fInstanceCount * indicesPerInstance; | 777 info.fIndexCount = info.fInstanceCount * indicesPerInstance; |
779 | 778 |
780 if (this->checkDraw(*ds, | 779 if (this->checkDraw(*ds, |
781 gp, | 780 gp, |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 GrDrawState::AutoRestoreStencil* ars, | 1215 GrDrawState::AutoRestoreStencil* ars, |
1217 GrScissorState* scissorState, | 1216 GrScissorState* scissorState, |
1218 const SkRect* devBounds) { | 1217 const SkRect* devBounds) { |
1219 return fClipMaskManager.setupClipping(ds, | 1218 return fClipMaskManager.setupClipping(ds, |
1220 are, | 1219 are, |
1221 ars, | 1220 ars, |
1222 scissorState, | 1221 scissorState, |
1223 this->getClip(), | 1222 this->getClip(), |
1224 devBounds); | 1223 devBounds); |
1225 } | 1224 } |
OLD | NEW |