| 1 |
// Copyright 2019 Google LLC. |
| 2 |
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. |
| 3 |
#include "tools/fiddle/examples.h" |
| 4 |
REG_FIDDLE(Matrix_mapRect_3, 256, 256, false, 0) { |
| 5 |
void draw(SkCanvas* canvas) { |
| 6 |
SkRect rect{110, 50, 180, 100}; |
| 7 |
SkMatrix matrix; |
| 8 |
matrix.setRotate(50, 28, 28); |
| 9 |
SkRect mapped = matrix.mapRect(rect); |
| 10 |
SkPaint paint; |
| 11 |
paint.setAntiAlias(true); |
| 12 |
paint.setStyle(SkPaint::kStroke_Style); |
| 13 |
canvas->drawRect(rect, paint); |
| 14 |
canvas->drawRect(mapped, paint); |
| 15 |
canvas->concat(matrix); |
| 16 |
canvas->drawRect(rect, paint); |
| 17 |
} |
| 18 |
} // END FIDDLE |