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

Side by Side Diff: gm/cubicpaths.cpp

Issue 805963002: There can be only one (SkRandom)! (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 6 years 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 | « gm/convexpaths.cpp ('k') | gm/degeneratesegments.cpp » ('j') | 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 2011 Google Inc. 2 * Copyright 2011 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 #include "gm.h" 7 #include "gm.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkPaint.h" 9 #include "SkPaint.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 sk_tool_utils::set_portable_typeface(&titlePaint); 133 sk_tool_utils::set_portable_typeface(&titlePaint);
134 titlePaint.setLCDRenderText(true); 134 titlePaint.setLCDRenderText(true);
135 titlePaint.setTextSize(15 * SK_Scalar1); 135 titlePaint.setTextSize(15 * SK_Scalar1);
136 const char title[] = "Cubic Drawn Into Rectangle Clips With " 136 const char title[] = "Cubic Drawn Into Rectangle Clips With "
137 "Indicated Style, Fill and Linecaps, with stroke wi dth 10"; 137 "Indicated Style, Fill and Linecaps, with stroke wi dth 10";
138 canvas->drawText(title, strlen(title), 138 canvas->drawText(title, strlen(title),
139 20 * SK_Scalar1, 139 20 * SK_Scalar1,
140 20 * SK_Scalar1, 140 20 * SK_Scalar1,
141 titlePaint); 141 titlePaint);
142 142
143 SkLCGRandom rand; 143 SkRandom rand;
144 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); 144 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1);
145 canvas->save(); 145 canvas->save();
146 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); 146 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1);
147 canvas->save(); 147 canvas->save();
148 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { 148 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) {
149 if (0 < cap) { 149 if (0 < cap) {
150 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO UNT(gStyles), 0); 150 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO UNT(gStyles), 0);
151 } 151 }
152 canvas->save(); 152 canvas->save();
153 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { 153 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 sk_tool_utils::set_portable_typeface(&titlePaint); 283 sk_tool_utils::set_portable_typeface(&titlePaint);
284 titlePaint.setLCDRenderText(true); 284 titlePaint.setLCDRenderText(true);
285 titlePaint.setTextSize(15 * SK_Scalar1); 285 titlePaint.setTextSize(15 * SK_Scalar1);
286 const char title[] = "Cubic Closed Drawn Into Rectangle Clips With " 286 const char title[] = "Cubic Closed Drawn Into Rectangle Clips With "
287 "Indicated Style, Fill and Linecaps, with stroke wi dth 10"; 287 "Indicated Style, Fill and Linecaps, with stroke wi dth 10";
288 canvas->drawText(title, strlen(title), 288 canvas->drawText(title, strlen(title),
289 20 * SK_Scalar1, 289 20 * SK_Scalar1,
290 20 * SK_Scalar1, 290 20 * SK_Scalar1,
291 titlePaint); 291 titlePaint);
292 292
293 SkLCGRandom rand; 293 SkRandom rand;
294 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); 294 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1);
295 canvas->save(); 295 canvas->save();
296 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); 296 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1);
297 canvas->save(); 297 canvas->save();
298 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { 298 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) {
299 if (0 < cap) { 299 if (0 < cap) {
300 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO UNT(gStyles), 0); 300 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO UNT(gStyles), 0);
301 } 301 }
302 canvas->save(); 302 canvas->save();
303 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { 303 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 351
352 private: 352 private:
353 typedef skiagm::GM INHERITED; 353 typedef skiagm::GM INHERITED;
354 }; 354 };
355 355
356 ////////////////////////////////////////////////////////////////////////////// 356 //////////////////////////////////////////////////////////////////////////////
357 357
358 DEF_GM( return new CubicPathGM; ) 358 DEF_GM( return new CubicPathGM; )
359 DEF_GM( return new CubicClosePathGM; ) 359 DEF_GM( return new CubicClosePathGM; )
360 DEF_GM( return new ClippedCubicGM; ) 360 DEF_GM( return new ClippedCubicGM; )
OLDNEW
« no previous file with comments | « gm/convexpaths.cpp ('k') | gm/degeneratesegments.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698