Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Matrix_TypeMask.cpp
Go to the documentation of this file.
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.
4// HASH=ba19b36df8cd78586f3dff54e2d4c093
5REG_FIDDLE(Matrix_TypeMask, 256, 256, true, 0) {
6void draw(SkCanvas* canvas) {
7 auto debugster = [](const char* prefix, const SkMatrix& matrix) -> void {
8 SkString typeMask;
9 typeMask += SkMatrix::kIdentity_Mask == matrix.getType() ? "kIdentity_Mask " : "";
10 typeMask += SkMatrix::kTranslate_Mask & matrix.getType() ? "kTranslate_Mask " : "";
11 typeMask += SkMatrix::kScale_Mask & matrix.getType() ? "kScale_Mask " : "";
12 typeMask += SkMatrix::kAffine_Mask & matrix.getType() ? "kAffine_Mask " : "";
13 typeMask += SkMatrix::kPerspective_Mask & matrix.getType() ? "kPerspective_Mask" : "";
14 SkDebugf("after %s: %s\n", prefix, typeMask.c_str());
15 };
16SkMatrix matrix;
17matrix.reset();
18debugster("reset", matrix);
19matrix.postTranslate(1, 0);
20debugster("postTranslate", matrix);
21matrix.postScale(2, 1);
22debugster("postScale", matrix);
23matrix.postRotate(45);
24debugster("postScale", matrix);
25SkPoint polys[][4] = {{{0, 0}, {0, 1}, {1, 1}, {1, 0}}, {{0, 0}, {0, 1}, {2, 1}, {1, 0}}};
26matrix.setPolyToPoly(polys[0], polys[1], 4);
27debugster("setPolyToPoly", matrix);
28}
29} // END FIDDLE
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
@ kPerspective_Mask
perspective SkMatrix
Definition SkMatrix.h:196
@ kTranslate_Mask
translation SkMatrix
Definition SkMatrix.h:193
@ kScale_Mask
scale SkMatrix
Definition SkMatrix.h:194
@ kIdentity_Mask
identity SkMatrix; all bits clear
Definition SkMatrix.h:192
@ kAffine_Mask
skew or rotate SkMatrix
Definition SkMatrix.h:195
const char * c_str() const
Definition SkString.h:133
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60