| 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 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 innerYRadius = yRadius - scaledStroke.fY; | 1074 innerYRadius = yRadius - scaledStroke.fY; |
| 1075 } | 1075 } |
| 1076 | 1076 |
| 1077 xRadius += scaledStroke.fX; | 1077 xRadius += scaledStroke.fX; |
| 1078 yRadius += scaledStroke.fY; | 1078 yRadius += scaledStroke.fY; |
| 1079 } | 1079 } |
| 1080 | 1080 |
| 1081 // We've extended the outer x radius out half a pixel to antialias. | 1081 // We've extended the outer x radius out half a pixel to antialias. |
| 1082 // This will also expand the rect so all the pixels will be captured. | 1082 // This will also expand the rect so all the pixels will be captured. |
| 1083 // TODO: Consider if we should use sqrt(2)/2 instead | 1083 // TODO: Consider if we should use sqrt(2)/2 instead |
| 1084 SkScalar geoXRadius = xRadius + SK_ScalarHalf; | 1084 xRadius += SK_ScalarHalf; |
| 1085 SkScalar geoYRadius = yRadius + SK_ScalarHalf; | 1085 yRadius += SK_ScalarHalf; |
| 1086 | 1086 |
| 1087 EllipseBatch::Geometry geometry; | 1087 EllipseBatch::Geometry geometry; |
| 1088 geometry.fViewMatrix = viewMatrix; | 1088 geometry.fViewMatrix = viewMatrix; |
| 1089 geometry.fColor = color; | 1089 geometry.fColor = color; |
| 1090 geometry.fXRadius = xRadius; | 1090 geometry.fXRadius = xRadius; |
| 1091 geometry.fYRadius = yRadius; | 1091 geometry.fYRadius = yRadius; |
| 1092 geometry.fInnerXRadius = innerXRadius; | 1092 geometry.fInnerXRadius = innerXRadius; |
| 1093 geometry.fInnerYRadius = innerYRadius; | 1093 geometry.fInnerYRadius = innerYRadius; |
| 1094 geometry.fStroke = isStrokeOnly && innerXRadius > 0 && innerYRadius > 0; | 1094 geometry.fStroke = isStrokeOnly && innerXRadius > 0 && innerYRadius > 0; |
| 1095 geometry.fDevBounds = SkRect::MakeLTRB(center.fX - geoXRadius, center.fY - g
eoYRadius, | 1095 geometry.fDevBounds = SkRect::MakeLTRB(center.fX - xRadius, center.fY - yRad
ius, |
| 1096 center.fX + geoXRadius, center.fY + g
eoYRadius); | 1096 center.fX + xRadius, center.fY + yRad
ius); |
| 1097 | 1097 |
| 1098 return EllipseBatch::Create(geometry); | 1098 return EllipseBatch::Create(geometry); |
| 1099 } | 1099 } |
| 1100 | 1100 |
| 1101 bool GrOvalRenderer::DrawEllipse(GrDrawTarget* target, | 1101 bool GrOvalRenderer::DrawEllipse(GrDrawTarget* target, |
| 1102 const GrPipelineBuilder& pipelineBuilder, | 1102 const GrPipelineBuilder& pipelineBuilder, |
| 1103 GrColor color, | 1103 GrColor color, |
| 1104 const SkMatrix& viewMatrix, | 1104 const SkMatrix& viewMatrix, |
| 1105 bool useCoverageAA, | 1105 bool useCoverageAA, |
| 1106 const SkRect& ellipse, | 1106 const SkRect& ellipse, |
| (...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2058 } | 2058 } |
| 2059 | 2059 |
| 2060 DRAW_BATCH_TEST_DEFINE(RRectBatch) { | 2060 DRAW_BATCH_TEST_DEFINE(RRectBatch) { |
| 2061 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2061 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
| 2062 GrColor color = GrRandomColor(random); | 2062 GrColor color = GrRandomColor(random); |
| 2063 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 2063 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
| 2064 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 2064 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
| 2065 } | 2065 } |
| 2066 | 2066 |
| 2067 #endif | 2067 #endif |
| OLD | NEW |