examples/fboverlay/fboverlay_main.c: Appease nxstyle

This commit is contained in:
YAMAMOTO Takashi 2020-11-13 17:12:08 +09:00 committed by Xiang Xiao
parent 379c0c1fd4
commit 20c7a06a84

View File

@ -292,30 +292,30 @@ static void draw_rect32(FAR void *fbmem, FAR struct fb_overlayinfo_s * oinfo,
#ifdef CONFIG_FB_CMAP #ifdef CONFIG_FB_CMAP
static int video_putcmap(int fb, FAR const struct fb_cmap_s *cmap) static int video_putcmap(int fb, FAR const struct fb_cmap_s *cmap)
{ {
int n; int n;
int ret; int ret;
printf("Set cmap\n"); printf("Set cmap\n");
for (n = cmap->first; n < cmap->len; n++) for (n = cmap->first; n < cmap->len; n++)
{ {
printf(" Color %d: (a,r,g,b) = (%02x,%02x,%02x,%02x)\n", n, printf(" Color %d: (a,r,g,b) = (%02x,%02x,%02x,%02x)\n", n,
# ifdef CONFIG_CMAP_TRANSPARENCY # ifdef CONFIG_CMAP_TRANSPARENCY
cmap->transp[n], cmap->transp[n],
# else # else
(uint8_t)0xff, (uint8_t)0xff,
# endif # endif
cmap->red[n], cmap->red[n],
cmap->green[n], cmap->green[n],
cmap->blue[n]); cmap->blue[n]);
} }
ret = ioctl(fb, FBIOPUT_CMAP, (unsigned long)(uintptr_t)cmap); ret = ioctl(fb, FBIOPUT_CMAP, (unsigned long)(uintptr_t)cmap);
if (ret != OK) if (ret != OK)
{ {
fprintf(stderr, "Unable to set camp\n"); 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) static int video_getcmap(int fb, FAR struct fb_cmap_s *cmap)
{ {
int n; int n;
int ret; int ret;
ret = ioctl(fb, FBIOGET_CMAP, (unsigned long)(uintptr_t)cmap); ret = ioctl(fb, FBIOGET_CMAP, (unsigned long)(uintptr_t)cmap);
if (ret != OK) if (ret != OK)
{ {
fprintf(stderr, "Unable to set camp\n"); fprintf(stderr, "Unable to set camp\n");
} }
printf("Get cmap\n"); printf("Get cmap\n");
for (n = cmap->first; n < cmap->len; n++) for (n = cmap->first; n < cmap->len; n++)
{ {
printf(" Color %d: (a,r,g,b) = (%02x,%02x,%02x,%02x)\n", n, printf(" Color %d: (a,r,g,b) = (%02x,%02x,%02x,%02x)\n", n,
# ifdef CONFIG_CMAP_TRANSPARENCY # ifdef CONFIG_CMAP_TRANSPARENCY
cmap->transp[n], cmap->transp[n],
# else # else
(uint8_t)0xff, (uint8_t)0xff,
# endif # endif
cmap->red[n], cmap->red[n],
cmap->green[n], cmap->green[n],
cmap->blue[n]); cmap->blue[n]);
} }
return ret; return ret;
} }
#endif /* CONFIG_FB_CMAP */ #endif /* CONFIG_FB_CMAP */
@ -415,8 +415,8 @@ static void print_plane_info(int fb)
return; return;
} }
fbmem = mmap(NULL, pinfo.fblen, PROT_READ|PROT_WRITE, fbmem = mmap(NULL, pinfo.fblen, PROT_READ | PROT_WRITE,
MAP_SHARED|MAP_FILE, fb, 0); MAP_SHARED | MAP_FILE, fb, 0);
if (fbmem == MAP_FAILED) if (fbmem == MAP_FAILED)
{ {
@ -430,7 +430,8 @@ static void print_plane_info(int fb)
" stride: %u\n" " stride: %u\n"
" display: %u\n" " display: %u\n"
" bpp: %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); pinfo.bpp, fbmem);
} }
@ -470,8 +471,8 @@ static void print_overlay_info(int fb, uint8_t overlayno)
return; return;
} }
fbmem = mmap(NULL, oinfo.fblen, PROT_READ|PROT_WRITE, fbmem = mmap(NULL, oinfo.fblen, PROT_READ | PROT_WRITE,
MAP_SHARED|MAP_FILE, fb, 0); MAP_SHARED | MAP_FILE, fb, 0);
if (fbmem == MAP_FAILED) if (fbmem == MAP_FAILED)
{ {
@ -492,7 +493,8 @@ static void print_overlay_info(int fb, uint8_t overlayno)
" mode: %08x\n" " mode: %08x\n"
" accl: %08x\n" " accl: %08x\n"
" mmap: %p\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.bpp, oinfo.blank, oinfo.chromakey, oinfo.color,
oinfo.transp.transp, oinfo.transp.transp_mode, oinfo.accl, fbmem); 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; return -1;
} }
fbmem = mmap(NULL, oinfo.fblen, PROT_READ|PROT_WRITE, fbmem = mmap(NULL, oinfo.fblen, PROT_READ | PROT_WRITE,
MAP_SHARED|MAP_FILE, fb, 0); MAP_SHARED | MAP_FILE, fb, 0);
if (fbmem == MAP_FAILED) if (fbmem == MAP_FAILED)
{ {
@ -556,7 +558,8 @@ static int overlay_fill(int fb, uint8_t overlayno, uint32_t color,
if (offset > oinfo.fblen) 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; 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); ret = overlay_accl(fb, oinfo->overlay, FB_ACCL_TRANSP);
if (ret != OK) 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"); "the selected overlay area\n");
} }
else 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); ret = overlay_accl(fb, blend->background.overlay, FB_ACCL_BLEND);
} }
if (ret == OK) if (ret == OK)
{ {
ret = overlay_accl(fb, blend->dest.overlay, FB_ACCL_BLEND); ret = overlay_accl(fb, blend->dest.overlay, FB_ACCL_BLEND);
@ -991,7 +996,8 @@ static void usage(const char * progname)
" 1 : Off\n" " 1 : Off\n"
" -area overlayno <xpos> <ypos> <xres> <yres>\n" " -area overlayno <xpos> <ypos> <xres> <yres>\n"
#ifdef CONFIG_FB_OVERLAY_BLIT #ifdef CONFIG_FB_OVERLAY_BLIT
" -blit doverlayno <destxpos> <destypos> <destxres> <destyres>\n" " -blit doverlayno <destxpos> <destypos> <destxres> "
"<destyres>\n"
" soverlayno <srcxpos> <srcypos> <srcxres> <srcyres>\n" " soverlayno <srcxpos> <srcypos> <srcxres> <srcyres>\n"
" -blend doverlayno <dxpos> <dypos> <dxres> <dyres>\n" " -blend doverlayno <dxpos> <dypos> <dxres> <dyres>\n"
" foverlayno <fxpos> <fypos> <fxres> <fyres>\n" " foverlayno <fxpos> <fypos> <fxres> <fyres>\n"
@ -1012,7 +1018,6 @@ static void usage(const char * progname)
int main(int argc, FAR char *argv[]) int main(int argc, FAR char *argv[])
{ {
char *fbdevice; char *fbdevice;
int fb = -1; 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]); rgb8888(strtoul(argv[3], NULL, 16), &a[1], &r[1], &g[1], &b[1]);
cmap.len = 2; cmap.len = 2;
} }
if (argc >= 4) if (argc >= 4)
{ {
rgb8888(strtoul(argv[4], NULL, 16), &a[2], &r[2], &g[2], &b[2]); rgb8888(strtoul(argv[4], NULL, 16), &a[2], &r[2], &g[2], &b[2]);
cmap.len = 3; cmap.len = 3;
} }
if (argc >= 5) if (argc >= 5)
{ {
rgb8888(strtoul(argv[5], NULL, 16), &a[3], &r[3], &g[3], &b[3]); rgb8888(strtoul(argv[5], NULL, 16), &a[3], &r[3], &g[3], &b[3]);
cmap.len = 4; cmap.len = 4;
} }
if (argc >= 6) if (argc >= 6)
{ {
rgb8888(strtoul(argv[6], NULL, 16), &a[4], &r[4], &g[4], &b[4]); rgb8888(strtoul(argv[6], NULL, 16), &a[4], &r[4], &g[4], &b[4]);
cmap.len = 5; cmap.len = 5;
} }
# ifdef CONFIG_FB_TRANSPARENCY # ifdef CONFIG_FB_TRANSPARENCY
cmap.transp = a; cmap.transp = a;
# endif # endif