Index: src/gpu/GrContext.cpp |
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
index 43ac464c24b4b705043aa0146ea22b8b974af630..bc08adc6b64dc9f6cbd506d27aea7b1ceba05b82 100755 |
--- a/src/gpu/GrContext.cpp |
+++ b/src/gpu/GrContext.cpp |
@@ -798,6 +798,11 @@ void GrContext::drawRect(GrRenderTarget* rt, |
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); |
} else { |
// filled BW rect |