Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Matrix_decomposeScale.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=139b874da0a3ede1f3df88119085c0aa
5REG_FIDDLE(Matrix_decomposeScale, 256, 256, true, 0) {
6void draw(SkCanvas* canvas) {
7 SkMatrix matrix;
8 matrix.setRotate(90 * SK_Scalar1);
9 matrix.postScale(1.f / 4, 1.f / 2);
10 matrix.dump();
12 SkMatrix remaining;
13 remaining.reset();
14 bool success = matrix.decomposeScale(&scale, &remaining);
15 SkDebugf("success: %s ", success ? "true" : "false");
16 SkDebugf("scale: %g, %g\n", scale.width(), scale.height());
17 remaining.dump();
18 SkMatrix scaleMatrix = SkMatrix::Scale(scale.width(), scale.height());
19 SkMatrix combined = SkMatrix::Concat(scaleMatrix, remaining);
20 combined.dump();
21}
22} // END FIDDLE
static void scaleMatrix(const SkPath &one, const SkPath &two, SkMatrix &scale)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define SK_Scalar1
Definition SkScalar.h:18
#define SK_ScalarNaN
Definition SkScalar.h:28
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
static SkMatrix Scale(SkScalar sx, SkScalar sy)
Definition SkMatrix.h:75
void dump() const
static SkMatrix Concat(const SkMatrix &a, const SkMatrix &b)
Definition SkMatrix.h:1775
SkMatrix & reset()
Definition SkMatrix.cpp:49
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
const Scalar scale