| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrContext.h" | 9 #include "GrContext.h" |
| 10 | 10 |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 geometry.fColor = color; | 791 geometry.fColor = color; |
| 792 geometry.fRect = rect; | 792 geometry.fRect = rect; |
| 793 geometry.fStrokeWidth = width; | 793 geometry.fStrokeWidth = width; |
| 794 | 794 |
| 795 SkAutoTUnref<GrBatch> batch(StrokeRectBatch::Create(geometry)); | 795 SkAutoTUnref<GrBatch> batch(StrokeRectBatch::Create(geometry)); |
| 796 | 796 |
| 797 SkRect bounds = rect; | 797 SkRect bounds = rect; |
| 798 SkScalar rad = SkScalarHalf(width); | 798 SkScalar rad = SkScalarHalf(width); |
| 799 bounds.outset(rad, rad); | 799 bounds.outset(rad, rad); |
| 800 viewMatrix.mapRect(&bounds); | 800 viewMatrix.mapRect(&bounds); |
| 801 // Depending on sub-pixel coordinates and the particular GPU, we may los
e a corner of |
| 802 // hairline rects. We jam all the vertices to pixel centers to avoid thi
s, but not when MSAA |
| 803 // is enabled because it can cause ugly artifacts. |
| 804 pipelineBuilder.setState(GrPipelineBuilder::kSnapVerticesToPixelCenters_
Flag, |
| 805 0 == width && !rt->isMultisampled()); |
| 801 target->drawBatch(&pipelineBuilder, batch, &bounds); | 806 target->drawBatch(&pipelineBuilder, batch, &bounds); |
| 802 } else { | 807 } else { |
| 803 // filled BW rect | 808 // filled BW rect |
| 804 target->drawSimpleRect(&pipelineBuilder, color, viewMatrix, rect); | 809 target->drawSimpleRect(&pipelineBuilder, color, viewMatrix, rect); |
| 805 } | 810 } |
| 806 } | 811 } |
| 807 | 812 |
| 808 void GrContext::drawNonAARectToRect(GrRenderTarget* rt, | 813 void GrContext::drawNonAARectToRect(GrRenderTarget* rt, |
| 809 const GrClip& clip, | 814 const GrClip& clip, |
| 810 const GrPaint& paint, | 815 const GrPaint& paint, |
| (...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2031 } | 2036 } |
| 2032 } | 2037 } |
| 2033 | 2038 |
| 2034 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { | 2039 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { |
| 2035 fGpu->removeGpuTraceMarker(marker); | 2040 fGpu->removeGpuTraceMarker(marker); |
| 2036 if (fDrawBuffer) { | 2041 if (fDrawBuffer) { |
| 2037 fDrawBuffer->removeGpuTraceMarker(marker); | 2042 fDrawBuffer->removeGpuTraceMarker(marker); |
| 2038 } | 2043 } |
| 2039 } | 2044 } |
| 2040 | 2045 |
| OLD | NEW |