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

Unified Diff: src/gpu/GrContext.cpp

Issue 1121463002: Move bounds to GrBatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 8 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
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index b5c8e3e592b21f1d7667d33434316c92a48f5435..70029418f8a24bcd36693bef172c3c507d5da2d6 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -625,6 +625,12 @@ private:
fBatch.fHairline = geometry.fStrokeWidth == 0;
fGeoData.push_back(geometry);
+
+ // setup bounds
+ this->setBounds(geometry.fRect);
+ SkScalar rad = SkScalarHalf(geometry.fStrokeWidth);
+ this->getBounds()->outset(rad, rad);
+ geometry.fViewMatrix.mapRect(this->getBounds());
}
/* create a triangle strip that strokes the specified rect. There are 8
@@ -775,16 +781,12 @@ void GrContext::drawRect(GrRenderTarget* rt,
SkAutoTUnref<GrBatch> batch(StrokeRectBatch::Create(geometry));
- SkRect bounds = rect;
- SkScalar rad = SkScalarHalf(width);
- bounds.outset(rad, rad);
- viewMatrix.mapRect(&bounds);
// Depending on sub-pixel coordinates and the particular GPU, we may lose a corner of
// hairline rects. We jam all the vertices to pixel centers to avoid this, but not when MSAA
// is enabled because it can cause ugly artifacts.
pipelineBuilder.setState(GrPipelineBuilder::kSnapVerticesToPixelCenters_Flag,
0 == width && !rt->isMultisampled());
- target->drawBatch(&pipelineBuilder, batch, &bounds);
+ target->drawBatch(&pipelineBuilder, batch);
} else {
// filled BW rect
target->drawSimpleRect(&pipelineBuilder, color, viewMatrix, rect);
@@ -1022,6 +1024,9 @@ private:
fBatch.fVertexCount = vertexCount;
fBatch.fIndexCount = indexCount;
fBatch.fPrimitiveType = primitiveType;
+
+ // TODO figure out bounds
+ this->setBoundsLargest();
}
GrPrimitiveType primitiveType() const { return fBatch.fPrimitiveType; }
@@ -1076,6 +1081,8 @@ private:
fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin());
fBatch.fVertexCount += that->vertexCount();
fBatch.fIndexCount += that->indexCount();
+
+ this->joinBounds(that->bounds());
return true;
}
@@ -1126,8 +1133,7 @@ void GrContext::drawVertices(GrRenderTarget* rt,
positions, vertexCount, indices,
indexCount,colors, texCoords));
- // TODO figure out bounds
- target->drawBatch(&pipelineBuilder, batch, NULL);
+ target->drawBatch(&pipelineBuilder, batch);
}
///////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698