diff --git a/impeller/aiks/aiks_unittests.cc b/impeller/aiks/aiks_unittests.cc index 07fae56e3a32d..e29d40d8bc748 100644 --- a/impeller/aiks/aiks_unittests.cc +++ b/impeller/aiks/aiks_unittests.cc @@ -119,7 +119,7 @@ TEST_F(AiksTest, CanRenderGroupOpacity) { Paint alpha; alpha.color = Color::Red().WithAlpha(0.5); - canvas.SaveLayer(alpha); + // canvas.SaveLayer(alpha); canvas.DrawRect({000, 000, 100, 100}, red); canvas.DrawRect({020, 020, 100, 100}, green); diff --git a/impeller/geometry/geometry_unittests.h b/impeller/geometry/geometry_unittests.h index e247facd523e3..746df49df6075 100644 --- a/impeller/geometry/geometry_unittests.h +++ b/impeller/geometry/geometry_unittests.h @@ -11,49 +11,6 @@ #include "impeller/geometry/size.h" #include "impeller/geometry/vector.h" -namespace std { - -inline std::ostream& operator<<(std::ostream& out, const impeller::Matrix& m) { - out << "("; - for (size_t i = 0; i < 4u; i++) { - for (size_t j = 0; j < 4u; j++) { - out << m.e[i][j] << ","; - } - out << std::endl; - } - out << ")"; - return out; -} - -inline std::ostream& operator<<(std::ostream& out, - const impeller::Quaternion& q) { - out << "(" << q.x << ", " << q.y << ", " << q.z << ", " << q.w << ")"; - return out; -} - -template -inline std::ostream& operator<<(std::ostream& out, - const impeller::TSize& s) { - out << "(" << s.width << ", " << s.height << ")"; - return out; -} - -template -inline std::ostream& operator<<(std::ostream& out, - const impeller::TPoint& p) { - out << "(" << p.x << ", " << p.y << ")"; - return out; -} - -template -inline std::ostream& operator<<(std::ostream& out, - const impeller::TRect& r) { - out << "(" << r.origin << ", " << r.size << ")"; - return out; -} - -} // namespace std - inline bool NumberNear(double a, double b) { static const double epsilon = 1e-3; return (a > (b - epsilon)) && (a < (b + epsilon)); diff --git a/impeller/geometry/matrix.h b/impeller/geometry/matrix.h index 3156a81009a7b..a52e5eeed0375 100644 --- a/impeller/geometry/matrix.h +++ b/impeller/geometry/matrix.h @@ -6,6 +6,7 @@ #include #include +#include #include #include "impeller/geometry/matrix_decomposition.h" @@ -257,8 +258,8 @@ struct Matrix { static constexpr Matrix MakeOrthographic(TSize size) { // Per assumptions about NDC documented above. const auto scale = - MakeScale({1.0f / static_cast(size.width), - -1.0f / static_cast(size.height), 1.0}); + MakeScale({2.0f / static_cast(size.width), + -2.0f / static_cast(size.height), 1.0}); const auto translate = MakeTranslation({-1.0, 1.0, 0.5}); return translate * scale; } @@ -275,3 +276,19 @@ inline Vector4 operator*(const Vector4& v, const Matrix& m) { } } // namespace impeller + +namespace std { + +inline std::ostream& operator<<(std::ostream& out, const impeller::Matrix& m) { + out << "("; + for (size_t i = 0; i < 4u; i++) { + for (size_t j = 0; j < 4u; j++) { + out << m.e[i][j] << ","; + } + out << std::endl; + } + out << ")"; + return out; +} + +} // namespace std diff --git a/impeller/geometry/point.h b/impeller/geometry/point.h index ba12338557c52..e84338796d5e2 100644 --- a/impeller/geometry/point.h +++ b/impeller/geometry/point.h @@ -6,6 +6,7 @@ #include #include +#include #include #include "impeller/geometry/scalar.h" @@ -113,3 +114,14 @@ using Point = TPoint; using IPoint = TPoint; } // namespace impeller + +namespace std { + +template +inline std::ostream& operator<<(std::ostream& out, + const impeller::TPoint& p) { + out << "(" << p.x << ", " << p.y << ")"; + return out; +} + +} // namespace std diff --git a/impeller/geometry/quaternion.cc b/impeller/geometry/quaternion.cc index b00e350ed9691..2c5a75b286b53 100644 --- a/impeller/geometry/quaternion.cc +++ b/impeller/geometry/quaternion.cc @@ -27,11 +27,4 @@ Quaternion Quaternion::Slerp(const Quaternion& to, double time) const { } } -std::string Quaternion::ToString() const { - std::stringstream stream; - stream << "{" << x << ", " - << ", " << y << ", " << z << ", " << w << "}"; - return stream.str(); -} - } // namespace impeller diff --git a/impeller/geometry/quaternion.h b/impeller/geometry/quaternion.h index 00b9e0c1d904c..4985287000b71 100644 --- a/impeller/geometry/quaternion.h +++ b/impeller/geometry/quaternion.h @@ -4,7 +4,9 @@ #pragma once -#include "vector.h" +#include + +#include "impeller/geometry/vector.h" namespace impeller { @@ -73,8 +75,16 @@ struct Quaternion { bool operator!=(const Quaternion& o) const { return x != o.x || y != o.y || z != o.z || w != o.w; } - - std::string ToString() const; }; } // namespace impeller + +namespace std { + +inline std::ostream& operator<<(std::ostream& out, + const impeller::Quaternion& q) { + out << "(" << q.x << ", " << q.y << ", " << q.z << ", " << q.w << ")"; + return out; +} + +} // namespace std diff --git a/impeller/geometry/rect.h b/impeller/geometry/rect.h index 4fcd69d15abf4..c7477d806c9ee 100644 --- a/impeller/geometry/rect.h +++ b/impeller/geometry/rect.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include "impeller/geometry/point.h" @@ -122,3 +123,14 @@ using Rect = TRect; using IRect = TRect; } // namespace impeller + +namespace std { + +template +inline std::ostream& operator<<(std::ostream& out, + const impeller::TRect& r) { + out << "(" << r.origin << ", " << r.size << ")"; + return out; +} + +} // namespace std diff --git a/impeller/geometry/size.h b/impeller/geometry/size.h index 450f11b19a4de..11301eaa9d9a4 100644 --- a/impeller/geometry/size.h +++ b/impeller/geometry/size.h @@ -6,6 +6,7 @@ #include #include +#include #include #include "impeller/geometry/scalar.h" @@ -100,3 +101,14 @@ using ISize = TSize; static_assert(sizeof(Size) == 2 * sizeof(Scalar)); } // namespace impeller + +namespace std { + +template +inline std::ostream& operator<<(std::ostream& out, + const impeller::TSize& s) { + out << "(" << s.width << ", " << s.height << ")"; + return out; +} + +} // namespace std