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

Unified Diff: src/gpu/GrContext.cpp

Issue 1123253003: fix bounds for BW lines, AA Hairlines (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks 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
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index b361b671c3b3080b9373ee30a76daf9ce91d7b7a..83fa60e5d5553f98ec3a367bc29d3ff741450c5c 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -522,6 +522,10 @@ private:
SkScalar rad = SkScalarHalf(geometry.fStrokeWidth);
fBounds.outset(rad, rad);
geometry.fViewMatrix.mapRect(&fBounds);
+
robertphillips 2015/05/07 13:17:17 rm "then" ?
+ // Since we don't have AA then we outset for a half pixel in each direction to account for
+ // snapping
robertphillips 2015/05/07 13:17:17 // This is conservative but, b.c. the hardware can
+ fBounds.outset(0.5f, 0.5f);
robertphillips 2015/05/07 13:17:17 Shouldn't this only occur for hairlines? For fills
}
/* create a triangle strip that strokes the specified rect. There are 8
@@ -1021,6 +1025,12 @@ void GrContext::drawVertices(GrRenderTarget* rt,
viewMatrix.mapRect(&bounds);
+ // If we don't have AA then we outset for a half pixel in each direction to account for
+ // snapping
+ if (!paint.isAntiAlias()) {
+ bounds.outset(0.5f, 0.5f);
+ }
+
DrawVerticesBatch::Geometry geometry;
geometry.fColor = paint.getColor();
SkAutoTUnref<GrBatch> batch(DrawVerticesBatch::Create(geometry, primitiveType, viewMatrix,
« src/gpu/GrAAHairLinePathRenderer.cpp ('K') | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698