flutter_flutter/testing/assertions_skia.h
Chinmay Garde 1c7300ed1e
Account for root surface transformation on the surfaces managed by the external view embedder. (#11384)
The earlier design speculated that embedders could affect the same
transformations on the layers post engine compositor presentation but before
final composition.

However, the linked issue points out that this design is not suitable for use
with hardware overlay planes. When rendering to the same, to affect the
transformation before composition, embedders would have to render to an
off-screen render target and then apply the transformation before presentation.
This patch negates the need for that off-screen render pass.

To be clear, the previous architecture is still fully viable. Embedders still
have full control over layer transformations before composition. This is an
optimization for the hardware overlay planes use-case.

Fixes b/139758641
2019-09-17 15:16:59 -07:00

80 lines
2.7 KiB
C++

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_TESTING_ASSERTIONS_SKIA_H_
#define FLUTTER_TESTING_ASSERTIONS_SKIA_H_
#include <ostream>
#include "third_party/skia/include/core/SkMatrix.h"
#include "third_party/skia/include/core/SkMatrix44.h"
#include "third_party/skia/include/core/SkPoint3.h"
#include "third_party/skia/include/core/SkRRect.h"
//------------------------------------------------------------------------------
// Printing
//------------------------------------------------------------------------------
inline std::ostream& operator<<(std::ostream& os, const SkMatrix& m) {
os << std::endl;
os << "Scale X: " << m[SkMatrix::kMScaleX] << ", ";
os << "Skew X: " << m[SkMatrix::kMSkewX] << ", ";
os << "Trans X: " << m[SkMatrix::kMTransX] << std::endl;
os << "Skew Y: " << m[SkMatrix::kMSkewY] << ", ";
os << "Scale Y: " << m[SkMatrix::kMScaleY] << ", ";
os << "Trans Y: " << m[SkMatrix::kMTransY] << std::endl;
os << "Persp X: " << m[SkMatrix::kMPersp0] << ", ";
os << "Persp Y: " << m[SkMatrix::kMPersp1] << ", ";
os << "Persp Z: " << m[SkMatrix::kMPersp2];
os << std::endl;
return os;
}
inline std::ostream& operator<<(std::ostream& os, const SkMatrix44& m) {
os << m.get(0, 0) << ", " << m.get(0, 1) << ", " << m.get(0, 2) << ", "
<< m.get(0, 3) << std::endl;
os << m.get(1, 0) << ", " << m.get(1, 1) << ", " << m.get(1, 2) << ", "
<< m.get(1, 3) << std::endl;
os << m.get(2, 0) << ", " << m.get(2, 1) << ", " << m.get(2, 2) << ", "
<< m.get(2, 3) << std::endl;
os << m.get(3, 0) << ", " << m.get(3, 1) << ", " << m.get(3, 2) << ", "
<< m.get(3, 3);
return os;
}
inline std::ostream& operator<<(std::ostream& os, const SkVector3& v) {
os << v.x() << ", " << v.y() << ", " << v.z();
return os;
}
inline std::ostream& operator<<(std::ostream& os, const SkVector4& v) {
os << v.fData[0] << ", " << v.fData[1] << ", " << v.fData[2] << ", "
<< v.fData[3];
return os;
}
inline std::ostream& operator<<(std::ostream& os, const SkRect& r) {
os << "LTRB: " << r.fLeft << ", " << r.fTop << ", " << r.fRight << ", "
<< r.fBottom;
return os;
}
inline std::ostream& operator<<(std::ostream& os, const SkRRect& r) {
os << "LTRB: " << r.rect().fLeft << ", " << r.rect().fTop << ", "
<< r.rect().fRight << ", " << r.rect().fBottom;
return os;
}
inline std::ostream& operator<<(std::ostream& os, const SkPoint& r) {
os << "XY: " << r.fX << ", " << r.fY;
return os;
}
inline std::ostream& operator<<(std::ostream& os, const SkISize& size) {
os << size.width() << ", " << size.height();
return os;
}
#endif // FLUTTER_TESTING_ASSERTIONS_SKIA_H_