Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: src/gpu/GrOvalRenderer.cpp

Issue 1129083005: AADistanceFieldPathRenderer unit tests (Closed) Base URL: https://skia.googlesource.com/skia.git@randbatch7
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 } 2084 }
2085 2085
2086 target->drawBatch(pipelineBuilder, batch); 2086 target->drawBatch(pipelineBuilder, batch);
2087 return true; 2087 return true;
2088 } 2088 }
2089 2089
2090 //////////////////////////////////////////////////////////////////////////////// /////////////////// 2090 //////////////////////////////////////////////////////////////////////////////// ///////////////////
2091 2091
2092 #ifdef GR_TEST_UTILS 2092 #ifdef GR_TEST_UTILS
2093 2093
2094 static SkStrokeRec random_strokerec(SkRandom* random) {
2095 SkStrokeRec::InitStyle style =
2096 SkStrokeRec::InitStyle(random->nextULessThan(SkStrokeRec::kFill_Init Style + 1));
2097 SkStrokeRec rec(style);
2098 bool strokeAndFill = random->nextBool();
2099 SkScalar strokeWidth = random->nextBool() ? 0.f : 1.f;
2100 rec.setStrokeStyle(strokeWidth, strokeAndFill);
2101 return rec;
2102 }
2103
2104 BATCH_TEST_DEFINE(CircleBatch) { 2094 BATCH_TEST_DEFINE(CircleBatch) {
2105 SkMatrix viewMatrix = GrTest::TestMatrix(random); 2095 SkMatrix viewMatrix = GrTest::TestMatrix(random);
2106 GrColor color = GrRandomColor(random); 2096 GrColor color = GrRandomColor(random);
2107 bool useCoverageAA = random->nextBool(); 2097 bool useCoverageAA = random->nextBool();
2108 SkRect circle = GrTest::TestRect(random); 2098 SkRect circle = GrTest::TestRect(random);
2109 return create_circle_batch(color, viewMatrix, useCoverageAA, circle, random_ strokerec(random)); 2099 return create_circle_batch(color, viewMatrix, useCoverageAA, circle,
2100 GrTest::TestStrokeRec(random));
2110 } 2101 }
2111 2102
2112 BATCH_TEST_DEFINE(EllipseBatch) { 2103 BATCH_TEST_DEFINE(EllipseBatch) {
2113 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); 2104 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random);
2114 GrColor color = GrRandomColor(random); 2105 GrColor color = GrRandomColor(random);
2115 bool useCoverageAA = random->nextBool(); 2106 bool useCoverageAA = random->nextBool();
2116 SkRect ellipse = GrTest::TestRect(random); 2107 SkRect ellipse = GrTest::TestRect(random);
2117 return create_ellipse_batch(color, viewMatrix, useCoverageAA, ellipse, 2108 return create_ellipse_batch(color, viewMatrix, useCoverageAA, ellipse,
2118 random_strokerec(random)); 2109 GrTest::TestStrokeRec(random));
2119 } 2110 }
2120 2111
2121 BATCH_TEST_DEFINE(DIEllipseBatch) { 2112 BATCH_TEST_DEFINE(DIEllipseBatch) {
2122 SkMatrix viewMatrix = GrTest::TestMatrix(random); 2113 SkMatrix viewMatrix = GrTest::TestMatrix(random);
2123 GrColor color = GrRandomColor(random); 2114 GrColor color = GrRandomColor(random);
2124 bool useCoverageAA = random->nextBool(); 2115 bool useCoverageAA = random->nextBool();
2125 SkRect ellipse = GrTest::TestRect(random); 2116 SkRect ellipse = GrTest::TestRect(random);
2126 return create_diellipse_batch(color, viewMatrix, useCoverageAA, ellipse, 2117 return create_diellipse_batch(color, viewMatrix, useCoverageAA, ellipse,
2127 random_strokerec(random)); 2118 GrTest::TestStrokeRec(random));
2128 } 2119 }
2129 2120
2130 BATCH_TEST_DEFINE(RRectBatch) { 2121 BATCH_TEST_DEFINE(RRectBatch) {
2131 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); 2122 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random);
2132 GrColor color = GrRandomColor(random); 2123 GrColor color = GrRandomColor(random);
2133 const SkRRect& rrect = GrTest::TestRRectSimple(random); 2124 const SkRRect& rrect = GrTest::TestRRectSimple(random);
2134 return create_rrect_batch(color, viewMatrix, rrect, random_strokerec(random) ); 2125 return create_rrect_batch(color, viewMatrix, rrect,
2126 GrTest::TestStrokeRec(random));
2135 } 2127 }
2136 2128
2137 #endif 2129 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698