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/Rect.h | |
parent | eabebc1539b7e8b412da33c9e462665087cb1bfc (diff) |
Support op dumping in new pipeline
bug:26565102
Change-Id: I266e420a2f18ba9ad62942b8a0de295dfa3a2a88
Diffstat (limited to 'libs/hwui/Rect.h')
-rw-r--r-- | libs/hwui/Rect.h | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h index 30c925c8775b..d9fce9b2c824 100644 --- a/libs/hwui/Rect.h +++ b/libs/hwui/Rect.h @@ -14,16 +14,17 @@ * limitations under the License. */ -#ifndef ANDROID_HWUI_RECT_H -#define ANDROID_HWUI_RECT_H +#pragma once -#include <cmath> -#include <algorithm> -#include <SkRect.h> +#include "Vertex.h" #include <utils/Log.h> -#include "Vertex.h" +#include <algorithm> +#include <cmath> +#include <iomanip> +#include <ostream> +#include <SkRect.h> namespace android { namespace uirenderer { @@ -282,9 +283,23 @@ public: void dump(const char* label = nullptr) const { ALOGD("%s[l=%.2f t=%.2f r=%.2f b=%.2f]", label ? label : "Rect", left, top, right, bottom); } + + friend std::ostream& operator<<(std::ostream& os, const Rect& rect) { + if (rect.isEmpty()) { + return os << "empty"; + } + + if (rect.left == 0 && rect.top == 0) { + return os << "[" << rect.right << " x " << rect.bottom << "]"; + } + + return os << "[" << rect.left + << " " << rect.top + << " " << rect.right + << " " << rect.bottom << "]"; + } }; // class Rect }; // namespace uirenderer }; // namespace android -#endif // ANDROID_HWUI_RECT_H |