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

Unified Diff: src/gpu/GrTessellatingPathRenderer.cpp

Issue 1128083004: Tesellating path renderer: typecast cleanup; logging build fix. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 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 0fc2b9edbe545e2cd195b2b4ea8f04b13bc69acf..0fd8afd754652ab0c27d9dcefdcdbb77478a6302 100644
--- a/src/gpu/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/GrTessellatingPathRenderer.cpp
@@ -185,13 +185,12 @@ bool sweep_gt_vert(const SkPoint& a, const SkPoint& b) {
return a.fY == b.fY ? a.fX > b.fX : a.fY > b.fY;
}
-inline void* emit_vertex(Vertex* v, void* data) {
- SkPoint* d = static_cast<SkPoint*>(data);
- *d++ = v->fPoint;
- return d;
+inline SkPoint* emit_vertex(Vertex* v, SkPoint* data) {
+ *data++ = v->fPoint;
+ return data;
}
-void* emit_triangle(Vertex* v0, Vertex* v1, Vertex* v2, void* data) {
+SkPoint* emit_triangle(Vertex* v0, Vertex* v1, Vertex* v2, SkPoint* data) {
#if WIREFRAME
data = emit_vertex(v0, data);
data = emit_vertex(v1, data);
@@ -360,7 +359,7 @@ struct Poly {
return done;
}
- void* emit(void* data) {
+ SkPoint* emit(SkPoint* data) {
Vertex* first = fHead;
Vertex* v = first->fNext;
while (v != fTail) {
@@ -428,7 +427,7 @@ struct Poly {
}
addVertex(v, fActive->fSide == kLeft_Side ? kRight_Side : kLeft_Side, alloc);
}
- void* emit(void *data) {
+ SkPoint* emit(SkPoint *data) {
if (fCount < 3) {
return data;
}
@@ -1277,7 +1276,7 @@ Poly* tessellate(Vertex* vertices, SkChunkAlloc& alloc) {
}
#if LOGGING_ENABLED
LOG("\nactive edges:\n");
- for (Edge* e = activeEdges->fHead; e != NULL; e = e->fRight) {
+ for (Edge* e = activeEdges.fHead; e != NULL; e = e->fRight) {
LOG("%g -> %g, lpoly %d, rpoly %d\n", e->fTop->fID, e->fBottom->fID,
e->fLeftPoly ? e->fLeftPoly->fID : -1, e->fRightPoly ? e->fRightPoly->fID : -1);
}
@@ -1320,8 +1319,8 @@ Poly* contours_to_polys(Vertex** contours, int contourCnt, Comparator& c, SkChun
// Stage 6: Triangulate the monotone polygons into a vertex buffer.
-void* polys_to_triangles(Poly* polys, SkPath::FillType fillType, void* data) {
- void* d = data;
+SkPoint* polys_to_triangles(Poly* polys, SkPath::FillType fillType, SkPoint* data) {
+ SkPoint* d = data;
for (Poly* poly = polys; poly; poly = poly->fNext) {
if (apply_fill_type(fillType, poly->fWinding)) {
d = poly->emit(d);
@@ -1438,18 +1437,19 @@ public:
}
size_t stride = gp->getVertexStride();
+ SkASSERT(stride == sizeof(SkPoint));
const GrVertexBuffer* vertexBuffer;
int firstVertex;
- void* verts = batchTarget->makeVertSpace(stride, count, &vertexBuffer, &firstVertex);
+ SkPoint* verts = static_cast<SkPoint*>(
+ batchTarget->makeVertSpace(stride, count, &vertexBuffer, &firstVertex));
if (!verts) {
SkDebugf("Could not allocate vertices\n");
return;
}
LOG("emitting %d verts\n", count);
- void* end = polys_to_triangles(polys, fillType, verts);
- int actualCount = static_cast<int>(
- (static_cast<char*>(end) - static_cast<char*>(verts)) / stride);
+ SkPoint* end = polys_to_triangles(polys, fillType, verts);
+ int actualCount = static_cast<int>(end - verts);
LOG("actual count: %d\n", actualCount);
SkASSERT(actualCount <= count);
« 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