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

Side by Side Diff: src/gpu/GrContext.cpp

Issue 1101663007: Make non-AA hairline stroke rects snap to pixels centers so they close. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrPipeline.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrPipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698