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=90fed1bb11efb43aada94113338c63d8 5cb93a386Sopenharmony_ciREG_FIDDLE(Canvas_drawRRect, 256, 256, false, 0) { 6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 7cb93a386Sopenharmony_ci SkPaint paint; 8cb93a386Sopenharmony_ci paint.setAntiAlias(true); 9cb93a386Sopenharmony_ci SkRect outer = {30, 40, 210, 220}; 10cb93a386Sopenharmony_ci SkRect radii = {30, 50, 70, 90 }; 11cb93a386Sopenharmony_ci SkRRect rRect; 12cb93a386Sopenharmony_ci rRect.setNinePatch(outer, radii.fLeft, radii.fTop, radii.fRight, radii.fBottom); 13cb93a386Sopenharmony_ci canvas->drawRRect(rRect, paint); 14cb93a386Sopenharmony_ci paint.setColor(SK_ColorWHITE); 15cb93a386Sopenharmony_ci canvas->drawLine(outer.fLeft + radii.fLeft, outer.fTop, 16cb93a386Sopenharmony_ci outer.fLeft + radii.fLeft, outer.fBottom, paint); 17cb93a386Sopenharmony_ci canvas->drawLine(outer.fRight - radii.fRight, outer.fTop, 18cb93a386Sopenharmony_ci outer.fRight - radii.fRight, outer.fBottom, paint); 19cb93a386Sopenharmony_ci canvas->drawLine(outer.fLeft, outer.fTop + radii.fTop, 20cb93a386Sopenharmony_ci outer.fRight, outer.fTop + radii.fTop, paint); 21cb93a386Sopenharmony_ci canvas->drawLine(outer.fLeft, outer.fBottom - radii.fBottom, 22cb93a386Sopenharmony_ci outer.fRight, outer.fBottom - radii.fBottom, paint); 23cb93a386Sopenharmony_ci} 24cb93a386Sopenharmony_ci} // END FIDDLE 25