This commit is contained in:
endrift 2018-03-15 16:12:41 +00:00 committed by GitHub
commit c7770609b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -559,10 +559,26 @@ void gfxFlushBuffers(void) {
size_t width = g_gfx_framebuf_display_width;
size_t height = g_gfx_framebuf_display_height;
u32 *in_framebuf = (u32*)g_gfxFramebufLinear;
u128 *out_framebuf = (u128*)actual_framebuf;
for (y=0; y<height; y++) {
for (x=0; x<width; x+=4) {
*((u128*)&actual_framebuf[gfxGetFramebufferDisplayOffset(x, y)]) = *((u128*)&in_framebuf[y * width + x]);
size_t row = y;
size_t y_base = y * width;
if (g_gfx_drawflip) row = g_gfx_framebuf_display_height-1-row;
size_t y_offset = (row & 0x78) + (row & ~0x7F) * (g_gfx_framebuf_aligned_width / 16);
y_offset = y_offset * 4 + (row & 6) * 2 + (row & 1);
size_t x_offset = 0;
for (x=0; x<width; x+=16) {
u128 *in_pos = (u128*)&in_framebuf[y_base + x];
u128 *out_pos = &out_framebuf[y_offset + x_offset];
out_pos[0] = in_pos[0];
out_pos[2] = in_pos[1];
out_pos[16] = in_pos[2];
out_pos[18] = in_pos[3];
x_offset += 0x200;
}
}
}