зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1749390 - Add debug support for mozilla::Side. r=gfx-reviewers,lsalzman
This was useful so may as well land it. Need to use mozilla::Side in the header because otherwise it is ambiguous with mozilla::ipc::Side, yay C++. Depends on D135562 Differential Revision: https://phabricator.services.mozilla.com/D135563
This commit is contained in:
Родитель
f6525aeca7
Коммит
a5d45cd2fe
|
@ -11,6 +11,28 @@
|
|||
#include <ostream>
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
std::ostream& operator<<(std::ostream& aOut, const Side& aSide) {
|
||||
#define Emit(x) \
|
||||
case x: \
|
||||
aOut << #x; \
|
||||
break
|
||||
|
||||
switch (aSide) {
|
||||
Emit(eSideTop);
|
||||
Emit(eSideBottom);
|
||||
Emit(eSideLeft);
|
||||
Emit(eSideRight);
|
||||
default:
|
||||
NS_ERROR("unknown side");
|
||||
aOut << int(aSide);
|
||||
break;
|
||||
}
|
||||
|
||||
#undef Emit
|
||||
return aOut;
|
||||
}
|
||||
|
||||
namespace gfx {
|
||||
|
||||
std::ostream& operator<<(std::ostream& aOut, const SurfaceFormat& aFormat) {
|
||||
|
|
|
@ -858,6 +858,8 @@ namespace mozilla {
|
|||
// Side constants for use in various places.
|
||||
enum Side : uint8_t { eSideTop, eSideRight, eSideBottom, eSideLeft };
|
||||
|
||||
std::ostream& operator<<(std::ostream&, const mozilla::Side&);
|
||||
|
||||
constexpr auto AllPhysicalSides() {
|
||||
return mozilla::MakeInclusiveEnumeratedRange(eSideTop, eSideLeft);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче