Allow each layered image to retain its own flags (#4460)

This fixes an issue where context-menu items for zero-width emotes displayed the wrong provider.
This commit is contained in:
nerix
2023-03-19 11:26:30 +01:00
committed by GitHub
parent 0acbc0d2c3
commit a777a227d4
6 changed files with 58 additions and 29 deletions
+12
View File
@@ -42,6 +42,12 @@ public:
reinterpret_cast<Q &>(this->value_) |= static_cast<Q>(flag);
}
/** Adds the flags from `flags` in this enum. */
void set(FlagsEnum flags)
{
reinterpret_cast<Q &>(this->value_) |= static_cast<Q>(flags.value_);
}
void unset(T flag)
{
reinterpret_cast<Q &>(this->value_) &= ~static_cast<Q>(flag);
@@ -69,6 +75,12 @@ public:
return xd;
}
FlagsEnum operator|(FlagsEnum rhs)
{
return static_cast<T>(static_cast<Q>(this->value_) |
static_cast<Q>(rhs.value_));
}
bool hasAny(FlagsEnum flags) const
{
return static_cast<Q>(this->value_) & static_cast<Q>(flags.value_);