From 20c7a06a84cd4710fee7973dad31ac2b5fdd037f Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 13 Nov 2020 17:12:08 +0900 Subject: [PATCH] examples/fboverlay/fboverlay_main.c: Appease nxstyle --- examples/fboverlay/fboverlay_main.c | 106 +++++++++++++++------------- 1 file changed, 58 insertions(+), 48 deletions(-) diff --git a/examples/fboverlay/fboverlay_main.c b/examples/fboverlay/fboverlay_main.c index 025e1001a..d84c112e5 100644 --- a/examples/fboverlay/fboverlay_main.c +++ b/examples/fboverlay/fboverlay_main.c @@ -292,30 +292,30 @@ static void draw_rect32(FAR void *fbmem, FAR struct fb_overlayinfo_s * oinfo, #ifdef CONFIG_FB_CMAP static int video_putcmap(int fb, FAR const struct fb_cmap_s *cmap) { - int n; - int ret; + int n; + int ret; - printf("Set cmap\n"); - for (n = cmap->first; n < cmap->len; n++) - { - printf(" Color %d: (a,r,g,b) = (%02x,%02x,%02x,%02x)\n", n, + printf("Set cmap\n"); + for (n = cmap->first; n < cmap->len; n++) + { + printf(" Color %d: (a,r,g,b) = (%02x,%02x,%02x,%02x)\n", n, # ifdef CONFIG_CMAP_TRANSPARENCY - cmap->transp[n], + cmap->transp[n], # else - (uint8_t)0xff, + (uint8_t)0xff, # endif - cmap->red[n], - cmap->green[n], - cmap->blue[n]); - } + cmap->red[n], + cmap->green[n], + cmap->blue[n]); + } - ret = ioctl(fb, FBIOPUT_CMAP, (unsigned long)(uintptr_t)cmap); - if (ret != OK) - { - fprintf(stderr, "Unable to set camp\n"); - } + ret = ioctl(fb, FBIOPUT_CMAP, (unsigned long)(uintptr_t)cmap); + if (ret != OK) + { + fprintf(stderr, "Unable to set camp\n"); + } - return ret; + return ret; } /**************************************************************************** @@ -332,30 +332,30 @@ static int video_putcmap(int fb, FAR const struct fb_cmap_s *cmap) static int video_getcmap(int fb, FAR struct fb_cmap_s *cmap) { - int n; - int ret; + int n; + int ret; - ret = ioctl(fb, FBIOGET_CMAP, (unsigned long)(uintptr_t)cmap); - if (ret != OK) - { - fprintf(stderr, "Unable to set camp\n"); - } + ret = ioctl(fb, FBIOGET_CMAP, (unsigned long)(uintptr_t)cmap); + if (ret != OK) + { + fprintf(stderr, "Unable to set camp\n"); + } - printf("Get cmap\n"); - for (n = cmap->first; n < cmap->len; n++) - { - printf(" Color %d: (a,r,g,b) = (%02x,%02x,%02x,%02x)\n", n, + printf("Get cmap\n"); + for (n = cmap->first; n < cmap->len; n++) + { + printf(" Color %d: (a,r,g,b) = (%02x,%02x,%02x,%02x)\n", n, # ifdef CONFIG_CMAP_TRANSPARENCY - cmap->transp[n], + cmap->transp[n], # else - (uint8_t)0xff, + (uint8_t)0xff, # endif - cmap->red[n], - cmap->green[n], - cmap->blue[n]); - } + cmap->red[n], + cmap->green[n], + cmap->blue[n]); + } - return ret; + return ret; } #endif /* CONFIG_FB_CMAP */ @@ -415,8 +415,8 @@ static void print_plane_info(int fb) return; } - fbmem = mmap(NULL, pinfo.fblen, PROT_READ|PROT_WRITE, - MAP_SHARED|MAP_FILE, fb, 0); + fbmem = mmap(NULL, pinfo.fblen, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_FILE, fb, 0); if (fbmem == MAP_FAILED) { @@ -430,7 +430,8 @@ static void print_plane_info(int fb) " stride: %u\n" " display: %u\n" " bpp: %u\n", - pinfo.fbmem, (unsigned long)pinfo.fblen, pinfo.stride, pinfo.display, + pinfo.fbmem, (unsigned long)pinfo.fblen, pinfo.stride, + pinfo.display, pinfo.bpp, fbmem); } @@ -470,8 +471,8 @@ static void print_overlay_info(int fb, uint8_t overlayno) return; } - fbmem = mmap(NULL, oinfo.fblen, PROT_READ|PROT_WRITE, - MAP_SHARED|MAP_FILE, fb, 0); + fbmem = mmap(NULL, oinfo.fblen, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_FILE, fb, 0); if (fbmem == MAP_FAILED) { @@ -492,7 +493,8 @@ static void print_overlay_info(int fb, uint8_t overlayno) " mode: %08x\n" " accl: %08x\n" " mmap: %p\n", - oinfo.fbmem, (unsigned long)oinfo.fblen, oinfo.stride, oinfo.overlay, + oinfo.fbmem, (unsigned long)oinfo.fblen, oinfo.stride, + oinfo.overlay, oinfo.bpp, oinfo.blank, oinfo.chromakey, oinfo.color, oinfo.transp.transp, oinfo.transp.transp_mode, oinfo.accl, fbmem); } @@ -541,8 +543,8 @@ static int overlay_fill(int fb, uint8_t overlayno, uint32_t color, return -1; } - fbmem = mmap(NULL, oinfo.fblen, PROT_READ|PROT_WRITE, - MAP_SHARED|MAP_FILE, fb, 0); + fbmem = mmap(NULL, oinfo.fblen, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_FILE, fb, 0); if (fbmem == MAP_FAILED) { @@ -556,7 +558,8 @@ static int overlay_fill(int fb, uint8_t overlayno, uint32_t color, if (offset > oinfo.fblen) { - fprintf(stderr, "Area is out of range: %d >= %d\n", offset, oinfo.fblen); + fprintf(stderr, "Area is out of range: %d >= %d\n", offset, + oinfo.fblen); return -1; } @@ -736,7 +739,8 @@ static int overlay_transp(int fb, FAR struct fb_overlayinfo_s *oinfo) ret = overlay_accl(fb, oinfo->overlay, FB_ACCL_TRANSP); if (ret != OK) { - fprintf(stderr, "No hardware acceleration to set the transparency within " + fprintf(stderr, + "No hardware acceleration to set the transparency within " "the selected overlay area\n"); } else @@ -893,6 +897,7 @@ static int overlay_blend(int fb, FAR struct fb_overlayblend_s *blend) { ret = overlay_accl(fb, blend->background.overlay, FB_ACCL_BLEND); } + if (ret == OK) { ret = overlay_accl(fb, blend->dest.overlay, FB_ACCL_BLEND); @@ -991,7 +996,8 @@ static void usage(const char * progname) " 1 : Off\n" " -area overlayno \n" #ifdef CONFIG_FB_OVERLAY_BLIT - " -blit doverlayno \n" + " -blit doverlayno " + "\n" " soverlayno \n" " -blend doverlayno \n" " foverlayno \n" @@ -1012,7 +1018,6 @@ static void usage(const char * progname) int main(int argc, FAR char *argv[]) { - char *fbdevice; int fb = -1; @@ -1092,21 +1097,26 @@ int main(int argc, FAR char *argv[]) rgb8888(strtoul(argv[3], NULL, 16), &a[1], &r[1], &g[1], &b[1]); cmap.len = 2; } + if (argc >= 4) { rgb8888(strtoul(argv[4], NULL, 16), &a[2], &r[2], &g[2], &b[2]); cmap.len = 3; } + if (argc >= 5) + { rgb8888(strtoul(argv[5], NULL, 16), &a[3], &r[3], &g[3], &b[3]); cmap.len = 4; } + if (argc >= 6) { rgb8888(strtoul(argv[6], NULL, 16), &a[4], &r[4], &g[4], &b[4]); cmap.len = 5; } + # ifdef CONFIG_FB_TRANSPARENCY cmap.transp = a; # endif