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

Side by Side Diff: src/gpu/GrTessellatingPathRenderer.cpp

Issue 1124733004: Move DrawInfo out from GrDrawTarget and rename to GrVertices. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comment changes Created 5 years, 7 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/GrGpu.cpp ('k') | src/gpu/GrTest.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 * 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 "GrTessellatingPathRenderer.h" 8 #include "GrTessellatingPathRenderer.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
11 #include "GrBatchTarget.h" 11 #include "GrBatchTarget.h"
12 #include "GrDefaultGeoProcFactory.h" 12 #include "GrDefaultGeoProcFactory.h"
13 #include "GrPathUtils.h" 13 #include "GrPathUtils.h"
14 #include "GrVertexBuffer.h" 14 #include "GrVertices.h"
15 #include "SkChunkAlloc.h" 15 #include "SkChunkAlloc.h"
16 #include "SkGeometry.h" 16 #include "SkGeometry.h"
17 17
18 #include <stdio.h> 18 #include <stdio.h>
19 19
20 /* 20 /*
21 * This path renderer tessellates the path into triangles, uploads the triangles to a 21 * This path renderer tessellates the path into triangles, uploads the triangles to a
22 * vertex buffer, and renders them with a single draw call. It does not currentl y do 22 * vertex buffer, and renders them with a single draw call. It does not currentl y do
23 * antialiasing, so it must be used in conjunction with multisampling. 23 * antialiasing, so it must be used in conjunction with multisampling.
24 * 24 *
(...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 count += (poly->fCount - 2) * (WIREFRAME ? 6 : 3); 1432 count += (poly->fCount - 2) * (WIREFRAME ? 6 : 3);
1433 } 1433 }
1434 } 1434 }
1435 if (0 == count) { 1435 if (0 == count) {
1436 return; 1436 return;
1437 } 1437 }
1438 1438
1439 size_t stride = gp->getVertexStride(); 1439 size_t stride = gp->getVertexStride();
1440 const GrVertexBuffer* vertexBuffer; 1440 const GrVertexBuffer* vertexBuffer;
1441 int firstVertex; 1441 int firstVertex;
1442 void* vertices = batchTarget->vertexPool()->makeSpace(stride, 1442 void* verts = batchTarget->vertexPool()->makeSpace(stride,
1443 count, 1443 count,
1444 &vertexBuffer, 1444 &vertexBuffer,
1445 &firstVertex); 1445 &firstVertex);
1446 1446
1447 if (!vertices) { 1447 if (!verts) {
1448 SkDebugf("Could not allocate vertices\n"); 1448 SkDebugf("Could not allocate vertices\n");
1449 return; 1449 return;
1450 } 1450 }
1451 1451
1452 LOG("emitting %d verts\n", count); 1452 LOG("emitting %d verts\n", count);
1453 void* end = polys_to_triangles(polys, fillType, vertices); 1453 void* end = polys_to_triangles(polys, fillType, verts);
1454 int actualCount = static_cast<int>( 1454 int actualCount = static_cast<int>(
1455 (static_cast<char*>(end) - static_cast<char*>(vertices)) / stride); 1455 (static_cast<char*>(end) - static_cast<char*>(verts)) / stride);
1456 LOG("actual count: %d\n", actualCount); 1456 LOG("actual count: %d\n", actualCount);
1457 SkASSERT(actualCount <= count); 1457 SkASSERT(actualCount <= count);
1458 1458
1459 GrPrimitiveType primitiveType = WIREFRAME ? kLines_GrPrimitiveType 1459 GrPrimitiveType primitiveType = WIREFRAME ? kLines_GrPrimitiveType
1460 : kTriangles_GrPrimitiveType; 1460 : kTriangles_GrPrimitiveType;
1461 GrDrawTarget::DrawInfo drawInfo; 1461 GrVertices vertices;
1462 drawInfo.init(primitiveType, vertexBuffer, firstVertex, actualCount); 1462 vertices.init(primitiveType, vertexBuffer, firstVertex, actualCount);
1463 batchTarget->draw(drawInfo); 1463 batchTarget->draw(vertices);
1464 1464
1465 batchTarget->putBackVertices((size_t)(count - actualCount), stride); 1465 batchTarget->putBackVertices((size_t)(count - actualCount), stride);
1466 return; 1466 return;
1467 } 1467 }
1468 1468
1469 bool onCombineIfPossible(GrBatch*) override { 1469 bool onCombineIfPossible(GrBatch*) override {
1470 return false; 1470 return false;
1471 } 1471 }
1472 1472
1473 private: 1473 private:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 SkMatrix vmi; 1511 SkMatrix vmi;
1512 if (!viewM.invert(&vmi)) { 1512 if (!viewM.invert(&vmi)) {
1513 return false; 1513 return false;
1514 } 1514 }
1515 vmi.mapRect(&clipBounds); 1515 vmi.mapRect(&clipBounds);
1516 SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM , clipBounds)); 1516 SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM , clipBounds));
1517 target->drawBatch(pipelineBuilder, batch); 1517 target->drawBatch(pipelineBuilder, batch);
1518 1518
1519 return true; 1519 return true;
1520 } 1520 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698