mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-11 13:20:04 +00:00
address more comments
This commit is contained in:
parent
3534ad0835
commit
c2a32e942b
15 changed files with 87 additions and 56 deletions
|
@ -2,12 +2,10 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QImage>
|
||||
#include <QString>
|
||||
#include "citra_qt/qt_image_interface.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/frontend/image_interface.h"
|
||||
#include "qt_image_interface.h"
|
||||
|
||||
bool QtImageInterface::DecodePNG(std::vector<u8>& dst, u32& width, u32& height,
|
||||
const std::string& path) {
|
||||
|
@ -20,16 +18,10 @@ bool QtImageInterface::DecodePNG(std::vector<u8>& dst, u32& width, u32& height,
|
|||
width = image.width();
|
||||
height = image.height();
|
||||
|
||||
image = image.convertToFormat(QImage::Format_RGBA8888);
|
||||
|
||||
// Write RGBA8 to vector
|
||||
for (int y = 0; y < image.height(); y++) {
|
||||
for (int x = 0; x < image.width(); x++) {
|
||||
const QColor pixel(image.pixelColor(x, y));
|
||||
dst.push_back(pixel.red());
|
||||
dst.push_back(pixel.green());
|
||||
dst.push_back(pixel.blue());
|
||||
dst.push_back(pixel.alpha());
|
||||
}
|
||||
}
|
||||
dst = std::vector<u8>(image.constBits(), image.constBits() + (width * height * 4));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue