1 #if 0 // Disabled until updated to use current API. 2 // Copyright 2019 Google LLC. 3 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 4 #include "tools/fiddle/examples.h" 5 // HASH=8b37f4ae7fec1756433c0f984175fb14 6 REG_FIDDLE(Matrix_isSimilarity, 256, 256, false, 0) { 7 void draw(SkCanvas* canvas) { 8 SkPaint p; 9 p.setAntiAlias(true); 10 SkMatrix m; 11 int below = 175; 12 for (SkScalar sx : { -1, 1 } ) { 13 for (SkScalar sy : { -1, 1 } ) { 14 m.setAll(sx, 1, 128, 1, sy, 32, 0, 0, 1); 15 bool isSimilarity = m.isSimilarity(); 16 SkString str; 17 str.printf("sx: %g sy: %g sim: %s", sx, sy, isSimilarity ? "true" : "false"); 18 { 19 SkAutoCanvasRestore autoRestore(canvas, true); 20 canvas->concat(m); 21 canvas->drawString(str, 0, 0, p); 22 } 23 if (!isSimilarity) { 24 canvas->drawString(str, 40, below, p); 25 below += 20; 26 } 27 } 28 } 29 } 30 } // END FIDDLE 31 #endif // Disabled until updated to use current API. 32