From 4f63d7f20492ff76f9e1f927b2c5f5f50cc2b891 Mon Sep 17 00:00:00 2001 From: spycrab Date: Mon, 26 Mar 2018 08:13:15 +0200 Subject: [PATCH] Qt: Fix low-resolution icon --- CMakeLists.txt | 2 +- Data/dolphin-emu.png | Bin 1452 -> 10033 bytes Source/Core/DolphinQt2/CMakeLists.txt | 1 + Source/Core/DolphinQt2/DolphinQt2.vcxproj | 4 +- Source/Core/DolphinQt2/MainWindow.cpp | 2 +- .../Core/DolphinQt2/QtUtils/WinIconHelper.cpp | 94 ++++++++++++++++++ .../Core/DolphinQt2/QtUtils/WinIconHelper.h | 16 +++ Source/Core/DolphinQt2/Resources.cpp | 18 ++++ Source/Core/DolphinQt2/Resources.h | 1 + 9 files changed, 135 insertions(+), 3 deletions(-) create mode 100644 Source/Core/DolphinQt2/QtUtils/WinIconHelper.cpp create mode 100644 Source/Core/DolphinQt2/QtUtils/WinIconHelper.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 14681c35ef..8d7b4b8c47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -805,7 +805,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD|OpenBSD") install(FILES Data/dolphin-emu.svg DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps) install(FILES Data/dolphin-emu.png - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps) + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/256x256/apps) install(FILES Data/dolphin-emu.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) # Install manpages diff --git a/Data/dolphin-emu.png b/Data/dolphin-emu.png index bb0ca33dabb7f40ae77854097946274d010fe3bc..c9d5b6836a17e65206a81502bc1c311bd10b1417 100644 GIT binary patch literal 10033 zcmd5?go86m$UqG*lH0fQyYP%shYCqY7*r zb!7#>(|^y`?(%d1fEl2w@J1iJa=Pvp_-DTR>EGhrR2qW{?nBvV&$H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V7vvuf~oye%)o4WH*-(v?B zyKTvTY`-++g;BR8B^N1lWY^V+xNUjWrufX8=cy%P*qWp&&T}Uwdu&(a8+4K;|1tqp zg|lCrYNL7@{16+Gw-|h6CD$e@P`#*9W|9*I`h$V0uyHWYE$sK_+!v+syT3NV~E zpq0)1)cb5NrjY^+ht&ll!>;m;8Y|$m9#%!C-apJXd+Y~|r1-4#1^OK&BQ;jQW+hC` zhMbjXtN_EL-_gDrEx_@3dfGpC|0G%gt$ + @@ -310,6 +311,7 @@ + @@ -414,4 +416,4 @@ - + \ No newline at end of file diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index f77e23a663..4733fc9944 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -85,7 +85,7 @@ MainWindow::MainWindow(std::unique_ptr boot_parameters) : QMainWindow(nullptr) { setWindowTitle(QString::fromStdString(Common::scm_rev_str)); - setWindowIcon(QIcon(Resources::GetMisc(Resources::LOGO_SMALL))); + setWindowIcon(Resources::GetAppIcon()); setUnifiedTitleAndToolBarOnMac(true); setAcceptDrops(true); diff --git a/Source/Core/DolphinQt2/QtUtils/WinIconHelper.cpp b/Source/Core/DolphinQt2/QtUtils/WinIconHelper.cpp new file mode 100644 index 0000000000..c076a9c250 --- /dev/null +++ b/Source/Core/DolphinQt2/QtUtils/WinIconHelper.cpp @@ -0,0 +1,94 @@ +// Copyright 2018 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "DolphinQt2/QtUtils/WinIconHelper.h" + +#ifdef _WIN32 + +#include + +// The following code is adapted from qpixmap_win.cpp (c) The Qt Company Ltd. (https://qt.io) +// Licensed under the GNU GPL v3 +static inline BITMAPINFO GetBMI(int width, int height, bool topToBottom) +{ + BITMAPINFO bmi = {}; + auto& bih = bmi.bmiHeader; + + bih.biSize = sizeof(BITMAPINFOHEADER); + bih.biWidth = width; + bih.biHeight = topToBottom ? -height : height; + bih.biPlanes = 1; + bih.biBitCount = 32; + bih.biCompression = BI_RGB; + bih.biSizeImage = width * height * 4; + + return bmi; +} + +static QPixmap PixmapFromHICON(HICON icon) +{ + HDC screenDevice = GetDC(0); + HDC hdc = CreateCompatibleDC(screenDevice); + ReleaseDC(0, screenDevice); + ICONINFO iconinfo; + const bool result = GetIconInfo(icon, &iconinfo); // x and y Hotspot describes the icon center + if (!result) + { + qErrnoWarning("QPixmap::fromWinHICON(), failed to GetIconInfo()"); + DeleteDC(hdc); + return QPixmap(); + } + const int w = iconinfo.xHotspot * 2; + const int h = iconinfo.yHotspot * 2; + BITMAPINFO bitmapInfo = GetBMI(w, h, false); + DWORD* bits; + HBITMAP winBitmap = CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, (VOID**)&bits, NULL, 0); + HGDIOBJ oldhdc = reinterpret_cast(SelectObject(hdc, winBitmap)); + DrawIconEx(hdc, 0, 0, icon, iconinfo.xHotspot * 2, iconinfo.yHotspot * 2, 0, 0, DI_NORMAL); + + QImage image(w, h, QImage::Format_ARGB32_Premultiplied); + if (image.isNull()) + return {}; + + BITMAPINFO bmi = GetBMI(w, h, true); + + QScopedArrayPointer data(new uchar[bmi.bmiHeader.biSizeImage]); + if (!GetDIBits(hdc, winBitmap, 0, h, data.data(), &bmi, DIB_RGB_COLORS)) + return {}; + + for (int y = 0; y < image.height(); ++y) + { + void* dest = static_cast(image.scanLine(y)); + const void* src = data.data() + y * image.bytesPerLine(); + memcpy(dest, src, image.bytesPerLine()); + } + + // dispose resources created by iconinfo call + DeleteObject(iconinfo.hbmMask); + DeleteObject(iconinfo.hbmColor); + SelectObject(hdc, oldhdc); // restore state + DeleteObject(winBitmap); + DeleteDC(hdc); + return QPixmap::fromImage(image); +} + +QIcon WinIconHelper::GetNativeIcon() +{ + QIcon icon; + for (int size : {16, 32, 48, 256}) + { + HANDLE h = LoadImageW(GetModuleHandleW(nullptr), L"\"DOLPHIN\"", IMAGE_ICON, size, size, + LR_CREATEDIBSECTION); + + if (h && h != INVALID_HANDLE_VALUE) + { + auto* icon_handle = static_cast(h); + icon.addPixmap(PixmapFromHICON(icon_handle)); + } + } + + return icon; +} + +#endif diff --git a/Source/Core/DolphinQt2/QtUtils/WinIconHelper.h b/Source/Core/DolphinQt2/QtUtils/WinIconHelper.h new file mode 100644 index 0000000000..8648704f3a --- /dev/null +++ b/Source/Core/DolphinQt2/QtUtils/WinIconHelper.h @@ -0,0 +1,16 @@ +// Copyright 2018 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#ifdef _WIN32 + +#include + +namespace WinIconHelper +{ +QIcon GetNativeIcon(); +}; + +#endif diff --git a/Source/Core/DolphinQt2/Resources.cpp b/Source/Core/DolphinQt2/Resources.cpp index 3698f92810..d24f8cc184 100644 --- a/Source/Core/DolphinQt2/Resources.cpp +++ b/Source/Core/DolphinQt2/Resources.cpp @@ -14,6 +14,10 @@ #include "DolphinQt2/Resources.h" #include "DolphinQt2/Settings.h" +#ifdef _WIN32 +#include "DolphinQt2/QtUtils/WinIconHelper.h" +#endif + QList Resources::m_platforms; QList Resources::m_countries; QList Resources::m_ratings; @@ -128,3 +132,17 @@ QPixmap Resources::GetMisc(int id) { return m_misc[id]; } + +QIcon Resources::GetAppIcon() +{ + QIcon icon; + +#ifdef _WIN32 + icon = WinIconHelper::GetNativeIcon(); +#else + icon.addPixmap(GetScaledPixmap("dolphin_logo")); + icon.addPixmap(GetScaledPixmap("Dolphin")); +#endif + + return icon; +} diff --git a/Source/Core/DolphinQt2/Resources.h b/Source/Core/DolphinQt2/Resources.h index bb93d4ce61..31730d6f3a 100644 --- a/Source/Core/DolphinQt2/Resources.h +++ b/Source/Core/DolphinQt2/Resources.h @@ -28,6 +28,7 @@ public: static QIcon GetScaledIcon(const std::string& name); static QIcon GetScaledThemeIcon(const std::string& name); + static QIcon GetAppIcon(); static QPixmap GetScaledPixmap(const std::string& name); static QPixmap GetScaledThemePixmap(const std::string& name);