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

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

Issue 2106953009: Fix bug where ovals' AA exceed bounds by .5 pixel (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Realized that lines of code previous to change were inverse of the change. Deleted them. Created 4 years, 5 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 | « no previous file | no next file » | 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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrOvalRenderer.h" 8 #include "GrOvalRenderer.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 // this is legit only if scale & translation (which should be the case a t the moment) 931 // this is legit only if scale & translation (which should be the case a t the moment)
932 if (isStrokeOnly) { 932 if (isStrokeOnly) {
933 innerXRadius = xRadius - scaledStroke.fX; 933 innerXRadius = xRadius - scaledStroke.fX;
934 innerYRadius = yRadius - scaledStroke.fY; 934 innerYRadius = yRadius - scaledStroke.fY;
935 } 935 }
936 936
937 xRadius += scaledStroke.fX; 937 xRadius += scaledStroke.fX;
938 yRadius += scaledStroke.fY; 938 yRadius += scaledStroke.fY;
939 } 939 }
940 940
941 // We've extended the outer x radius out half a pixel to antialias.
942 // This will also expand the rect so all the pixels will be captured.
943 // TODO: Consider if we should use sqrt(2)/2 instead
944 xRadius += SK_ScalarHalf;
945 yRadius += SK_ScalarHalf;
jvanverth1 2016/06/30 15:29:19 I don't think this is quite right. We need to expa
vjiaoblack 2016/06/30 16:55:35 I've implemented these changes locally, and cross-
946
947 EllipseBatch::Geometry geometry; 941 EllipseBatch::Geometry geometry;
948 geometry.fColor = color; 942 geometry.fColor = color;
949 geometry.fXRadius = xRadius; 943 geometry.fXRadius = xRadius;
950 geometry.fYRadius = yRadius; 944 geometry.fYRadius = yRadius;
951 geometry.fInnerXRadius = innerXRadius; 945 geometry.fInnerXRadius = innerXRadius;
952 geometry.fInnerYRadius = innerYRadius; 946 geometry.fInnerYRadius = innerYRadius;
953 geometry.fDevBounds = SkRect::MakeLTRB(center.fX - xRadius, center.fY - yRad ius, 947 geometry.fDevBounds = SkRect::MakeLTRB(center.fX - xRadius, center.fY - yRad ius,
954 center.fX + xRadius, center.fY + yRad ius); 948 center.fX + xRadius, center.fY + yRad ius);
955 949
956 return new EllipseBatch(geometry, viewMatrix, 950 return new EllipseBatch(geometry, viewMatrix,
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 } 1711 }
1718 1712
1719 DRAW_BATCH_TEST_DEFINE(RRectBatch) { 1713 DRAW_BATCH_TEST_DEFINE(RRectBatch) {
1720 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); 1714 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random);
1721 GrColor color = GrRandomColor(random); 1715 GrColor color = GrRandomColor(random);
1722 const SkRRect& rrect = GrTest::TestRRectSimple(random); 1716 const SkRRect& rrect = GrTest::TestRRectSimple(random);
1723 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom)); 1717 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom));
1724 } 1718 }
1725 1719
1726 #endif 1720 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698