summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2025-06-09 00:10:03 -0400
committerGitHub <noreply@github.com>2025-06-09 00:10:03 -0400
commit7ad85e875df1c38ae591f2be7eddb85ae51df964 (patch)
tree647e03d616e352aeffa6622272b4527014a07aad /Source/Core
parent42d5f2b7056b3d3fb8be8320003ad836bb003fae (diff)
parent61e8fa060b93437a88c4260df4d1dd75b5b65d16 (diff)
Merge pull request #13738 from Tilka/convert_banner
QtUtils/ImageConverter: simplify
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinQt/QtUtils/ImageConverter.cpp23
-rw-r--r--Source/Core/DolphinQt/QtUtils/ImageConverter.h5
2 files changed, 3 insertions, 25 deletions
diff --git a/Source/Core/DolphinQt/QtUtils/ImageConverter.cpp b/Source/Core/DolphinQt/QtUtils/ImageConverter.cpp
index cdd9a1c70b..4d00d82c15 100644
--- a/Source/Core/DolphinQt/QtUtils/ImageConverter.cpp
+++ b/Source/Core/DolphinQt/QtUtils/ImageConverter.cpp
@@ -3,30 +3,13 @@
#include "DolphinQt/QtUtils/ImageConverter.h"
-#include <vector>
-
#include <QPixmap>
-#include "Common/CommonTypes.h"
#include "UICommon/GameFile.h"
QPixmap ToQPixmap(const UICommon::GameBanner& banner)
{
- return ToQPixmap(banner.buffer, banner.width, banner.height);
-}
-
-QPixmap ToQPixmap(const std::vector<u32>& buffer, int width, int height)
-{
- QImage image(width, height, QImage::Format_RGB888);
- for (int y = 0; y < height; y++)
- {
- for (int x = 0; x < width; x++)
- {
- const u32 color = buffer[y * width + x];
- image.setPixel(
- x, y, qRgb((color & 0xFF0000) >> 16, (color & 0x00FF00) >> 8, (color & 0x0000FF) >> 0));
- }
- }
-
- return QPixmap::fromImage(image);
+ const auto* ptr = reinterpret_cast<const uchar*>(banner.buffer.data());
+ QImage image(ptr, banner.width, banner.height, QImage::Format_RGBX8888);
+ return QPixmap::fromImage(std::move(image).rgbSwapped());
}
diff --git a/Source/Core/DolphinQt/QtUtils/ImageConverter.h b/Source/Core/DolphinQt/QtUtils/ImageConverter.h
index 917c0a4f56..673bc05eb2 100644
--- a/Source/Core/DolphinQt/QtUtils/ImageConverter.h
+++ b/Source/Core/DolphinQt/QtUtils/ImageConverter.h
@@ -3,10 +3,6 @@
#pragma once
-#include <vector>
-
-#include "Common/CommonTypes.h"
-
class QPixmap;
namespace UICommon
@@ -15,4 +11,3 @@ struct GameBanner;
}
QPixmap ToQPixmap(const UICommon::GameBanner& banner);
-QPixmap ToQPixmap(const std::vector<u32>& buffer, int width, int height);