From 35a206fe888d688884f93b3870054cea09a53b5e Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 28 Nov 2008 13:57:20 +0000 Subject: Add more trapezoid support git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1324 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/graphics/nxbe/nxbe.h | 20 ++++++++ nuttx/graphics/nxglib/Make.defs | 3 +- nuttx/graphics/nxglib/nxglib_runcopy.c | 84 +++++++++++++++++++++++++++++++++ nuttx/graphics/nxglib/nxglib_trapcopy.c | 84 +++++++++++++++++++++++++++++++++ nuttx/include/nuttx/nxglib.h | 24 ++++++++++ 5 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 nuttx/graphics/nxglib/nxglib_runcopy.c create mode 100644 nuttx/graphics/nxglib/nxglib_trapcopy.c (limited to 'nuttx') diff --git a/nuttx/graphics/nxbe/nxbe.h b/nuttx/graphics/nxbe/nxbe.h index 958ea9f35..077d8214e 100644 --- a/nuttx/graphics/nxbe/nxbe.h +++ b/nuttx/graphics/nxbe/nxbe.h @@ -286,6 +286,26 @@ EXTERN void nxbe_fill(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_rect_s *rect, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); +/**************************************************************************** + * Name: nxbe_filltrapezoid + * + * Description: + * Fill the specified rectangle in the window with the specified color + * + * Input Parameters: + * wnd - The window structure reference + * rect - The location to be filled + * col - The color to use in the fill + * + * Return: + * None + * + ****************************************************************************/ + +EXTERN void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd, + FAR const struct nxgl_trapezoid_s *trap, + nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); + /**************************************************************************** * Name: nxbe_move * diff --git a/nuttx/graphics/nxglib/Make.defs b/nuttx/graphics/nxglib/Make.defs index 82ce3bdd9..b93e135cc 100644 --- a/nuttx/graphics/nxglib/Make.defs +++ b/nuttx/graphics/nxglib/Make.defs @@ -54,7 +54,8 @@ RCOPY2_CSRCS = nxglib_copyrectangle_8bpp.c nxglib_copyrectangle_16bpp.c \ RECT_CSRCS = nxglib_rectcopy.c nxglib_rectoffset.c nxglib_vectoradd.c \ nxglib_rectintersect.c nxglib_nonintersecting.c \ nxglib_rectoverlap.c nxglib_nullrect.c -TRAP_CSRCS = nxglib_runoffset.c nxglib_trapoffset.c +TRAP_CSRCS = nxglib_runoffset.c nxglib_runcopy.c \ + nxglib_trapoffset.c nxglib_trapcopy.c NXGLIB_CSRCS = nxglib_rgb2yuv.c nxglib_yuv2rgb.c \ $(RFILL1_CSRCS) $(RFILL2_CSRCS) $(TFILL1_CSRCS) $(TFILL2_CSRCS) \ $(RMOVE1_CSRCS) $(RMOVE2_CSRCS) $(RCOPY1_CSRCS) $(RCOPY2_CSRCS) \ diff --git a/nuttx/graphics/nxglib/nxglib_runcopy.c b/nuttx/graphics/nxglib/nxglib_runcopy.c new file mode 100644 index 000000000..4d4b1abc5 --- /dev/null +++ b/nuttx/graphics/nxglib/nxglib_runcopy.c @@ -0,0 +1,84 @@ +/**************************************************************************** + * graphics/nxglib/nxsglib_runcopy.c + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxgl_runcopy + * + * Description: + * This is essentially memcpy for runs. We don't do structure assignments + * because some compilers are not good at that. + * + ****************************************************************************/ + +void nxgl_runcopy(FAR struct nxgl_run_s *dest, FAR const struct nxgl_run_s *src) +{ + dest->x1 = src->x1; + dest->x2 = src->x2; + dest->y = src->y; +} diff --git a/nuttx/graphics/nxglib/nxglib_trapcopy.c b/nuttx/graphics/nxglib/nxglib_trapcopy.c new file mode 100644 index 000000000..94b8a4d28 --- /dev/null +++ b/nuttx/graphics/nxglib/nxglib_trapcopy.c @@ -0,0 +1,84 @@ +/**************************************************************************** + * graphics/nxglib/nxsglib_trapcopy.c + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxgl_trapcopy + * + * Description: + * This is essentially memcpy for trapezoids. We don't do structure + * assignments because some compilers are not good at that. + * + ****************************************************************************/ + +void nxgl_trapcopy(FAR struct nxgl_trapezoid_s *dest, + FAR const struct nxgl_trapezoid_s *src) +{ + nxgl_runcopy(&dest->top, &src->top); + nxgl_runcopy(&dest->bot, &src->bot); +} diff --git a/nuttx/include/nuttx/nxglib.h b/nuttx/include/nuttx/nxglib.h index 79e10d603..47471a5f8 100644 --- a/nuttx/include/nuttx/nxglib.h +++ b/nuttx/include/nuttx/nxglib.h @@ -410,6 +410,18 @@ EXTERN void nxgl_runoffset(FAR struct nxgl_run_s *dest, FAR const struct nxgl_run_s *src, nxgl_coord_t dx, nxgl_coord_t dy); +/**************************************************************************** + * Name: nxgl_runcopy + * + * Description: + * This is essentially memcpy for runs. We don't do structure assignments + * because some compilers are not good at that. + * + ****************************************************************************/ + +EXTERN void nxgl_runcopy(FAR struct nxgl_run_s *dest, + FAR const struct nxgl_run_s *src); + /**************************************************************************** * Name: nxgl_trapoffset * @@ -422,6 +434,18 @@ EXTERN void nxgl_trapoffset(FAR struct nxgl_trapezoid_s *dest, FAR const struct nxgl_trapezoid_s *src, nxgl_coord_t dx, nxgl_coord_t dy); +/**************************************************************************** + * Name: nxgl_trapcopy + * + * Description: + * This is essentially memcpy for trapezoids. We don't do structure + * assignments because some compilers are not good at that. + * + ****************************************************************************/ + +EXTERN void nxgl_trapcopy(FAR struct nxgl_trapezoid_s *dest, + FAR const struct nxgl_trapezoid_s *src); + #undef EXTERN #if defined(__cplusplus) } -- cgit v1.2.3