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=9e50185d502dc6903783679a84106089 5cb93a386Sopenharmony_ciREG_FIDDLE(Matrix_mapXY, 256, 256, 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 SkPoint lines[] = {{50, 50}, {150, 50}, {150, 150}}; 12cb93a386Sopenharmony_ci for (size_t i = 0; i < SK_ARRAY_COUNT(lines); ++i) { 13cb93a386Sopenharmony_ci SkPoint pt; 14cb93a386Sopenharmony_ci matrix.mapXY(lines[i].fX, lines[i].fY, &pt); 15cb93a386Sopenharmony_ci canvas->drawCircle(pt.fX, pt.fY, 3, paint); 16cb93a386Sopenharmony_ci } 17cb93a386Sopenharmony_ci canvas->concat(matrix); 18cb93a386Sopenharmony_ci canvas->drawPoints(SkCanvas::kPolygon_PointMode, SK_ARRAY_COUNT(lines), lines, paint); 19cb93a386Sopenharmony_ci} 20cb93a386Sopenharmony_ci} // END FIDDLE 21