X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=ginge.git;a=blobdiff_plain;f=common%2Fhost_fb.c;fp=common%2Fhost_fb.c;h=94910ec8b31abd23b6868de63adc44afd6a04c58;hp=46467d469acea8e65468bc9a53e3623248753470;hb=6ca083930098ee075c8f61cf2c04d616349959c3;hpb=e6c89531c9402107731e5b5ef5c34282ce5967a4 diff --git a/common/host_fb.c b/common/host_fb.c index 46467d4..94910ec 100644 --- a/common/host_fb.c +++ b/common/host_fb.c @@ -14,6 +14,7 @@ static int host_stride; #include "fbdev.c" static struct vout_fbdev *fbdev; +static unsigned short host_pal[256]; void *host_video_flip(void) { @@ -42,39 +43,13 @@ int host_video_init(int *stride, int no_dblbuf) return 0; } -#elif defined(WIZ) - -#include "warm.c" -#include "wiz_video.c" - -void *host_video_flip(void) +void host_video_finish(void) { - vout_gp2x_flip(); - host_screen = g_screen_ptr; - return host_screen; + vout_fbdev_finish(fbdev); + fbdev = NULL; } -int host_video_init(int *stride, int no_dblbuf) -{ - int ret; - - host_stride = 320 * 2; - if (stride != 0) - *stride = host_stride; - - ret = vout_gp2x_init(no_dblbuf); - if (ret != 0) - return ret; - - host_video_flip(); - return 0; -} - -#endif - -static unsigned short host_pal[256]; - -static void host_update_pal(unsigned int *pal) +void host_video_update_pal(unsigned int *pal) { unsigned short *dstp = host_pal; int i; @@ -85,15 +60,16 @@ static void host_update_pal(unsigned int *pal) } } -void host_video_blit4(const unsigned char *src, int w, int h, unsigned int *pal) +void host_video_change_bpp(int bpp) +{ +} + +void host_video_blit4(const unsigned char *src, int w, int h) { unsigned short *dst = host_screen; unsigned short *hpal = host_pal; int i, u; - if (pal != NULL) - host_update_pal(pal); - for (i = 0; i < 240; i++, dst += host_stride / 2 - 320) { for (u = 320 / 2; u > 0; u--, src++) { *dst++ = hpal[*src >> 4]; @@ -104,15 +80,12 @@ void host_video_blit4(const unsigned char *src, int w, int h, unsigned int *pal) host_video_flip(); } -void host_video_blit8(const unsigned char *src, int w, int h, unsigned int *pal) +void host_video_blit8(const unsigned char *src, int w, int h) { unsigned short *dst = host_screen; unsigned short *hpal = host_pal; int i, u; - if (pal != NULL) - host_update_pal(pal); - for (i = 0; i < 240; i++, dst += host_stride / 2 - 320) { for (u = 320 / 4; u > 0; u--) { *dst++ = hpal[*src++]; @@ -136,3 +109,73 @@ void host_video_blit16(const unsigned short *src, int w, int h) host_video_flip(); } +#elif defined(WIZ) + +#include "warm.c" +#include "wiz_video.c" + +void *host_video_flip(void) +{ + vout_gp2x_flip(); + host_screen = g_screen_ptr; + return host_screen; +} + +int host_video_init(int *stride, int no_dblbuf) +{ + int ret; + + host_stride = 320 * 2; + if (stride != 0) + *stride = host_stride; + + ret = vout_gp2x_init(no_dblbuf); + if (ret != 0) + return ret; + + vout_gp2x_set_mode(16, !no_dblbuf); + host_video_flip(); + return 0; +} + +void host_video_finish(void) +{ + vout_gp2x_finish(); +} + +void host_video_update_pal(unsigned int *pal) +{ + vout_gp2x_set_palette(pal, 256); +} + +void host_video_change_bpp(int bpp) +{ + vout_gp2x_set_mode(bpp, 1); +} + +#ifdef LOADER +void host_video_blit4(const unsigned char *src, int w, int h) +{ + memcpy(host_screen, src, 320*240/2); // FIXME + host_video_flip(); +} + +void host_video_blit8(const unsigned char *src, int w, int h) +{ + extern void rotated_blit8(void *dst, const void *linesx4); + + rotated_blit8(host_screen, src); + host_video_flip(); +} + +void host_video_blit16(const unsigned short *src, int w, int h) +{ + extern void rotated_blit16(void *dst, const void *linesx4); + + rotated_blit16(host_screen, src); + host_video_flip(); +} +#endif // LOADER + +#endif // WIZ +