• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "flutter/flow/debug_print.h"
6 
7 #include <ostream>
8 
9 #include "third_party/skia/include/core/SkString.h"
10 
operator <<(std::ostream & os,const flutter::MatrixDecomposition & m)11 std::ostream& operator<<(std::ostream& os,
12                          const flutter::MatrixDecomposition& m) {
13   if (!m.IsValid()) {
14     os << "Invalid Matrix!" << std::endl;
15     return os;
16   }
17 
18   os << "Translation (x, y, z): " << m.translation() << std::endl;
19   os << "Scale (z, y, z): " << m.scale() << std::endl;
20   os << "Shear (zy, yz, zx): " << m.shear() << std::endl;
21   os << "Perspective (x, y, z, w): " << m.perspective() << std::endl;
22   os << "Rotation (x, y, z, w): " << m.rotation() << std::endl;
23 
24   return os;
25 }
26 
operator <<(std::ostream & os,const SkMatrix & m)27 std::ostream& operator<<(std::ostream& os, const SkMatrix& m) {
28   SkString string;
29   string.printf("[%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f]",
30                 m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8]);
31   os << string.c_str();
32   return os;
33 }
34 
operator <<(std::ostream & os,const SkMatrix44 & m)35 std::ostream& operator<<(std::ostream& os, const SkMatrix44& m) {
36   os << m.get(0, 0) << ", " << m.get(0, 1) << ", " << m.get(0, 2) << ", "
37      << m.get(0, 3) << std::endl;
38   os << m.get(1, 0) << ", " << m.get(1, 1) << ", " << m.get(1, 2) << ", "
39      << m.get(1, 3) << std::endl;
40   os << m.get(2, 0) << ", " << m.get(2, 1) << ", " << m.get(2, 2) << ", "
41      << m.get(2, 3) << std::endl;
42   os << m.get(3, 0) << ", " << m.get(3, 1) << ", " << m.get(3, 2) << ", "
43      << m.get(3, 3);
44   return os;
45 }
46 
operator <<(std::ostream & os,const SkVector3 & v)47 std::ostream& operator<<(std::ostream& os, const SkVector3& v) {
48   os << v.x() << ", " << v.y() << ", " << v.z();
49   return os;
50 }
51 
operator <<(std::ostream & os,const SkVector4 & v)52 std::ostream& operator<<(std::ostream& os, const SkVector4& v) {
53   os << v.fData[0] << ", " << v.fData[1] << ", " << v.fData[2] << ", "
54      << v.fData[3];
55   return os;
56 }
57 
operator <<(std::ostream & os,const SkRect & r)58 std::ostream& operator<<(std::ostream& os, const SkRect& r) {
59   os << "LTRB: " << r.fLeft << ", " << r.fTop << ", " << r.fRight << ", "
60      << r.fBottom;
61   return os;
62 }
63 
operator <<(std::ostream & os,const SkRRect & r)64 std::ostream& operator<<(std::ostream& os, const SkRRect& r) {
65   os << "LTRB: " << r.rect().fLeft << ", " << r.rect().fTop << ", "
66      << r.rect().fRight << ", " << r.rect().fBottom;
67   return os;
68 }
69 
operator <<(std::ostream & os,const SkPoint & r)70 std::ostream& operator<<(std::ostream& os, const SkPoint& r) {
71   os << "XY: " << r.fX << ", " << r.fY;
72   return os;
73 }
74 
operator <<(std::ostream & os,const flutter::PictureRasterCacheKey & k)75 std::ostream& operator<<(std::ostream& os,
76                          const flutter::PictureRasterCacheKey& k) {
77   os << "Picture: " << k.id() << " matrix: " << k.matrix();
78   return os;
79 }
80 
operator <<(std::ostream & os,const SkISize & size)81 std::ostream& operator<<(std::ostream& os, const SkISize& size) {
82   os << size.width() << ", " << size.height();
83   return os;
84 }
85