summaryrefslogtreecommitdiff
path: root/Servers
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-06 13:39:17 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-06 13:39:17 +0100
commit5c06c32df4062a17e1caf7aa01ee51e87852070a (patch)
tree1590bbe4af3624accc6e30575c9ec6a64d692890 /Servers
parentf8b00aa29010cc3a99b285d0afd88314c40be079 (diff)
downloadserenity-5c06c32df4062a17e1caf7aa01ee51e87852070a.zip
LibGfx: Prefer using Gfx::Bitmap::load_from_file instead of load_png()
Code that just wants to open a Gfx::Bitmap from a file should not be calling the PNG codec directly.
Diffstat (limited to 'Servers')
-rw-r--r--Servers/WindowServer/WSCompositor.cpp3
-rw-r--r--Servers/WindowServer/WSMenuManager.cpp5
2 files changed, 3 insertions, 5 deletions
diff --git a/Servers/WindowServer/WSCompositor.cpp b/Servers/WindowServer/WSCompositor.cpp
index ed9382cbbd..d97724ea6d 100644
--- a/Servers/WindowServer/WSCompositor.cpp
+++ b/Servers/WindowServer/WSCompositor.cpp
@@ -31,7 +31,6 @@
#include "WSWindow.h"
#include "WSWindowManager.h"
#include <LibGfx/Font.h>
-#include <LibGfx/PNGLoader.h>
#include <LibGfx/Painter.h>
#include <LibThread/BackgroundAction.h>
@@ -328,7 +327,7 @@ bool WSCompositor::set_wallpaper(const String& path, Function<void(bool)>&& call
{
LibThread::BackgroundAction<RefPtr<Gfx::Bitmap>>::create(
[path] {
- return Gfx::load_png(path);
+ return Gfx::Bitmap::load_from_file(path);
},
[this, path, callback = move(callback)](RefPtr<Gfx::Bitmap> bitmap) {
diff --git a/Servers/WindowServer/WSMenuManager.cpp b/Servers/WindowServer/WSMenuManager.cpp
index 110118a4a1..6217911714 100644
--- a/Servers/WindowServer/WSMenuManager.cpp
+++ b/Servers/WindowServer/WSMenuManager.cpp
@@ -28,7 +28,6 @@
#include <AK/QuickSort.h>
#include <LibCore/CDirIterator.h>
#include <LibGfx/Font.h>
-#include <LibGfx/PNGLoader.h>
#include <LibGfx/Painter.h>
#include <WindowServer/WSMenuManager.h>
#include <WindowServer/WSScreen.h>
@@ -102,7 +101,7 @@ WSMenuManager::WSMenuManager()
int app_identifier = 1;
for (const auto& app : m_apps) {
auto parent_menu = m_app_category_menus.get(app.category).value_or(*m_system_menu);
- parent_menu->add_item(make<WSMenuItem>(*m_system_menu, app_identifier++, app.name, String(), true, false, false, Gfx::load_png(app.icon_path)));
+ parent_menu->add_item(make<WSMenuItem>(*m_system_menu, app_identifier++, app.name, String(), true, false, false, Gfx::Bitmap::load_from_file(app.icon_path)));
}
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, WSMenuItem::Separator));
@@ -140,7 +139,7 @@ WSMenuManager::WSMenuManager()
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, 100, "Reload WM Config File"));
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, WSMenuItem::Separator));
- m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, 200, "About...", String(), true, false, false, Gfx::load_png("/res/icons/16x16/ladybug.png")));
+ m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, 200, "About...", String(), true, false, false, Gfx::Bitmap::load_from_file("/res/icons/16x16/ladybug.png")));
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, WSMenuItem::Separator));
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, 300, "Shutdown..."));
m_system_menu->on_item_activation = [this](WSMenuItem& item) {