| 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 int startVertex, | 439 int startVertex, |
| 440 int startIndex, | 440 int startIndex, |
| 441 int vertexCount, | 441 int vertexCount, |
| 442 int indexCount, | 442 int indexCount, |
| 443 const SkRect* devBounds) { | 443 const SkRect* devBounds) { |
| 444 SkASSERT(ds); | 444 SkASSERT(ds); |
| 445 if (indexCount > 0 && | 445 if (indexCount > 0 && |
| 446 this->checkDraw(*ds, gp, type, startVertex, startIndex, vertexCount, ind
exCount)) { | 446 this->checkDraw(*ds, gp, type, startVertex, startIndex, vertexCount, ind
exCount)) { |
| 447 | 447 |
| 448 // Setup clip | 448 // Setup clip |
| 449 GrClipMaskManager::ScissorState scissorState; | 449 GrScissorState scissorState; |
| 450 GrDrawState::AutoRestoreEffects are; | 450 GrDrawState::AutoRestoreEffects are; |
| 451 GrDrawState::AutoRestoreStencil ars; | 451 GrDrawState::AutoRestoreStencil ars; |
| 452 if (!this->setupClip(devBounds, &are, &ars, ds, &scissorState)) { | 452 if (!this->setupClip(devBounds, &are, &ars, ds, &scissorState)) { |
| 453 return; | 453 return; |
| 454 } | 454 } |
| 455 | 455 |
| 456 DrawInfo info; | 456 DrawInfo info; |
| 457 info.fPrimitiveType = type; | 457 info.fPrimitiveType = type; |
| 458 info.fStartVertex = startVertex; | 458 info.fStartVertex = startVertex; |
| 459 info.fStartIndex = startIndex; | 459 info.fStartIndex = startIndex; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 482 void GrDrawTarget::drawNonIndexed(GrDrawState* ds, | 482 void GrDrawTarget::drawNonIndexed(GrDrawState* ds, |
| 483 const GrGeometryProcessor* gp, | 483 const GrGeometryProcessor* gp, |
| 484 GrPrimitiveType type, | 484 GrPrimitiveType type, |
| 485 int startVertex, | 485 int startVertex, |
| 486 int vertexCount, | 486 int vertexCount, |
| 487 const SkRect* devBounds) { | 487 const SkRect* devBounds) { |
| 488 SkASSERT(ds); | 488 SkASSERT(ds); |
| 489 if (vertexCount > 0 && this->checkDraw(*ds, gp, type, startVertex, -1, verte
xCount, -1)) { | 489 if (vertexCount > 0 && this->checkDraw(*ds, gp, type, startVertex, -1, verte
xCount, -1)) { |
| 490 | 490 |
| 491 // Setup clip | 491 // Setup clip |
| 492 GrClipMaskManager::ScissorState scissorState; | 492 GrScissorState scissorState; |
| 493 GrDrawState::AutoRestoreEffects are; | 493 GrDrawState::AutoRestoreEffects are; |
| 494 GrDrawState::AutoRestoreStencil ars; | 494 GrDrawState::AutoRestoreStencil ars; |
| 495 if (!this->setupClip(devBounds, &are, &ars, ds, &scissorState)) { | 495 if (!this->setupClip(devBounds, &are, &ars, ds, &scissorState)) { |
| 496 return; | 496 return; |
| 497 } | 497 } |
| 498 | 498 |
| 499 DrawInfo info; | 499 DrawInfo info; |
| 500 info.fPrimitiveType = type; | 500 info.fPrimitiveType = type; |
| 501 info.fStartVertex = startVertex; | 501 info.fStartVertex = startVertex; |
| 502 info.fStartIndex = 0; | 502 info.fStartIndex = 0; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 void GrDrawTarget::stencilPath(GrDrawState* ds, | 561 void GrDrawTarget::stencilPath(GrDrawState* ds, |
| 562 const GrPathProcessor* pathProc, | 562 const GrPathProcessor* pathProc, |
| 563 const GrPath* path, | 563 const GrPath* path, |
| 564 GrPathRendering::FillType fill) { | 564 GrPathRendering::FillType fill) { |
| 565 // TODO: extract portions of checkDraw that are relevant to path stenciling. | 565 // TODO: extract portions of checkDraw that are relevant to path stenciling. |
| 566 SkASSERT(path); | 566 SkASSERT(path); |
| 567 SkASSERT(this->caps()->pathRenderingSupport()); | 567 SkASSERT(this->caps()->pathRenderingSupport()); |
| 568 SkASSERT(ds); | 568 SkASSERT(ds); |
| 569 | 569 |
| 570 // Setup clip | 570 // Setup clip |
| 571 GrClipMaskManager::ScissorState scissorState; | 571 GrScissorState scissorState; |
| 572 GrDrawState::AutoRestoreEffects are; | 572 GrDrawState::AutoRestoreEffects are; |
| 573 GrDrawState::AutoRestoreStencil ars; | 573 GrDrawState::AutoRestoreStencil ars; |
| 574 if (!this->setupClip(NULL, &are, &ars, ds, &scissorState)) { | 574 if (!this->setupClip(NULL, &are, &ars, ds, &scissorState)) { |
| 575 return; | 575 return; |
| 576 } | 576 } |
| 577 | 577 |
| 578 // set stencil settings for path | 578 // set stencil settings for path |
| 579 GrStencilSettings stencilSettings; | 579 GrStencilSettings stencilSettings; |
| 580 this->getPathStencilSettingsForFilltype(fill, | 580 this->getPathStencilSettingsForFilltype(fill, |
| 581 ds->getRenderTarget()->getStencilBuf
fer(), | 581 ds->getRenderTarget()->getStencilBuf
fer(), |
| 582 &stencilSettings); | 582 &stencilSettings); |
| 583 | 583 |
| 584 this->onStencilPath(*ds, pathProc, path, scissorState, stencilSettings); | 584 this->onStencilPath(*ds, pathProc, path, scissorState, stencilSettings); |
| 585 } | 585 } |
| 586 | 586 |
| 587 void GrDrawTarget::drawPath(GrDrawState* ds, | 587 void GrDrawTarget::drawPath(GrDrawState* ds, |
| 588 const GrPathProcessor* pathProc, | 588 const GrPathProcessor* pathProc, |
| 589 const GrPath* path, | 589 const GrPath* path, |
| 590 GrPathRendering::FillType fill) { | 590 GrPathRendering::FillType fill) { |
| 591 // TODO: extract portions of checkDraw that are relevant to path rendering. | 591 // TODO: extract portions of checkDraw that are relevant to path rendering. |
| 592 SkASSERT(path); | 592 SkASSERT(path); |
| 593 SkASSERT(this->caps()->pathRenderingSupport()); | 593 SkASSERT(this->caps()->pathRenderingSupport()); |
| 594 SkASSERT(ds); | 594 SkASSERT(ds); |
| 595 | 595 |
| 596 SkRect devBounds = path->getBounds(); | 596 SkRect devBounds = path->getBounds(); |
| 597 SkMatrix viewM = ds->getViewMatrix(); | 597 SkMatrix viewM = ds->getViewMatrix(); |
| 598 viewM.mapRect(&devBounds); | 598 viewM.mapRect(&devBounds); |
| 599 | 599 |
| 600 // Setup clip | 600 // Setup clip |
| 601 GrClipMaskManager::ScissorState scissorState; | 601 GrScissorState scissorState; |
| 602 GrDrawState::AutoRestoreEffects are; | 602 GrDrawState::AutoRestoreEffects are; |
| 603 GrDrawState::AutoRestoreStencil ars; | 603 GrDrawState::AutoRestoreStencil ars; |
| 604 if (!this->setupClip(&devBounds, &are, &ars, ds, &scissorState)) { | 604 if (!this->setupClip(&devBounds, &are, &ars, ds, &scissorState)) { |
| 605 return; | 605 return; |
| 606 } | 606 } |
| 607 | 607 |
| 608 // set stencil settings for path | 608 // set stencil settings for path |
| 609 GrStencilSettings stencilSettings; | 609 GrStencilSettings stencilSettings; |
| 610 this->getPathStencilSettingsForFilltype(fill, | 610 this->getPathStencilSettingsForFilltype(fill, |
| 611 ds->getRenderTarget()->getStencilBuf
fer(), | 611 ds->getRenderTarget()->getStencilBuf
fer(), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 630 int count, | 630 int count, |
| 631 GrPathRendering::FillType fill) { | 631 GrPathRendering::FillType fill) { |
| 632 SkASSERT(this->caps()->pathRenderingSupport()); | 632 SkASSERT(this->caps()->pathRenderingSupport()); |
| 633 SkASSERT(pathRange); | 633 SkASSERT(pathRange); |
| 634 SkASSERT(indices); | 634 SkASSERT(indices); |
| 635 SkASSERT(0 == reinterpret_cast<long>(indices) % GrPathRange::PathIndexSizeIn
Bytes(indexType)); | 635 SkASSERT(0 == reinterpret_cast<long>(indices) % GrPathRange::PathIndexSizeIn
Bytes(indexType)); |
| 636 SkASSERT(transformValues); | 636 SkASSERT(transformValues); |
| 637 SkASSERT(ds); | 637 SkASSERT(ds); |
| 638 | 638 |
| 639 // Setup clip | 639 // Setup clip |
| 640 GrClipMaskManager::ScissorState scissorState; | 640 GrScissorState scissorState; |
| 641 GrDrawState::AutoRestoreEffects are; | 641 GrDrawState::AutoRestoreEffects are; |
| 642 GrDrawState::AutoRestoreStencil ars; | 642 GrDrawState::AutoRestoreStencil ars; |
| 643 | 643 |
| 644 if (!this->setupClip(NULL, &are, &ars, ds, &scissorState)) { | 644 if (!this->setupClip(NULL, &are, &ars, ds, &scissorState)) { |
| 645 return; | 645 return; |
| 646 } | 646 } |
| 647 | 647 |
| 648 // set stencil settings for path | 648 // set stencil settings for path |
| 649 GrStencilSettings stencilSettings; | 649 GrStencilSettings stencilSettings; |
| 650 this->getPathStencilSettingsForFilltype(fill, | 650 this->getPathStencilSettingsForFilltype(fill, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 if (!verticesPerInstance || !indicesPerInstance) { | 741 if (!verticesPerInstance || !indicesPerInstance) { |
| 742 return; | 742 return; |
| 743 } | 743 } |
| 744 | 744 |
| 745 int maxInstancesPerDraw = this->indexCountInCurrentSource() / indicesPerInst
ance; | 745 int maxInstancesPerDraw = this->indexCountInCurrentSource() / indicesPerInst
ance; |
| 746 if (!maxInstancesPerDraw) { | 746 if (!maxInstancesPerDraw) { |
| 747 return; | 747 return; |
| 748 } | 748 } |
| 749 | 749 |
| 750 // Setup clip | 750 // Setup clip |
| 751 GrClipMaskManager::ScissorState scissorState; | 751 GrScissorState scissorState; |
| 752 GrDrawState::AutoRestoreEffects are; | 752 GrDrawState::AutoRestoreEffects are; |
| 753 GrDrawState::AutoRestoreStencil ars; | 753 GrDrawState::AutoRestoreStencil ars; |
| 754 if (!this->setupClip(devBounds, &are, &ars, ds, &scissorState)) { | 754 if (!this->setupClip(devBounds, &are, &ars, ds, &scissorState)) { |
| 755 return; | 755 return; |
| 756 } | 756 } |
| 757 | 757 |
| 758 DrawInfo info; | 758 DrawInfo info; |
| 759 info.fPrimitiveType = type; | 759 info.fPrimitiveType = type; |
| 760 info.fStartIndex = 0; | 760 info.fStartIndex = 0; |
| 761 info.fStartVertex = 0; | 761 info.fStartVertex = 0; |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 } while (id == SK_InvalidUniqueID); | 1207 } while (id == SK_InvalidUniqueID); |
| 1208 return id; | 1208 return id; |
| 1209 } | 1209 } |
| 1210 | 1210 |
| 1211 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 1211 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 1212 | 1212 |
| 1213 bool GrClipTarget::setupClip(const SkRect* devBounds, | 1213 bool GrClipTarget::setupClip(const SkRect* devBounds, |
| 1214 GrDrawState::AutoRestoreEffects* are, | 1214 GrDrawState::AutoRestoreEffects* are, |
| 1215 GrDrawState::AutoRestoreStencil* ars, | 1215 GrDrawState::AutoRestoreStencil* ars, |
| 1216 GrDrawState* ds, | 1216 GrDrawState* ds, |
| 1217 GrClipMaskManager::ScissorState* scissorState) { | 1217 GrScissorState* scissorState) { |
| 1218 return fClipMaskManager.setupClipping(ds, | 1218 return fClipMaskManager.setupClipping(ds, |
| 1219 are, | 1219 are, |
| 1220 ars, | 1220 ars, |
| 1221 scissorState, | 1221 scissorState, |
| 1222 this->getClip(), | 1222 this->getClip(), |
| 1223 devBounds); | 1223 devBounds); |
| 1224 } | 1224 } |
| OLD | NEW |