Chromium Code Reviews| Index: src/gpu/GrContext.cpp |
| diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
| index b361b671c3b3080b9373ee30a76daf9ce91d7b7a..725cf0359c5938289cb9a90f0b6695dac4a9ecd2 100755 |
| --- a/src/gpu/GrContext.cpp |
| +++ b/src/gpu/GrContext.cpp |
| @@ -522,6 +522,12 @@ private: |
| SkScalar rad = SkScalarHalf(geometry.fStrokeWidth); |
| fBounds.outset(rad, rad); |
| geometry.fViewMatrix.mapRect(&fBounds); |
| + |
|
robertphillips
2015/05/07 14:42:02
For this case, BW hairline rect draw, I believe we
bsalomon
2015/05/07 14:47:45
Correct. This is an unfortunate case of coupling w
|
| + // This is conservative but, b.c. the hardware can employ somewhat arbitrary |
| + // snapping rules to BW lines, it is the best we can do. |
| + if (fBatch.fHairline) { |
| + fBounds.outset(0.5f, 0.5f); |
| + } |
| } |
| /* create a triangle strip that strokes the specified rect. There are 8 |
| @@ -1021,6 +1027,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, |