8800042f69
I also added the `get_examples.py` script which pulls down new fiddles. Change-Id: I953e461685a4d118ac4e425453e47d665a485aa2 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264570 Commit-Queue: Hal Canary <halcanary@skia.org> Reviewed-by: Joe Gregorio <jcgregorio@google.com>
20 lines
733 B
C++
20 lines
733 B
C++
// Copyright 2020 Google LLC.
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
#include "tools/fiddle/examples.h"
|
|
REG_FIDDLE_ANIMATED(software_bitmap_w_perspective, 256, 256, false, 6, 5) {
|
|
void draw(SkCanvas* canvas) {
|
|
const float width = image->width();
|
|
const float height = image->height();
|
|
|
|
const SkPoint src[] = {{ 0, 0}, {width, 0}, {width * (float)frame, height * (float)frame}, { 0, height}};
|
|
const SkPoint dst[] = { {0, 0}, {width, 0}, {width, height}, {0, height} };
|
|
|
|
SkMatrix matrix;
|
|
matrix.setPolyToPoly(src, dst, 4);
|
|
|
|
SkAutoCanvasRestore acr(canvas, true);
|
|
canvas->concat(matrix);
|
|
canvas->drawImage(image, 0, 0);
|
|
}
|
|
} // END FIDDLE
|