mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibGUI: Fix crash when previewing palette images
For example, navigating File Manager to a directory that contains a vaild BMP file that uses a palette, this code would end up trying to create an indexed thumbnail. However, Painter asserts that the thumbnail that we paint on is *not* indexed, usually crashing File Manager. Partially fixes #5299, as it now crashes somewhere else.
This commit is contained in:
parent
e3c00c93ae
commit
3084291625
Notes:
sideshowbarker
2024-07-18 22:01:41 +09:00
Author: https://github.com/BenWiederhake
Commit: 3084291625
Pull-request: https://github.com/SerenityOS/serenity/pull/5438
Reviewed-by: https://github.com/alimpfard
1 changed files with 1 additions and 1 deletions
|
@ -497,7 +497,7 @@ static RefPtr<Gfx::Bitmap> render_thumbnail(const StringView& path)
|
|||
|
||||
double scale = min(32 / (double)png_bitmap->width(), 32 / (double)png_bitmap->height());
|
||||
|
||||
auto thumbnail = Gfx::Bitmap::create(png_bitmap->format(), { 32, 32 });
|
||||
auto thumbnail = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, { 32, 32 });
|
||||
Gfx::IntRect destination = Gfx::IntRect(0, 0, (int)(png_bitmap->width() * scale), (int)(png_bitmap->height() * scale));
|
||||
destination.center_within(thumbnail->rect());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue