Inline CharacterColor comparison operators and pass by value

No need for them to be out of line or be passed by reference.
wilder
Waqar Ahmed 4 years ago
parent 8b9d197116
commit c463ff9860
  1. 20
      src/characters/CharacterColor.h

@ -184,12 +184,18 @@ public:
* Compares two colors and returns true if they represent the same color value and
* use the same color space.
*/
friend constexpr bool operator==(const CharacterColor &a, const CharacterColor &b);
friend constexpr bool operator==(const CharacterColor a, const CharacterColor b)
{
return a._colorSpace == b._colorSpace && a._u == b._u && a._v == b._v && a._w == b._w;
}
/**
* Compares two colors and returns true if they represent different color values
* or use different color spaces.
*/
friend constexpr bool operator!=(const CharacterColor &a, const CharacterColor &b);
friend constexpr bool operator!=(const CharacterColor a, const CharacterColor b)
{
return !operator==(a, b);
}
private:
quint8 _colorSpace;
@ -200,16 +206,6 @@ private:
quint8 _w;
};
constexpr bool operator==(const CharacterColor &a, const CharacterColor &b)
{
return a._colorSpace == b._colorSpace && a._u == b._u && a._v == b._v && a._w == b._w;
}
constexpr bool operator!=(const CharacterColor &a, const CharacterColor &b)
{
return !operator==(a, b);
}
constexpr QColor color256(quint8 u, const QColor *base)
{
// 0.. 16: system colors

Loading…
Cancel
Save