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

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

Issue 1831133004: Revert of Consolidate GPU buffer implementations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/batches/GrNonAAStrokeRectBatch.cpp ('k') | src/gpu/batches/GrTInstanceBatch.h » ('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 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrPLSPathRenderer.h" 8 #include "GrPLSPathRenderer.h"
9 9
10 #include "SkChunkAlloc.h" 10 #include "SkChunkAlloc.h"
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 866
867 GrMesh mesh; 867 GrMesh mesh;
868 868
869 PLSVertices triVertices; 869 PLSVertices triVertices;
870 PLSVertices quadVertices; 870 PLSVertices quadVertices;
871 if (!get_geometry(*pathPtr, *viewMatrix, triVertices, quadVertices, rp, bounds)) { 871 if (!get_geometry(*pathPtr, *viewMatrix, triVertices, quadVertices, rp, bounds)) {
872 continue; 872 continue;
873 } 873 }
874 874
875 if (triVertices.count()) { 875 if (triVertices.count()) {
876 const GrBuffer* triVertexBuffer; 876 const GrVertexBuffer* triVertexBuffer;
877 int firstTriVertex; 877 int firstTriVertex;
878 size_t triStride = triangleProcessor->getVertexStride(); 878 size_t triStride = triangleProcessor->getVertexStride();
879 PLSVertex* triVerts = reinterpret_cast<PLSVertex*>(target->makeV ertexSpace( 879 PLSVertex* triVerts = reinterpret_cast<PLSVertex*>(target->makeV ertexSpace(
880 triStride, triVertices.count(), &triVertexBuffer, &first TriVertex)); 880 triStride, triVertices.count(), &triVertexBuffer, &first TriVertex));
881 if (!triVerts) { 881 if (!triVerts) {
882 SkDebugf("Could not allocate vertices\n"); 882 SkDebugf("Could not allocate vertices\n");
883 return; 883 return;
884 } 884 }
885 for (int i = 0; i < triVertices.count(); ++i) { 885 for (int i = 0; i < triVertices.count(); ++i) {
886 triVerts[i] = triVertices[i]; 886 triVerts[i] = triVertices[i];
887 } 887 }
888 mesh.init(kTriangles_GrPrimitiveType, triVertexBuffer, firstTriV ertex, 888 mesh.init(kTriangles_GrPrimitiveType, triVertexBuffer, firstTriV ertex,
889 triVertices.count()); 889 triVertices.count());
890 target->initDraw(triangleProcessor); 890 target->initDraw(triangleProcessor);
891 target->draw(mesh); 891 target->draw(mesh);
892 } 892 }
893 893
894 if (quadVertices.count()) { 894 if (quadVertices.count()) {
895 const GrBuffer* quadVertexBuffer; 895 const GrVertexBuffer* quadVertexBuffer;
896 int firstQuadVertex; 896 int firstQuadVertex;
897 size_t quadStride = quadProcessor->getVertexStride(); 897 size_t quadStride = quadProcessor->getVertexStride();
898 PLSVertex* quadVerts = reinterpret_cast<PLSVertex*>(target->make VertexSpace( 898 PLSVertex* quadVerts = reinterpret_cast<PLSVertex*>(target->make VertexSpace(
899 quadStride, quadVertices.count(), &quadVertexBuffer, &fi rstQuadVertex)); 899 quadStride, quadVertices.count(), &quadVertexBuffer, &fi rstQuadVertex));
900 if (!quadVerts) { 900 if (!quadVerts) {
901 SkDebugf("Could not allocate vertices\n"); 901 SkDebugf("Could not allocate vertices\n");
902 return; 902 return;
903 } 903 }
904 for (int i = 0; i < quadVertices.count(); ++i) { 904 for (int i = 0; i < quadVertices.count(); ++i) {
905 quadVerts[i] = quadVertices[i]; 905 quadVerts[i] = quadVertices[i];
906 } 906 }
907 mesh.init(kTriangles_GrPrimitiveType, quadVertexBuffer, firstQua dVertex, 907 mesh.init(kTriangles_GrPrimitiveType, quadVertexBuffer, firstQua dVertex,
908 quadVertices.count()); 908 quadVertices.count());
909 target->initDraw(quadProcessor); 909 target->initDraw(quadProcessor);
910 target->draw(mesh); 910 target->draw(mesh);
911 } 911 }
912 912
913 SkAutoTUnref<GrGeometryProcessor> finishProcessor( 913 SkAutoTUnref<GrGeometryProcessor> finishProcessor(
914 PLSFinishEffect::Create(this->color(), 914 PLSFinishEffect::Create(this->color(),
915 pathPtr->getFillType() == 915 pathPtr->getFillType() ==
916 SkPath::FillType ::kEvenOdd_FillType, 916 SkPath::FillType ::kEvenOdd_FillType,
917 invert, 917 invert,
918 this->usesLocalCoords())); 918 this->usesLocalCoords()));
919 const GrBuffer* rectVertexBuffer; 919 const GrVertexBuffer* rectVertexBuffer;
920 size_t finishStride = finishProcessor->getVertexStride(); 920 size_t finishStride = finishProcessor->getVertexStride();
921 int firstRectVertex; 921 int firstRectVertex;
922 static const int kRectVertexCount = 6; 922 static const int kRectVertexCount = 6;
923 SkPoint* rectVerts = reinterpret_cast<SkPoint*>(target->makeVertexSp ace( 923 SkPoint* rectVerts = reinterpret_cast<SkPoint*>(target->makeVertexSp ace(
924 finishStride, kRectVertexCount, &rectVertexBuffer, &firstRec tVertex)); 924 finishStride, kRectVertexCount, &rectVertexBuffer, &firstRec tVertex));
925 if (!rectVerts) { 925 if (!rectVerts) {
926 SkDebugf("Could not allocate vertices\n"); 926 SkDebugf("Could not allocate vertices\n");
927 return; 927 return;
928 } 928 }
929 rectVerts[0] = { bounds.fLeft, bounds.fTop }; 929 rectVerts[0] = { bounds.fLeft, bounds.fTop };
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 DRAW_BATCH_TEST_DEFINE(PLSPathBatch) { 1002 DRAW_BATCH_TEST_DEFINE(PLSPathBatch) {
1003 PLSPathBatch::Geometry geometry; 1003 PLSPathBatch::Geometry geometry;
1004 geometry.fColor = GrRandomColor(random); 1004 geometry.fColor = GrRandomColor(random);
1005 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); 1005 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
1006 geometry.fPath = GrTest::TestPathConvex(random); 1006 geometry.fPath = GrTest::TestPathConvex(random);
1007 1007
1008 return PLSPathBatch::Create(geometry); 1008 return PLSPathBatch::Create(geometry);
1009 } 1009 }
1010 1010
1011 #endif 1011 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrNonAAStrokeRectBatch.cpp ('k') | src/gpu/batches/GrTInstanceBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698