1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 08:27:46 +00:00

Everywhere: Run clang-format

This commit is contained in:
Linus Groh 2022-10-17 00:06:11 +02:00
parent 8639d8bc21
commit d26aabff04
140 changed files with 1202 additions and 723 deletions

View file

@ -136,7 +136,7 @@ public:
template<typename U>
requires(!IsSame<T, U>)
[[nodiscard]] ALWAYS_INLINE constexpr Line<U> to_type() const
[[nodiscard]] ALWAYS_INLINE constexpr Line<U> to_type() const
{
return Line<U>(*this);
}

View file

@ -212,7 +212,8 @@ public:
}
template<size_t U>
[[nodiscard]] constexpr Matrix<U, T> submatrix_from_topleft() const requires(U > 0 && U < N)
[[nodiscard]] constexpr Matrix<U, T> submatrix_from_topleft() const
requires(U > 0 && U < N)
{
Matrix<U, T> result;
for (size_t i = 0; i < U; ++i) {

View file

@ -232,7 +232,7 @@ template<typename T>
ALWAYS_INLINE static void unpack_grayscale_without_alpha(PNGLoadingContext& context)
{
for (int y = 0; y < context.height; ++y) {
auto* gray_values = reinterpret_cast<const T*>(context.scanlines[y].data.data());
auto* gray_values = reinterpret_cast<T const*>(context.scanlines[y].data.data());
for (int i = 0; i < context.width; ++i) {
auto& pixel = (Pixel&)context.bitmap->scanline(y)[i];
pixel.r = gray_values[i];

View file

@ -230,7 +230,7 @@ public:
template<typename U>
requires(!IsSame<T, U>)
[[nodiscard]] Point<U> to_type() const
[[nodiscard]] Point<U> to_type() const
{
return Point<U>(*this);
}

View file

@ -950,7 +950,7 @@ public:
template<typename U>
requires(!IsSame<T, U>)
[[nodiscard]] ALWAYS_INLINE Rect<U> to_type() const
[[nodiscard]] ALWAYS_INLINE Rect<U> to_type() const
{
return Rect<U>(*this);
}

View file

@ -177,7 +177,7 @@ public:
template<typename U>
requires(!IsSame<T, U>)
[[nodiscard]] ALWAYS_INLINE constexpr Size<U> to_type() const
[[nodiscard]] ALWAYS_INLINE constexpr Size<U> to_type() const
{
return Size<U>(*this);
}

View file

@ -35,28 +35,47 @@ requires(N >= 2 && N <= 4) class VectorN final {
public:
[[nodiscard]] constexpr VectorN() = default;
[[nodiscard]] constexpr VectorN(T x, T y) requires(N == 2)
[[nodiscard]] constexpr VectorN(T x, T y)
requires(N == 2)
: m_data { x, y }
{
}
[[nodiscard]] constexpr VectorN(T x, T y, T z) requires(N == 3)
[[nodiscard]] constexpr VectorN(T x, T y, T z)
requires(N == 3)
: m_data { x, y, z }
{
}
[[nodiscard]] constexpr VectorN(T x, T y, T z, T w) requires(N == 4)
[[nodiscard]] constexpr VectorN(T x, T y, T z, T w)
requires(N == 4)
: m_data { x, y, z, w }
{
}
[[nodiscard]] constexpr T x() const { return m_data[0]; }
[[nodiscard]] constexpr T y() const { return m_data[1]; }
[[nodiscard]] constexpr T z() const requires(N >= 3) { return m_data[2]; }
[[nodiscard]] constexpr T w() const requires(N >= 4) { return m_data[3]; }
[[nodiscard]] constexpr T z() const
requires(N >= 3)
{
return m_data[2];
}
[[nodiscard]] constexpr T w() const
requires(N >= 4)
{
return m_data[3];
}
constexpr void set_x(T value) { m_data[0] = value; }
constexpr void set_y(T value) { m_data[1] = value; }
constexpr void set_z(T value) requires(N >= 3) { m_data[2] = value; }
constexpr void set_w(T value) requires(N >= 4) { m_data[3] = value; }
constexpr void set_z(T value)
requires(N >= 3)
{
m_data[2] = value;
}
constexpr void set_w(T value)
requires(N >= 4)
{
m_data[3] = value;
}
[[nodiscard]] constexpr T const& operator[](size_t index) const
{
@ -86,7 +105,7 @@ public:
return *this;
}
constexpr VectorN& operator*=(const T& t)
constexpr VectorN& operator*=(T const& t)
{
UNROLL_LOOP
for (auto i = 0u; i < N; ++i)
@ -168,7 +187,8 @@ public:
return result;
}
[[nodiscard]] constexpr VectorN cross(VectorN const& other) const requires(N == 3)
[[nodiscard]] constexpr VectorN cross(VectorN const& other) const
requires(N == 3)
{
return VectorN(
y() * other.z() - z() * other.y(),
@ -211,12 +231,14 @@ public:
return AK::sqrt<O>(dot(*this));
}
[[nodiscard]] constexpr VectorN<2, T> xy() const requires(N >= 3)
[[nodiscard]] constexpr VectorN<2, T> xy() const
requires(N >= 3)
{
return VectorN<2, T>(x(), y());
}
[[nodiscard]] constexpr VectorN<3, T> xyz() const requires(N >= 4)
[[nodiscard]] constexpr VectorN<3, T> xyz() const
requires(N >= 4)
{
return VectorN<3, T>(x(), y(), z());
}