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=62bc26989c2b4c2a54d516596a71dd97 5cb93a386Sopenharmony_ciREG_FIDDLE(Matrix_mapRectScaleTranslate, 256, 256, false, 0) { 6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 7cb93a386Sopenharmony_ci SkPaint paint; 8cb93a386Sopenharmony_ci SkMatrix matrix; 9cb93a386Sopenharmony_ci SkRect rect = {100, 50, 150, 180}; 10cb93a386Sopenharmony_ci matrix.setScale(2, .5f, rect.centerX(), rect.centerY()); 11cb93a386Sopenharmony_ci SkRect rotated; 12cb93a386Sopenharmony_ci matrix.mapRectScaleTranslate(&rotated, rect); 13cb93a386Sopenharmony_ci paint.setStyle(SkPaint::kStroke_Style); 14cb93a386Sopenharmony_ci canvas->drawRect(rect, paint); 15cb93a386Sopenharmony_ci paint.setColor(SK_ColorRED); 16cb93a386Sopenharmony_ci canvas->drawRect(rotated, paint); 17cb93a386Sopenharmony_ci} 18cb93a386Sopenharmony_ci} // END FIDDLE 19