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

Side by Side Diff: gm/arcto.cpp

Issue 1682203002: make test consistent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BD-style license that can be 4 * Use of this source code is governed by a BD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkParsePath.h" 9 #include "SkParsePath.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 path.arcTo(80, 80, 0, SkPath::kLarge_ArcSize, SkPath::kCW_Direction, 200, 10 0); 102 path.arcTo(80, 80, 0, SkPath::kLarge_ArcSize, SkPath::kCW_Direction, 200, 10 0);
103 canvas->drawPath(path, paint); 103 canvas->drawPath(path, paint);
104 } 104 }
105 105
106 #include "random_parse_path.h" 106 #include "random_parse_path.h"
107 #include "SkRandom.h" 107 #include "SkRandom.h"
108 108
109 /* The test below generates a reference image using SVG. To compare the result f or correctness, 109 /* The test below generates a reference image using SVG. To compare the result f or correctness,
110 enable the define below and then view the generated SVG in a browser. 110 enable the define below and then view the generated SVG in a browser.
111 */ 111 */
112 #define GENERATE_SVG_REFERENCE 0 112 #define GENERATE_SVG_REFERENCE 01
113 113
114 #if GENERATE_SVG_REFERENCE 114 #if GENERATE_SVG_REFERENCE
115 #include "SkOSFile.h" 115 #include "SkOSFile.h"
116 #endif 116 #endif
117 117
118 enum { 118 enum {
119 kParsePathTestDimension = 500 119 kParsePathTestDimension = 500
120 }; 120 };
121 121
122 DEF_SIMPLE_GM(parsedpaths, canvas, kParsePathTestDimension, kParsePathTestDimens ion) { 122 DEF_SIMPLE_GM(parsedpaths, canvas, kParsePathTestDimension, kParsePathTestDimens ion) {
(...skipping 18 matching lines...) Expand all
141 sk_fwrite(str.c_str(), str.size(), file); 141 sk_fwrite(str.c_str(), str.size(), file);
142 str.printf("<rect width='100' height='100' x='0' y='0'></rect>\n"); 142 str.printf("<rect width='100' height='100' x='0' y='0'></rect>\n");
143 sk_fwrite(str.c_str(), str.size(), file); 143 sk_fwrite(str.c_str(), str.size(), file);
144 str.printf("</clipPath>\n"); 144 str.printf("</clipPath>\n");
145 sk_fwrite(str.c_str(), str.size(), file); 145 sk_fwrite(str.c_str(), str.size(), file);
146 #endif 146 #endif
147 int count = 3; 147 int count = 3;
148 do { 148 do {
149 SkPath path; 149 SkPath path;
150 SkString spec; 150 SkString spec;
151 spec.printf("M %d,%d\n", rand.nextRangeU(30, 70), rand.nextRange U(30, 70)); 151 uint32_t y = rand.nextRangeU(30, 70);
152 uint32_t x = rand.nextRangeU(30, 70);
153 spec.printf("M %d,%d\n", x, y);
152 uint32_t count = rand.nextRangeU(0, 10); 154 uint32_t count = rand.nextRangeU(0, 10);
153 for (uint32_t i = 0; i < count; ++i) { 155 for (uint32_t i = 0; i < count; ++i) {
154 spec.append(MakeRandomParsePathPiece(&rand)); 156 spec.append(MakeRandomParsePathPiece(&rand));
155 } 157 }
156 SkAssertResult(SkParsePath::FromSVGString(spec.c_str(), &path)); 158 SkAssertResult(SkParsePath::FromSVGString(spec.c_str(), &path));
157 paint.setColor(rand.nextU()); 159 paint.setColor(rand.nextU());
158 canvas->save(); 160 canvas->save();
159 canvas->clipRect(SkRect::MakeIWH(100, 100)); 161 canvas->clipRect(SkRect::MakeIWH(100, 100));
160 canvas->drawPath(path, paint); 162 canvas->drawPath(path, paint);
161 canvas->restore(); 163 canvas->restore();
(...skipping 16 matching lines...) Expand all
178 } 180 }
179 canvas->restore(); 181 canvas->restore();
180 canvas->translate(100, 0); 182 canvas->translate(100, 0);
181 } 183 }
182 #if GENERATE_SVG_REFERENCE 184 #if GENERATE_SVG_REFERENCE
183 const char trailer[] = "</svg>\n"; 185 const char trailer[] = "</svg>\n";
184 sk_fwrite(trailer, sizeof(trailer) - 1, file); 186 sk_fwrite(trailer, sizeof(trailer) - 1, file);
185 sk_fclose(file); 187 sk_fclose(file);
186 #endif 188 #endif
187 } 189 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698