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=c69cd2a590b5733c3cbc92cb9ceed3f5 5cb93a386Sopenharmony_ciREG_FIDDLE(Matrix_mapRectToQuad, 256, 192, false, 0) { 6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 7cb93a386Sopenharmony_ci SkPaint paint; 8cb93a386Sopenharmony_ci paint.setAntiAlias(true); 9cb93a386Sopenharmony_ci SkMatrix matrix; 10cb93a386Sopenharmony_ci matrix.setRotate(60, 128, 128); 11cb93a386Sopenharmony_ci SkRect rect = {50, 50, 150, 150}; 12cb93a386Sopenharmony_ci SkPoint pts[4]; 13cb93a386Sopenharmony_ci matrix.mapRectToQuad(pts, rect); 14cb93a386Sopenharmony_ci for (int i = 0; i < 4; ++i) { 15cb93a386Sopenharmony_ci canvas->drawCircle(pts[i].fX, pts[i].fY, 3, paint); 16cb93a386Sopenharmony_ci } 17cb93a386Sopenharmony_ci canvas->concat(matrix); 18cb93a386Sopenharmony_ci paint.setStyle(SkPaint::kStroke_Style); 19cb93a386Sopenharmony_ci canvas->drawRect(rect, paint); 20cb93a386Sopenharmony_ci} 21cb93a386Sopenharmony_ci} // END FIDDLE 22