Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: src/gpu/batches/GrAAConvexPathRenderer.cpp

Issue 1825393002: Consolidate GPU buffer implementations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: asserts Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrVertexBuffer.h ('k') | src/gpu/batches/GrAADistanceFieldPathRenderer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 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 #include "GrAAConvexPathRenderer.h" 9 #include "GrAAConvexPathRenderer.h"
10 10
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 807
808 for (int i = 0; i < instanceCount; i++) { 808 for (int i = 0; i < instanceCount; i++) {
809 tess.rewind(); 809 tess.rewind();
810 810
811 const Geometry& args = fGeoData[i]; 811 const Geometry& args = fGeoData[i];
812 812
813 if (!tess.tessellate(args.fViewMatrix, args.fPath)) { 813 if (!tess.tessellate(args.fViewMatrix, args.fPath)) {
814 continue; 814 continue;
815 } 815 }
816 816
817 const GrVertexBuffer* vertexBuffer; 817 const GrBuffer* vertexBuffer;
818 int firstVertex; 818 int firstVertex;
819 819
820 void* verts = target->makeVertexSpace(vertexStride, tess.numPts(), & vertexBuffer, 820 void* verts = target->makeVertexSpace(vertexStride, tess.numPts(), & vertexBuffer,
821 &firstVertex); 821 &firstVertex);
822 if (!verts) { 822 if (!verts) {
823 SkDebugf("Could not allocate vertices\n"); 823 SkDebugf("Could not allocate vertices\n");
824 return; 824 return;
825 } 825 }
826 826
827 const GrIndexBuffer* indexBuffer; 827 const GrBuffer* indexBuffer;
828 int firstIndex; 828 int firstIndex;
829 829
830 uint16_t* idxs = target->makeIndexSpace(tess.numIndices(), &indexBuf fer, &firstIndex); 830 uint16_t* idxs = target->makeIndexSpace(tess.numIndices(), &indexBuf fer, &firstIndex);
831 if (!idxs) { 831 if (!idxs) {
832 SkDebugf("Could not allocate indices\n"); 832 SkDebugf("Could not allocate indices\n");
833 return; 833 return;
834 } 834 }
835 835
836 extract_verts(tess, verts, vertexStride, args.fColor, idxs, canTweak AlphaForCoverage); 836 extract_verts(tess, verts, vertexStride, args.fColor, idxs, canTweak AlphaForCoverage);
837 837
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 kPreallocDrawCnt = 4, 893 kPreallocDrawCnt = 4,
894 }; 894 };
895 SkSTArray<kPreallocSegmentCnt, Segment, true> segments; 895 SkSTArray<kPreallocSegmentCnt, Segment, true> segments;
896 SkPoint fanPt; 896 SkPoint fanPt;
897 897
898 if (!get_segments(*pathPtr, *viewMatrix, &segments, &fanPt, &vertexC ount, 898 if (!get_segments(*pathPtr, *viewMatrix, &segments, &fanPt, &vertexC ount,
899 &indexCount)) { 899 &indexCount)) {
900 continue; 900 continue;
901 } 901 }
902 902
903 const GrVertexBuffer* vertexBuffer; 903 const GrBuffer* vertexBuffer;
904 int firstVertex; 904 int firstVertex;
905 905
906 size_t vertexStride = quadProcessor->getVertexStride(); 906 size_t vertexStride = quadProcessor->getVertexStride();
907 QuadVertex* verts = reinterpret_cast<QuadVertex*>(target->makeVertex Space( 907 QuadVertex* verts = reinterpret_cast<QuadVertex*>(target->makeVertex Space(
908 vertexStride, vertexCount, &vertexBuffer, &firstVertex)); 908 vertexStride, vertexCount, &vertexBuffer, &firstVertex));
909 909
910 if (!verts) { 910 if (!verts) {
911 SkDebugf("Could not allocate vertices\n"); 911 SkDebugf("Could not allocate vertices\n");
912 return; 912 return;
913 } 913 }
914 914
915 const GrIndexBuffer* indexBuffer; 915 const GrBuffer* indexBuffer;
916 int firstIndex; 916 int firstIndex;
917 917
918 uint16_t *idxs = target->makeIndexSpace(indexCount, &indexBuffer, &f irstIndex); 918 uint16_t *idxs = target->makeIndexSpace(indexCount, &indexBuffer, &f irstIndex);
919 if (!idxs) { 919 if (!idxs) {
920 SkDebugf("Could not allocate indices\n"); 920 SkDebugf("Could not allocate indices\n");
921 return; 921 return;
922 } 922 }
923 923
924 SkSTArray<kPreallocDrawCnt, Draw, true> draws; 924 SkSTArray<kPreallocDrawCnt, Draw, true> draws;
925 create_vertices(segments, fanPt, &draws, verts, idxs); 925 create_vertices(segments, fanPt, &draws, verts, idxs);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { 1025 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) {
1026 AAConvexPathBatch::Geometry geometry; 1026 AAConvexPathBatch::Geometry geometry;
1027 geometry.fColor = GrRandomColor(random); 1027 geometry.fColor = GrRandomColor(random);
1028 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); 1028 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
1029 geometry.fPath = GrTest::TestPathConvex(random); 1029 geometry.fPath = GrTest::TestPathConvex(random);
1030 1030
1031 return AAConvexPathBatch::Create(geometry); 1031 return AAConvexPathBatch::Create(geometry);
1032 } 1032 }
1033 1033
1034 #endif 1034 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrVertexBuffer.h ('k') | src/gpu/batches/GrAADistanceFieldPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698