diff options
author | godspeed1989 <tongxinjichu@gmail.com> | 2013-05-08 10:02:35 +0800 |
---|---|---|
committer | godspeed1989 <tongxinjichu@gmail.com> | 2013-05-08 10:02:35 +0800 |
commit | 7672c628aedb3ebe98e843b82dfba8cf848c8e5c (patch) | |
tree | 60738a25c6dcafa1d5ff3bcd30a06f5dabf2deb4 | |
parent | e0ca0d4bcbd1195dc6f173c07bdfa61335306746 (diff) | |
download | fbv-7672c628aedb3ebe98e843b82dfba8cf848c8e5c.tar.gz fbv-7672c628aedb3ebe98e843b82dfba8cf848c8e5c.zip |
fix g++ compile err
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | fb_display.c | 21 | ||||
-rw-r--r-- | fbv.h | 4 | ||||
-rw-r--r-- | jpeg.c | 2 | ||||
-rw-r--r-- | png.c | 6 |
5 files changed, 20 insertions, 15 deletions
@@ -5,7 +5,7 @@ include Make.conf -CC = gcc +CC = g++ CFLAGS = -Wall -D_GNU_SOURCE SOURCES = main.c jpeg.c png.c bmp.c fb_display.c transforms.c diff --git a/fb_display.c b/fb_display.c index db45840..542816e 100644 --- a/fb_display.c +++ b/fb_display.c @@ -15,12 +15,12 @@ #include <string.h> /* Public Use Functions: * - * extern void fb_display(unsigned char *rgbbuff, + * extern int fb_display(unsigned char *rgbbuff, * int x_size, int y_size, * int x_pan, int y_pan, * int x_offs, int y_offs); * - * extern void getCurrentRes(int *x,int *y); + * extern int getCurrentRes(int *x,int *y); * */ @@ -37,20 +37,23 @@ void setVarScreenInfo(int fh, struct fb_var_screeninfo *var); void getFixScreenInfo(int fh, struct fb_fix_screeninfo *fix); void set332map(int fh); void* convertRGB2FB(int fh, unsigned char *rgbbuff, unsigned long count, int bpp, int *cpp); -void blit2FB(int fh, void *fbbuff, unsigned char *alpha, +void blit2FB(int fh, unsigned char *fbbuff, unsigned char *alpha, unsigned int pic_xs, unsigned int pic_ys, unsigned int scr_xs, unsigned int scr_ys, unsigned int xp, unsigned int yp, unsigned int xoffs, unsigned int yoffs, int cpp); -int fb_display(unsigned char *rgbbuff, unsigned char * alpha, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs) +int fb_display(unsigned char *rgbbuff, unsigned char * alpha, + unsigned int x_size, unsigned int y_size, + unsigned int x_pan, unsigned int y_pan, + unsigned int x_offs, unsigned int y_offs) { struct fb_var_screeninfo var; struct fb_fix_screeninfo fix; - unsigned short *fbbuff = NULL; + unsigned char *fbbuff = NULL; int fh = -1, bp = 0; - unsigned long x_stride; + unsigned int x_stride; /* get the framebuffer device handle */ fh = openFB(NULL); @@ -71,7 +74,7 @@ int fb_display(unsigned char *rgbbuff, unsigned char * alpha, int x_size, int y_ if(y_offs + y_size > var.yres) y_offs = 0; /* blit buffer 2 fb */ - fbbuff = convertRGB2FB(fh, rgbbuff, x_size * y_size, var.bits_per_pixel, &bp); + fbbuff = (unsigned char*)convertRGB2FB(fh, rgbbuff, x_size * y_size, var.bits_per_pixel, &bp); #if 0 blit2FB(fh, fbbuff, alpha, x_size, y_size, x_stride, var.yres, x_pan, y_pan, x_offs, y_offs, bp); #else @@ -195,7 +198,7 @@ void set332map(int fh) set8map(fh, &map332); } -void blit2FB(int fh, void *fbbuff, unsigned char *alpha, +void blit2FB(int fh, unsigned char *fbbuff, unsigned char *alpha, unsigned int pic_xs, unsigned int pic_ys, unsigned int scr_xs, unsigned int scr_ys, unsigned int xp, unsigned int yp, @@ -211,7 +214,7 @@ void blit2FB(int fh, void *fbbuff, unsigned char *alpha, xc = (pic_xs > scr_xs) ? scr_xs : pic_xs; yc = (pic_ys > scr_ys) ? scr_ys : pic_ys; - fb = mmap(NULL, scr_xs * scr_ys * cpp, PROT_WRITE | PROT_READ, MAP_SHARED, fh, 0); + fb = (unsigned char*)mmap(NULL, scr_xs * scr_ys * cpp, PROT_WRITE | PROT_READ, MAP_SHARED, fh, 0); if(fb == MAP_FAILED) { @@ -6,7 +6,9 @@ #define FH_ERROR_FORMAT 2 /* file format error */ int fb_display(unsigned char *rgbbuff, unsigned char * alpha, - int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs); + unsigned int x_size, unsigned int y_size, + unsigned int x_pan, unsigned int y_pan, + unsigned int x_offs, unsigned int y_offs); int getCurrentRes(int *x, int *y); #ifdef FBV_SUPPORT_BMP @@ -71,7 +71,7 @@ int fh_jpeg_load(char *filename, unsigned char *buffer, unsigned char ** alpha, if(c==3) { - lb = (*ciptr->mem->alloc_small)((j_common_ptr)ciptr, JPOOL_PERMANENT, c*px); + lb = (JSAMPLE*)(*ciptr->mem->alloc_small)((j_common_ptr)ciptr, JPOOL_PERMANENT, c*px); bp = buffer; while (ciptr->output_scanline < ciptr->output_height) { @@ -28,12 +28,12 @@ int fh_png_id(char *name) } -int fh_png_load(char *name,unsigned char *buffer, unsigned char ** alpha,int x,int y) +int fh_png_load(char *name, unsigned char *buffer, unsigned char ** alpha,int x,int y) { png_structp png_ptr; png_infop info_ptr; png_uint_32 width, height; - int i; + png_uint_32 i; int bit_depth, color_type, interlace_type; int number_passes,pass, trans = 0; png_bytep rptr[2]; @@ -94,7 +94,7 @@ int fh_png_load(char *name,unsigned char *buffer, unsigned char ** alpha,int x,i aptr = alpha_buffer; for(i=0; i<height; i++) { - int n; + png_uint_32 n; unsigned char *trp = rp; png_read_rows(png_ptr, rptr, NULL, 1); for(n = 0; n < width; n++, fbptr += 3, trp += 4) |