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

Unified Diff: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp

Issue 2160563004: Cherry-pick fix for GrAADistanceFieldPathRenderer bounds to M53 (Closed) Base URL: https://chromium.googlesource.com/skia.git@m53
Patch Set: Created 4 years, 5 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 | « src/gpu/GrBatchAtlas.cpp ('k') | tests/DFPathRendererTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
index 725358ebf161009516051afd22e2d8d09b077956..11a6c035ec01e0e53f34755a1da7d198a6ab62b5 100644
--- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
@@ -226,6 +226,8 @@ private:
}
flushInfo.fInstancesToFlush = 0;
+ // Pointer to the next set of vertices to write.
+ intptr_t offset = reinterpret_cast<intptr_t>(vertices);
for (int i = 0; i < instanceCount; i++) {
const Geometry& args = fGeoData[i];
@@ -263,24 +265,22 @@ private:
args.fAntiAlias,
desiredDimension,
scale)) {
+ delete shapeData;
SkDebugf("Can't rasterize path\n");
- return;
+ continue;
}
}
atlas->setLastUseToken(shapeData->fID, target->nextDrawToken());
- // Now set vertices
- intptr_t offset = reinterpret_cast<intptr_t>(vertices);
- offset += i * kVerticesPerQuad * vertexStride;
this->writePathVertices(target,
atlas,
offset,
args.fColor,
vertexStride,
this->viewMatrix(),
- args.fShape,
shapeData);
+ offset += kVerticesPerQuad * vertexStride;
flushInfo.fInstancesToFlush++;
}
@@ -371,15 +371,11 @@ private:
// add to atlas
SkIPoint16 atlasLocation;
GrBatchAtlas::AtlasID id;
- bool success = atlas->addToAtlas(&id, target, width, height, dfStorage.get(),
- &atlasLocation);
- if (!success) {
+ if (!atlas->addToAtlas(&id, target, width, height, dfStorage.get(), &atlasLocation)) {
this->flush(target, flushInfo);
-
- SkDEBUGCODE(success =) atlas->addToAtlas(&id, target, width, height,
- dfStorage.get(), &atlasLocation);
- SkASSERT(success);
-
+ if (!atlas->addToAtlas(&id, target, width, height, dfStorage.get(), &atlasLocation)) {
+ return false;
+ }
}
// add to cache
@@ -415,7 +411,6 @@ private:
GrColor color,
size_t vertexStride,
const SkMatrix& viewMatrix,
- const GrShape& shape,
const ShapeData* shapeData) const {
GrTexture* texture = atlas->getTexture();
@@ -456,15 +451,17 @@ private:
}
void flush(GrVertexBatch::Target* target, FlushInfo* flushInfo) const {
- GrMesh mesh;
- int maxInstancesPerDraw =
- static_cast<int>(flushInfo->fIndexBuffer->gpuMemorySize() / sizeof(uint16_t) / 6);
- mesh.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuffer,
- flushInfo->fIndexBuffer, flushInfo->fVertexOffset, kVerticesPerQuad,
- kIndicesPerQuad, flushInfo->fInstancesToFlush, maxInstancesPerDraw);
- target->draw(flushInfo->fGeometryProcessor.get(), mesh);
- flushInfo->fVertexOffset += kVerticesPerQuad * flushInfo->fInstancesToFlush;
- flushInfo->fInstancesToFlush = 0;
+ if (flushInfo->fInstancesToFlush) {
+ GrMesh mesh;
+ int maxInstancesPerDraw =
+ static_cast<int>(flushInfo->fIndexBuffer->gpuMemorySize() / sizeof(uint16_t) / 6);
+ mesh.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuffer,
+ flushInfo->fIndexBuffer, flushInfo->fVertexOffset, kVerticesPerQuad,
+ kIndicesPerQuad, flushInfo->fInstancesToFlush, maxInstancesPerDraw);
+ target->draw(flushInfo->fGeometryProcessor.get(), mesh);
+ flushInfo->fVertexOffset += kVerticesPerQuad * flushInfo->fInstancesToFlush;
+ flushInfo->fInstancesToFlush = 0;
+ }
}
GrColor color() const { return fGeoData[0].fColor; }
« no previous file with comments | « src/gpu/GrBatchAtlas.cpp ('k') | tests/DFPathRendererTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698