amiga_imgv
diff src/amiga/gfx.c @ 4:0fd37effde29
progress
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 27 Oct 2017 11:36:18 +0300 |
parents | 663471a80c21 |
children | 0d3d7b020e6a |
line diff
1.1 --- a/src/amiga/gfx.c Thu Oct 26 15:49:56 2017 +0300 1.2 +++ b/src/amiga/gfx.c Fri Oct 27 11:36:18 2017 +0300 1.3 @@ -4,6 +4,7 @@ 1.4 #include "copper.h" 1.5 #include "hwregs.h" 1.6 #include "logger.h" 1.7 +#include "image.h" 1.8 1.9 static int scr_width, scr_height; 1.10 static int fb_width, fb_height; 1.11 @@ -124,7 +125,7 @@ 1.12 bpladdr = (uint32_t)framebuf; 1.13 logmsg("bitplane address: %lx\n", (unsigned long)bpladdr); 1.14 1.15 - bplmod = (fb_width - scr_width) / 8 + fb_width / 8 * num_bitplanes; 1.16 + bplmod = (fb_width - scr_width) / 8 + fb_width / 8 * (num_bitplanes - 1); 1.17 REG_BPL1MOD = bplmod; 1.18 REG_BPL2MOD = bplmod; 1.19 1.20 @@ -205,4 +206,36 @@ 1.21 1.22 void gfx_show_image(struct ham_image *img) 1.23 { 1.24 + int i, j, k, fbwidth, fbheight, ncolors, prev_line; 1.25 + unsigned char *fbptr = gfx_get_framebuffer(); 1.26 + struct palchange *chg = img->chglist; 1.27 + 1.28 + fbwidth = gfx_framebuffer_width(); 1.29 + fbheight = gfx_framebuffer_height(); 1.30 + 1.31 + logmsg("showing ham image %dx%d\n", fbwidth, fbheight); 1.32 + 1.33 + memcpy(fbptr, img->pixels, fbwidth * fbheight / 8 * num_bitplanes); 1.34 + 1.35 + /* create copper list that handles the palette */ 1.36 + clear_copper(); 1.37 + gfx_begin_copperlist(); 1.38 + /* initial palette at the start of frame */ 1.39 + for(i=0; i<16; i++) { 1.40 + add_copper(COPPER_MOVE(REGN_COLOR(i), img->palette[i])); 1.41 + logmsg("copper palette[%d]: %x\n", i, (unsigned int)img->palette[i]); 1.42 + } 1.43 +#if 0 1.44 + /* add copper instructions for palette changes according to the image changelist */ 1.45 + prev_line = -1; 1.46 + while(chg) { 1.47 + assert(chg->line >= prev_line); 1.48 + if(chg->line != prev_line) { 1.49 + prev_line = chg->line; 1.50 + add_copper(COPPER_VWAIT(chg->line)); 1.51 + } 1.52 + add_copper(COPPER_MOVE(REGN_COLOR(chg->entry >> 12), chg->entry & 0xfff)); 1.53 + } 1.54 +#endif 1.55 + add_copper(COPPER_END); 1.56 }