mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 12:48:57 +00:00
Move DolphinQt2 to DolphinQt
This commit is contained in:
parent
059880bb16
commit
13ba24c5a6
233 changed files with 392 additions and 392 deletions
33
Source/Core/DolphinQt/QtUtils/ImageConverter.cpp
Normal file
33
Source/Core/DolphinQt/QtUtils/ImageConverter.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2018 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue