mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:57:45 +00:00
LibGfx: Use Core::System::open() in Gfx::Bitmap :^)
This commit is contained in:
parent
0ed5f84bd9
commit
adb9b86807
1 changed files with 3 additions and 6 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <AK/String.h>
|
||||
#include <AK/Try.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImageDecoder.h>
|
||||
#include <LibGfx/ShareableBitmap.h>
|
||||
|
@ -113,9 +114,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_file(String const& path, in
|
|||
highdpi_icon_path.append(lexical_path.extension());
|
||||
|
||||
auto highdpi_icon_string = highdpi_icon_path.to_string();
|
||||
int fd = open(highdpi_icon_string.characters(), O_RDONLY);
|
||||
if (fd < 0)
|
||||
return Error::from_errno(errno);
|
||||
auto fd = TRY(Core::System::open(highdpi_icon_string, O_RDONLY));
|
||||
|
||||
auto bitmap = TRY(try_load_from_fd_and_close(fd, highdpi_icon_string));
|
||||
VERIFY(bitmap->width() % scale_factor == 0);
|
||||
|
@ -126,9 +125,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_file(String const& path, in
|
|||
return bitmap;
|
||||
}
|
||||
|
||||
int fd = open(path.characters(), O_RDONLY);
|
||||
if (fd < 0)
|
||||
return Error::from_errno(errno);
|
||||
auto fd = TRY(Core::System::open(path, O_RDONLY));
|
||||
return try_load_from_fd_and_close(fd, path);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue