diff options
author | Chris Craik <ccraik@google.com> | 2016-02-22 13:39:33 -0800 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2016-02-23 18:52:54 +0000 |
commit | 91eff22b5d7f8fe551bae01331948858ce932a96 (patch) | |
tree | 3a6c850a68142c40bc0c3f1ea7b84a942d1c67e8 /libs/hwui/Matrix.h | |
parent | eabebc1539b7e8b412da33c9e462665087cb1bfc (diff) |
Support op dumping in new pipeline
bug:26565102
Change-Id: I266e420a2f18ba9ad62942b8a0de295dfa3a2a88
Diffstat (limited to 'libs/hwui/Matrix.h')
-rw-r--r-- | libs/hwui/Matrix.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/libs/hwui/Matrix.h b/libs/hwui/Matrix.h index 1c25f26c0c25..36007cd5dc0e 100644 --- a/libs/hwui/Matrix.h +++ b/libs/hwui/Matrix.h @@ -14,14 +14,14 @@ * limitations under the License. */ -#ifndef ANDROID_HWUI_MATRIX_H -#define ANDROID_HWUI_MATRIX_H +#pragma once -#include <SkMatrix.h> +#include "Rect.h" #include <cutils/compiler.h> - -#include "Rect.h" +#include <iomanip> +#include <ostream> +#include <SkMatrix.h> namespace android { namespace uirenderer { @@ -218,6 +218,22 @@ public: void dump(const char* label = nullptr) const; + friend std::ostream& operator<<(std::ostream& os, const Matrix4& matrix) { + if (matrix.isSimple()) { + os << "offset " << matrix.getTranslateX() << "x" << matrix.getTranslateY(); + if (!matrix.isPureTranslate()) { + os << ", scale " << matrix[kScaleX] << "x" << matrix[kScaleY]; + } + } else { + os << "[" << matrix[0]; + for (int i = 1; i < 16; i++) { + os << ", " << matrix[i]; + } + os << "]"; + } + return os; + } + static const Matrix4& identity(); private: @@ -244,4 +260,3 @@ typedef Matrix4 mat4; }; // namespace uirenderer }; // namespace android -#endif // ANDROID_HWUI_MATRIX_H |