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 "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2083 } | 2083 } |
2084 | 2084 |
2085 target->drawBatch(pipelineBuilder, batch); | 2085 target->drawBatch(pipelineBuilder, batch); |
2086 return true; | 2086 return true; |
2087 } | 2087 } |
2088 | 2088 |
2089 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 2089 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
2090 | 2090 |
2091 #ifdef GR_TEST_UTILS | 2091 #ifdef GR_TEST_UTILS |
2092 | 2092 |
2093 static SkStrokeRec random_strokerec(SkRandom* random) { | |
2094 SkStrokeRec::InitStyle style = | |
2095 SkStrokeRec::InitStyle(random->nextULessThan(SkStrokeRec::kFill_Init
Style + 1)); | |
2096 SkStrokeRec rec(style); | |
2097 bool strokeAndFill = random->nextBool(); | |
2098 SkScalar strokeWidth = random->nextBool() ? 0.f : 1.f; | |
2099 rec.setStrokeStyle(strokeWidth, strokeAndFill); | |
2100 return rec; | |
2101 } | |
2102 | |
2103 BATCH_TEST_DEFINE(CircleBatch) { | 2093 BATCH_TEST_DEFINE(CircleBatch) { |
2104 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 2094 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
2105 GrColor color = GrRandomColor(random); | 2095 GrColor color = GrRandomColor(random); |
2106 bool useCoverageAA = random->nextBool(); | 2096 bool useCoverageAA = random->nextBool(); |
2107 SkRect circle = GrTest::TestRect(random); | 2097 SkRect circle = GrTest::TestRect(random); |
2108 return create_circle_batch(color, viewMatrix, useCoverageAA, circle, random_
strokerec(random)); | 2098 return create_circle_batch(color, viewMatrix, useCoverageAA, circle, |
| 2099 GrTest::TestStrokeRec(random)); |
2109 } | 2100 } |
2110 | 2101 |
2111 BATCH_TEST_DEFINE(EllipseBatch) { | 2102 BATCH_TEST_DEFINE(EllipseBatch) { |
2112 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2103 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
2113 GrColor color = GrRandomColor(random); | 2104 GrColor color = GrRandomColor(random); |
2114 bool useCoverageAA = random->nextBool(); | 2105 bool useCoverageAA = random->nextBool(); |
2115 SkRect ellipse = GrTest::TestRect(random); | 2106 SkRect ellipse = GrTest::TestRect(random); |
2116 return create_ellipse_batch(color, viewMatrix, useCoverageAA, ellipse, | 2107 return create_ellipse_batch(color, viewMatrix, useCoverageAA, ellipse, |
2117 random_strokerec(random)); | 2108 GrTest::TestStrokeRec(random)); |
2118 } | 2109 } |
2119 | 2110 |
2120 BATCH_TEST_DEFINE(DIEllipseBatch) { | 2111 BATCH_TEST_DEFINE(DIEllipseBatch) { |
2121 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 2112 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
2122 GrColor color = GrRandomColor(random); | 2113 GrColor color = GrRandomColor(random); |
2123 bool useCoverageAA = random->nextBool(); | 2114 bool useCoverageAA = random->nextBool(); |
2124 SkRect ellipse = GrTest::TestRect(random); | 2115 SkRect ellipse = GrTest::TestRect(random); |
2125 return create_diellipse_batch(color, viewMatrix, useCoverageAA, ellipse, | 2116 return create_diellipse_batch(color, viewMatrix, useCoverageAA, ellipse, |
2126 random_strokerec(random)); | 2117 GrTest::TestStrokeRec(random)); |
2127 } | 2118 } |
2128 | 2119 |
2129 BATCH_TEST_DEFINE(RRectBatch) { | 2120 BATCH_TEST_DEFINE(RRectBatch) { |
2130 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2121 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
2131 GrColor color = GrRandomColor(random); | 2122 GrColor color = GrRandomColor(random); |
2132 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 2123 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
2133 return create_rrect_batch(color, viewMatrix, rrect, random_strokerec(random)
); | 2124 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
2134 } | 2125 } |
2135 | 2126 |
2136 #endif | 2127 #endif |
OLD | NEW |