Pica: Cleanup color conversion.
This commit is contained in:
parent
614baa39d1
commit
47543d62cf
3 changed files with 51 additions and 26 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <QPushButton>
|
||||
#include <QSpinBox>
|
||||
|
||||
#include "video_core/color.h"
|
||||
#include "video_core/pica.h"
|
||||
|
||||
#include "graphics_framebuffer.hxx"
|
||||
|
@ -259,14 +260,10 @@ void GraphicsFramebufferWidget::OnUpdate()
|
|||
for (unsigned y = 0; y < framebuffer_height; ++y) {
|
||||
for (unsigned x = 0; x < framebuffer_width; ++x) {
|
||||
u16 value = *(u16*)(((u8*)color_buffer) + x * 2 + y * framebuffer_width * 2);
|
||||
u8 r = (value >> 11) & 0x1F;
|
||||
u8 g = (value >> 6) & 0x1F;
|
||||
u8 b = (value >> 1) & 0x1F;
|
||||
u8 a = value & 1;
|
||||
r = (r << 3) | (r >> 2);
|
||||
g = (g << 3) | (g >> 2);
|
||||
b = (b << 3) | (b >> 2);
|
||||
a *= 255;
|
||||
u8 r = Color::Convert5To8((value >> 11) & 0x1F);
|
||||
u8 g = Color::Convert5To8((value >> 6) & 0x1F);
|
||||
u8 b = Color::Convert5To8((value >> 1) & 0x1F);
|
||||
u8 a = Color::Convert1To8(value & 1);
|
||||
|
||||
decoded_image.setPixel(x, y, qRgba(r, g, b, 255/*a*/));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue