2019-03-15 18:22:51 +00:00
|
|
|
// Copyright 2019 Google LLC.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "tools/fiddle/examples.h"
|
2019-03-15 18:22:51 +00:00
|
|
|
// HASH=139b874da0a3ede1f3df88119085c0aa
|
2019-03-18 20:06:34 +00:00
|
|
|
REG_FIDDLE(Matrix_decomposeScale, 256, 256, true, 0) {
|
2019-03-15 18:22:51 +00:00
|
|
|
void draw(SkCanvas* canvas) {
|
|
|
|
SkMatrix matrix;
|
|
|
|
matrix.setRotate(90 * SK_Scalar1);
|
|
|
|
matrix.postScale(1.f / 4, 1.f / 2);
|
|
|
|
matrix.dump();
|
|
|
|
SkSize scale = {SK_ScalarNaN, SK_ScalarNaN};
|
|
|
|
SkMatrix remaining;
|
|
|
|
remaining.reset();
|
|
|
|
bool success = matrix.decomposeScale(&scale, &remaining);
|
|
|
|
SkDebugf("success: %s ", success ? "true" : "false");
|
|
|
|
SkDebugf("scale: %g, %g\n", scale.width(), scale.height());
|
|
|
|
remaining.dump();
|
2020-05-21 16:11:27 +00:00
|
|
|
SkMatrix scaleMatrix = SkMatrix::Scale(scale.width(), scale.height());
|
2019-03-15 18:22:51 +00:00
|
|
|
SkMatrix combined = SkMatrix::Concat(scaleMatrix, remaining);
|
|
|
|
combined.dump();
|
|
|
|
}
|
|
|
|
} // END FIDDLE
|