Take fb stride into account

This commit is contained in:
TuxSH 2017-06-20 18:29:30 +02:00
parent 31ff6a1da8
commit cc64ef9670

View File

@ -265,10 +265,11 @@ void Draw_ConvertFrameBufferLine(u8 *line, bool top, bool left, u32 y)
GSPGPU_FramebufferFormats fmt = top ? (GSPGPU_FramebufferFormats)(GPU_FB_TOP_FMT & 7) : (GSPGPU_FramebufferFormats)(GPU_FB_BOTTOM_FMT & 7); GSPGPU_FramebufferFormats fmt = top ? (GSPGPU_FramebufferFormats)(GPU_FB_TOP_FMT & 7) : (GSPGPU_FramebufferFormats)(GPU_FB_BOTTOM_FMT & 7);
u32 width = top ? 400 : 320; u32 width = top ? 400 : 320;
u8 formatSizes[] = { 4, 3, 2, 2, 2 }; u8 formatSizes[] = { 4, 3, 2, 2, 2 };
u32 stride = top ? GPU_FB_TOP_STRIDE : GPU_FB_BOTTOM_STRIDE;
u32 pa = Draw_GetCurrentFramebufferAddress(top, left); u32 pa = Draw_GetCurrentFramebufferAddress(top, left);
u8 *addr = (u8 *)PA_PTR(pa); u8 *addr = (u8 *)PA_PTR(pa);
for(u32 x = 0; x < width; x++) for(u32 x = 0; x < width; x++)
Draw_ConvertPixelToBGR8(line + x * 3 , addr + (x * 240 + y) * formatSizes[(u8)fmt], fmt); Draw_ConvertPixelToBGR8(line + x * 3 , addr + x * stride + y * formatSizes[(u8)fmt], fmt);
} }