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

Side by Side Diff: gm/beziers.cpp

Issue 645773002: Turn SkCanvasStateUtils into a class with static functions. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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 | include/core/SkCanvas.h » ('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 2014 Google Inc. 2 * Copyright 2014 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 "gm.h" 8 #include "gm.h"
9 #include "SkRandom.h" 9 #include "SkRandom.h"
10 10
11 #define W 400 11 #define W 400
12 #define H 400 12 #define H 400
13 #define N 10 13 #define N 10
14 14
15 static const SkScalar SW = SkIntToScalar(W);
16 static const SkScalar SH = SkIntToScalar(H); 15 static const SkScalar SH = SkIntToScalar(H);
17 16
18 static void rnd_quad(SkPath* p, SkPaint* paint, SkLCGRandom& rand) { 17 static void rnd_quad(SkPath* p, SkPaint* paint, SkLCGRandom& rand) {
19 p->moveTo(rand.nextRangeScalar(0, W), rand.nextRangeScalar(0, H)); 18 p->moveTo(rand.nextRangeScalar(0, W), rand.nextRangeScalar(0, H));
20 for (int x = 0; x < 2; ++x) { 19 for (int x = 0; x < 2; ++x) {
21 p->quadTo(rand.nextRangeScalar(W / 4, W), rand.nextRangeScalar(0, H), 20 p->quadTo(rand.nextRangeScalar(W / 4, W), rand.nextRangeScalar(0, H),
22 rand.nextRangeScalar(0, W), rand.nextRangeScalar(H / 4, H)); 21 rand.nextRangeScalar(0, W), rand.nextRangeScalar(H / 4, H));
23 } 22 }
24 paint->setColor(rand.nextU()); 23 paint->setColor(rand.nextU());
25 SkScalar width = rand.nextRangeScalar(1, 5); 24 SkScalar width = rand.nextRangeScalar(1, 5);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 canvas->drawPath(p, paint); 77 canvas->drawPath(p, paint);
79 } 78 }
80 } 79 }
81 80
82 private: 81 private:
83 typedef skiagm::GM INHERITED; 82 typedef skiagm::GM INHERITED;
84 }; 83 };
85 84
86 static skiagm::GM* F0(void*) { return new BeziersGM; } 85 static skiagm::GM* F0(void*) { return new BeziersGM; }
87 static skiagm::GMRegistry R0(F0); 86 static skiagm::GMRegistry R0(F0);
OLDNEW
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698