mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +00:00
LibGfx: Convert String::format() => String::formatted()
This commit is contained in:
parent
d996e43df6
commit
e875d4e044
4 changed files with 5 additions and 7 deletions
|
@ -511,7 +511,7 @@ Optional<BackingStore> Bitmap::allocate_backing_store(BitmapFormat format, const
|
|||
if (purgeable == Purgeable::Yes)
|
||||
map_flags |= MAP_NORESERVE;
|
||||
#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
|
||||
void* data = mmap(nullptr, data_size_in_bytes, PROT_READ | PROT_WRITE, map_flags, 0, 0);
|
||||
#endif
|
||||
|
|
|
@ -40,12 +40,12 @@ namespace Gfx {
|
|||
|
||||
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
|
||||
{
|
||||
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)
|
||||
|
|
|
@ -39,9 +39,7 @@ const Bitmap* Emoji::emoji_for_code_point(u32 code_point)
|
|||
if (it != s_emojis.end())
|
||||
return (*it).value.ptr();
|
||||
|
||||
String path = String::format("/res/emoji/U+%X.png", code_point);
|
||||
|
||||
auto bitmap = Bitmap::load_from_file(path);
|
||||
auto bitmap = Bitmap::load_from_file(String::formatted("/res/emoji/U+{:X}.png", code_point));
|
||||
if (!bitmap) {
|
||||
s_emojis.set(code_point, nullptr);
|
||||
return nullptr;
|
||||
|
|
|
@ -154,7 +154,7 @@ void Rect<T>::set_size_around(const Size<T>& new_size, const Point<T>& fixed_poi
|
|||
template<>
|
||||
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<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue