Issue #1925 - Move NS_FOR_CSS_HALF_CORNER to gfx/2d/Types.h and rewrite it.

This commit is contained in:
Moonchild 2024-08-02 08:10:52 +02:00 • committed by roytam1
commit 1730199755
2 changed files with 16 additions and 2 deletions

View file

@ -443,6 +443,22 @@ enum HalfCorner {
eCornerBottomLeftY = 7
};
// Creates a for loop that walks over the eight mozilla::HalfCorner values.
// This implementation uses the same technique as NS_FOR_CSS_SIDES.
#define NS_FOR_CSS_HALF_CORNERS(var_) \
int32_t MOZ_CONCAT(var_,__LINE__) = mozilla::eCornerTopLeftX; \
for (mozilla::HalfCorner var_; \
MOZ_CONCAT(var_,__LINE__) <= mozilla::eCornerBottomLeftY && \
(var_ = mozilla::HalfCorner(MOZ_CONCAT(var_,__LINE__)), true); \
++MOZ_CONCAT(var_,__LINE__))
static inline mozilla::HalfCorner operator++(mozilla::HalfCorner& aHalfCorner) {
MOZ_ASSERT(aHalfCorner >= eCornerTopLeftX && aHalfCorner <= eCornerBottomLeftY,
"Out of range half corner!");
aHalfCorner = mozilla::HalfCorner(aHalfCorner + 1);
return aHalfCorner;
}
} // namespace mozilla
#endif /* MOZILLA_GFX_TYPES_H_ */