amiga_imgv
diff src/sdl/gfx.c @ 11:3d9aaefb8ba6
interlace mode
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 30 Oct 2017 15:24:23 +0200 |
parents | 5614fbb9c1de |
children |
line diff
1.1 --- a/src/sdl/gfx.c Sun Oct 29 22:53:41 2017 +0200 1.2 +++ b/src/sdl/gfx.c Mon Oct 30 15:24:23 2017 +0200 1.3 @@ -50,6 +50,8 @@ 1.4 1.5 void *gfx_set_framebuffer(void *fb, int width, int height) 1.6 { 1.7 + fb_width = width; 1.8 + fb_height = height; 1.9 return 0; 1.10 } 1.11 1.12 @@ -131,13 +133,15 @@ 1.13 1.14 void gfx_show_image(struct ham_image *img) 1.15 { 1.16 - int i, j, k; 1.17 - uint32_t color, palette[16]; 1.18 + int i, j, k, ncolors; 1.19 + uint32_t color, palette[256]; 1.20 uint32_t *dest; 1.21 unsigned char *src; 1.22 struct palchange *chg = img->chglist; 1.23 1.24 - for(i=0; i<16; i++) { 1.25 + ncolors = 1 << img->nbitplanes; 1.26 + 1.27 + for(i=0; i<ncolors; i++) { 1.28 uint16_t pcol = img->palette[i]; 1.29 int red = ARED(pcol); 1.30 int green = AGREEN(pcol); 1.31 @@ -152,6 +156,8 @@ 1.32 dest = fbsurf->pixels; 1.33 src = img->pixels; 1.34 for(i=0; i<img->height; i++) { 1.35 + if(i >= scr_height) break; 1.36 + 1.37 while(chg && chg->line <= i) { 1.38 int idx = (chg->entry & 0xf000) >> 12; 1.39 int red = ARED(chg->entry);