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=9202430b3f4f5275af8eec5cc9d7baa8 5cb93a386Sopenharmony_ciREG_FIDDLE(Path_addRect_2, 256, 128, false, 0) { 6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 7cb93a386Sopenharmony_ci const SkPoint arrow[] = { {5, -5}, {15, -5}, {20, 0}, {15, 5}, {5, 5}, {10, 0} }; 8cb93a386Sopenharmony_ci const SkRect rect = {10, 10, 54, 54}; 9cb93a386Sopenharmony_ci SkPaint rectPaint; 10cb93a386Sopenharmony_ci rectPaint.setAntiAlias(true); 11cb93a386Sopenharmony_ci rectPaint.setStyle(SkPaint::kStroke_Style); 12cb93a386Sopenharmony_ci SkPaint arrowPaint(rectPaint); 13cb93a386Sopenharmony_ci SkPath arrowPath; 14cb93a386Sopenharmony_ci arrowPath.addPoly(arrow, SK_ARRAY_COUNT(arrow), true); 15cb93a386Sopenharmony_ci arrowPaint.setPathEffect(SkPath1DPathEffect::Make(arrowPath, 176, 0, 16cb93a386Sopenharmony_ci SkPath1DPathEffect::kRotate_Style)); 17cb93a386Sopenharmony_ci for (auto direction : { SkPathDirection::kCW, SkPathDirection::kCCW } ) { 18cb93a386Sopenharmony_ci for (unsigned start : { 0, 1, 2, 3 } ) { 19cb93a386Sopenharmony_ci SkPath path; 20cb93a386Sopenharmony_ci path.addRect(rect, direction, start); 21cb93a386Sopenharmony_ci canvas->drawPath(path, rectPaint); 22cb93a386Sopenharmony_ci canvas->drawPath(path, arrowPaint); 23cb93a386Sopenharmony_ci canvas->translate(64, 0); 24cb93a386Sopenharmony_ci } 25cb93a386Sopenharmony_ci canvas->translate(-256, 64); 26cb93a386Sopenharmony_ci } 27cb93a386Sopenharmony_ci} 28cb93a386Sopenharmony_ci} // END FIDDLE 29