Flutter Engine
The Flutter Engine
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.
4REG_FIDDLE(Matrix_TypeMask, 256, 256, true, 0) {
5void draw(SkCanvas* canvas) {
6 auto debugster = [](const char* prefix, const SkMatrix& matrix) -> void {
7 SkString typeMask;
8 typeMask += SkMatrix::kIdentity_Mask == matrix.getType() ? "kIdentity_Mask " : "";
9 typeMask += SkMatrix::kTranslate_Mask & matrix.getType() ? "kTranslate_Mask " : "";
10 typeMask += SkMatrix::kScale_Mask & matrix.getType() ? "kScale_Mask " : "";
11 typeMask += SkMatrix::kAffine_Mask & matrix.getType() ? "kAffine_Mask " : "";
12 typeMask += SkMatrix::kPerspective_Mask & matrix.getType() ? "kPerspective_Mask" : "";
13 SkDebugf("after %s: %s\n", prefix, typeMask.c_str());
14 };
16matrix.reset();
17debugster("reset", matrix);
18matrix.postTranslate(1, 0);
19debugster("postTranslate", matrix);
20matrix.postScale(2, 1);
21debugster("postScale", matrix);
22matrix.postRotate(45);
23debugster("postScale", matrix);
24SkPoint polys[][4] = {{{0, 0}, {0, 1}, {1, 1}, {1, 0}}, {{0, 0}, {0, 1}, {2, 1}, {1, 0}}};
25matrix.setPolyToPoly(polys[0], polys[1], 4);
26debugster("setPolyToPoly", matrix);
27}
28} // END FIDDLE
REG_FIDDLE(Matrix_TypeMask, 256, 256, true, 0)
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
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258