1cb93a386Sopenharmony_ci// Copyright 2019 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_ci// HASH=22d25e03b19d5bae92118877e462361b 5cb93a386Sopenharmony_ciREG_FIDDLE(Path_conicTo_2, 256, 128, false, 0) { 6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 7cb93a386Sopenharmony_ci SkPaint paint; 8cb93a386Sopenharmony_ci paint.setAntiAlias(true); 9cb93a386Sopenharmony_ci paint.setStyle(SkPaint::kStroke_Style); 10cb93a386Sopenharmony_ci SkRect oval = {0, 20, 120, 140}; 11cb93a386Sopenharmony_ci SkPath path; 12cb93a386Sopenharmony_ci for (int i = 0; i < 4; ++i) { 13cb93a386Sopenharmony_ci path.moveTo(oval.centerX(), oval.fTop); 14cb93a386Sopenharmony_ci path.arcTo(oval, -90, 90 - 20 * i, false); 15cb93a386Sopenharmony_ci oval.inset(15, 15); 16cb93a386Sopenharmony_ci } 17cb93a386Sopenharmony_ci path.offset(100, 0); 18cb93a386Sopenharmony_ci SkScalar conicWeights[] = { 0.707107f, 0.819152f, 0.906308f, 0.965926f }; 19cb93a386Sopenharmony_ci SkPoint conicPts[][3] = { { {40, 20}, {100, 20}, {100, 80} }, 20cb93a386Sopenharmony_ci { {40, 35}, {71.509f, 35}, {82.286f, 64.6091f} }, 21cb93a386Sopenharmony_ci { {40, 50}, {53.9892f, 50}, {62.981f, 60.7164f} }, 22cb93a386Sopenharmony_ci { {40, 65}, {44.0192f, 65}, {47.5f, 67.0096f} } }; 23cb93a386Sopenharmony_ci for (int i = 0; i < 4; ++i) { 24cb93a386Sopenharmony_ci path.moveTo(conicPts[i][0]); 25cb93a386Sopenharmony_ci path.conicTo(conicPts[i][1], conicPts[i][2], conicWeights[i]); 26cb93a386Sopenharmony_ci } 27cb93a386Sopenharmony_ci canvas->drawPath(path, paint); 28cb93a386Sopenharmony_ci} 29cb93a386Sopenharmony_ci} // END FIDDLE 30