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

Side by Side Diff: gm/bubbles.cpp

Issue 2087263002: Remove bubbles GM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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
(Empty)
1 /*
2 * Copyright 2016 Google, Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "gm.h"
9
10 /*
11 * Draw 50 semi-transparent circles with pseudo-random positions, radii, and
12 * colors, using the default blend mode (SRC OVER). Use of SkRandom with
13 * default seed means results SHOULD be identical across multiple platforms.
14 */
15 DEF_SIMPLE_GM(bubbles, canvas, 512, 512) {
16 canvas->clear(SK_ColorWHITE);
17
18 SkPaint p;
19 p.setAntiAlias(true);
20
21 SkRandom rand;
22
23 auto pos_min = SkIntToScalar(0);
24 auto pos_max = SkIntToScalar(511);
25 auto radius_min = SkIntToScalar(0);
26 auto radius_max = SkIntToScalar(128);
27 auto color_min = SkIntToScalar(0);
28 auto color_max = SkIntToScalar(255);
29
30 const int NUM_BUBBLES = 50;
31 for (int i = 0; i < NUM_BUBBLES; i++) {
32 auto cx = rand.nextRangeScalar(pos_min, pos_max);
33 auto cy = rand.nextRangeScalar(pos_min, pos_max);
34 auto radius = rand.nextRangeScalar(radius_min, radius_max);
35
36 auto a = (U8CPU)128;
37 auto r = (U8CPU)rand.nextRangeScalar(color_min, color_max);
38 auto g = (U8CPU)rand.nextRangeScalar(color_min, color_max);
39 auto b = (U8CPU)rand.nextRangeScalar(color_min, color_max);
40 p.setColor(SkColorSetARGB(a, r, g, b));
41
42 canvas->drawCircle(cx, cy, radius, p);
43 }
44 }
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