mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-18 21:27:56 +00:00
Compare commits
2 Commits
65df20f58a
...
ec5b4ecaac
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ec5b4ecaac | ||
![]() |
61e8fa060b |
@ -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());
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user