X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fdos%2Fvidsys.c;h=9ee925e47dcfa224830d7b83bd6c18fcb8e22633;hb=HEAD;hp=7b9f3d5114f4dc34628ea50186c8e4a4f85ac345;hpb=af36400e1b3d2d591beaf66e1539884434e30475;p=retroray diff --git a/src/dos/vidsys.c b/src/dos/vidsys.c index 7b9f3d5..9ee925e 100644 --- a/src/dos/vidsys.c +++ b/src/dos/vidsys.c @@ -197,17 +197,38 @@ void vid_getpal(int idx, int count, struct vid_color *col) cur_mode->ops.getpal(idx, count, col); } +void vid_blit(int x, int y, int w, int h, void *src, int pitch) +{ + if(pitch <= 0) { + pitch = cur_mode->width << 2; + } + cur_mode->ops.blit(x, y, w, h, src, pitch); +} + void vid_blitfb(void *fb, int pitch) { if(pitch <= 0) { - pitch = cur_mode->pitch; + pitch = cur_mode->width << 2; } cur_mode->ops.blitfb(fb, pitch); } +void vid_blit32(int x, int y, int w, int h, uint32_t *src, int pitch) +{ + if(cur_mode->bpp == 32) { + vid_blit(x, y, w, h, src, pitch); + return; + } + + if(pitch <= 0) { + pitch = cur_mode->width << 2; + } + /* XXX */ +} + void vid_blitfb32(uint32_t *src, int pitch) { - int i, j, winpos, winleft; + int i, j, winpos, winleft, endskip; unsigned char *dest; uint16_t *dest16; @@ -223,7 +244,7 @@ void vid_blitfb32(uint32_t *src, int pitch) if(vid_islinear()) { winleft = INT_MAX; } else { - winleft = 65536;/*cur_mode->win_size << 10;*/ + winleft = cur_mode->win_size << 10; winpos = 0; vid_setwin(0, 0); } @@ -242,22 +263,26 @@ void vid_blitfb32(uint32_t *src, int pitch) case 24: dest = vid_vmem; + endskip = cur_mode->pitch - cur_mode->width * 3; + for(i=0; iheight; i++) { for(j=0; jwidth; j++) { uint32_t pixel = src[j]; if(winleft <= 0) { winpos += cur_mode->win_step; vid_setwin(0, winpos); - winleft = 65536;/*cur_mode->win_size << 10;*/ + winleft = cur_mode->win_size << 10; dest = vid_vmem; } - dest[0] = (pixel >> 16) & 0xff; + dest[0] = pixel & 0xff; dest[1] = (pixel >> 8) & 0xff; - dest[2] = pixel & 0xff; + dest[2] = (pixel >> 16) & 0xff; dest += 3; winleft -= 3; } src = (uint32_t*)((char*)src + pitch); + dest += endskip; + winleft -= endskip; } break;