1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 10:27:34 +00:00

LibGfx: Convert String::format() => String::formatted()

This commit is contained in:
Andreas Kling 2021-04-21 21:11:16 +02:00
parent d996e43df6
commit e875d4e044
4 changed files with 5 additions and 7 deletions

View file

@ -511,7 +511,7 @@ Optional<BackingStore> Bitmap::allocate_backing_store(BitmapFormat format, const
if (purgeable == Purgeable::Yes) if (purgeable == Purgeable::Yes)
map_flags |= MAP_NORESERVE; map_flags |= MAP_NORESERVE;
#ifdef __serenity__ #ifdef __serenity__
void* data = mmap_with_name(nullptr, data_size_in_bytes, PROT_READ | PROT_WRITE, map_flags, 0, 0, String::format("GraphicsBitmap [%dx%d]", size.width(), size.height()).characters()); void* data = mmap_with_name(nullptr, data_size_in_bytes, PROT_READ | PROT_WRITE, map_flags, 0, 0, String::formatted("GraphicsBitmap [{}]", size).characters());
#else #else
void* data = mmap(nullptr, data_size_in_bytes, PROT_READ | PROT_WRITE, map_flags, 0, 0); void* data = mmap(nullptr, data_size_in_bytes, PROT_READ | PROT_WRITE, map_flags, 0, 0);
#endif #endif

View file

@ -40,12 +40,12 @@ namespace Gfx {
String Color::to_string() const String Color::to_string() const
{ {
return String::format("#%02x%02x%02x%02x", red(), green(), blue(), alpha()); return String::formatted("#{:02x}{:02x}{:02x}{:02x}", red(), green(), blue(), alpha());
} }
String Color::to_string_without_alpha() const String Color::to_string_without_alpha() const
{ {
return String::format("#%02x%02x%02x", red(), green(), blue()); return String::formatted("#{:02x}{:02x}{:02x}", red(), green(), blue());
} }
static Optional<Color> parse_rgb_color(const StringView& string) static Optional<Color> parse_rgb_color(const StringView& string)

View file

@ -39,9 +39,7 @@ const Bitmap* Emoji::emoji_for_code_point(u32 code_point)
if (it != s_emojis.end()) if (it != s_emojis.end())
return (*it).value.ptr(); return (*it).value.ptr();
String path = String::format("/res/emoji/U+%X.png", code_point); auto bitmap = Bitmap::load_from_file(String::formatted("/res/emoji/U+{:X}.png", code_point));
auto bitmap = Bitmap::load_from_file(path);
if (!bitmap) { if (!bitmap) {
s_emojis.set(code_point, nullptr); s_emojis.set(code_point, nullptr);
return nullptr; return nullptr;

View file

@ -154,7 +154,7 @@ void Rect<T>::set_size_around(const Size<T>& new_size, const Point<T>& fixed_poi
template<> template<>
String IntRect::to_string() const String IntRect::to_string() const
{ {
return String::format("[%d,%d %dx%d]", x(), y(), width(), height()); return String::formatted("[{},{} {}x{}]", x(), y(), width(), height());
} }
template<> template<>