mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-09 02:56:10 +00:00
UI/AppKit: Extract gfx_bitmap_to_ns_image() code
This commit is contained in:
parent
bfd7ac1204
commit
e0b5e742de
Notes:
github-actions[bot]
2025-02-28 12:51:16 +00:00
Author: https://github.com/AtkinsSJ
Commit: e0b5e742de
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3644
3 changed files with 19 additions and 11 deletions
|
@ -7,7 +7,6 @@
|
|||
#include <AK/ByteString.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/Resource.h>
|
||||
#include <LibGfx/ImageFormats/PNGWriter.h>
|
||||
#include <LibGfx/ShareableBitmap.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <LibWebView/ViewImplementation.h>
|
||||
|
@ -348,17 +347,8 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800;
|
|||
|
||||
- (void)onFaviconChange:(Gfx::Bitmap const&)bitmap
|
||||
{
|
||||
auto png = Gfx::PNGWriter::encode(bitmap);
|
||||
if (png.is_error()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* data = [NSData dataWithBytes:png.value().data()
|
||||
length:png.value().size()];
|
||||
|
||||
auto* favicon = [[NSImage alloc] initWithData:data];
|
||||
auto* favicon = Ladybird::gfx_bitmap_to_ns_image(bitmap);
|
||||
[favicon setResizingMode:NSImageResizingModeStretch];
|
||||
|
||||
self.favicon = favicon;
|
||||
[self updateTabTitleAndFavicon];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue