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 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1892 | 1892 |
1893 /////////////////////////////////////////////////////////////////////////////// | 1893 /////////////////////////////////////////////////////////////////////////////// |
1894 | 1894 |
1895 GrDrawBatch* GrOvalRenderer::CreateArcBatch(GrColor color, | 1895 GrDrawBatch* GrOvalRenderer::CreateArcBatch(GrColor color, |
1896 const SkMatrix& viewMatrix, | 1896 const SkMatrix& viewMatrix, |
1897 const SkRect& oval, | 1897 const SkRect& oval, |
1898 SkScalar startAngle, SkScalar sweepA
ngle, | 1898 SkScalar startAngle, SkScalar sweepA
ngle, |
1899 bool useCenter, | 1899 bool useCenter, |
1900 const GrStyle& style, | 1900 const GrStyle& style, |
1901 const GrShaderCaps* shaderCaps) { | 1901 const GrShaderCaps* shaderCaps) { |
| 1902 SkASSERT(!oval.isEmpty()); |
| 1903 SkASSERT(sweepAngle); |
1902 SkScalar width = oval.width(); | 1904 SkScalar width = oval.width(); |
| 1905 if (SkScalarAbs(sweepAngle) >= 360.f) { |
| 1906 return nullptr; |
| 1907 } |
1903 if (!SkScalarNearlyEqual(width, oval.height()) || !circle_stays_circle(viewM
atrix)) { | 1908 if (!SkScalarNearlyEqual(width, oval.height()) || !circle_stays_circle(viewM
atrix)) { |
1904 return nullptr; | 1909 return nullptr; |
1905 } | 1910 } |
1906 SkPoint center = {oval.centerX(), oval.centerY()}; | 1911 SkPoint center = {oval.centerX(), oval.centerY()}; |
1907 CircleBatch::ArcParams arcParams = { | 1912 CircleBatch::ArcParams arcParams = { |
1908 SkDegreesToRadians(startAngle), | 1913 SkDegreesToRadians(startAngle), |
1909 SkDegreesToRadians(sweepAngle), | 1914 SkDegreesToRadians(sweepAngle), |
1910 useCenter | 1915 useCenter |
1911 }; | 1916 }; |
1912 return CircleBatch::Create(color, viewMatrix, center, width/2.f, style, &arc
Params); | 1917 return CircleBatch::Create(color, viewMatrix, center, width/2.f, style, &arc
Params); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1962 } | 1967 } |
1963 | 1968 |
1964 DRAW_BATCH_TEST_DEFINE(RRectBatch) { | 1969 DRAW_BATCH_TEST_DEFINE(RRectBatch) { |
1965 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 1970 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
1966 GrColor color = GrRandomColor(random); | 1971 GrColor color = GrRandomColor(random); |
1967 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 1972 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
1968 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 1973 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
1969 } | 1974 } |
1970 | 1975 |
1971 #endif | 1976 #endif |
OLD | NEW |