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/testing/assertions_skia.h"
6
7namespace flutter {
8namespace testing {
9
10std::ostream& operator<<(std::ostream& os, const SkClipOp& o) {
11 switch (o) {
12 case SkClipOp::kDifference:
13 os << "ClipOpDifference";
14 break;
15 case SkClipOp::kIntersect:
16 os << "ClipOpIntersect";
17 break;
18 default:
19 os << "ClipOpUnknown" << static_cast<int>(o);
20 break;
21 }
22 return os;
23}
24
25std::ostream& operator<<(std::ostream& os, const SkMatrix& m) {
26 os << std::endl;
27 os << "Scale X: " << m[SkMatrix::kMScaleX] << ", ";
28 os << "Skew X: " << m[SkMatrix::kMSkewX] << ", ";
29 os << "Trans X: " << m[SkMatrix::kMTransX] << std::endl;
30 os << "Skew Y: " << m[SkMatrix::kMSkewY] << ", ";
31 os << "Scale Y: " << m[SkMatrix::kMScaleY] << ", ";
32 os << "Trans Y: " << m[SkMatrix::kMTransY] << std::endl;
33 os << "Persp X: " << m[SkMatrix::kMPersp0] << ", ";
34 os << "Persp Y: " << m[SkMatrix::kMPersp1] << ", ";
35 os << "Persp Z: " << m[SkMatrix::kMPersp2];
36 os << std::endl;
37 return os;
38}
39
40std::ostream& operator<<(std::ostream& os, const SkM44& m) {
41 os << m.rc(r: 0, c: 0) << ", " << m.rc(r: 0, c: 1) << ", " << m.rc(r: 0, c: 2) << ", "
42 << m.rc(r: 0, c: 3) << std::endl;
43 os << m.rc(r: 1, c: 0) << ", " << m.rc(r: 1, c: 1) << ", " << m.rc(r: 1, c: 2) << ", "
44 << m.rc(r: 1, c: 3) << std::endl;
45 os << m.rc(r: 2, c: 0) << ", " << m.rc(r: 2, c: 1) << ", " << m.rc(r: 2, c: 2) << ", "
46 << m.rc(r: 2, c: 3) << std::endl;
47 os << m.rc(r: 3, c: 0) << ", " << m.rc(r: 3, c: 1) << ", " << m.rc(r: 3, c: 2) << ", "
48 << m.rc(r: 3, c: 3);
49 return os;
50}
51
52std::ostream& operator<<(std::ostream& os, const SkVector3& v) {
53 return os << v.x() << ", " << v.y() << ", " << v.z();
54}
55
56std::ostream& operator<<(std::ostream& os, const SkIRect& r) {
57 return os << "LTRB: " << r.fLeft << ", " << r.fTop << ", " << r.fRight << ", "
58 << r.fBottom;
59}
60
61std::ostream& operator<<(std::ostream& os, const SkRect& r) {
62 return os << "LTRB: " << r.fLeft << ", " << r.fTop << ", " << r.fRight << ", "
63 << r.fBottom;
64}
65
66std::ostream& operator<<(std::ostream& os, const SkRRect& r) {
67 return os << "LTRB: " << r.rect().fLeft << ", " << r.rect().fTop << ", "
68 << r.rect().fRight << ", " << r.rect().fBottom;
69}
70
71std::ostream& operator<<(std::ostream& os, const SkPath& r) {
72 return os << "Valid: " << r.isValid()
73 << ", FillType: " << static_cast<int>(r.getFillType())
74 << ", Bounds: " << r.getBounds();
75}
76
77std::ostream& operator<<(std::ostream& os, const SkPoint& r) {
78 return os << "XY: " << r.fX << ", " << r.fY;
79}
80
81std::ostream& operator<<(std::ostream& os, const SkISize& size) {
82 return os << size.width() << ", " << size.height();
83}
84
85std::ostream& operator<<(std::ostream& os, const SkColor4f& r) {
86 return os << r.fR << ", " << r.fG << ", " << r.fB << ", " << r.fA;
87}
88
89std::ostream& operator<<(std::ostream& os, const SkPaint& r) {
90 return os << "Color: " << r.getColor4f() << ", Style: " << r.getStyle()
91 << ", AA: " << r.isAntiAlias() << ", Shader: " << r.getShader();
92}
93
94std::ostream& operator<<(std::ostream& os, const SkSamplingOptions& s) {
95 if (s.useCubic) {
96 return os << "CubicResampler: " << s.cubic.B << ", " << s.cubic.C;
97 } else {
98 return os << "Filter: " << static_cast<int>(s.filter)
99 << ", Mipmap: " << static_cast<int>(s.mipmap);
100 }
101}
102
103} // namespace testing
104} // namespace flutter
105

source code of flutter_engine/flutter/testing/assertions_skia.cc