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

Unified Diff: src/gpu/GrTessellatingPathRenderer.cpp

Issue 1288683004: Add support for non-mappable vert buffers to tessellating path renderer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTessellatingPathRenderer.cpp
diff --git a/src/gpu/GrTessellatingPathRenderer.cpp b/src/gpu/GrTessellatingPathRenderer.cpp
index 6a70a9028363cc677374957525282983f656eff7..9fe5278b42899236280bdc066c49da454612b0b2 100644
--- a/src/gpu/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/GrTessellatingPathRenderer.cpp
@@ -1417,7 +1417,8 @@ private:
int tessellate(GrUniqueKey* key,
GrResourceProvider* resourceProvider,
- SkAutoTUnref<GrVertexBuffer>& vertexBuffer) {
+ SkAutoTUnref<GrVertexBuffer>& vertexBuffer,
+ bool canMapVB) {
SkPath path;
GrStrokeInfo stroke(fStroke);
if (stroke.isDashed()) {
@@ -1490,13 +1491,23 @@ private:
SkDebugf("Could not allocate vertices\n");
return 0;
}
- SkPoint* verts = static_cast<SkPoint*>(vertexBuffer->map());
- LOG("emitting %d verts\n", count);
+ SkPoint* verts;
+ if (canMapVB) {
+ verts = static_cast<SkPoint*>(vertexBuffer->map());
+ } else {
+ verts = SkNEW_ARRAY(SkPoint, count);
+ }
SkPoint* end = polys_to_triangles(polys, fillType, verts);
- vertexBuffer->unmap();
int actualCount = static_cast<int>(end - verts);
LOG("actual count: %d\n", actualCount);
SkASSERT(actualCount <= count);
+ if (canMapVB) {
+ vertexBuffer->unmap();
+ } else {
+ vertexBuffer->updateData(verts, actualCount * sizeof(SkPoint));
+ SkDELETE_ARRAY(verts);
+ }
+
if (!fPath.isVolatile()) {
TessInfo info;
@@ -1533,7 +1544,8 @@ private:
SkScalar tol = GrPathUtils::scaleToleranceToSrc(
screenSpaceTol, fViewMatrix, fPath.getBounds());
if (!cache_match(vertexBuffer.get(), tol, &actualCount)) {
- actualCount = tessellate(&key, rp, vertexBuffer);
+ bool canMapVB = GrCaps::kNone_MapFlags != target->caps().mapBufferFlags();
+ actualCount = tessellate(&key, rp, vertexBuffer, canMapVB);
}
if (actualCount == 0) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698