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 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 }; | 1911 }; |
1912 return CircleBatch::Create(color, viewMatrix, center, width/2.f, style, &arc
Params); | 1912 return CircleBatch::Create(color, viewMatrix, center, width/2.f, style, &arc
Params); |
1913 } | 1913 } |
1914 | 1914 |
1915 /////////////////////////////////////////////////////////////////////////////// | 1915 /////////////////////////////////////////////////////////////////////////////// |
1916 | 1916 |
1917 #ifdef GR_TEST_UTILS | 1917 #ifdef GR_TEST_UTILS |
1918 | 1918 |
1919 DRAW_BATCH_TEST_DEFINE(CircleBatch) { | 1919 DRAW_BATCH_TEST_DEFINE(CircleBatch) { |
1920 do { | 1920 do { |
1921 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 1921 SkScalar rotate = random->nextSScalar1() * 360.f; |
| 1922 SkScalar translateX = random->nextSScalar1() * 1000.f; |
| 1923 SkScalar translateY = random->nextSScalar1() * 1000.f; |
| 1924 SkScalar scale = random->nextSScalar1() * 100.f; |
| 1925 SkMatrix viewMatrix; |
| 1926 viewMatrix.setRotate(rotate); |
| 1927 viewMatrix.postTranslate(translateX, translateY); |
| 1928 viewMatrix.postScale(scale, scale); |
1922 GrColor color = GrRandomColor(random); | 1929 GrColor color = GrRandomColor(random); |
1923 SkRect circle = GrTest::TestSquare(random); | 1930 SkRect circle = GrTest::TestSquare(random); |
1924 SkPoint center = {circle.centerX(), circle.centerY()}; | 1931 SkPoint center = {circle.centerX(), circle.centerY()}; |
1925 SkScalar radius = circle.width() / 2.f; | 1932 SkScalar radius = circle.width() / 2.f; |
1926 SkStrokeRec stroke = GrTest::TestStrokeRec(random); | 1933 SkStrokeRec stroke = GrTest::TestStrokeRec(random); |
1927 CircleBatch::ArcParams arcParamsTmp; | 1934 CircleBatch::ArcParams arcParamsTmp; |
1928 const CircleBatch::ArcParams* arcParams = nullptr; | 1935 const CircleBatch::ArcParams* arcParams = nullptr; |
1929 if (random->nextBool()) { | 1936 if (random->nextBool()) { |
1930 arcParamsTmp.fStartAngleRadians = random->nextSScalar1() * SK_Scalar
PI * 2; | 1937 arcParamsTmp.fStartAngleRadians = random->nextSScalar1() * SK_Scalar
PI * 2; |
1931 arcParamsTmp.fStartAngleRadians = random->nextSScalar1() * SK_Scalar
PI * 2 - .01f; | 1938 arcParamsTmp.fStartAngleRadians = random->nextSScalar1() * SK_Scalar
PI * 2 - .01f; |
(...skipping 22 matching lines...) Expand all Loading... |
1954 } | 1961 } |
1955 | 1962 |
1956 DRAW_BATCH_TEST_DEFINE(RRectBatch) { | 1963 DRAW_BATCH_TEST_DEFINE(RRectBatch) { |
1957 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 1964 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
1958 GrColor color = GrRandomColor(random); | 1965 GrColor color = GrRandomColor(random); |
1959 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 1966 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
1960 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 1967 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
1961 } | 1968 } |
1962 | 1969 |
1963 #endif | 1970 #endif |
OLD | NEW |