1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 07:54:58 +00:00
serenity/Userland/Libraries/LibGfx/Rect.cpp
Ben Wiederhake c2a900b853 Everywhere: Remove unused includes of AK/StdLibExtras.h
These instances were detected by searching for files that include
AK/StdLibExtras.h, but don't match the regex:

\\b(abs|AK_REPLACED_STD_NAMESPACE|array_size|ceil_div|clamp|exchange|for
ward|is_constant_evaluated|is_power_of_two|max|min|mix|move|_RawPtr|RawP
tr|round_up_to_power_of_two|swap|to_underlying)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use any "extra stdlib" functions.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00

50 lines
1 KiB
C++

/*
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/Vector.h>
#include <LibGfx/Line.h>
#include <LibGfx/Rect.h>
#include <LibIPC/Decoder.h>
#include <LibIPC/Encoder.h>
namespace Gfx {
template<>
DeprecatedString IntRect::to_deprecated_string() const
{
return DeprecatedString::formatted("[{},{} {}x{}]", x(), y(), width(), height());
}
template<>
DeprecatedString FloatRect::to_deprecated_string() const
{
return DeprecatedString::formatted("[{},{} {}x{}]", x(), y(), width(), height());
}
}
namespace IPC {
template<>
bool encode(Encoder& encoder, Gfx::IntRect const& rect)
{
encoder << rect.location() << rect.size();
return true;
}
template<>
ErrorOr<Gfx::IntRect> decode(Decoder& decoder)
{
auto point = TRY(decoder.decode<Gfx::IntPoint>());
auto size = TRY(decoder.decode<Gfx::IntSize>());
return Gfx::IntRect { point, size };
}
}
template class Gfx::Rect<int>;
template class Gfx::Rect<float>;