Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
assertions_skia.cc
Go to the documentation of this file.
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 std {
8
9std::ostream& operator<<(std::ostream& os, const SkClipOp& o) {
10 switch (o) {
12 os << "ClipOpDifference";
13 break;
15 os << "ClipOpIntersect";
16 break;
17 default:
18 os << "ClipOpUnknown" << static_cast<int>(o);
19 break;
20 }
21 return os;
22}
23
24std::ostream& operator<<(std::ostream& os, const SkMatrix& m) {
25 os << std::endl;
26 os << "Scale X: " << m[SkMatrix::kMScaleX] << ", ";
27 os << "Skew X: " << m[SkMatrix::kMSkewX] << ", ";
28 os << "Trans X: " << m[SkMatrix::kMTransX] << std::endl;
29 os << "Skew Y: " << m[SkMatrix::kMSkewY] << ", ";
30 os << "Scale Y: " << m[SkMatrix::kMScaleY] << ", ";
31 os << "Trans Y: " << m[SkMatrix::kMTransY] << std::endl;
32 os << "Persp X: " << m[SkMatrix::kMPersp0] << ", ";
33 os << "Persp Y: " << m[SkMatrix::kMPersp1] << ", ";
34 os << "Persp Z: " << m[SkMatrix::kMPersp2];
35 os << std::endl;
36 return os;
37}
38
39std::ostream& operator<<(std::ostream& os, const SkM44& m) {
40 os << m.rc(0, 0) << ", " << m.rc(0, 1) << ", " << m.rc(0, 2) << ", "
41 << m.rc(0, 3) << std::endl;
42 os << m.rc(1, 0) << ", " << m.rc(1, 1) << ", " << m.rc(1, 2) << ", "
43 << m.rc(1, 3) << std::endl;
44 os << m.rc(2, 0) << ", " << m.rc(2, 1) << ", " << m.rc(2, 2) << ", "
45 << m.rc(2, 3) << std::endl;
46 os << m.rc(3, 0) << ", " << m.rc(3, 1) << ", " << m.rc(3, 2) << ", "
47 << m.rc(3, 3);
48 return os;
49}
50
51std::ostream& operator<<(std::ostream& os, const SkVector3& v) {
52 return os << v.x() << ", " << v.y() << ", " << v.z();
53}
54
55std::ostream& operator<<(std::ostream& os, const SkIRect& r) {
56 return os << "LTRB: " << r.fLeft << ", " << r.fTop << ", " << r.fRight << ", "
57 << r.fBottom;
58}
59
60std::ostream& operator<<(std::ostream& os, const SkRect& r) {
61 return os << "LTRB: " << r.fLeft << ", " << r.fTop << ", " << r.fRight << ", "
62 << r.fBottom;
63}
64
65std::ostream& operator<<(std::ostream& os, const SkRRect& r) {
66 return os << "LTRB: " << r.rect().fLeft << ", " << r.rect().fTop << ", "
67 << r.rect().fRight << ", " << r.rect().fBottom;
68}
69
70std::ostream& operator<<(std::ostream& os, const SkPath& r) {
71 return os << "Valid: " << r.isValid()
72 << ", FillType: " << static_cast<int>(r.getFillType())
73 << ", Bounds: " << r.getBounds();
74}
75
76std::ostream& operator<<(std::ostream& os, const SkPoint& r) {
77 return os << "XY: " << r.fX << ", " << r.fY;
78}
79
80std::ostream& operator<<(std::ostream& os, const SkISize& size) {
81 return os << size.width() << ", " << size.height();
82}
83
84std::ostream& operator<<(std::ostream& os, const SkColor4f& r) {
85 return os << r.fR << ", " << r.fG << ", " << r.fB << ", " << r.fA;
86}
87
88std::ostream& operator<<(std::ostream& os, const SkPaint& r) {
89 return os << "Color: " << r.getColor4f() << ", Style: " << r.getStyle()
90 << ", AA: " << r.isAntiAlias() << ", Shader: " << r.getShader();
91}
92
93std::ostream& operator<<(std::ostream& os, const SkSamplingOptions& s) {
94 if (s.useCubic) {
95 return os << "CubicResampler: " << s.cubic.B << ", " << s.cubic.C;
96 } else {
97 return os << "Filter: " << static_cast<int>(s.filter)
98 << ", Mipmap: " << static_cast<int>(s.mipmap);
99 }
100}
101
102} // namespace std
SkClipOp
Definition SkClipOp.h:13
Definition SkM44.h:150
static constexpr int kMScaleX
horizontal scale factor
Definition SkMatrix.h:353
static constexpr int kMTransY
vertical translation
Definition SkMatrix.h:358
static constexpr int kMPersp1
input y perspective factor
Definition SkMatrix.h:360
static constexpr int kMPersp0
input x perspective factor
Definition SkMatrix.h:359
static constexpr int kMPersp2
perspective bias
Definition SkMatrix.h:361
static constexpr int kMTransX
horizontal translation
Definition SkMatrix.h:355
static constexpr int kMSkewY
vertical skew factor
Definition SkMatrix.h:356
static constexpr int kMScaleY
vertical scale factor
Definition SkMatrix.h:357
static constexpr int kMSkewX
horizontal skew factor
Definition SkMatrix.h:354
Style getStyle() const
Definition SkPaint.h:204
SkColor4f getColor4f() const
Definition SkPaint.h:232
bool isAntiAlias() const
Definition SkPaint.h:162
SkShader * getShader() const
Definition SkPaint.h:397
SkPathFillType getFillType() const
Definition SkPath.h:230
const SkRect & getBounds() const
Definition SkPath.cpp:420
bool isValid() const
Definition SkPath.cpp:428
const SkRect & rect() const
Definition SkRRect.h:264
struct MyStruct s
Definition ref_ptr.h:256
std::ostream & operator<<(std::ostream &out, const impeller::Color &c)
Definition color.h:951
int32_t fBottom
larger y-axis bounds
Definition SkRect.h:36
int32_t fTop
smaller y-axis bounds
Definition SkRect.h:34
int32_t fLeft
smaller x-axis bounds
Definition SkRect.h:33
int32_t fRight
larger x-axis bounds
Definition SkRect.h:35
SkScalar x() const
Definition SkPoint3.h:24
SkScalar y() const
Definition SkPoint3.h:25
SkScalar z() const
Definition SkPoint3.h:26
float fX
x-axis value
float fY
y-axis value
SkScalar fBottom
larger y-axis bounds
Definition extension.cpp:17
SkScalar fLeft
smaller x-axis bounds
Definition extension.cpp:14
SkScalar fRight
larger x-axis bounds
Definition extension.cpp:16
SkScalar fTop
smaller y-axis bounds
Definition extension.cpp:15