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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 instanceCount -= info.fInstanceCount; | 608 instanceCount -= info.fInstanceCount; |
609 } | 609 } |
610 } | 610 } |
611 | 611 |
612 //////////////////////////////////////////////////////////////////////////////// | 612 //////////////////////////////////////////////////////////////////////////////// |
613 | 613 |
614 void GrDrawTarget::drawRect(const GrRect& rect, | 614 void GrDrawTarget::drawRect(const GrRect& rect, |
615 const SkMatrix* matrix, | 615 const SkMatrix* matrix, |
616 const GrRect* localRect, | 616 const GrRect* localRect, |
617 const SkMatrix* localMatrix) { | 617 const SkMatrix* localMatrix) { |
618 GrAttribBindings bindings = 0; | |
619 // position + (optional) texture coord | 618 // position + (optional) texture coord |
620 static const GrVertexAttrib kAttribs[] = { | 619 static const GrVertexAttrib kAttribs[] = { |
621 {kVec2f_GrVertexAttribType, 0}, | 620 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBin
ding}, |
622 {kVec2f_GrVertexAttribType, sizeof(GrPoint)} | 621 {kVec2f_GrVertexAttribType, sizeof(GrPoint), kLocalCoord_GrVertexAttribB
inding} |
623 }; | 622 }; |
624 int attribCount = 1; | 623 int attribCount = 1; |
625 | 624 |
626 if (NULL != localRect) { | 625 if (NULL != localRect) { |
627 bindings |= GrDrawState::kLocalCoords_AttribBindingsBit; | |
628 attribCount = 2; | 626 attribCount = 2; |
629 this->drawState()->setAttribIndex(GrDrawState::kLocalCoords_AttribIndex,
1); | |
630 } | 627 } |
631 | 628 |
632 GrDrawState::AutoViewMatrixRestore avmr; | 629 GrDrawState::AutoViewMatrixRestore avmr; |
633 if (NULL != matrix) { | 630 if (NULL != matrix) { |
634 avmr.set(this->drawState(), *matrix); | 631 avmr.set(this->drawState(), *matrix); |
635 } | 632 } |
636 | 633 |
637 this->drawState()->setVertexAttribs(kAttribs, attribCount); | 634 this->drawState()->setVertexAttribs(kAttribs, attribCount); |
638 this->drawState()->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0); | |
639 this->drawState()->setAttribBindings(bindings); | |
640 AutoReleaseGeometry geo(this, 4, 0); | 635 AutoReleaseGeometry geo(this, 4, 0); |
641 if (!geo.succeeded()) { | 636 if (!geo.succeeded()) { |
642 GrPrintf("Failed to get space for vertices!\n"); | 637 GrPrintf("Failed to get space for vertices!\n"); |
643 return; | 638 return; |
644 } | 639 } |
645 | 640 |
646 size_t vsize = this->drawState()->getVertexSize(); | 641 size_t vsize = this->drawState()->getVertexSize(); |
647 geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom
, vsize); | 642 geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom
, vsize); |
648 if (NULL != localRect) { | 643 if (NULL != localRect) { |
649 GrAssert(attribCount == 2); | 644 GrAssert(attribCount == 2); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 GrPrintf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]); | 810 GrPrintf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]); |
816 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]
); | 811 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]
); |
817 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); | 812 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); |
818 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor
t]); | 813 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor
t]); |
819 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); | 814 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); |
820 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]); | 815 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]); |
821 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); | 816 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); |
822 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); | 817 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); |
823 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); | 818 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); |
824 } | 819 } |
OLD | NEW |