OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |