| 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 } | 522 } |
| 523 info.fStartVertex += info.fVertexCount; | 523 info.fStartVertex += info.fVertexCount; |
| 524 instanceCount -= info.fInstanceCount; | 524 instanceCount -= info.fInstanceCount; |
| 525 } | 525 } |
| 526 } | 526 } |
| 527 | 527 |
| 528 //////////////////////////////////////////////////////////////////////////////// | 528 //////////////////////////////////////////////////////////////////////////////// |
| 529 | 529 |
| 530 void GrDrawTarget::drawRect(const GrRect& rect, | 530 void GrDrawTarget::drawRect(const GrRect& rect, |
| 531 const SkMatrix* matrix, | 531 const SkMatrix* matrix, |
| 532 const GrRect* srcRect, | 532 const GrRect* localRect, |
| 533 const SkMatrix* srcMatrix, | 533 const SkMatrix* localMatrix) { |
| 534 int stage) { | |
| 535 GrAttribBindings bindings = 0; | 534 GrAttribBindings bindings = 0; |
| 536 uint32_t explicitCoordMask = 0; | |
| 537 // position + (optional) texture coord | 535 // position + (optional) texture coord |
| 538 static const GrVertexAttrib kAttribs[] = { | 536 static const GrVertexAttrib kAttribs[] = { |
| 539 {kVec2f_GrVertexAttribType, 0}, | 537 {kVec2f_GrVertexAttribType, 0}, |
| 540 {kVec2f_GrVertexAttribType, sizeof(GrPoint)} | 538 {kVec2f_GrVertexAttribType, sizeof(GrPoint)} |
| 541 }; | 539 }; |
| 542 int attribCount = 1; | 540 int attribCount = 1; |
| 543 | 541 |
| 544 if (NULL != srcRect) { | 542 if (NULL != localRect) { |
| 545 bindings |= GrDrawState::ExplicitTexCoordAttribBindingsBit(stage); | 543 bindings |= GrDrawState::kLocalCoords_AttribBindingsBit; |
| 546 attribCount = 2; | 544 attribCount = 2; |
| 547 this->drawState()->setAttribIndex(GrDrawState::kTexCoord_AttribIndex, 1)
; | 545 this->drawState()->setAttribIndex(GrDrawState::kLocalCoords_AttribIndex,
1); |
| 548 explicitCoordMask = (1 << stage); | |
| 549 } | 546 } |
| 550 | 547 |
| 551 GrDrawState::AutoViewMatrixRestore avmr; | 548 GrDrawState::AutoViewMatrixRestore avmr; |
| 552 if (NULL != matrix) { | 549 if (NULL != matrix) { |
| 553 avmr.set(this->drawState(), *matrix, explicitCoordMask); | 550 avmr.set(this->drawState(), *matrix); |
| 554 } | 551 } |
| 555 | 552 |
| 556 this->drawState()->setVertexAttribs(kAttribs, attribCount); | 553 this->drawState()->setVertexAttribs(kAttribs, attribCount); |
| 557 this->drawState()->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0); | 554 this->drawState()->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0); |
| 558 this->drawState()->setAttribBindings(bindings); | 555 this->drawState()->setAttribBindings(bindings); |
| 559 AutoReleaseGeometry geo(this, 4, 0); | 556 AutoReleaseGeometry geo(this, 4, 0); |
| 560 if (!geo.succeeded()) { | 557 if (!geo.succeeded()) { |
| 561 GrPrintf("Failed to get space for vertices!\n"); | 558 GrPrintf("Failed to get space for vertices!\n"); |
| 562 return; | 559 return; |
| 563 } | 560 } |
| 564 | 561 |
| 565 size_t vsize = this->drawState()->getVertexSize(); | 562 size_t vsize = this->drawState()->getVertexSize(); |
| 566 geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom
, vsize); | 563 geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom
, vsize); |
| 567 if (NULL != srcRect) { | 564 if (NULL != localRect) { |
| 568 GrAssert(attribCount == 2); | 565 GrAssert(attribCount == 2); |
| 569 GrPoint* coords = GrTCast<GrPoint*>(GrTCast<intptr_t>(geo.vertices()) + | 566 GrPoint* coords = GrTCast<GrPoint*>(GrTCast<intptr_t>(geo.vertices()) + |
| 570 kAttribs[1].fOffset); | 567 kAttribs[1].fOffset); |
| 571 coords->setRectFan(srcRect->fLeft, srcRect->fTop, | 568 coords->setRectFan(localRect->fLeft, localRect->fTop, |
| 572 srcRect->fRight, srcRect->fBottom, | 569 localRect->fRight, localRect->fBottom, |
| 573 vsize); | 570 vsize); |
| 574 if (NULL != srcMatrix) { | 571 if (NULL != localMatrix) { |
| 575 srcMatrix->mapPointsWithStride(coords, vsize, 4); | 572 localMatrix->mapPointsWithStride(coords, vsize, 4); |
| 576 } | 573 } |
| 577 } | 574 } |
| 578 | 575 |
| 579 this->drawNonIndexed(kTriangleFan_GrPrimitiveType, 0, 4); | 576 this->drawNonIndexed(kTriangleFan_GrPrimitiveType, 0, 4); |
| 580 } | 577 } |
| 581 | 578 |
| 582 void GrDrawTarget::clipWillBeSet(const GrClipData* clipData) { | 579 void GrDrawTarget::clipWillBeSet(const GrClipData* clipData) { |
| 583 } | 580 } |
| 584 | 581 |
| 585 //////////////////////////////////////////////////////////////////////////////// | 582 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 GrPrintf("HW AA Lines Support : %s\n", gNY[fInternals.fHWAALineSuppo
rt]); | 686 GrPrintf("HW AA Lines Support : %s\n", gNY[fInternals.fHWAALineSuppo
rt]); |
| 690 GrPrintf("Shader Derivative Support : %s\n", gNY[fInternals.fShaderDerivat
iveSupport]); | 687 GrPrintf("Shader Derivative Support : %s\n", gNY[fInternals.fShaderDerivat
iveSupport]); |
| 691 GrPrintf("Geometry Shader Support : %s\n", gNY[fInternals.fGeometryShade
rSupport]); | 688 GrPrintf("Geometry Shader Support : %s\n", gNY[fInternals.fGeometryShade
rSupport]); |
| 692 GrPrintf("FSAA Support : %s\n", gNY[fInternals.fFSAASupport])
; | 689 GrPrintf("FSAA Support : %s\n", gNY[fInternals.fFSAASupport])
; |
| 693 GrPrintf("Dual Source Blending Support: %s\n", gNY[fInternals.fDualSourceBle
ndingSupport]); | 690 GrPrintf("Dual Source Blending Support: %s\n", gNY[fInternals.fDualSourceBle
ndingSupport]); |
| 694 GrPrintf("Buffer Lock Support : %s\n", gNY[fInternals.fBufferLockSup
port]); | 691 GrPrintf("Buffer Lock Support : %s\n", gNY[fInternals.fBufferLockSup
port]); |
| 695 GrPrintf("Path Stenciling Support : %s\n", gNY[fInternals.fPathStencilin
gSupport]); | 692 GrPrintf("Path Stenciling Support : %s\n", gNY[fInternals.fPathStencilin
gSupport]); |
| 696 GrPrintf("Max Texture Size : %d\n", fInternals.fMaxTextureSize); | 693 GrPrintf("Max Texture Size : %d\n", fInternals.fMaxTextureSize); |
| 697 GrPrintf("Max Render Target Size : %d\n", fInternals.fMaxRenderTargetSi
ze); | 694 GrPrintf("Max Render Target Size : %d\n", fInternals.fMaxRenderTargetSi
ze); |
| 698 } | 695 } |
| OLD | NEW |