diff options
Diffstat (limited to 'src/ppu.c')
-rw-r--r-- | src/ppu.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -27,6 +27,7 @@ static size_t screen_height = 0; | |||
27 | static size_t bpp = 0; | 27 | static size_t bpp = 0; |
28 | static int fb_file = 0; | 28 | static int fb_file = 0; |
29 | static int refresh_file = 0; | 29 | static int refresh_file = 0; |
30 | static int zoom = 2; | ||
30 | 31 | ||
31 | static u8 *framebuffer = 0; | 32 | static u8 *framebuffer = 0; |
32 | 33 | ||
@@ -175,6 +176,8 @@ ppu_init(void) { | |||
175 | fprintf(stderr, "error: couldn't mmap the framebuffer\n"); | 176 | fprintf(stderr, "error: couldn't mmap the framebuffer\n"); |
176 | exit(EXIT_FAILURE); | 177 | exit(EXIT_FAILURE); |
177 | } | 178 | } |
179 | screen_width /= zoom; | ||
180 | screen_height /= zoom; | ||
178 | 181 | ||
179 | // Allocate intermediate buffers. | 182 | // Allocate intermediate buffers. |
180 | pixels_fg = malloc(screen_width * screen_height); | 183 | pixels_fg = malloc(screen_width * screen_height); |
@@ -222,7 +225,12 @@ blit_framebuffer(void) { | |||
222 | size_t idx = i + j * screen_width; | 225 | size_t idx = i + j * screen_width; |
223 | if (bpp == 16) { | 226 | if (bpp == 16) { |
224 | u16 *p = framebuffer; | 227 | u16 *p = framebuffer; |
225 | p[idx] = rgb565(palette[pixels_fg[idx] << 2 | pixels_bg[idx]]); | 228 | for (size_t zz = 0; zz < zoom; zz++) { |
229 | size_t fb_idx = (i * zoom + j * screen_width * zoom * zoom + zz * screen_width * zoom); | ||
230 | for (size_t z = 0; z < zoom; z++) { | ||
231 | p[fb_idx + z] = rgb565(palette[pixels_fg[idx] << 2 | pixels_bg[idx]]); | ||
232 | } | ||
233 | } | ||
226 | } else if (bpp == 32) { | 234 | } else if (bpp == 32) { |
227 | u32 *p = framebuffer; | 235 | u32 *p = framebuffer; |
228 | p[idx] = palette[pixels_fg[idx] << 2 | pixels_bg[idx]]; | 236 | p[idx] = palette[pixels_fg[idx] << 2 | pixels_bg[idx]]; |