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 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 viewMatrix.postScale(scale, scale); | 1928 viewMatrix.postScale(scale, scale); |
1929 GrColor color = GrRandomColor(random); | 1929 GrColor color = GrRandomColor(random); |
1930 SkRect circle = GrTest::TestSquare(random); | 1930 SkRect circle = GrTest::TestSquare(random); |
1931 SkPoint center = {circle.centerX(), circle.centerY()}; | 1931 SkPoint center = {circle.centerX(), circle.centerY()}; |
1932 SkScalar radius = circle.width() / 2.f; | 1932 SkScalar radius = circle.width() / 2.f; |
1933 SkStrokeRec stroke = GrTest::TestStrokeRec(random); | 1933 SkStrokeRec stroke = GrTest::TestStrokeRec(random); |
1934 CircleBatch::ArcParams arcParamsTmp; | 1934 CircleBatch::ArcParams arcParamsTmp; |
1935 const CircleBatch::ArcParams* arcParams = nullptr; | 1935 const CircleBatch::ArcParams* arcParams = nullptr; |
1936 if (random->nextBool()) { | 1936 if (random->nextBool()) { |
1937 arcParamsTmp.fStartAngleRadians = random->nextSScalar1() * SK_Scalar
PI * 2; | 1937 arcParamsTmp.fStartAngleRadians = random->nextSScalar1() * SK_Scalar
PI * 2; |
1938 arcParamsTmp.fStartAngleRadians = random->nextSScalar1() * SK_Scalar
PI * 2 - .01f; | 1938 arcParamsTmp.fSweepAngleRadians = random->nextSScalar1() * SK_Scalar
PI * 2 - .01f; |
| 1939 arcParamsTmp.fUseCenter = random->nextBool(); |
1939 arcParams = &arcParamsTmp; | 1940 arcParams = &arcParamsTmp; |
1940 } | 1941 } |
1941 GrDrawBatch* batch = CircleBatch::Create(color, viewMatrix, center, radi
us, | 1942 GrDrawBatch* batch = CircleBatch::Create(color, viewMatrix, center, radi
us, |
1942 GrStyle(stroke, nullptr), arcPa
rams); | 1943 GrStyle(stroke, nullptr), arcPa
rams); |
1943 if (batch) { | 1944 if (batch) { |
1944 return batch; | 1945 return batch; |
1945 } | 1946 } |
1946 } while (true); | 1947 } while (true); |
1947 } | 1948 } |
1948 | 1949 |
(...skipping 12 matching lines...) Expand all Loading... |
1961 } | 1962 } |
1962 | 1963 |
1963 DRAW_BATCH_TEST_DEFINE(RRectBatch) { | 1964 DRAW_BATCH_TEST_DEFINE(RRectBatch) { |
1964 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 1965 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
1965 GrColor color = GrRandomColor(random); | 1966 GrColor color = GrRandomColor(random); |
1966 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 1967 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
1967 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 1968 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
1968 } | 1969 } |
1969 | 1970 |
1970 #endif | 1971 #endif |
OLD | NEW |