mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:27:35 +00:00
LibCore+LibGfx: Pass file-path as StringView
This commit is contained in:
parent
e6a3cac5ce
commit
69aece9279
4 changed files with 8 additions and 8 deletions
|
@ -102,7 +102,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_wrapper(BitmapFormat format, I
|
|||
return adopt_ref(*new Bitmap(format, size, scale_factor, pitch, data));
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_file(String const& path, int scale_factor)
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_file(StringView path, int scale_factor)
|
||||
{
|
||||
if (scale_factor > 1 && path.starts_with("/res/")) {
|
||||
LexicalPath lexical_path { path };
|
||||
|
@ -129,7 +129,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_file(String const& path, in
|
|||
return try_load_from_fd_and_close(fd, path);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_fd_and_close(int fd, String const& path)
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_fd_and_close(int fd, StringView path)
|
||||
{
|
||||
auto file = TRY(Core::MappedFile::map_from_fd_and_close(fd, path));
|
||||
if (auto decoder = ImageDecoder::try_create(file->bytes())) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue