1cb93a386Sopenharmony_ci// Copyright 2020 Google LLC. 2cb93a386Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 3cb93a386Sopenharmony_ci#include "tools/fiddle/examples.h" 4cb93a386Sopenharmony_ciREG_FIDDLE(drawarcs, 256, 256, false, 0) { 5cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 6cb93a386Sopenharmony_ci SkPaint paint; 7cb93a386Sopenharmony_ci paint.setAntiAlias(true); 8cb93a386Sopenharmony_ci paint.setStyle(SkPaint::kStroke_Style); 9cb93a386Sopenharmony_ci paint.setStrokeWidth(8); 10cb93a386Sopenharmony_ci 11cb93a386Sopenharmony_ci SkPath path; 12cb93a386Sopenharmony_ci SkRandom rand; 13cb93a386Sopenharmony_ci 14cb93a386Sopenharmony_ci for (int i = 0; i < 100; ++i) { 15cb93a386Sopenharmony_ci SkScalar x = rand.nextUScalar1() * 200; 16cb93a386Sopenharmony_ci SkScalar y = rand.nextUScalar1() * 200; 17cb93a386Sopenharmony_ci 18cb93a386Sopenharmony_ci path.rewind(); 19cb93a386Sopenharmony_ci path.addArc(SkRect::MakeXYWH(x, y, 70, 70), rand.nextUScalar1() * 360, 20cb93a386Sopenharmony_ci rand.nextUScalar1() * 360); 21cb93a386Sopenharmony_ci paint.setColor(rand.nextU() | 0xFF000000); 22cb93a386Sopenharmony_ci canvas->drawPath(path, paint); 23cb93a386Sopenharmony_ci } 24cb93a386Sopenharmony_ci} 25cb93a386Sopenharmony_ci} // END FIDDLE 26