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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 // Set the same bounds for all the draws. | 644 // Set the same bounds for all the draws. |
645 if (NULL != devBounds) { | 645 if (NULL != devBounds) { |
646 info.setDevBounds(*devBounds); | 646 info.setDevBounds(*devBounds); |
647 } | 647 } |
648 // TODO: We should continue with incorrect blending. | 648 // TODO: We should continue with incorrect blending. |
649 if (!this->setupDstReadIfNecessary(&info)) { | 649 if (!this->setupDstReadIfNecessary(&info)) { |
650 return; | 650 return; |
651 } | 651 } |
652 | 652 |
653 while (instanceCount) { | 653 while (instanceCount) { |
654 info.fInstanceCount = GrMin(instanceCount, maxInstancesPerDraw); | 654 info.fInstanceCount = SkTMin(instanceCount, maxInstancesPerDraw); |
655 info.fVertexCount = info.fInstanceCount * verticesPerInstance; | 655 info.fVertexCount = info.fInstanceCount * verticesPerInstance; |
656 info.fIndexCount = info.fInstanceCount * indicesPerInstance; | 656 info.fIndexCount = info.fInstanceCount * indicesPerInstance; |
657 | 657 |
658 if (this->checkDraw(type, | 658 if (this->checkDraw(type, |
659 info.fStartVertex, | 659 info.fStartVertex, |
660 info.fStartIndex, | 660 info.fStartIndex, |
661 info.fVertexCount, | 661 info.fVertexCount, |
662 info.fIndexCount)) { | 662 info.fIndexCount)) { |
663 this->onDraw(info); | 663 this->onDraw(info); |
664 } | 664 } |
665 info.fStartVertex += info.fVertexCount; | 665 info.fStartVertex += info.fVertexCount; |
666 instanceCount -= info.fInstanceCount; | 666 instanceCount -= info.fInstanceCount; |
667 } | 667 } |
668 } | 668 } |
669 | 669 |
670 //////////////////////////////////////////////////////////////////////////////// | 670 //////////////////////////////////////////////////////////////////////////////// |
671 | 671 |
672 namespace { | 672 namespace { |
673 | 673 |
674 // position + (optional) texture coord | 674 // position + (optional) texture coord |
675 extern const GrVertexAttrib gBWRectPosUVAttribs[] = { | 675 extern const GrVertexAttrib gBWRectPosUVAttribs[] = { |
676 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding
}, | 676 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding
}, |
677 {kVec2f_GrVertexAttribType, sizeof(GrPoint), kLocalCoord_GrVertexAttribBindi
ng} | 677 {kVec2f_GrVertexAttribType, sizeof(SkPoint), kLocalCoord_GrVertexAttribBindi
ng} |
678 }; | 678 }; |
679 | 679 |
680 void set_vertex_attributes(GrDrawState* drawState, bool hasUVs) { | 680 void set_vertex_attributes(GrDrawState* drawState, bool hasUVs) { |
681 if (hasUVs) { | 681 if (hasUVs) { |
682 drawState->setVertexAttribs<gBWRectPosUVAttribs>(2); | 682 drawState->setVertexAttribs<gBWRectPosUVAttribs>(2); |
683 } else { | 683 } else { |
684 drawState->setVertexAttribs<gBWRectPosUVAttribs>(1); | 684 drawState->setVertexAttribs<gBWRectPosUVAttribs>(1); |
685 } | 685 } |
686 } | 686 } |
687 | 687 |
(...skipping 13 matching lines...) Expand all Loading... |
701 | 701 |
702 AutoReleaseGeometry geo(this, 4, 0); | 702 AutoReleaseGeometry geo(this, 4, 0); |
703 if (!geo.succeeded()) { | 703 if (!geo.succeeded()) { |
704 GrPrintf("Failed to get space for vertices!\n"); | 704 GrPrintf("Failed to get space for vertices!\n"); |
705 return; | 705 return; |
706 } | 706 } |
707 | 707 |
708 size_t vsize = this->drawState()->getVertexSize(); | 708 size_t vsize = this->drawState()->getVertexSize(); |
709 geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom
, vsize); | 709 geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom
, vsize); |
710 if (NULL != localRect) { | 710 if (NULL != localRect) { |
711 GrPoint* coords = GrTCast<GrPoint*>(GrTCast<intptr_t>(geo.vertices()) + | 711 SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) + |
712 sizeof(GrPoint)); | 712 sizeof(SkPoint)); |
713 coords->setRectFan(localRect->fLeft, localRect->fTop, | 713 coords->setRectFan(localRect->fLeft, localRect->fTop, |
714 localRect->fRight, localRect->fBottom, | 714 localRect->fRight, localRect->fBottom, |
715 vsize); | 715 vsize); |
716 if (NULL != localMatrix) { | 716 if (NULL != localMatrix) { |
717 localMatrix->mapPointsWithStride(coords, vsize, 4); | 717 localMatrix->mapPointsWithStride(coords, vsize, 4); |
718 } | 718 } |
719 } | 719 } |
720 SkRect bounds; | 720 SkRect bounds; |
721 this->getDrawState().getViewMatrix().mapRect(&bounds, rect); | 721 this->getDrawState().getViewMatrix().mapRect(&bounds, rect); |
722 | 722 |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { | 1098 for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
1099 if (i != kUnknown_GrPixelConfig) { | 1099 if (i != kUnknown_GrPixelConfig) { |
1100 r.appendf("%s is renderable: %s, with MSAA: %s\n", | 1100 r.appendf("%s is renderable: %s, with MSAA: %s\n", |
1101 kConfigNames[i], | 1101 kConfigNames[i], |
1102 gNY[fConfigRenderSupport[i][0]], | 1102 gNY[fConfigRenderSupport[i][0]], |
1103 gNY[fConfigRenderSupport[i][1]]); | 1103 gNY[fConfigRenderSupport[i][1]]); |
1104 } | 1104 } |
1105 } | 1105 } |
1106 return r; | 1106 return r; |
1107 } | 1107 } |
OLD | NEW |