aviralgarg05 commented on code in PR #3644:
URL: https://github.com/apache/nuttx-apps/pull/3644#discussion_r3597242281
##########
games/NXDoom/src/i_video.c:
##########
@@ -262,27 +269,61 @@ static void blit_screen(void)
uint8_t p_idx;
void *fbptr;
- /* TODO: It would be best to do this more efficiently/with less memory.
- * It also would be good if we could handle the palette translation here
- * such that DOOM can be played on frame buffers with differing bit depths
- * and pixel formats.
- */
+ /* TODO: It would be best to do this more efficiently/with less memory. */
- fbptr = g_graphics_state.fbmem;
- for (unsigned y = 0; y < SCREENHEIGHT * g_graphics_state.scale; y++)
+ fbptr = g_graphics_state.fbmem +
+ g_graphics_state.yoffset * g_graphics_state.pinfo.stride +
+ g_graphics_state.xoffset *
+ (g_graphics_state.pinfo.bpp == 16 ? 2 : 4);
+
+ if (g_graphics_state.pinfo.bpp == 16)
Review Comment:
You're right, the loops are identical except the pixel-format branch
I'll collapse it into one loop with the if at the write step instead of
duplicating the whole thing. And yes, this is tested on real hardware, not just
theoretical: my actual target board's framebuffer is RGB565 (FB_FMT_RGB16_565),
so the 16-bit path is what I'm running
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]