diff options
Diffstat (limited to 'nuttx/graphics/nxglib')
40 files changed, 0 insertions, 5832 deletions
diff --git a/nuttx/graphics/nxglib/Make.defs b/nuttx/graphics/nxglib/Make.defs deleted file mode 100644 index 240cdbd7c..000000000 --- a/nuttx/graphics/nxglib/Make.defs +++ /dev/null @@ -1,93 +0,0 @@ -############################################################################ -# graphics/nxglib/Make.defs -# -# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt <gnutt@nuttx.org> -# -# 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. -# -############################################################################ - -NXGLIB_ASRCS = - -SETP1_CSRCS = nxglib_setpixel_1bpp.c nxglib_setpixel_2bpp.c \ - nxglib_setpixel_4bpp.c - -SETP2_CSRCS = nxglib_setpixel_8bpp.c nxglib_setpixel_16bpp.c \ - nxglib_setpixel_24bpp.c nxglib_setpixel_32bpp.c - -RFILL1_CSRCS = nxglib_fillrectangle_1bpp.c nxglib_fillrectangle_2bpp.c \ - nxglib_fillrectangle_4bpp.c - -RFILL2_CSRCS = nxglib_fillrectangle_8bpp.c nxglib_fillrectangle_16bpp.c \ - nxglib_fillrectangle_24bpp.c nxglib_fillrectangle_32bpp.c - -RGET1_CSRCS = nxglib_getrectangle_1bpp.c nxglib_getrectangle_2bpp.c \ - nxglib_getrectangle_4bpp.c - -RGET2_CSRCS = nxglib_getrectangle_8bpp.c nxglib_getrectangle_16bpp.c \ - nxglib_getrectangle_24bpp.c nxglib_getrectangle_32bpp.c - -TFILL1_CSRCS = nxglib_filltrapezoid_1bpp.c nxglib_filltrapezoid_2bpp.c \ - nxglib_filltrapezoid_4bpp.c - -TFILL2_CSRCS = nxglib_filltrapezoid_8bpp.c nxglib_filltrapezoid_16bpp.c \ - nxglib_filltrapezoid_24bpp.c nxglib_filltrapezoid_32bpp.c - -RMOVE1_CSRCS = nxglib_moverectangle_1bpp.c nxglib_moverectangle_2bpp.c \ - nxglib_moverectangle_4bpp.c - -RMOVE2_CSRCS = nxglib_moverectangle_8bpp.c nxglib_moverectangle_16bpp.c \ - nxglib_moverectangle_24bpp.c nxglib_moverectangle_32bpp.c - -RCOPY1_CSRCS = nxglib_copyrectangle_1bpp.c nxglib_copyrectangle_2bpp.c \ - nxglib_copyrectangle_4bpp.c - -RCOPY2_CSRCS = nxglib_copyrectangle_8bpp.c nxglib_copyrectangle_16bpp.c \ - nxglib_copyrectangle_24bpp.c nxglib_copyrectangle_32bpp.c - -RECT_CSRCS = nxglib_rectcopy.c nxglib_rectoffset.c nxglib_vectoradd.c \ - nxglib_vectsubtract.c nxglib_rectadd.c nxglib_rectintersect.c \ - nxglib_intersecting.c nxglib_nonintersecting.c nxglib_rectunion.c \ - nxglib_rectinside.c nxglib_rectoverlap.c nxglib_rectsize.c nxglib_nullrect.c - -TRAP_CSRCS = nxglib_runoffset.c nxglib_runcopy.c \ - nxglib_trapoffset.c nxglib_trapcopy.c - -COLOR_CSRCS = nxglib_colorcopy.c nxglib_rgb2yuv.c nxglib_yuv2rgb.c - -DRAW_CSRCS = nxglib_splitline.c nxglib_circlepts.c nxglib_circletraps.c - -LCD_CSRCS = - -NXGLIB_CSRCS = \ - $(SETP1_CSRCS) $(SETP2_CSRCS) $(RFILL1_CSRCS) $(RFILL2_CSRCS) \ - $(RGET1_CSRCS) $(RGET2_CSRCS) $(TFILL1_CSRCS) $(TFILL2_CSRCS) \ - $(RMOVE1_CSRCS) $(RMOVE2_CSRCS) $(RCOPY1_CSRCS) $(RCOPY2_CSRCS) \ - $(RECT_CSRCS) $(TRAP_CSRCS) $(COLOR_CSRCS) $(DRAW_CSRCS) $(LCD_CSRCS) - diff --git a/nuttx/graphics/nxglib/Makefile.sources b/nuttx/graphics/nxglib/Makefile.sources deleted file mode 100644 index 71d6e0661..000000000 --- a/nuttx/graphics/nxglib/Makefile.sources +++ /dev/null @@ -1,175 +0,0 @@ -############################################################################ -# graphics/nxglib/Makefile.sources -# -# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt <gnutt@nuttx.org> -# -# 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -ifeq ($(NXGLIB_BITSPERPIXEL),1) -NXGLIB_SUFFIX := _1bpp -SETP_CSRC := nxglib_setpixel_1bpp.c -RFILL_CSRC := nxglib_fillrectangle_1bpp.c -RGET_CSRC := nxglib_getrectangle_1bpp.c -TFILL_CSRC := nxglib_filltrapezoid_1bpp.c -RMOVE_CSRC := nxglib_moverectangle_1bpp.c -RCOPY_CSRC := nxglib_copyrectangle_1bpp.c -endif -ifeq ($(NXGLIB_BITSPERPIXEL),2) -NXGLIB_SUFFIX := _2bpp -SETP_CSRC := nxglib_setpixel_2bpp.c -RFILL_CSRC := nxglib_fillrectangle_2bpp.c -RGET_CSRC := nxglib_getrectangle_2bpp.c -TFILL_CSRC := nxglib_filltrapezoid_2bpp.c -RMOVE_CSRC := nxglib_moverectangle_2bpp.c -RCOPY_CSRC := nxglib_copyrectangle_2bpp.c -endif -ifeq ($(NXGLIB_BITSPERPIXEL),4) -NXGLIB_SUFFIX := _4bpp -SETP_CSRC := nxglib_setpixel_4bpp.c -RFILL_CSRC := nxglib_fillrectangle_4bpp.c -RGET_CSRC := nxglib_getrectangle_4bpp.c -TFILL_CSRC := nxglib_filltrapezoid_4bpp.c -RMOVE_CSRC := nxglib_moverectangle_4bpp.c -RCOPY_CSRC := nxglib_copyrectangle_4bpp.c -endif -ifeq ($(NXGLIB_BITSPERPIXEL),8) -NXGLIB_SUFFIX := _8bpp -SETP_CSRC := nxglib_setpixel_8bpp.c -RFILL_CSRC := nxglib_fillrectangle_8bpp.c -RGET_CSRC := nxglib_getrectangle_8bpp.c -TFILL_CSRC := nxglib_filltrapezoid_8bpp.c -RMOVE_CSRC := nxglib_moverectangle_8bpp.c -RCOPY_CSRC := nxglib_copyrectangle_8bpp.c -endif -ifeq ($(NXGLIB_BITSPERPIXEL),16) -NXGLIB_SUFFIX := _16bpp -SETP_CSRC := nxglib_setpixel_16bpp.c -RFILL_CSRC := nxglib_fillrectangle_16bpp.c -RGET_CSRC := nxglib_getrectangle_16bpp.c -TFILL_CSRC := nxglib_filltrapezoid_16bpp.c -RMOVE_CSRC := nxglib_moverectangle_16bpp.c -RCOPY_CSRC := nxglib_copyrectangle_16bpp.c -endif -ifeq ($(NXGLIB_BITSPERPIXEL),24) -NXGLIB_SUFFIX := _24bpp -SETP_CSRC := nxglib_setpixel_24bpp.c -RFILL_CSRC := nxglib_fillrectangle_24bpp.c -RGET_CSRC := nxglib_getrectangle_24bpp.c -TFILL_CSRC := nxglib_filltrapezoid_24bpp.c -RMOVE_CSRC := nxglib_moverectangle_24bpp.c -RCOPY_CSRC := nxglib_copyrectangle_24bpp.c -endif -ifeq ($(NXGLIB_BITSPERPIXEL),32) -NXGLIB_SUFFIX := _32bpp -SETP_CSRC := nxglib_setpixel_32bpp.c -RFILL_CSRC := nxglib_fillrectangle_32bpp.c -RGET_CSRC := nxglib_getrectangle_32bpp.c -TFILL_CSRC := nxglib_filltrapezoid_32bpp.c -RMOVE_CSRC := nxglib_moverectangle_32bpp.c -RCOPY_CSRC := nxglib_copyrectangle_32bpp.c -endif - -CPPFLAGS += -DNXGLIB_BITSPERPIXEL=$(NXGLIB_BITSPERPIXEL) -CPPFLAGS += -DNXGLIB_SUFFIX=$(NXGLIB_SUFFIX) - -SETP_TMP = $(SETP_CSRC:.c=.i) -RFILL_TMP = $(RFILL_CSRC:.c=.i) -RGET_TMP = $(RGET_CSRC:.c=.i) -TFILL_TMP = $(TFILL_CSRC:.c=.i) -RMOVE_TMP = $(RMOVE_CSRC:.c=.i) -RCOPY_TMP = $(RCOPY_CSRC:.c=.i) - -GEN_CSRCS = $(SETP_CSRC) $(RFILL_CSRC) $(RGET_CSRC) $(TFILL_CSRC) $(RMOVE_CSRC) $(RCOPY_CSRC) - -ifeq ($(CONFIG_NX_LCDDRIVER),y) -BLITDIR = lcd -else -BLITDIR = fb -endif - -all: $(GEN_CSRCS) -.PHONY : clean distclean - -$(SETP_CSRC) : $(BLITDIR)/nxglib_setpixel.c nxglib_bitblit.h -ifneq ($(NXGLIB_BITSPERPIXEL),) - $(call PREPROCESS, $(BLITDIR)/nxglib_setpixel.c, $(SETP_TMP)) - $(Q) cat $(SETP_TMP) | sed -e "/^#/d" >$@ - $(Q) rm -f $(SETP_TMP) -endif - -$(RFILL_CSRC) : $(BLITDIR)/nxglib_fillrectangle.c nxglib_bitblit.h -ifneq ($(NXGLIB_BITSPERPIXEL),) - $(call PREPROCESS, $(BLITDIR)/nxglib_fillrectangle.c, $(RFILL_TMP)) - $(Q) cat $(RFILL_TMP) | sed -e "/^#/d" >$@ - $(Q) rm -f $(RFILL_TMP) -endif - -$(RGET_CSRC) : $(BLITDIR)/nxglib_getrectangle.c nxglib_bitblit.h -ifneq ($(NXGLIB_BITSPERPIXEL),) - $(call PREPROCESS, $(BLITDIR)/nxglib_getrectangle.c, $(RGET_TMP)) - $(Q) cat $(RGET_TMP) | sed -e "/^#/d" >$@ - $(Q) rm -f $(RGET_TMP) -endif - -$(TFILL_CSRC) : $(BLITDIR)/nxglib_filltrapezoid.c nxglib_bitblit.h -ifneq ($(NXGLIB_BITSPERPIXEL),) - $(call PREPROCESS, $(BLITDIR)/nxglib_filltrapezoid.c, $(TFILL_TMP)) - $(Q) cat $(TFILL_TMP) | sed -e "/^#/d" >$@ - $(Q) rm -f $(TFILL_TMP) -endif - -$(RMOVE_CSRC) : $(BLITDIR)/nxglib_moverectangle.c nxglib_bitblit.h -ifneq ($(NXGLIB_BITSPERPIXEL),) - $(call PREPROCESS, $(BLITDIR)/nxglib_moverectangle.c, $(RMOVE_TMP)) - $(Q) cat $(RMOVE_TMP) | sed -e "/^#/d" >$@ - $(Q) rm -f $(RMOVE_TMP) -endif - -$(RCOPY_CSRC) : $(BLITDIR)/nxglib_copyrectangle.c nxglib_bitblit.h -ifneq ($(NXGLIB_BITSPERPIXEL),) - $(call PREPROCESS, $(BLITDIR)/nxglib_copyrectangle.c, $(RCOPY_TMP)) - $(Q) cat $(RCOPY_TMP) | sed -e "/^#/d" >$@ - $(Q) rm -f $(RCOPY_TMP) -endif - -clean: - $(call DELFILE, *.i) - $(call CLEAN) - -distclean: clean - $(call DELFILE, nxglib_setpixel_*bpp.c) - $(call DELFILE, nxglib_fillrectangle_*bpp.c) - $(call DELFILE, nxglib_getrectangle_*bpp.c) - $(call DELFILE, nxglib_filltrapezoid_*bpp.c) - $(call DELFILE, nxglib_moverectangle_*bpp.c) - $(call DELFILE, nxglib_copyrectangle_*bpp.c) diff --git a/nuttx/graphics/nxglib/fb/nxglib_copyrectangle.c b/nuttx/graphics/nxglib/fb/nxglib_copyrectangle.c deleted file mode 100644 index bf9812ac3..000000000 --- a/nuttx/graphics/nxglib/fb/nxglib_copyrectangle.c +++ /dev/null @@ -1,179 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/fb/nxsglib_copyrectangle.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdint.h> - -#include <nuttx/fb.h> -#include <nuttx/nx/nxglib.h> - -#include "nxglib_bitblit.h" - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_copyrectangle_*bpp - * - * Descripton: - * Copy a rectangular bitmap image into the specific position in the - * framebuffer memory. - * - ****************************************************************************/ - -void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX) -(FAR struct fb_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *dest, - FAR const void *src, FAR const struct nxgl_point_s *origin, - unsigned int srcstride) -{ - FAR const uint8_t *sline; - FAR uint8_t *dline; - unsigned int width; - unsigned int deststride; - unsigned int rows; - -#if NXGLIB_BITSPERPIXEL < 8 - FAR const uint8_t *sptr; - FAR uint8_t *dptr; - uint8_t leadmask; - uint8_t tailmask; - uint8_t mask; - int lnlen; -#endif - - /* Get the width of the framebuffer in bytes */ - - deststride = pinfo->stride; - - /* Get the dimensions of the rectange to fill: width in pixels, - * height in rows - */ - - width = dest->pt2.x - dest->pt1.x + 1; - rows = dest->pt2.y - dest->pt1.y + 1; - -#if NXGLIB_BITSPERPIXEL < 8 -# ifdef CONFIG_NX_PACKEDMSFIRST - - /* Get the mask for pixels that are ordered so that they pack from the - * MS byte down. - */ - - leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x))); - tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(dest->pt2.x-1))); -# else - /* Get the mask for pixels that are ordered so that they pack from the - * LS byte up. - */ - - leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(dest->pt1.x))); - tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x-1))); -# endif -#endif - - /* Then copy the image */ - - sline = (const uint8_t*)src + NXGL_SCALEX(dest->pt1.x - origin->x) + (dest->pt1.y - origin->y) * srcstride; - dline = pinfo->fbmem + dest->pt1.y * deststride + NXGL_SCALEX(dest->pt1.x); - - while (rows--) - { -#if NXGLIB_BITSPERPIXEL < 8 - /* Handle masking of the fractional initial byte */ - - mask = leadmask; - sptr = sline; - dptr = dline; - lnlen = width; - - if (lnlen > 1 && mask) - { - dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask); - mask = 0xff; - dptr++; - sptr++; - lnlen--; - } - - /* Handle masking of the fractional final byte */ - - mask &= tailmask; - if (lnlen > 0 && mask) - { - dptr[lnlen-1] = (dptr[lnlen-1] & ~mask) | (sptr[lnlen-1] & mask); - lnlen--; - } - - /* Handle all of the unmasked bytes in-between */ - - if (lnlen > 0) - { - NXGL_MEMCPY(dptr, sptr, lnlen); - } -#else - /* Copy the whole line */ - - NXGL_MEMCPY((NXGL_PIXEL_T*)dline, (NXGL_PIXEL_T*)sline, width); -#endif - dline += deststride; - sline += srcstride; - } -} diff --git a/nuttx/graphics/nxglib/fb/nxglib_fillrectangle.c b/nuttx/graphics/nxglib/fb/nxglib_fillrectangle.c deleted file mode 100644 index 777a906a4..000000000 --- a/nuttx/graphics/nxglib/fb/nxglib_fillrectangle.c +++ /dev/null @@ -1,177 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/fb/nxglib_fillrectangle.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdint.h> - -#include <nuttx/fb.h> -#include <nuttx/nx/nxglib.h> - -#include "nxglib_bitblit.h" - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -#ifndef NXGLIB_SUFFIX -# error "NXGLIB_SUFFIX must be defined before including this header file" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_fillrectangle_*bpp - * - * Descripton: - * Fill a rectangle region in the framebuffer memory with a fixed color - * - ****************************************************************************/ - -void NXGL_FUNCNAME(nxgl_fillrectangle,NXGLIB_SUFFIX) - (FAR struct fb_planeinfo_s *pinfo, - FAR const struct nxgl_rect_s *rect, - NXGL_PIXEL_T color) -{ - FAR uint8_t *line; - unsigned int width; - unsigned int stride; - int rows; - -#if NXGLIB_BITSPERPIXEL < 8 - FAR uint8_t *dest; - uint8_t mpixel = NXGL_MULTIPIXEL(color); - uint8_t leadmask; - uint8_t tailmask; - uint8_t mask; - int lnlen; -#endif - - /* Get the width of the framebuffer in bytes */ - - stride = pinfo->stride; - - /* Get the dimensions of the rectange to fill in pixels */ - - width = rect->pt2.x - rect->pt1.x + 1; - rows = rect->pt2.y - rect->pt1.y + 1; - - /* Get the address of the first byte in the first line to write */ - - line = pinfo->fbmem + rect->pt1.y * stride + NXGL_SCALEX(rect->pt1.x); - -#if NXGLIB_BITSPERPIXEL < 8 -# ifdef CONFIG_NX_PACKEDMSFIRST - - /* Get the mask for pixels that are ordered so that they pack from the - * MS byte down. - */ - - leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x))); - tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x-1))); -# else - /* Get the mask for pixels that are ordered so that they pack from the - * LS byte up. - */ - - leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x))); - tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x-1))); -# endif -#endif - - /* Then fill the rectangle line-by-line */ - - while (rows-- > 0) - { -#if NXGLIB_BITSPERPIXEL < 8 - /* Handle masking of the fractional initial byte */ - - mask = leadmask; - dest = line; - lnlen = width; - - if (lnlen > 1 && mask) - { - dest[0] = (dest[0] & ~mask) | (mpixel & mask); - mask = 0xff; - dest++; - lnlen--; - } - - /* Handle masking of the fractional final byte */ - - mask &= tailmask; - if (lnlen > 0 && mask) - { - dest[lnlen-1] = (dest[lnlen-1] & ~mask) | (mpixel & mask); - lnlen--; - } - - /* Handle all of the unmasked bytes in-between */ - - if (lnlen > 0) - { - NXGL_MEMSET(dest, (NXGL_PIXEL_T)color, lnlen); - } -#else - /* Draw the entire raster line */ - - NXGL_MEMSET(line, (NXGL_PIXEL_T)color, width); -#endif - line += stride; - } -} diff --git a/nuttx/graphics/nxglib/fb/nxglib_filltrapezoid.c b/nuttx/graphics/nxglib/fb/nxglib_filltrapezoid.c deleted file mode 100644 index 7623bf84f..000000000 --- a/nuttx/graphics/nxglib/fb/nxglib_filltrapezoid.c +++ /dev/null @@ -1,285 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/fb/nxglib_filltrapezoid.c - * - * Copyright (C) 2008-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdint.h> -#include <fixedmath.h> - -#include <nuttx/fb.h> -#include <nuttx/nx/nxglib.h> - -#include "nxglib_bitblit.h" - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -#ifndef NXGLIB_SUFFIX -# error "NXGLIB_SUFFIX must be defined before including this header file" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxglib_filltrapezoid_*bpp - * - * Descripton: - * Fill a trapezoidal region in the framebuffer memory with a fixed color. - * Clip the trapezoid to lie within a boundng box. This is useful for - * drawing complex shapes that can be broken into a set of trapezoids. - * - ****************************************************************************/ - -void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)( - FAR struct fb_planeinfo_s *pinfo, - FAR const struct nxgl_trapezoid_s *trap, - FAR const struct nxgl_rect_s *bounds, - NXGL_PIXEL_T color) -{ - unsigned int stride; - unsigned int width; - FAR uint8_t *dest; - FAR uint8_t *line; - int nrows; - b16_t x1; - b16_t x2; - nxgl_coord_t y1; - nxgl_coord_t y2; - b16_t dx1dy; - b16_t dx2dy; - -#if NXGLIB_BITSPERPIXEL < 8 - uint8_t mpixel = NXGL_MULTIPIXEL(color); - uint8_t mask; - int lnlen; -#endif - - /* Get the width of the framebuffer in bytes */ - - stride = pinfo->stride; - - /* Get the top run position and the number of rows to draw */ - - x1 = trap->top.x1; - x2 = trap->top.x2; - - /* Calculate the number of rows to render */ - - y1 = trap->top.y; - y2 = trap->bot.y; - nrows = y2 - y1 + 1; - - /* Calculate the slope of the left and right side of the trapezoid */ - - if (nrows > 1) - { - dx1dy = b16divi((trap->bot.x1 - x1), nrows - 1); - dx2dy = b16divi((trap->bot.x2 - x2), nrows - 1); - } - else - { - /* The trapezoid is a run! Use the average width. */ - - x1 = (x1 + trap->bot.x1) >> 1; - x2 = (x2 + trap->bot.x2) >> 1; - dx1dy = 0; - dx2dy = 0; - } - - /* Perform vertical clipping */ - - if (y1 < bounds->pt1.y) - { - /* Is the entire trapezoid "above" the clipping window? */ - - if (y2 < bounds->pt1.y) - { - /* Yes.. then do nothing */ - - return; - } - - /* Calculate the x values for the new top run */ - - int dy = bounds->pt1.y - y1; - x1 += dy * dx1dy; - x2 += dy * dx2dy; - - /* Clip and re-calculate the number of rows to render */ - - y1 = bounds->pt1.y; - nrows = y2 - y1 + 1; - } - - if (y2 > bounds->pt2.y) - { - /* Is the entire trapezoid "below" the clipping window? */ - - if (y1 > bounds->pt2.y) - { - /* Yes.. then do nothing */ - - return; - } - - /* Clip and re-calculate the number of rows to render */ - - y2 = bounds->pt2.y; - nrows = y2 - y1 + 1; - } - - /* Get the address of the first byte on the first line */ - - line = pinfo->fbmem + y1 * stride ; - - /* Then fill the trapezoid line-by-line */ - - while (nrows--) - { - int ix1; - int ix2; - - /* Handle the special case where the sides cross (as in an hourglass) */ - - if (x1 > x2) - { - b16_t tmp; - ngl_swap(x1, x2, tmp); - ngl_swap(dx1dy, dx2dy, tmp); - } - - /* Convert the positions to integer */ - - ix1 = b16toi(x1); - ix2 = b16toi(x2); - - /* Handle some corner cases where we draw nothing. Otherwise, we will - * always draw at least one pixel. - */ - - if (x1 <= x2 && ix2 >= bounds->pt1.x && ix1 <= bounds->pt2.x) - { - /* Get a clipped copies of the starting and ending X positions. This - * clipped truncates "down" and gives the quantized pixel holding the - * fractional X position - */ - - ix1 = ngl_clipl(ix1, bounds->pt1.x); - ix2 = ngl_clipr(ix2, bounds->pt2.x); - - /* Get the run length for the clipped row */ - - width = ix2 - ix1 + 1; - -#if NXGLIB_BITSPERPIXEL < 8 - /* Handle masking of the fractional initial byte */ - -#ifdef CONFIG_NX_PACKEDMSFIRST - mask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(ix1)); -#else - mask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(ix1))); -#endif - dest = line; - lnlen = width; - - if (lnlen > 1 && mask) - { - dest[0] = (dest[0] & ~mask) | (mpixel & mask); - mask = 0xff; - dest++; - lnlen--; - } - - /* Handle masking of the fractional final byte */ - -#ifdef CONFIG_NX_PACKEDMSFIRST - mask &= (uint8_t)(0xff << (8 - NXGL_REMAINDERX(ix2))); -#else - mask &= (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(ix2))); -#endif - if (lnlen > 0 && mask) - { - dest[lnlen-1] = (dest[lnlen-1] & ~mask) | (mpixel & mask); - lnlen--; - } - - /* Handle all of the unmasked bytes in-between */ - - if (lnlen > 0) - { - NXGL_MEMSET(dest, (NXGL_PIXEL_T)color, lnlen); - } - -#else - /* Then draw the run from (line + ix1) to (line + ix2) */ - - dest = line + NXGL_SCALEX(ix1); - NXGL_MEMSET(dest, (NXGL_PIXEL_T)color, width); -#endif - } - - /* Move to the start of the next line */ - - line += stride; - - /* Add the dx/dy value to get the run positions on the next row */ - - x1 += dx1dy; - x2 += dx2dy; - } -} diff --git a/nuttx/graphics/nxglib/fb/nxglib_getrectangle.c b/nuttx/graphics/nxglib/fb/nxglib_getrectangle.c deleted file mode 100644 index 82e541ec5..000000000 --- a/nuttx/graphics/nxglib/fb/nxglib_getrectangle.c +++ /dev/null @@ -1,201 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/fb/nxglib_getrectangle.c - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdint.h> - -#include <nuttx/fb.h> -#include <nuttx/nx/nxglib.h> - -#include "nxglib_bitblit.h" - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_lowresmemcpy - ****************************************************************************/ - -#if NXGLIB_BITSPERPIXEL < 8 -static inline void nxgl_lowresmemcpy(FAR uint8_t *dline, FAR const uint8_t *sline, - unsigned int width, - uint8_t leadmask, uint8_t tailmask) -{ - FAR const uint8_t *sptr; - FAR uint8_t *dptr; - uint8_t mask; - int lnlen; - - /* Handle masking of the fractional initial byte */ - - mask = leadmask; - sptr = sline; - dptr = dline; - lnlen = width; - - if (lnlen > 1 && mask) - { - dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask); - mask = 0xff; - dptr++; - sptr++; - lnlen--; - } - - /* Handle masking of the fractional final byte */ - - mask &= tailmask; - if (lnlen > 0 && mask) - { - dptr[lnlen-1] = (dptr[lnlen-1] & ~mask) | (sptr[lnlen-1] & mask); - lnlen--; - } - - /* Handle all of the unmasked bytes in-between */ - - if (lnlen > 0) - { - NXGL_MEMCPY(dptr, sptr, lnlen); - } -} -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_getrectangle_*bpp - * - * Descripton: - * Fetch a rectangular region from framebuffer memory. The source is - * expressed as a rectangle. - * - ****************************************************************************/ - -void NXGL_FUNCNAME(nxgl_getrectangle,NXGLIB_SUFFIX) -(FAR struct fb_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect, - FAR void *dest, unsigned int deststride) -{ - FAR const uint8_t *sline; - FAR uint8_t *dline; - unsigned int width; - unsigned int fbstride; - unsigned int rows; - -#if NXGLIB_BITSPERPIXEL < 8 - uint8_t leadmask; - uint8_t tailmask; -#endif - - /* Get the width of the framebuffer in bytes */ - - fbstride = pinfo->stride; - - /* Get the dimensions of the rectange to copy: width in pixels, height - * in rows - */ - - width = rect->pt2.x - rect->pt1.x + 1; - rows = rect->pt2.y - rect->pt1.y + 1; - -#if NXGLIB_BITSPERPIXEL < 8 -# ifdef CONFIG_NX_PACKEDMSFIRST - - /* Get the mask for pixels that are ordered so that they pack from the - * MS byte down. - */ - - leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x))); - tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x-1))); -# else - /* Get the mask for pixels that are ordered so that they pack from the - * LS byte up. - */ - - leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x))); - tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x-1))); -# endif -#endif - - /* sline = address of the first pixel in the top row of the source in - * framebuffer memory - */ - - sline = pinfo->fbmem + rect->pt1.y * fbstride + NXGL_SCALEX(rect->pt1.x); - - /* dline = address of the first row pixel */ - - dline = (FAR uint8_t *)dest; - - /* Yes.. Copy the rectangle */ - - while (rows--) - { - /* Copy the row */ - -#if NXGLIB_BITSPERPIXEL < 8 - nxgl_lowresmemcpy(dline, sline, width, leadmask, tailmask); -#else - NXGL_MEMCPY(dline, sline, width); -#endif - /* Point to the next source/dest row below the current one */ - - dline += deststride; - sline += fbstride; - } -} diff --git a/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c b/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c deleted file mode 100644 index d8e52250c..000000000 --- a/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c +++ /dev/null @@ -1,252 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/fb/nxglib_moverectangle.c - * - * Copyright (C) 2008-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdint.h> - -#include <nuttx/fb.h> -#include <nuttx/nx/nxglib.h> - -#include "nxglib_bitblit.h" - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_lowresmemcpy - ****************************************************************************/ - -#if NXGLIB_BITSPERPIXEL < 8 -static inline void nxgl_lowresmemcpy(FAR uint8_t *dline, FAR const uint8_t *sline, - unsigned int width, - uint8_t leadmask, uint8_t tailmask) -{ - FAR const uint8_t *sptr; - FAR uint8_t *dptr; - uint8_t mask; - int lnlen; - - /* Handle masking of the fractional initial byte */ - - mask = leadmask; - sptr = sline; - dptr = dline; - lnlen = width; - - if (lnlen > 1 && mask) - { - dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask); - mask = 0xff; - dptr++; - sptr++; - lnlen--; - } - - /* Handle masking of the fractional final byte */ - - mask &= tailmask; - if (lnlen > 0 && mask) - { - dptr[lnlen-1] = (dptr[lnlen-1] & ~mask) | (sptr[lnlen-1] & mask); - lnlen--; - } - - /* Handle all of the unmasked bytes in-between */ - - if (lnlen > 0) - { - NXGL_MEMCPY(dptr, sptr, lnlen); - } -} -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_moverectangle_*bpp - * - * Descripton: - * Move a rectangular region from location to another in the - * framebuffer memory. The source is expressed as a rectangle; the - * destination position is expressed as a point corresponding to the - * translation of the upper, left-hand corner. - * - ****************************************************************************/ - -void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX) -(FAR struct fb_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect, - FAR struct nxgl_point_s *offset) -{ - FAR const uint8_t *sline; - FAR uint8_t *dline; - unsigned int width; - unsigned int stride; - unsigned int rows; - -#if NXGLIB_BITSPERPIXEL < 8 - uint8_t leadmask; - uint8_t tailmask; -#endif - - /* Get the width of the framebuffer in bytes */ - - stride = pinfo->stride; - - /* Get the dimensions of the rectange to fill: width in pixels, height - * in rows - */ - - width = rect->pt2.x - rect->pt1.x + 1; - rows = rect->pt2.y - rect->pt1.y + 1; - -#if NXGLIB_BITSPERPIXEL < 8 -# ifdef CONFIG_NX_PACKEDMSFIRST - - /* Get the mask for pixels that are ordered so that they pack from the - * MS byte down. - */ - - leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x))); - tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x-1))); -# else - /* Get the mask for pixels that are ordered so that they pack from the - * LS byte up. - */ - - leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x))); - tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x-1))); -# endif -#endif - - /* sline = address of the first pixel in the top row of the source in - * framebuffer memory - */ - - sline = pinfo->fbmem + rect->pt1.y * stride + NXGL_SCALEX(rect->pt1.x); - - /* dline = address of the first pixel in the top row of the destination - * in framebuffer memory. We get dline by subtract the offset from the - * source position. - */ - - dline = pinfo->fbmem + offset->y * stride + NXGL_SCALEX(offset->x); - - /* Case 1: Is the destination position above the displayed position? - * If the destination position is less then then the src address, then the - * destination is offset to a postion below (and or to the left) of the - * source in framebuffer memory. - */ - - if (offset->y < rect->pt1.y || - (offset->y < rect->pt1.y && offset->x <= rect->pt1.x)) - { - /* Yes.. Copy the rectangle from top down (i.e., adding the stride - * to move to the next, lower row) */ - - while (rows--) - { - /* Copy the row */ - -#if NXGLIB_BITSPERPIXEL < 8 - nxgl_lowresmemcpy(dline, sline, width, leadmask, tailmask); -#else - NXGL_MEMCPY(dline, sline, width); -#endif - /* Point to the next source/dest row below the current one */ - - dline += stride; - sline += stride; - } - } - - /* Case 2: No.. the destination position is above (or to the left of) - * the displayed source position - */ - - else - { - /* Adjust sline and dline to point to the bottom row (+1) of the - * source and destination rectangles in framebuffer memory. - */ - - unsigned int hoffset = rows * stride; - sline += hoffset; - dline += hoffset; - - /* Copy the rectangle from the bottom up (i.e., subtracting stride - * to re-position to the previous, higher row) - */ - - while (rows--) - { - /* Point to the next source/dest row above the current one */ - - dline -= stride; - sline -= stride; - - /* Copy the row */ - -#if NXGLIB_BITSPERPIXEL < 8 - nxgl_lowresmemcpy(dline, sline, width, leadmask, tailmask); -#else - NXGL_MEMCPY(dline, sline, width); -#endif - } - } -} diff --git a/nuttx/graphics/nxglib/fb/nxglib_setpixel.c b/nuttx/graphics/nxglib/fb/nxglib_setpixel.c deleted file mode 100644 index 7079b7e57..000000000 --- a/nuttx/graphics/nxglib/fb/nxglib_setpixel.c +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/fb/nxglib_setpixel.c - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdint.h> - -#include <nuttx/fb.h> -#include <nuttx/nx/nxglib.h> - -#include "nxglib_bitblit.h" - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -#ifndef NXGLIB_SUFFIX -# error "NXGLIB_SUFFIX must be defined before including this header file" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_setpixel_*bpp - * - * Descripton: - * Draw a single pixel in frambuffer memory at the given position and with - * the given color. This is equivalent to nxgl_fillrectangle_*bpp() with - * a 1x1 rectangle but is more efficient. - * - ****************************************************************************/ - -void NXGL_FUNCNAME(nxgl_setpixel,NXGLIB_SUFFIX) - (FAR struct fb_planeinfo_s *pinfo, - FAR const struct nxgl_point_s *pos, - NXGL_PIXEL_T color) -{ - FAR uint8_t *dest; - -#if NXGLIB_BITSPERPIXEL < 8 - uint8_t shift; - uint8_t mask; -#else - FAR NXGL_PIXEL_T *pixel; -#endif - - /* Get the address of the first byte of the pixel to write */ - - dest = pinfo->fbmem + pos->y * pinfo->stride + NXGL_SCALEX(pos->x); - -#if NXGLIB_BITSPERPIXEL < 8 - - /* Shift the color into the proper position */ - -# ifdef CONFIG_NX_PACKEDMSFIRST - -#if NXGLIB_BITSPERPIXEL == 1 - shift = (7 - (pos->x & 7)); /* Shift is 0, 1, ... 7 */ - mask = (1 << shift); /* Mask is 0x01, 0x02, .. 0x80 */ - color <<= shift; /* Color is positioned under the mask */ -#elif NXGLIB_BITSPERPIXEL == 2 - shift = (6 - ((pos->x & 3) << 1)); /* Shift is 0, 2, 4, or 6 */ - mask = (3 << shift); /* Mask is 0x03, 0x0c, 0x30, or 0xc0 */ - color <<= shift; /* Color is positioned under the mask */ -#elif NXGLIB_BITSPERPIXEL == 4 - shift = (4 - ((pos->x & 1) << 2)); /* Shift is 0 or 4 */ - mask = (15 << shift); /* Mask is 0x0f or 0xf0 */ - color <<= shift; /* Color is positioned under the mask */ -#else -# error "Unsupport pixel depth" -#endif - -# else /* CONFIG_NX_PACKEDMSFIRST */ - -#if NXGLIB_BITSPERPIXEL == 1 - shift = (pos->x & 7); /* Shift is 0, 1, ... 7 */ - mask = (1 << shift); /* Mask is 0x01, 0x02, .. 0x80 */ - color <<= shift; /* Color is positioned under the mask */ -#elif NXGLIB_BITSPERPIXEL == 2 - shift = (pos->x & 3) << 1; /* Shift is 0, 2, 4, or 6 */ - mask = (3 << shift); /* Mask is 0x03, 0x0c, 0x30, or 0xc0 */ - color <<= shift; /* Color is positioned under the mask */ -#elif NXGLIB_BITSPERPIXEL == 4 - shift = (pos->x & 1) << 2; /* Shift is 0 or 4 */ - mask = (15 << shift); /* Mask is 0x0f or 0xf0 */ - color <<= shift; /* Color is positioned under the mask */ -#else -# error "Unsupport pixel depth" -#endif -#endif /* CONFIG_NX_PACKEDMSFIRST */ - - /* Handle masking of the fractional byte */ - - *dest = (*dest & ~mask) | (color & mask); -#else - - /* Write the pixel (proper alignment assumed) */ - - pixel = (FAR NXGL_PIXEL_T *)dest; - *pixel = color; -#endif -} diff --git a/nuttx/graphics/nxglib/lcd/nxglib_copyrectangle.c b/nuttx/graphics/nxglib/lcd/nxglib_copyrectangle.c deleted file mode 100644 index 40989acef..000000000 --- a/nuttx/graphics/nxglib/lcd/nxglib_copyrectangle.c +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/lcd/nxsglib_copyrectangle.c - * - * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdint.h> -#include <assert.h> - -#include <nuttx/lcd/lcd.h> -#include <nuttx/nx/nxglib.h> - -#include "nxglib_bitblit.h" -#include "nxglib_copyrun.h" - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_copyrectangle_*bpp - * - * Descripton: - * Copy a rectangular bitmap image into the specific position in the - * framebuffer memory. - * - ****************************************************************************/ - -void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX) -(FAR struct lcd_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *dest, - FAR const void *src, FAR const struct nxgl_point_s *origin, - unsigned int srcstride) -{ - FAR const uint8_t *sline; - unsigned int ncols; - unsigned int row; - unsigned int xoffset; -#if NXGLIB_BITSPERPIXEL < 8 - unsigned int remainder; -#endif - - /* Get the dimensions of the rectange to fill: width in pixels, - * height in rows - */ - - ncols = dest->pt2.x - dest->pt1.x + 1; - - /* Set up to copy the image */ - - xoffset = dest->pt1.x - origin->x; - sline = (const uint8_t*)src + NXGL_SCALEX(xoffset) + (dest->pt1.y - origin->y) * srcstride; -#if NXGLIB_BITSPERPIXEL < 8 - remainder = NXGL_REMAINDERX(xoffset); -#endif - - /* Copy the image, one row at a time */ - - for (row = dest->pt1.y; row <= dest->pt2.y; row++) - { -#if NXGLIB_BITSPERPIXEL < 8 - /* if the source pixel is not aligned with a byte boundary, then we will - * need to copy the image data to the run buffer first. - */ - - if (remainder != 0) - { - NXGL_FUNCNAME(nxgl_copyrun,NXGLIB_SUFFIX)(sline, pinfo->buffer, remainder, ncols); - (void)pinfo->putrun(row, dest->pt1.x, pinfo->buffer, ncols); - } - else -#endif - { - /* The pixel data is byte aligned. Copy the image data directly from - * the image memory. - */ - - (void)pinfo->putrun(row, dest->pt1.x, sline, ncols); - } - - /* Then adjust the source pointer to refer to the next line in the source - * image. - */ - - sline += srcstride; - } -} diff --git a/nuttx/graphics/nxglib/lcd/nxglib_fillrectangle.c b/nuttx/graphics/nxglib/lcd/nxglib_fillrectangle.c deleted file mode 100644 index b9554e1cc..000000000 --- a/nuttx/graphics/nxglib/lcd/nxglib_fillrectangle.c +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/lcd/nxglib_fillrectangle.c - * - * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <sys/types.h> -#include <stdint.h> - -#include <nuttx/lcd/lcd.h> -#include <nuttx/nx/nxglib.h> - -#include "nxglib_bitblit.h" -#include "nxglib_fillrun.h" - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -#ifndef NXGLIB_SUFFIX -# error "NXGLIB_SUFFIX must be defined before including this header file" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_fillrectangle_*bpp - * - * Descripton: - * Fill a rectangle region in the LCD memory with a fixed color - * - ****************************************************************************/ - -void NXGL_FUNCNAME(nxgl_fillrectangle,NXGLIB_SUFFIX) - (FAR struct lcd_planeinfo_s *pinfo, - FAR const struct nxgl_rect_s *rect, - NXGL_PIXEL_T color) -{ - unsigned int ncols; - unsigned int row; - - /* Get the dimensions of the rectange to fill in pixels */ - - ncols = rect->pt2.x - rect->pt1.x + 1; - - /* Fill the run buffer with the selected color */ - - NXGL_FUNCNAME(nxgl_fillrun,NXGLIB_SUFFIX)((NXGLIB_RUNTYPE*)pinfo->buffer, color, ncols); - - /* Then fill the rectangle line-by-line */ - - for (row = rect->pt1.y; row <= rect->pt2.y; row++) - { - /* Draw the raster line at this row */ - - (void)pinfo->putrun(row, rect->pt1.x, pinfo->buffer, ncols); - } -} diff --git a/nuttx/graphics/nxglib/lcd/nxglib_filltrapezoid.c b/nuttx/graphics/nxglib/lcd/nxglib_filltrapezoid.c deleted file mode 100644 index 3ba44b34a..000000000 --- a/nuttx/graphics/nxglib/lcd/nxglib_filltrapezoid.c +++ /dev/null @@ -1,259 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/lcd/nxglib_filltrapezoid.c - * - * Copyright (C) 2010-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdint.h> -#include <fixedmath.h> - -#include <nuttx/lcd/lcd.h> -#include <nuttx/nx/nxglib.h> - -#include "nxglib_bitblit.h" -#include "nxglib_fillrun.h" - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -#ifndef NXGLIB_SUFFIX -# error "NXGLIB_SUFFIX must be defined before including this header file" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxglib_filltrapezoid_*bpp - * - * Descripton: - * Fill a trapezoidal region in the LCD memory with a fixed color. - * Clip the trapezoid to lie within a boundng box. This is useful for - * drawing complex shapes that can be broken into a set of trapezoids. - * - ****************************************************************************/ - -void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX) - (FAR struct lcd_planeinfo_s *pinfo, - FAR const struct nxgl_trapezoid_s *trap, - FAR const struct nxgl_rect_s *bounds, - NXGL_PIXEL_T color) -{ - unsigned int ncols; - unsigned int topy; - unsigned int boty; - unsigned int row; - unsigned int botw; - b16_t topx1; - b16_t topx2; - b16_t botx1; - b16_t botx2; - b16_t dx1dy; - b16_t dx2dy; - int dy; - int ix1; - int ix2; - - /* Get the top run endpoints */ - - topx1 = trap->top.x1; - topx2 = trap->top.x2; - - /* Calculate the number of rows to render */ - - topy = trap->top.y; - boty = trap->bot.y; - - /* Get the bottom run endpoints */ - - botx1 = trap->bot.x1; - botx2 = trap->bot.x2; - - /* Calculate the slope of the left and right side of the trapezoid */ - - dy = boty - topy; - if (dy > 0) - { - dx1dy = b16divi((botx1 - topx1), dy); - dx2dy = b16divi((botx2 - topx2), dy); - } - else - { - /* The trapezoid is a run! Use the average width. */ - - topx1 = (topx1 + botx1) >> 1; - topx2 = (topx2 + botx2) >> 1; - botx1 = topx1; - botx2 = topx2; - dx1dy = 0; - dx2dy = 0; - } - - /* Perform vertical clipping */ - - if (topy < bounds->pt1.y) - { - /* Is the entire trapezoid "above" the clipping window? */ - - if (boty < bounds->pt1.y) - { - /* Yes.. then do nothing */ - - return; - } - - /* Calculate the x values for the new top run */ - - dy = bounds->pt1.y - topy; - topx1 += dy * dx1dy; - topx2 += dy * dx2dy; - - /* Clip the top row to render */ - - topy = bounds->pt1.y; - } - - if (boty > bounds->pt2.y) - { - /* Is the entire trapezoid "below" the clipping window? */ - - if (topy > bounds->pt2.y) - { - /* Yes.. then do nothing */ - - return; - } - - /* Calculate the x values for the new bottom run */ - - dy = boty - bounds->pt2.y; - botx1 -= dy * dx1dy; - botx2 -= dy * dx2dy; - - /* Clip the bottom row to render */ - - boty = bounds->pt2.y; - } - - /* Handle the special case where the sides cross (as in an hourglass) */ - - if (botx1 > botx2) - { - b16_t tmp; - ngl_swap(botx1, botx2, tmp); - } - - /* Fill the run buffer for the maximum run that we will need */ - - ix1 = b16toi(topx1); - ix1 = ngl_clipl(ix1, bounds->pt1.x); - ix2 = b16toi(topx2); - ix2 = ngl_clipr(ix2, bounds->pt2.x); - ncols = ix2 - ix1 + 1; - - ix1 = b16toi(botx1); - ix1 = ngl_clipl(ix1, bounds->pt1.x); - ix2 = b16toi(botx2); - ix2 = ngl_clipr(ix2, bounds->pt2.x); - botw = ix2 - ix1 + 1; - - if (ncols < botw) - { - ncols = botw; - } - - NXGL_FUNCNAME(nxgl_fillrun,NXGLIB_SUFFIX)((NXGLIB_RUNTYPE*)pinfo->buffer, color, ncols); - - /* Then fill the trapezoid row-by-row */ - - for (row = topy; row <= boty; row++) - { - /* Handle the special case where the sides cross (as in an hourglass) */ - - if (topx1 > topx2) - { - b16_t tmp; - ngl_swap(topx1, topx2, tmp); - ngl_swap(dx1dy, dx2dy, tmp); - } - - /* Convert the positions to integer and get the run width, clipping to - * fit within the bounding box. - */ - - ix1 = b16toi(topx1); - ix1 = ngl_clipl(ix1, bounds->pt1.x); - ix2 = b16toi(topx2); - ix2 = ngl_clipr(ix2, bounds->pt2.x); - - /* Handle some corner cases where we draw nothing. Otherwise, we will - * always draw at least one pixel. - */ - - if (ix1 <= ix2) - { - /* Then draw the run from ix1 to ix2 at row */ - - ncols = ix2 - ix1 + 1; - (void)pinfo->putrun(row, ix1, pinfo->buffer, ncols); - } - - /* Add the dx/dy value to get the run positions on the next row */ - - topx1 += dx1dy; - topx2 += dx2dy; - } -} diff --git a/nuttx/graphics/nxglib/lcd/nxglib_getrectangle.c b/nuttx/graphics/nxglib/lcd/nxglib_getrectangle.c deleted file mode 100644 index 9318426ba..000000000 --- a/nuttx/graphics/nxglib/lcd/nxglib_getrectangle.c +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/lcd/nxglib_getrectangle.c - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdint.h> - -#include <nuttx/lcd/lcd.h> -#include <nuttx/nx/nxglib.h> - -#include "nxglib_bitblit.h" - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_moverectangle_*bpp - * - * Descripton: - * Fetch a rectangular region from LCD GRAM memory. The source is - * expressed as a rectangle. - * - ****************************************************************************/ - -void NXGL_FUNCNAME(nxgl_getrectangle,NXGLIB_SUFFIX) -(FAR struct lcd_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect, - FAR void *dest, unsigned int deststride) -{ - FAR uint8_t *dline; - unsigned int ncols; - unsigned int srcrow; - - /* Get the width of the rectange to move in pixels. */ - - ncols = rect->pt2.x - rect->pt1.x + 1; - - /* dline = address of the first row pixel */ - - dline = (FAR uint8_t *)dest; - - /* Copy the rectangle */ - - for (srcrow = rect->pt1.y; srcrow <= rect->pt2.y; srcrow++) - { - (void)pinfo->getrun(srcrow, rect->pt1.x, dline, ncols); - dline += deststride; - } -} diff --git a/nuttx/graphics/nxglib/lcd/nxglib_moverectangle.c b/nuttx/graphics/nxglib/lcd/nxglib_moverectangle.c deleted file mode 100644 index b46a17e61..000000000 --- a/nuttx/graphics/nxglib/lcd/nxglib_moverectangle.c +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/lcd/nxglib_moverectangle.c - * - * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdint.h> - -#include <nuttx/lcd/lcd.h> -#include <nuttx/nx/nxglib.h> - -#include "nxglib_bitblit.h" - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_moverectangle_*bpp - * - * Descripton: - * Move a rectangular region from location to another in the - * LCD memory. The source is expressed as a rectangle; the - * destination position is expressed as a point corresponding to the - * translation of the upper, left-hand corner. - * - ****************************************************************************/ - -void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX) -(FAR struct lcd_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect, - FAR struct nxgl_point_s *offset) -{ - unsigned int ncols; - unsigned int srcrow; - unsigned int destrow; - - /* Get the width of the rectange to move in pixels. */ - - ncols = rect->pt2.x - rect->pt1.x + 1; - - /* Case 1: The destination position (offset) is above the displayed - * position (rect) - */ - - if (offset->y < rect->pt1.y) - { - /* Copy the rectangle from top down */ - - for (srcrow = rect->pt1.y, destrow = offset->y; - srcrow <= rect->pt2.y; - srcrow++, destrow++) - { - (void)pinfo->getrun(srcrow, rect->pt1.x, pinfo->buffer, ncols); - (void)pinfo->putrun(destrow, offset->x, pinfo->buffer, ncols); - } - } - - /* Case 2: The destination position (offset) is below the displayed - * position (rect) - */ - - else - { - unsigned int dy = rect->pt2.y - rect->pt1.y; - - /* Copy the rectangle from the bottom up */ - - for (srcrow = rect->pt2.y, destrow = offset->y + dy; - srcrow >= rect->pt1.y; - srcrow--, destrow--) - { - (void)pinfo->getrun(srcrow, rect->pt1.x, pinfo->buffer, ncols); - (void)pinfo->putrun(destrow, offset->x, pinfo->buffer, ncols); - } - } -} diff --git a/nuttx/graphics/nxglib/lcd/nxglib_setpixel.c b/nuttx/graphics/nxglib/lcd/nxglib_setpixel.c deleted file mode 100644 index c5cff99a7..000000000 --- a/nuttx/graphics/nxglib/lcd/nxglib_setpixel.c +++ /dev/null @@ -1,153 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/lcd/nxglib_setpixel.c - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <sys/types.h> -#include <stdint.h> - -#include <nuttx/lcd/lcd.h> -#include <nuttx/nx/nxglib.h> - -#include "nxglib_bitblit.h" - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -#ifndef NXGLIB_SUFFIX -# error "NXGLIB_SUFFIX must be defined before including this header file" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_setpixel_*bpp - * - * Descripton: - * Draw a single pixel in LCD memory at the given position and with the - * given color. This is equivalent to nxgl_fillrectangle_*bpp() with a 1x1 - * rectangle but is more efficient. - * - ****************************************************************************/ - -void NXGL_FUNCNAME(nxgl_setpixel,NXGLIB_SUFFIX) - (FAR struct lcd_planeinfo_s *pinfo, - FAR const struct nxgl_point_s *pos, - NXGL_PIXEL_T color) -{ -#if NXGLIB_BITSPERPIXEL < 8 - uint8_t shift; - uint8_t mask; - uint8_t pixel; - - /* Read the byte that contains the pixel to be changed */ - - (void)pinfo->getrun(pos->y, pos->x, &pixel, 8 / NXGLIB_BITSPERPIXEL); - - /* Shift the color into the proper position */ - -# ifdef CONFIG_NX_PACKEDMSFIRST - -#if NXGLIB_BITSPERPIXEL == 1 - shift = (7 - (pos->x & 7)); /* Shift is 0, 1, ... 7 */ - mask = (1 << shift); /* Mask is 0x01, 0x02, .. 0x80 */ - color <<= shift; /* Color is positioned under the mask */ -#elif NXGLIB_BITSPERPIXEL == 2 - shift = (6 - ((pos->x & 3) << 1)); /* Shift is 0, 2, 4, or 6 */ - mask = (3 << shift); /* Mask is 0x03, 0x0c, 0x30, or 0xc0 */ - color <<= shift; /* Color is positioned under the mask */ -#elif NXGLIB_BITSPERPIXEL == 4 - shift = (4 - ((pos->x & 1) << 2)); /* Shift is 0 or 4 */ - mask = (15 << shift); /* Mask is 0x0f or 0xf0 */ - color <<= shift; /* Color is positioned under the mask */ -#else -# error "Unsupport pixel depth" -#endif - -# else /* CONFIG_NX_PACKEDMSFIRST */ - -#if NXGLIB_BITSPERPIXEL == 1 - shift = (pos->x & 7); /* Shift is 0, 1, ... 7 */ - mask = (1 << shift); /* Mask is 0x01, 0x02, .. 0x80 */ - color <<= shift; /* Color is positioned under the mask */ -#elif NXGLIB_BITSPERPIXEL == 2 - shift = (pos->x & 3) << 1; /* Shift is 0, 2, 4, or 6 */ - mask = (3 << shift); /* Mask is 0x03, 0x0c, 0x30, or 0xc0 */ - color <<= shift; /* Color is positioned under the mask */ -#elif NXGLIB_BITSPERPIXEL == 4 - shift = (pos->x & 1) << 2; /* Shift is 0 or 4 */ - mask = (15 << shift); /* Mask is 0x0f or 0xf0 */ - color <<= shift; /* Color is positioned under the mask */ -#else -# error "Unsupport pixel depth" -#endif -#endif /* CONFIG_NX_PACKEDMSFIRST */ - - /* Handle masking of the fractional byte */ - - pixel = (pixel & ~mask) | (color & mask); - - /* Write the modified byte back to graphics memory */ - - (void)pinfo->putrun(pos->y, pos->x, (FAR uint8_t *)&pixel, 8 / NXGLIB_BITSPERPIXEL); -#else - /* Draw a single pixel at this position raster line at this row */ - - (void)pinfo->putrun(pos->y, pos->x, (FAR uint8_t *)&color, 1); -#endif -} diff --git a/nuttx/graphics/nxglib/nxglib_bitblit.h b/nuttx/graphics/nxglib/nxglib_bitblit.h deleted file mode 100644 index 0182337d1..000000000 --- a/nuttx/graphics/nxglib/nxglib_bitblit.h +++ /dev/null @@ -1,208 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxglib_bitblit.h - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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. - * - ****************************************************************************/ - -#ifndef __GRAPHICS_NXGLIB_NXGLIB_BITBLIT_H -#define __GRAPHICS_NXGLIB_NXGLIB_BITBLIT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <stdint.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* Make sure the bits-per-pixel value has been set by the includer of - * this header file. - */ - -#ifndef NXGLIB_BITSPERPIXEL -# error "NXGLIB_BITSPERPIXEL must be defined before including this header file" -#endif - -/* Set up bit blit macros for this BPP */ - -#if NXGLIB_BITSPERPIXEL == 1 - -# define NXGL_PIXELSHIFT 3 -# define NXGL_PIXELMASK 7 -# define NXGL_MULTIPIXEL(p) ((p) ? 0xff : 0x00) -# define NXGL_PIXEL_T uint8_t - -#elif NXGLIB_BITSPERPIXEL == 2 - -# define NXGL_PIXELSHIFT 2 -# define NXGL_PIXELMASK 3 -# define NXGL_MULTIPIXEL(p) ((uint8_t)(p) << 6 | (uint8_t)(p) << 4 | (uint8_t)(p) << 2 | (p)) -# define NXGL_PIXEL_T uint8_t - -#elif NXGLIB_BITSPERPIXEL == 4 - -# define NXGL_PIXELSHIFT 1 -# define NXGL_PIXELMASK 1 -# define NXGL_MULTIPIXEL(p) ((uint8_t)(p) << 4 | (p)) -# define NXGL_PIXEL_T uint8_t - -#elif NXGLIB_BITSPERPIXEL == 8 - -# define NXGL_SCALEX(x) (x) -# define NXGL_PIXEL_T uint8_t - -#elif NXGLIB_BITSPERPIXEL == 16 - -# define NXGL_SCALEX(x) ((x) << 1) -# define NXGL_PIXEL_T uint16_t - -#elif NXGLIB_BITSPERPIXEL == 24 - -# define NXGL_SCALEX(x) (((x) << 1) + (x)) -# define NXGL_PIXEL_T uint32_t - -#elif NXGLIB_BITSPERPIXEL == 32 - -# define NXGL_SCALEX(x) ((x) << 2) -# define NXGL_PIXEL_T uint32_t - -#endif - -#if NXGLIB_BITSPERPIXEL < 8 -# define NXGL_SCALEX(x) ((x) >> NXGL_PIXELSHIFT) -# define NXGL_REMAINDERX(x) ((x) & NXGL_PIXELMASK) -# define NXGL_ALIGNDOWN(x) ((x) & ~NXGL_PIXELMASK) -# define NXGL_ALIGNUP(x) (((x) + NXGL_PIXELMASK) & ~NXGL_PIXELMASK) - -# define NXGL_MEMSET(dest,value,width) \ - { \ - FAR uint8_t *_ptr = (FAR uint8_t*)(dest); \ - int _nby = NXGL_SCALEX(width); \ - while (_nby--) \ - { \ - *_ptr++ = (value); \ - } \ - } -# define NXGL_MEMCPY(dest,src,width) \ - { \ - FAR uint8_t *_dptr = (FAR uint8_t*)(dest); \ - FAR uint8_t *_sptr = (FAR uint8_t*)(src); \ - int _nby = NXGL_SCALEX(width); \ - while (_nby--) \ - { \ - *_dptr++ = *_sptr++; \ - } \ - } - -#elif NXGLIB_BITSPERPIXEL == 24 -# define NXGL_MEMSET(dest,value,width) \ - { \ - FAR uint8_t *_ptr = (FAR uint8_t*)(dest); \ - nxgl_coord_t _npix = (width); \ - while (_npix--) \ - { \ - *_ptr++ = (value); \ - *_ptr++ = (value) >> 8; \ - *_ptr++ = (value) >> 16; \ - } \ - } -# define NXGL_MEMCPY(dest,src,width) \ - { \ - FAR uint8_t *_dptr = (FAR uint8_t*)(dest); \ - FAR uint8_t *_sptr = (FAR uint8_t*)(src); \ - nxgl_coord_t _npix = (width); \ - while (_npix--) \ - { \ - *_dptr++ = *_sptr++; \ - *_dptr++ = *_sptr++; \ - *_dptr++ = *_sptr++; \ - } \ - } -#else -# define NXGL_MEMSET(dest,value,width) \ - { \ - FAR NXGL_PIXEL_T *_ptr = (FAR NXGL_PIXEL_T*)(dest); \ - nxgl_coord_t _npix = (width); \ - while (_npix--) \ - { \ - *_ptr++ = (value); \ - } \ - } -# define NXGL_MEMCPY(dest,src,width) \ - { \ - FAR NXGL_PIXEL_T *_dptr = (FAR NXGL_PIXEL_T*)(dest); \ - FAR NXGL_PIXEL_T *_sptr = (FAR NXGL_PIXEL_T*)(src); \ - nxgl_coord_t _npix = (width); \ - while (_npix--) \ - { \ - *_dptr++ = *_sptr++; \ - } \ - } -#endif - -/* Form a function name by concatenating two strings */ - -#define _NXGL_FUNCNAME(a,b) a ## b -#define NXGL_FUNCNAME(a,b) _NXGL_FUNCNAME(a,b) - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __GRAPHICS_NXGLIB_NXGLIB_BITBLIT_H */ diff --git a/nuttx/graphics/nxglib/nxglib_circlepts.c b/nuttx/graphics/nxglib/nxglib_circlepts.c deleted file mode 100644 index 811953dfc..000000000 --- a/nuttx/graphics/nxglib/nxglib_circlepts.c +++ /dev/null @@ -1,171 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxglib_circlepts.c - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <string.h> -#include <errno.h> -#include <fixedmath.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Trigonometry */ - -#define SIN_0p0 0 /* sin(0) = 0 */ -#define COS_0p0 1 /* cos(0) = 1 */ -#define SIN_22p5 25080 /* sin(22.5) = 25080 / 65536 */ -#define COS_22p5 60547 /* cos(22.5) = 60547 / 65536 */ -#define SIN_45p0 46341 /* sin(45) = 46341 / 65536 */ -#define COS_45p0 SIN_45p0 /* cos(45) = sin(45) */ - -/* Named indices into the 16 circle points generated by nxgl_circlepts */ - -#define POINT_0p0 0 -#define POINT_22p5 1 -#define POINT_45p0 2 -#define POINT_67p5 3 -#define POINT_90p0 4 -#define POINT_112p5 5 -#define POINT_135p0 6 -#define POINT_157p5 7 -#define POINT_180p0 8 -#define POINT_202p5 9 -#define POINT_225p0 10 -#define POINT_247p5 11 -#define POINT_270p0 12 -#define POINT_292p5 13 -#define POINT_315p0 14 -#define POINT_337p5 15 -#define NCIRCLE_POINTS 16 - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_circlepts - * - * Description: - * Given a description of a circle, return a set of 16 points on the - * circumference of the circle. These points may then be used by - * nx_drawcircle() or related APIs to draw a circle outline. - * - * Input parameters: - * center - A pointer to the point that is the center of the circle - * radius - The radius of the circle in pixels. - * circle - A pointer the first entry in an array of 16 points where the - * circle points will be returned. - * - * Returned value: - * None - * - ****************************************************************************/ - -void nxgl_circlepts(FAR const struct nxgl_point_s *center, nxgl_coord_t radius, - FAR struct nxgl_point_s *circle) -{ - nxgl_coord_t xoffs; - nxgl_coord_t yoffs; - - /* 0, 90, 180, and 270 degrees are the easiest */ - - circle[POINT_0p0].x = center->x + radius; - circle[POINT_0p0].y = center->y; - circle[POINT_90p0].x = center->x; - circle[POINT_90p0].y = center->y + radius; - circle[POINT_180p0].x = center->x - radius; - circle[POINT_180p0].y = center->y; - circle[POINT_270p0].x = center->x; - circle[POINT_270p0].y = center->y - radius; - - /* Now 22.5, 67.5, 112.5, 157.5, 202.5, 247.5, 292.5, and 337.5 */ - - xoffs = b16toi(b16muli(COS_22p5, radius) + b16HALF); - yoffs = b16toi(b16muli(SIN_22p5, radius) + b16HALF); - - circle[POINT_22p5].x = center->x + xoffs; - circle[POINT_22p5].y = center->y + yoffs; - circle[POINT_157p5].x = center->x - xoffs; - circle[POINT_157p5].y = center->y + yoffs; - circle[POINT_202p5].x = center->x - xoffs; - circle[POINT_202p5].y = center->y - yoffs; - circle[POINT_337p5].x = center->x + xoffs; - circle[POINT_337p5].y = center->y - yoffs; - - circle[POINT_67p5].x = center->x + yoffs; - circle[POINT_67p5].y = center->y + xoffs; - circle[POINT_112p5].x = center->x - yoffs; - circle[POINT_112p5].y = center->y + xoffs; - circle[POINT_247p5].x = center->x - yoffs; - circle[POINT_247p5].y = center->y - xoffs; - circle[POINT_292p5].x = center->x + yoffs; - circle[POINT_292p5].y = center->y - xoffs; - - /* Finally, 45.0, 135.0, 225.0, 315.0 */ - - xoffs = b16toi(b16muli(COS_45p0, radius) + b16HALF); - - circle[POINT_45p0].x = center->x + xoffs; - circle[POINT_45p0].y = center->y + xoffs; - circle[POINT_135p0].x = center->x - xoffs; - circle[POINT_135p0].y = center->y + xoffs; - circle[POINT_225p0].x = center->x - xoffs; - circle[POINT_225p0].y = center->y - xoffs; - circle[POINT_315p0].x = center->x + xoffs; - circle[POINT_315p0].y = center->y - xoffs; -} diff --git a/nuttx/graphics/nxglib/nxglib_circletraps.c b/nuttx/graphics/nxglib/nxglib_circletraps.c deleted file mode 100644 index 8ee287795..000000000 --- a/nuttx/graphics/nxglib/nxglib_circletraps.c +++ /dev/null @@ -1,176 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxglib_circletraps.c - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <string.h> -#include <errno.h> -#include <fixedmath.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Trigonometry */ - -#define SIN_0p0 0 /* sin(0) = 0 */ -#define COS_0p0 1 /* cos(0) = 1 */ -#define SIN_22p5 25080 /* sin(22.5) = 25080 / 65536 */ -#define COS_22p5 60547 /* cos(22.5) = 60547 / 65536 */ -#define SIN_45p0 46341 /* sin(45) = 46341 / 65536 */ -#define COS_45p0 SIN_45p0 /* cos(45) = sin(45) */ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_circletraps - * - * Description: - * Given a description of a a circle, return 8 trapezoids that can be - * used to fill the circle by nx_fillcircle() and other interfaces. - * - * Input parameters: - * center - A pointer to the point that is the center of the circle - * radius - The radius of the circle in pixels. - * circle - A pointer the first entry in an array of 8 trapezoids where - * the circle description will be returned. - * - * Returned value: - * None - * - ****************************************************************************/ - -void nxgl_circletraps(FAR const struct nxgl_point_s *center, nxgl_coord_t radius, - FAR struct nxgl_trapezoid_s *circle) -{ - nxgl_coord_t xoffs; - nxgl_coord_t yoffs; - - circle[0].top.x1 = itob16(center->x); - circle[0].top.x2 = circle[0].top.x1; - circle[0].top.y = center->y - radius; - - circle[7].bot.x1 = circle[0].top.x1; - circle[7].bot.x2 = circle[0].top.x1; - circle[7].bot.y = center->y + radius; - - circle[3].bot.x1 = itob16(center->x - radius); - circle[3].bot.x2 = itob16(center->x + radius); - circle[3].bot.y = center->y; - - circle[4].top.x1 = circle[3].bot.x1; - circle[4].top.x2 = circle[3].bot.x2; - circle[4].top.y = circle[3].bot.y; - - /* Now 22.5, 67.5, 112.5, 157.5, 202.5, 247.5, 292.5, and 337.5 */ - - xoffs = b16toi(b16muli(COS_22p5, radius) + b16HALF); - yoffs = b16toi(b16muli(SIN_22p5, radius) + b16HALF); - - circle[2].bot.x1 = itob16(center->x - xoffs); - circle[2].bot.x2 = itob16(center->x + xoffs); - circle[2].bot.y = center->y - yoffs; - - circle[3].top.x1 = circle[2].bot.x1; - circle[3].top.x2 = circle[2].bot.x2; - circle[3].top.y = circle[2].bot.y; - - circle[4].bot.x1 = circle[2].bot.x1; - circle[4].bot.x2 = circle[2].bot.x2; - circle[4].bot.y = center->y + yoffs; - - circle[5].top.x1 = circle[4].bot.x1; - circle[5].top.x2 = circle[4].bot.x2; - circle[5].top.y = circle[4].bot.y; - - circle[0].bot.x1 = itob16(center->x - yoffs); - circle[0].bot.x2 = itob16(center->x + yoffs); - circle[0].bot.y = center->y - xoffs; - - circle[1].top.x1 = circle[0].bot.x1; - circle[1].top.x2 = circle[0].bot.x2; - circle[1].top.y = circle[0].bot.y; - - circle[6].bot.x1 = circle[1].top.x1; - circle[6].bot.x2 = circle[1].top.x2; - circle[6].bot.y = center->y + xoffs; - - circle[7].top.x1 = circle[6].bot.x1; - circle[7].top.x2 = circle[6].bot.x2; - circle[7].top.y = circle[6].bot.y; - - /* Finally, 45.0, 135.0, 225.0, 315.0 */ - - xoffs = b16toi(b16muli(COS_45p0, radius) + b16HALF); - - circle[1].bot.x1 = itob16(center->x - xoffs); - circle[1].bot.x2 = itob16(center->x + xoffs); - circle[1].bot.y = center->y - xoffs; - - circle[2].top.x1 = circle[1].bot.x1; - circle[2].top.x2 = circle[1].bot.x2; - circle[2].top.y = circle[1].bot.y; - - circle[5].bot.x1 = circle[1].bot.x1; - circle[5].bot.x2 = circle[1].bot.x2; - circle[5].bot.y = center->y + xoffs; - - circle[6].top.x1 = circle[5].bot.x1; - circle[6].top.x2 = circle[5].bot.x2; - circle[6].top.y = circle[5].bot.y; -} diff --git a/nuttx/graphics/nxglib/nxglib_colorcopy.c b/nuttx/graphics/nxglib/nxglib_colorcopy.c deleted file mode 100644 index 42c0d0d45..000000000 --- a/nuttx/graphics/nxglib/nxglib_colorcopy.c +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_colorcopy.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_colorcopy - * - * Description: - * This is essentially memcpy for colors. This does very little for us - * other than hide all of the conditional compilation for planar colors - * in one place. - * - ****************************************************************************/ - -void nxgl_colorcopy(nxgl_mxpixel_t dest[CONFIG_NX_NPLANES], - const nxgl_mxpixel_t src[CONFIG_NX_NPLANES]) -{ - int i; - - for (i = 0; i < CONFIG_NX_NPLANES; i++) - { - dest[i] = src[i]; - } -} diff --git a/nuttx/graphics/nxglib/nxglib_copyrun.h b/nuttx/graphics/nxglib/nxglib_copyrun.h deleted file mode 100644 index a52af2246..000000000 --- a/nuttx/graphics/nxglib/nxglib_copyrun.h +++ /dev/null @@ -1,346 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_copyrun.h - * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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. - * - ****************************************************************************/ - -#ifndef __GRAPHICS_NXGLIB_NXGLIB_COPYRUN_H -#define __GRAPHICS_NXGLIB_NXGLIB_COPYRUN_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> -#include <stdint.h> -#include <string.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_copyrun_*bpp - * - * Description: - * Copy a row from an image into run. - * - ****************************************************************************/ - -#if NXGLIB_BITSPERPIXEL == 1 -static inline void -nxgl_copyrun_1bpp(FAR const uint8_t *src, FAR uint8_t *dest, - unsigned int remainder, size_t npixels) -{ - uint8_t indata; - uint8_t outdata; - uint8_t nextdata; - unsigned int outpixels = 0; - - DEBUGASSERT(remainder > 0 && remainder < 8); - - /* Take only the first 8-remainder pixels from the first byte. - * remainder is number between 1 and 7 (not zero!) that represents - * the alignment of the pixel bits in the source. - */ - - indata = *src++; - -#ifdef CONFIG_NX_PACKEDMSFIRST - /* If CONFIG_NX_PACKEDMSFIRST is defined, then bits 0-(remainder-1) - * are carried over to the first pass through the loop. For - * example if remainder == 2: - * - * indata: xxAA AAAA maps to nextdata: AAAA AAxx - */ - - nextdata = (indata << remainder); - -#else - /* If CONFIG_NX_PACKEDMSFIRST is NOT defined, then bits (7-remainder)-7 - * are carried over to the first pass through the loop. For example - * if remainder == 2: - * - * indata: AAAA AAxx maps to nextdata: xxAA AAAA - */ - - nextdata = (indata >> remainder); - -#endif - - /* Loop until all pixels have been packed into the destination. Note: - * a outpixels increments by 8 so a few extra pixels will be packed on - * the output. This should not be an issue. - */ - - while (outpixels < npixels) - { - /* Get the next byte from the source */ - - indata = *src++; - outdata = nextdata; - - /* remainder is number between 1 and 7 (not zero!) that represents - * the alignment of the pixel bits in the source. - */ - -#ifdef CONFIG_NX_PACKEDMSFIRST - /* If CONFIG_NX_PACKEDMSFIRST is defined, then bits (7-remainder)-7 - * are carried over from that last pass through the loop. For - * example if remainder == 2: - * - * nextdata = AAAA AAxx - dest = AAAA AABB - * src = BBCC CCCC - nextdata = CCCC CCxx - */ - - outdata |= (indata >> (8 - remainder)); - nextdata = (indata << remainder); -#else - /* If CONFIG_NX_PACKEDMSFIRST is NOT defined, then bits 0-(remainder-1) - * are carried over from that last pass through the loop . For - * example if remainder == 2: - * - * nextdata = xxAA AAAA - dest = BBAA AAAA - * src = CCCC CCBB - nextdata = xxCC CCCC - */ - - outdata |= (indata << (8 - remainder)); - nextdata = (indata >> remainder); -#endif - - /* Transfer the byte to the run buffer */ - - *dest++ = outdata; - outpixels += 8; - } -} - -#elif NXGLIB_BITSPERPIXEL == 2 -static inline void -nxgl_copyrun_2bpp(FAR const uint8_t *src, FAR uint8_t *dest, - unsigned int remainder, size_t npixels) -{ - uint8_t indata; - uint8_t outdata; - uint8_t nextdata; - unsigned int outpixels = 0; - unsigned int shift; - - DEBUGASSERT(remainder > 0 && remainder < 4); - - /* Take only the first 8-(2*remainder) pixels from the first byte. - * remainder is number between 1 and 3 (not zero!) that represents - * the alignment of the pixel bits in the source. - */ - - indata = *src++; - shift = (remainder << 1); - -#ifdef CONFIG_NX_PACKEDMSFIRST - /* If CONFIG_NX_PACKEDMSFIRST is defined, then bits 0-(2*remainder-1) - * are carried over to the first pass through the loop. For - * example if remainder == 1: - * - * indata: xxAA AAAA maps to nextdata: AAAA AAxx - */ - - nextdata = (indata << shift); - -#else - /* If CONFIG_NX_PACKEDMSFIRST is NOT defined, then bits (7-2*remainder)-7 - * are carried over to the first pass through the loop. For example - * if remainder == 1: - * - * indata: AAAA AAxx maps to nextdata: xxAA AAAA - */ - - nextdata = (indata >> shift); - -#endif - - /* Loop until all pixels have been packed into the destination. Note: - * a outpixels increments by 8 so a few extra pixels will be packed on - * the output. This should not be an issue. - */ - - while (outpixels < npixels) - { - /* Get the next byte from the source */ - - indata = *src++; - outdata = nextdata; - - /* remainder is number between 1 and 3 (not zero!) that represents - * the alignment of the pixel bits in the source. - */ - -#ifdef CONFIG_NX_PACKEDMSFIRST - /* If CONFIG_NX_PACKEDMSFIRST is defined, then bits (7-2*remainder)-7 - * are carried over from that last pass through the loop. For example - * if remainder == 1: - * - * nextdata = AAAA AAxx - dest = AAAA AABB - * src = BBCC CCCC - nextdata = CCCC CCxx - */ - - outdata |= (indata >> (8 - shift)); - nextdata = (indata << shift); -#else - /* If CONFIG_NX_PACKEDMSFIRST is NOT defined, then bits 0-(2*remainder-1) - * are carried over from that last pass through the loop. For example - * if remainder == 1: - * - * nextdata = xxAA AAAA - dest = BBAA AAAA - * src = CCCC CCBB - nextdata = xxCC CCCC - */ - - outdata |= (indata << (8 - shift)); - nextdata = (indata >> shift); -#endif - - /* Transfer the byte to the run buffer */ - - *dest++ = outdata; - outpixels += 4; - } -} - -#elif NXGLIB_BITSPERPIXEL == 4 -static inline void -nxgl_copyrun_4bpp(FAR const uint8_t *src, FAR uint8_t *dest, - unsigned int remainder, size_t npixels) -{ - uint8_t indata; - uint8_t outdata; - uint8_t nextdata; - unsigned int outpixels = 0; - - DEBUGASSERT(remainder == 1); - - /* Take only the first 8-remainder pixels from the first byte. - * remainder is number between 1 and 3 (not zero!) that represents - * the alignment of the pixel bits in the source. - */ - - indata = *src++; - -#ifdef CONFIG_NX_PACKEDMSFIRST - /* If CONFIG_NX_PACKEDMSFIRST is defined, then bits 0-3 - * are carried over to the first pass through the loop. For - * example: - * - * indata: xxxx AAAA maps to nextdata: AAAA xxxx - */ - - nextdata = (indata << 4); - -#else - /* If CONFIG_NX_PACKEDMSFIRST is NOT defined, then bits 4-7 - * are carried over to the first pass through the loop. For example: - * - * indata: AAAA xxxx maps to nextdata: xxxx AAAA - */ - - nextdata = (indata >> 4); - -#endif - - /* Loop until all pixels have been packed into the destination. Note: - * a outpixels increments by 8 so a few extra pixels will be packed on - * the output. This should not be an issue. - */ - - while (outpixels < npixels) - { - /* Get the next byte from the source */ - - indata = *src++; - outdata = nextdata; - - /* remainder is number between 1 and 3 (not zero!) that represents - * the alignment of the pixel bits in the source. - */ - -#ifdef CONFIG_NX_PACKEDMSFIRST - /* If CONFIG_NX_PACKEDMSFIRST is defined, then bits 4-7 - * are carried over from that last pass through the loop (or are - * ignored initially. For example if remainder == 1: - * - * nextdata = AAAA xxxx - dest = AAAA BBBB - * src = BBBB CCCC - nextdata = CCCC xxxx - */ - - outdata |= (indata >> 4); - nextdata = (indata << 4); -#else - /* If CONFIG_NX_PACKEDMSFIRST is NOT defined, then bits 0-(remainder-1) - * are carried over from that last pass through the loop (or are - * ignored initially). For example if remainder == 2: - * - * nextdata = xxAA AAAA - dest = BBAA AAAA - * src = CCCC CCBB - nextdata = xxCC CCCC - */ - - outdata |= (indata << 4); - nextdata = (indata >> 4); -#endif - - /* Transfer the byte to the run buffer */ - - *dest++ = outdata; - outpixels += 2; - } -} -#endif -#endif /* __GRAPHICS_NXGLIB_NXGLIB_COPYRUN_H */ - - diff --git a/nuttx/graphics/nxglib/nxglib_fillrun.h b/nuttx/graphics/nxglib/nxglib_fillrun.h deleted file mode 100644 index 1dcf85dd9..000000000 --- a/nuttx/graphics/nxglib/nxglib_fillrun.h +++ /dev/null @@ -1,196 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_fullrun.h - * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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. - * - ****************************************************************************/ - -#ifndef __GRAPHICS_NXGLIB_NXGLIB_FILLRUN_H -#define __GRAPHICS_NXGLIB_NXGLIB_FILLRUN_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> -#include <stdint.h> -#include <string.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -#if NXGLIB_BITSPERPIXEL < 16 -# define NXGLIB_RUNTYPE uint8_t -#elif NXGLIB_BITSPERPIXEL == 16 -# define NXGLIB_RUNTYPE uint16_t -#else -# define NXGLIB_RUNTYPE uint32_t -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -#if NXGLIB_BITSPERPIXEL == 2 -static uint8_t g_wide_2bpp[4] = { 0x00, 0x55, 0xaa, 0xff }; -#endif - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_fillrun_*bpp - * - * Description: - * fill a run with the specified color. - * - ****************************************************************************/ - -#if NXGLIB_BITSPERPIXEL == 1 -static inline void nxgl_fillrun_1bpp(FAR uint8_t *run, nxgl_mxpixel_t color, - size_t npixels) -{ - /* Get the number of bytes to fill */ - - unsigned int nbytes = (npixels + 7) >> 3; - - /* Get the value of the byte to fill */ - - uint8_t wide = (color & 1) != 0 ? 0xff : 0x00; - - /* Fill the run with the color (it is okay to run a fractional byte over - * the end) - */ - - memset(run, wide, nbytes); -} - -#elif NXGLIB_BITSPERPIXEL == 2 -static inline void nxgl_fillrun_2bpp(FAR uint8_t *run, nxgl_mxpixel_t color, - size_t npixels) -{ - /* Get the number of bytes to fill */ - - unsigned int nbytes = (npixels + 3) >> 2; - - /* Get the value of the byte to fill */ - - uint8_t wide = g_wide_2bpp[color & 3]; - - /* Fill the run with the color (it is okay to run a fractional byte over - * the end) - */ - - memset(run, wide, nbytes); -} - -#elif NXGLIB_BITSPERPIXEL == 4 -static inline void nxgl_fillrun_4bpp(FAR uint8_t *run, nxgl_mxpixel_t color, - size_t npixels) -{ - /* Get the number of bytes to fill */ - - unsigned int nbytes = (npixels + 1) >> 1; - - /* Get the value of the byte to fill */ - - uint8_t narrow = (uint8_t)color & 0x0f; - uint8_t wide = narrow | (narrow << 4); - - /* Fill the run with the color (it is okay to run a fractional byte over - * the end) - */ - - memset(run, wide, nbytes); -} - -#elif NXGLIB_BITSPERPIXEL == 8 -static inline void nxgl_fillrun_8bpp(FAR uint8_t *run, nxgl_mxpixel_t color, - size_t npixels) -{ - /* Fill the run with the color (it is okay to run a fractional byte overy the end */ - - memset(run, color, npixels); -} - -#elif NXGLIB_BITSPERPIXEL == 16 -static inline void nxgl_fillrun_16bpp(FAR uint16_t *run, nxgl_mxpixel_t color, - size_t npixels) -{ - /* Fill the run with the color (it is okay to run a fractional byte overy the end */ - - while (npixels-- > 0) - { - *run++ = (uint16_t)color; - } -} - -#elif NXGLIB_BITSPERPIXEL == 24 -static inline void nxgl_fillrun_24bpp(FAR uint32_t *run, nxgl_mxpixel_t color, size_t npixels) -{ - /* Fill the run with the color (it is okay to run a fractional byte overy the end */ -#warning "Assuming 24-bit color is not packed" - while (npixels-- > 0) - { - *run++ = (uint32_t)color; - } -} - -#elif NXGLIB_BITSPERPIXEL == 32 -static inline void nxgl_fillrun_32bpp(FAR uint32_t *run, nxgl_mxpixel_t color, size_t npixels) -{ - /* Fill the run with the color (it is okay to run a fractional byte overy the end */ - - while (npixels-- > 0) - { - *run++ = (uint32_t)color; - } -} -#else -# error "Unsupported value of NXGLIB_BITSPERPIXEL" -#endif -#endif /* __GRAPHICS_NXGLIB_NXGLIB_FILLRUN_H */ - - diff --git a/nuttx/graphics/nxglib/nxglib_intersecting.c b/nuttx/graphics/nxglib/nxglib_intersecting.c deleted file mode 100644 index e1370c140..000000000 --- a/nuttx/graphics/nxglib/nxglib_intersecting.c +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_intersecting.c - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdbool.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_intersecting - * - * Description: - * Return true if the rectangles intersect. - * - ****************************************************************************/ - -bool nxgl_intersecting(FAR const struct nxgl_rect_s *rect1, - FAR const struct nxgl_rect_s *rect2) -{ - return ((rect1->pt2.x > rect2->pt1.x) && (rect1->pt2.y > rect2->pt1.y) && - (rect1->pt1.x < rect2->pt2.x) && (rect1->pt1.y < rect2->pt1.y)); -} diff --git a/nuttx/graphics/nxglib/nxglib_nonintersecting.c b/nuttx/graphics/nxglib/nxglib_nonintersecting.c deleted file mode 100644 index d78da994e..000000000 --- a/nuttx/graphics/nxglib/nxglib_nonintersecting.c +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_rectnonintersecting.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_nonintersecting - * - * Description: - * Return the regions of rectangle rect 1 that do not intersect with - * rect2. This may be up to founr rectangles some of which may be - * degenerate (and can be picked off with nxgl_nullrect) - * - ****************************************************************************/ - -void nxgl_nonintersecting(FAR struct nxgl_rect_s result[4], - FAR const struct nxgl_rect_s *rect1, - FAR const struct nxgl_rect_s *rect2) -{ - struct nxgl_rect_s intersection; - - /* Get the intersection of the two rectangles */ - - nxgl_rectintersect(&intersection, rect1, rect2); - - /* Then return the four rectangles representing the regions NON included - * in the intersection. Some of these rectangles may be invalid (zero - * area), but those can be picked off using nxgl_nullrect() - * - * rect1.pt1 - * +-------------------------+ - * | rect2.pt1 | - * | int.pt1 | - * | +-------------------------+ - * | | | | - * | | | | - * +-------------------------+ | - * | rect1.pt2 | - * | int.pt2 | - * +-------------------------+ - * rect2.pt2 - * rect1.pt1 - * +-------------------------+ - * rect2.pt1 |int.pt1 | - * +---------+---------------+ | - * | | | | - * | | | | - * | | |int.pt2 | - * | +---------------+---------+ - * | | rect1.pt2 - * +-------------------------+ - * rect2.pt2 - * rect2.pt1 - * +-------------------------+ - * | rect1.pt1 | - * | int.pt1 | - * | +-------------------------+ - * | | | | - * | | | | - * | | | | - * +---------+---------------+ | - * | rect2.pt2 | - * | int.pt2 | - * +-------------------------+ - * rect1.pt2 - */ - - result[NX_TOP_NDX].pt1.x = rect1->pt1.x; - result[NX_TOP_NDX].pt1.y = rect1->pt1.y; - result[NX_TOP_NDX].pt2.x = rect1->pt2.x; - result[NX_TOP_NDX].pt2.y = intersection.pt1.y - 1; - - result[NX_BOTTOM_NDX].pt1.x = rect1->pt1.x; - result[NX_BOTTOM_NDX].pt1.y = intersection.pt2.y + 1; - result[NX_BOTTOM_NDX].pt2.x = rect1->pt2.x; - result[NX_BOTTOM_NDX].pt2.y = rect1->pt2.y; - - result[NX_LEFT_NDX].pt1.x = rect1->pt1.x; - result[NX_LEFT_NDX].pt1.y = intersection.pt1.y; - result[NX_LEFT_NDX].pt2.x = intersection.pt1.x - 1; - result[NX_LEFT_NDX].pt2.y = intersection.pt2.y; - - result[NX_RIGHT_NDX].pt1.x = intersection.pt2.x + 1; - result[NX_RIGHT_NDX].pt1.y = intersection.pt1.y; - result[NX_RIGHT_NDX].pt2.x = rect1->pt2.x; - result[NX_RIGHT_NDX].pt2.y = intersection.pt2.y; -} - - diff --git a/nuttx/graphics/nxglib/nxglib_nullrect.c b/nuttx/graphics/nxglib/nxglib_nullrect.c deleted file mode 100644 index 26fc9e8d7..000000000 --- a/nuttx/graphics/nxglib/nxglib_nullrect.c +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_nullrect.c - * - * Copyright (C) 2008-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdbool.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_nullrect - * - * Description: - * Return true if the area of the retangle is <= 0. - * - ****************************************************************************/ - -bool nxgl_nullrect(FAR const struct nxgl_rect_s *rect) -{ - return (rect->pt1.x > rect->pt2.x || rect->pt1.y > rect->pt2.y); -} - diff --git a/nuttx/graphics/nxglib/nxglib_rectadd.c b/nuttx/graphics/nxglib/nxglib_rectadd.c deleted file mode 100644 index f4eda341d..000000000 --- a/nuttx/graphics/nxglib/nxglib_rectadd.c +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_rectadd.c - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_rectadd - * - * Description: - * Return the rectangle that contains exactly two other rectanges. - * - ****************************************************************************/ - -void nxgl_rectadd(FAR struct nxgl_rect_s *dest, - FAR const struct nxgl_rect_s *src1, - FAR const struct nxgl_rect_s *src2) -{ - dest->pt1.x = ngl_min(src1->pt1.x, src2->pt1.x); - dest->pt1.y = ngl_min(src1->pt1.y, src2->pt1.y); - dest->pt2.x = ngl_max(src1->pt2.x, src2->pt2.x); - dest->pt2.y = ngl_max(src1->pt2.y, src2->pt2.y); -} diff --git a/nuttx/graphics/nxglib/nxglib_rectcopy.c b/nuttx/graphics/nxglib/nxglib_rectcopy.c deleted file mode 100644 index 67e5f6d69..000000000 --- a/nuttx/graphics/nxglib/nxglib_rectcopy.c +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_rectcopy.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_rectcopy - * - * Description: - * This is essentially memcpy for rectangles. We don't do structure - * assignements because some compilers are not good at that. - * - ****************************************************************************/ - -void nxgl_rectcopy(FAR struct nxgl_rect_s *dest, - FAR const struct nxgl_rect_s *src) -{ - dest->pt1.x = src->pt1.x; - dest->pt1.y = src->pt1.y; - dest->pt2.x = src->pt2.x; - dest->pt2.y = src->pt2.y; -} diff --git a/nuttx/graphics/nxglib/nxglib_rectinside.c b/nuttx/graphics/nxglib/nxglib_rectinside.c deleted file mode 100644 index 6ca29ddb6..000000000 --- a/nuttx/graphics/nxglib/nxglib_rectinside.c +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_rectinside.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdbool.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_rectinside - * - * Description: - * Return true if the point pt lies within rect. - * - ****************************************************************************/ - -bool nxgl_rectinside(FAR const struct nxgl_rect_s *rect, - FAR const struct nxgl_point_s *pt) -{ - return (pt->x >= rect->pt1.x && pt->x <= rect->pt2.x && - pt->y >= rect->pt1.y && pt->y <= rect->pt2.y); -} diff --git a/nuttx/graphics/nxglib/nxglib_rectintersect.c b/nuttx/graphics/nxglib/nxglib_rectintersect.c deleted file mode 100644 index 6af24ee26..000000000 --- a/nuttx/graphics/nxglib/nxglib_rectintersect.c +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_rectintersect.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_rectintersect - * - * Description: - * Return the rectangle representing the intersection of the two rectangles. - * - ****************************************************************************/ - -void nxgl_rectintersect(FAR struct nxgl_rect_s *dest, - FAR const struct nxgl_rect_s *src1, - FAR const struct nxgl_rect_s *src2) -{ - dest->pt1.x = ngl_max(src1->pt1.x, src2->pt1.x); - dest->pt1.y = ngl_max(src1->pt1.y, src2->pt1.y); - dest->pt2.x = ngl_min(src1->pt2.x, src2->pt2.x); - dest->pt2.y = ngl_min(src1->pt2.y, src2->pt2.y); -} diff --git a/nuttx/graphics/nxglib/nxglib_rectoffset.c b/nuttx/graphics/nxglib/nxglib_rectoffset.c deleted file mode 100644 index 2392d6448..000000000 --- a/nuttx/graphics/nxglib/nxglib_rectoffset.c +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_rectoffset.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_rectoffset - * - * Description: - * Offset the rectangle position by the specified dx, dy values. - * - ****************************************************************************/ - -void nxgl_rectoffset(FAR struct nxgl_rect_s *dest, - FAR const struct nxgl_rect_s *src, - nxgl_coord_t dx, nxgl_coord_t dy) -{ - dest->pt1.x = src->pt1.x + dx; - dest->pt1.y = src->pt1.y + dy; - dest->pt2.x = src->pt2.x + dx; - dest->pt2.y = src->pt2.y + dy; -} - - - diff --git a/nuttx/graphics/nxglib/nxglib_rectoverlap.c b/nuttx/graphics/nxglib/nxglib_rectoverlap.c deleted file mode 100644 index 779951881..000000000 --- a/nuttx/graphics/nxglib/nxglib_rectoverlap.c +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_nulloverlap.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdbool.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_rectoverlap - * - * Description: - * Return true if the two rectangles overlap - * - ****************************************************************************/ - -bool nxgl_rectoverlap(FAR struct nxgl_rect_s *rect1, - FAR struct nxgl_rect_s *rect2) -{ - /* The neither is wholly above, below, right, or left of the other, then - * the two rectangles overlap in some fashion. - */ - - return (rect1->pt1.x <= rect2->pt2.x) && /* false: rect1 is wholly to the right */ - (rect2->pt1.x <= rect1->pt2.x) && /* false: rect2 is wholly to the right */ - (rect1->pt1.y <= rect2->pt2.y) && /* false: rect1 is wholly below rect2 */ - (rect2->pt1.y <= rect1->pt2.y); /* false: rect2 is wholly below rect1 */ -} - diff --git a/nuttx/graphics/nxglib/nxglib_rectsize.c b/nuttx/graphics/nxglib/nxglib_rectsize.c deleted file mode 100644 index 37d863596..000000000 --- a/nuttx/graphics/nxglib/nxglib_rectsize.c +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxglib_rectsize.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_rectsize - * - * Description: - * Return the size of the specified rectangle. - * - ****************************************************************************/ - -void nxgl_rectsize(FAR struct nxgl_size_s *size, - FAR const struct nxgl_rect_s *rect) -{ - size->w = rect->pt2.x - rect->pt1.x + 1; - size->h = rect->pt2.y - rect->pt1.y + 1; -} diff --git a/nuttx/graphics/nxglib/nxglib_rectunion.c b/nuttx/graphics/nxglib/nxglib_rectunion.c deleted file mode 100644 index 36c0968fa..000000000 --- a/nuttx/graphics/nxglib/nxglib_rectunion.c +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_rectunion.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_rectunion - * - * Description: - * Given two rectanges, src1 and src2, return the larger rectangle that - * contains both, dest. - * - ****************************************************************************/ - -void nxgl_rectunion(FAR struct nxgl_rect_s *dest, - FAR const struct nxgl_rect_s *src1, - FAR const struct nxgl_rect_s *src2) -{ - dest->pt1.x = ngl_min(src1->pt1.x, src2->pt1.x); - dest->pt1.y = ngl_min(src1->pt1.y, src2->pt1.y); - dest->pt2.x = ngl_max(src1->pt2.x, src2->pt2.x); - dest->pt2.y = ngl_max(src1->pt2.y, src2->pt2.y); -} diff --git a/nuttx/graphics/nxglib/nxglib_rgb2yuv.c b/nuttx/graphics/nxglib/nxglib_rgb2yuv.c deleted file mode 100644 index 31eff23fa..000000000 --- a/nuttx/graphics/nxglib/nxglib_rgb2yuv.c +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** - * graphics/color/nxglib_rgb2yuv.c - * - * Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdint.h> -#include <debug.h> -#include <fixedmath.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -#define b16_P0813 0x000014d0 /* 0.0813 */ -#define b16_P1140 0x00001d2f /* 0.1140 */ -#define b16_P1687 0x00002b30 /* 0.1687 */ -#define b16_P2990 0x00004c8b /* 0.2990 */ -#define b16_P3313 0x000054d0 /* 0.3313 */ -#define b16_P4187 0x00006b30 /* 0.4187 */ -#define b16_P5000 0x00008000 /* 0.5000 */ -#define b16_P5870 0x00009646 /* 0.5870 */ -#define b16_128P0 0x00800000 /* 128.0 */ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_rgb2yuv - * - * Description: - * Convert 8-bit RGB triplet to 8-bit YUV triplet - * - ****************************************************************************/ - -void nxgl_rgb2yuv(uint8_t r, uint8_t g, uint8_t b, - uint8_t *y, uint8_t *u, uint8_t *v) -{ - /* Per the JFIF specification: - * - * Y = (0.2990 * R) + (0.5870 * G) + (0.1140 * B) - * U = 128 - (0.1687 * R) - (0.3313 * G) + (0.5000 * B) - * V = 128 + (0.5000 * R) - (0.4187 * G) - (0.0813 * B); - */ - - *y = (uint8_t)b16toi(b16muli(b16_P2990, r) + b16muli(b16_P5870, g) + b16muli(b16_P1140, b)); - *u = (uint8_t)b16toi(b16_128P0 - b16muli(b16_P1687, r) - b16muli(b16_P3313, g) + b16muli(b16_P5000, b)); - *v = (uint8_t)b16toi(b16_128P0 + b16muli(b16_P5000, r) - b16muli(b16_P4187, g) - b16muli(b16_P0813, b)); -} diff --git a/nuttx/graphics/nxglib/nxglib_runcopy.c b/nuttx/graphics/nxglib/nxglib_runcopy.c deleted file mode 100644 index b6170638c..000000000 --- a/nuttx/graphics/nxglib/nxglib_runcopy.c +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_runcopy.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * 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_runoffset.c b/nuttx/graphics/nxglib/nxglib_runoffset.c deleted file mode 100644 index 0c569ce2f..000000000 --- a/nuttx/graphics/nxglib/nxglib_runoffset.c +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_runoffset.c - * - * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <fixedmath.h> -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_runoffset - * - * Description: - * Offset the run position by the specified (integer) dx, dy values. - * - ****************************************************************************/ - -void nxgl_runoffset(FAR struct nxgl_run_s *dest, - FAR const struct nxgl_run_s *src, - nxgl_coord_t dx, nxgl_coord_t dy) -{ - b16_t b16dx = itob16(dx); - dest->x1 = src->x1 + b16dx; - dest->x2 = src->x2 + b16dx; - dest->y = src->y + dy; -} diff --git a/nuttx/graphics/nxglib/nxglib_splitline.c b/nuttx/graphics/nxglib/nxglib_splitline.c deleted file mode 100644 index fa2ccc1a0..000000000 --- a/nuttx/graphics/nxglib/nxglib_splitline.c +++ /dev/null @@ -1,532 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxglib_splitline.c - * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <string.h> -#include <errno.h> -#include <stdlib.h> -#include <debug.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -struct b16point_s -{ - b16_t x; - b16_t y; -}; - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static b16_t nxgl_interpolate(b16_t x, b16_t dy, b16_t dxdy) -{ - b16_t dx = b16mulb16(dy, dxdy); - return x + dx; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_splitline - * - * Description: - * In the general case, a line with width can be represented as a - * parallelogram with a triangle at the top and bottom. Triangles and - * parallelograms are both degenerate versions of a trapeziod. This - * function breaks a wide line into triangles and trapezoids. This - * function also detects other degenerate cases: - * - * 1. If y1 == y2 then the line is horizontal and is better represented - * as a rectangle. - * 2. If x1 == x2 then the line is vertical and also better represented - * as a rectangle. - * 3. If the width of the line is 1, then there are no triangles at the - * top and bottome (this may also be the case if the width is narrow - * and the line is near vertical). - * 4. If the line is oriented is certain angles, it may consist only of - * the upper and lower triangles with no trapezoid in between. In - * this case, 3 trapezoids will be returned, but traps[1] will be - * degenerate. - * - * Input parameters: - * vector - A pointer to the vector described the line to be drawn. - * traps - A pointer to a array of trapezoids (size 3). - * rect - A pointer to a rectangle. - * - * Returned value: - * 0: Line successfully broken up into three trapezoids. Values in - * traps[0], traps[1], and traps[2] are valid. - * 1: Line successfully represented by one trapezoid. Value in traps[1] - * is valid. - * 2: Line successfully represented by one rectangle. Value in rect is - * valid - * <0: On errors, a negated errno value is returned. - * - ****************************************************************************/ - -int nxgl_splitline(FAR struct nxgl_vector_s *vector, - FAR struct nxgl_trapezoid_s *traps, - FAR struct nxgl_rect_s *rect, - nxgl_coord_t linewidth) -{ - struct nxgl_vector_s line; - nxgl_coord_t iheight; - nxgl_coord_t iwidth; - nxgl_coord_t iyoffset; - struct b16point_s quad[4]; - b16_t b16xoffset; - b16_t b16yoffset; - b16_t b16dxdy; - b16_t angle; - b16_t cosangle; - b16_t sinangle; - b16_t b16x; - b16_t b16y; - - gvdbg("vector: (%d,%d)->(%d,%d) linewidth: %d\n", - vector->pt1.x, vector->pt1.y, vector->pt2.x, vector->pt2.y, linewidth); - - /* First, check the linewidth */ - - if (linewidth < 1) - { - return -EINVAL; - } - - /* Then make sure that the start position of the line is above the end - * position of the line... in raster order. - */ - - if (vector->pt1.y < vector->pt2.y) - { - /* Vector is already in raster order */ - - memcpy(&line, vector, sizeof(struct nxgl_vector_s)); - } - else if (vector->pt1.y > vector->pt2.y) - { - /* Swap the top and bottom */ - - line.pt1.x = vector->pt2.x; - line.pt1.y = vector->pt2.y; - line.pt2.x = vector->pt1.x; - line.pt2.y = vector->pt1.y; - } - else /* if (vector->pt1.y == vector->pt2.y) */ - { - /* First degenerate case: The line is horizontal. */ - - if (vector->pt1.x < vector->pt2.x) - { - rect->pt1.x = vector->pt1.x; - rect->pt2.x = vector->pt2.x; - } - else - { - rect->pt1.x = vector->pt2.x; - rect->pt2.x = vector->pt1.x; - } - - /* The height of the rectangle is the width of the line, half above - * and half below. - */ - - rect->pt1.y = vector->pt1.y - (linewidth >> 1); - rect->pt2.y = rect->pt1.y + linewidth - 1; - - gvdbg("Horizontal rect: (%d,%d),(%d,%d)\n", - rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y); - - return 2; - } - - /* Check if the line is vertical */ - - if (line.pt1.x == line.pt2.x) - { - /* Second degenerate case: The line is vertical. */ - - rect->pt1.y = line.pt1.y; - rect->pt2.y = line.pt2.y; - - rect->pt1.x = line.pt1.x - (linewidth >> 1); - rect->pt2.x = rect->pt1.x + linewidth - 1; - - gvdbg("Vertical rect: (%d,%d),(%d,%d)\n", - rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y); - - return 2; - } - - /* The final degenerate case */ - - if (linewidth == 1 && - abs(line.pt2.x - line.pt1.x) < (line.pt2.y - line.pt1.y)) - { - /* A close to vertical line of width 1 is basically - * a single parallelogram of width 1. - */ - - traps[1].top.x1 = itob16(line.pt1.x); - traps[1].top.x2 = traps[1].top.x1; - traps[1].top.y = line.pt1.y; - - traps[1].bot.x1 = itob16(line.pt2.x); - traps[1].bot.x2 = traps[1].bot.x1; - traps[1].bot.y = line.pt2.y; - - gvdbg("Vertical traps[1]: (%08x,%08x,%d),(%08x,%08x, %d)\n", - traps[1].top.x1, traps[1].top.x2, traps[1].top.y, - traps[1].bot.x1, traps[1].bot.x2, traps[1].bot.y); - - return 1; - } - - /* Okay, then what remains is interesting. - * - * iheight = |y2 - y1| - * iwidth = |x2 - x1| - */ - - iheight = line.pt2.y - line.pt1.y + 1; - if (line.pt1.x < line.pt2.x) - { - iwidth = line.pt2.x - line.pt1.x + 1; - } - else - { - iwidth = line.pt1.x - line.pt2.x + 1; - } - - /* Applying the line width to the line results in a rotated, rectangle. - * Get the Y offset from an end of the original thin line to a corner of the fat line. - * - * Angle of line: angle = atan2(iheight, iwidth) - * Y offset from line: b16yoffset = linewidth * cos(angle) - * - * For near verical lines, b16yoffset is be nearly zero. For near horizontal - * lines, b16yOffset is be about the same as linewidth. - */ - - angle = b16atan2(itob16(iheight), itob16(iwidth)); - cosangle = b16cos(angle); - b16yoffset = (linewidth * cosangle + 1) >> 1; - - /* Get the X offset from an end of the original thin line to a corner of the fat line. - * - * For near vertical lines, b16xoffset is about the same as linewidth. For near - * horizontal lines, b16xoffset is nearly zero. - */ - - sinangle = b16sin(angle); - b16xoffset = (linewidth * sinangle + 1) >> 1; - - gvdbg("height: %d width: %d angle: %08x b16yoffset: %08x b16xoffset: %08x\n", - iheight, iwidth, angle, b16yoffset, b16xoffset); - - /* Now we know all four points of the rotated rectangle */ - - iyoffset = b16toi(b16yoffset + b16HALF); - if (iyoffset > 0) - { - /* Get the Y positions of each point */ - - b16y = itob16(line.pt1.y); - quad[0].y = b16y - b16yoffset; - quad[1].y = b16y + b16yoffset; - - b16y = itob16(line.pt2.y); - quad[2].y = b16y - b16yoffset; - quad[3].y = b16y + b16yoffset; - - if (line.pt1.x < line.pt2.x) - { - /* Line is going "south east". Get the X positions of each point */ - - b16x = itob16(line.pt1.x); - quad[0].x = b16x + b16xoffset; - quad[1].x = b16x - b16xoffset; - - b16x = itob16(line.pt2.x); - quad[2].x = b16x + b16xoffset; - quad[3].x = b16x - b16xoffset; - - gvdbg("Southeast: quad (%08x,%08x),(%08x,%08x),(%08x,%08x),(%08x,%08x)\n", - quad[0].x, quad[0].y, quad[1].x, quad[1].y, - quad[2].x, quad[2].y, quad[3].x, quad[3].y); - - /* Now we can form the trapezoids. The top of the first trapezoid - * (triangle) is at quad[0] - */ - - traps[0].top.x1 = quad[0].x; - traps[0].top.x2 = quad[0].x; - traps[0].top.y = b16toi(quad[0].y + b16HALF); - - /* The bottom of the first trapezoid (triangle) may be either at - * quad[1] or quad[2], depending upon orientation. - */ - - if (quad[1]. y < quad[2].y) - { - /* quad[1] is at the bottom left of the triangle. Interpolate - * to get the corresponding point on the right side. - * - * Interpolation is from quad[0] along the line quad[0]->quad[2] - * which as the same slope as the line (positive) - */ - - b16dxdy = itob16(iwidth) / iheight; - - traps[0].bot.x1 = quad[1].x; - traps[0].bot.x2 = nxgl_interpolate(quad[0].x, quad[1].y - quad[0].y, b16dxdy); - traps[0].bot.y = b16toi(quad[1].y + b16HALF); - - /* quad[1] is at the top left of the second trapezoid. quad[2} is - * at the bottom right of the second trapezoid. Interpolate to get - * corresponding point on the left side. - * - * Interpolation is from quad[1] along the line quad[1]->quad[3] - * which as the same slope as the line (positive) - */ - - traps[1].top.x1 = traps[0].bot.x1; - traps[1].top.x2 = traps[0].bot.x2; - traps[1].top.y = traps[0].bot.y; - - traps[1].bot.x1 = nxgl_interpolate(traps[1].top.x1, quad[2].y - quad[1].y, b16dxdy); - traps[1].bot.x2 = quad[2].x; - traps[1].bot.y = b16toi(quad[2].y + b16HALF); - } - else - { - /* quad[2] is at the bottom right of the triangle. Interpolate - * to get the corresponding point on the left side. - * - * Interpolation is from quad[0] along the line quad[0]->quad[1] - * which orthogonal to the slope of the line (and negative) - */ - - b16dxdy = -itob16(iheight) / iwidth; - - traps[0].bot.x1 = nxgl_interpolate(quad[0].x, quad[2].y - quad[0].y, b16dxdy); - traps[0].bot.x2 = quad[2].x; - traps[0].bot.y = b16toi(quad[2].y + b16HALF); - - /* quad[2] is at the top right of the second trapezoid. quad[1} is - * at the bottom left of the second trapezoid. Interpolate to get - * corresponding point on the right side. - * - * Interpolation is from quad[2] along the line quad[2]->quad[3] - * which as the same slope as the previous interpolation. - */ - - traps[1].top.x1 = traps[0].bot.x1; - traps[1].top.x2 = traps[0].bot.x2; - traps[1].top.y = traps[0].bot.y; - - traps[1].bot.x1 = quad[1].x; - traps[1].bot.x2 = nxgl_interpolate(traps[1].top.x2, quad[1].y - quad[2].y, b16dxdy); - traps[1].bot.y = b16toi(quad[1].y + b16HALF); - } - - /* The final trapezond (triangle) at the bottom is new well defined */ - - traps[2].top.x1 = traps[1].bot.x1; - traps[2].top.x2 = traps[1].bot.x2; - traps[2].top.y = traps[1].bot.y; - - traps[2].bot.x1 = quad[3].x; - traps[2].bot.x2 = quad[3].x; - traps[2].bot.y = b16toi(quad[3].y + b16HALF); - } - else - { - /* Get the X positions of each point */ - - b16x = itob16(line.pt1.x); - quad[0].x = b16x - b16xoffset; - quad[1].x = b16x + b16xoffset; - - b16x = itob16(line.pt2.x); - quad[2].x = b16x - b16xoffset; - quad[3].x = b16x + b16xoffset; - - gvdbg("Southwest: quad (%08x,%08x),(%08x,%08x),(%08x,%08x),(%08x,%08x)\n", - quad[0].x, quad[0].y, quad[1].x, quad[1].y, - quad[2].x, quad[2].y, quad[3].x, quad[3].y); - - /* Now we can form the trapezoids. The top of the first trapezoid - * (triangle) is at quad[0] - */ - - traps[0].top.x1 = quad[0].x; - traps[0].top.x2 = quad[0].x; - traps[0].top.y = b16toi(quad[0].y + b16HALF); - - /* The bottom of the first trapezoid (triangle) may be either at - * quad[1] or quad[2], depending upon orientation. - */ - - if (quad[1].y < quad[2].y) - { - /* quad[1] is at the bottom right of the triangle. Interpolate - * to get the corresponding point on the left side. - * - * Interpolation is from quad[0] along the line quad[0]->quad[2] - * which as the same slope as the line (negative) - */ - - b16dxdy = -itob16(iwidth) / iheight; - - traps[0].bot.x1 = nxgl_interpolate(traps[0].top.x1, quad[1].y - quad[0].y, b16dxdy); - traps[0].bot.x2 = quad[1].x; - traps[0].bot.y = b16toi(quad[1].y + b16HALF); - - /* quad[1] is at the top right of the second trapezoid. quad[2} is - * at the bottom left of the second trapezoid. Interpolate to get - * corresponding point on the right side. - * - * Interpolation is from quad[1] along the line quad[1]->quad[3] - * which as the same slope as the line (negative) - */ - - traps[1].top.x1 = traps[0].bot.x1; - traps[1].top.x2 = traps[0].bot.x2; - traps[1].top.y = traps[0].bot.y; - - traps[1].bot.x1 = quad[2].x; - traps[1].bot.x2 = nxgl_interpolate(traps[1].top.x2, quad[2].y - quad[1].y, b16dxdy); - traps[1].bot.y = b16toi(quad[2].y + b16HALF); - } - else - { - /* quad[2] is at the bottom left of the triangle. Interpolate - * to get the corresponding point on the right side. - * - * Interpolation is from quad[0] along the line quad[0]->quad[1] - * which orthogonal to the slope of the line (and positive) - */ - - b16dxdy = itob16(iheight) / iwidth; - - traps[0].bot.x1 = quad[2].x; - traps[0].bot.x2 = nxgl_interpolate(traps[0].top.x2, quad[2].y - quad[0].y, b16dxdy); - traps[0].bot.y = b16toi(quad[2].y + b16HALF); - - /* quad[2] is at the top left of the second trapezoid. quad[1} is - * at the bottom right of the second trapezoid. Interpolate to get - * corresponding point on the left side. - * - * Interpolation is from quad[2] along the line quad[2]->quad[3] - * which as the same slope as the previous interpolation. - */ - - traps[1].top.x1 = traps[0].bot.x1; - traps[1].top.x2 = traps[0].bot.x2; - traps[1].top.y = traps[0].bot.y; - - traps[1].bot.x1 = nxgl_interpolate(traps[1].top.x1, quad[1].y - quad[2].y, b16dxdy); - traps[1].bot.x2 = quad[1].x; - traps[1].bot.y = b16toi(quad[1].y + b16HALF); - } - - /* The final trapezond (triangle) at the bottom is new well defined */ - - traps[2].top.x1 = traps[1].bot.x1; - traps[2].top.x2 = traps[1].bot.x2; - traps[2].top.y = traps[1].bot.y; - - traps[2].bot.x1 = quad[3].x; - traps[2].bot.x2 = quad[3].x; - traps[2].bot.y = b16toi(quad[3].y + b16HALF); - } - - gvdbg("traps[0]: (%08x,%08x,%d),(%08x,%08x,%d)\n", - traps[0].top.x1, traps[0].top.x2, traps[0].top.y, - traps[0].bot.x1, traps[0].bot.x2, traps[0].bot.y); - gvdbg("traps[1]: (%08x,%08x,%d),(%08x,%08x,%d)\n", - traps[1].top.x1, traps[1].top.x2, traps[1].top.y, - traps[1].bot.x1, traps[1].bot.x2, traps[1].bot.y); - gvdbg("traps[2]: (%08x,%08x,%d),(%08x,%08x,%d)\n", - traps[2].top.x1, traps[2].top.x2, traps[2].top.y, - traps[2].bot.x1, traps[2].bot.x2, traps[2].bot.y); - - return 0; - } - - /* The line is too vertical to have any significant triangular top or - * bottom. Just return the center parallelogram. - */ - - traps[1].top.x1 = itob16(line.pt1.x - (linewidth >> 1)); - traps[1].top.x2 = traps[1].top.x1 + itob16(linewidth - 1); - traps[1].top.y = line.pt1.y; - - traps[1].bot.x1 = itob16(line.pt2.x - (linewidth >> 1)); - traps[1].bot.x2 = traps[1].bot.x1 + itob16(linewidth - 1); - traps[1].bot.y = line.pt2.y; - - gvdbg("Horizontal traps[1]: (%08x,%08x,%d),(%08x,%08x, %d)\n", - traps[1].top.x1, traps[1].top.x2, traps[1].top.y, - traps[1].bot.x1, traps[1].bot.x2, traps[1].bot.y); - - return 1; -} - diff --git a/nuttx/graphics/nxglib/nxglib_trapcopy.c b/nuttx/graphics/nxglib/nxglib_trapcopy.c deleted file mode 100644 index f35da18e1..000000000 --- a/nuttx/graphics/nxglib/nxglib_trapcopy.c +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_trapcopy.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * 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/graphics/nxglib/nxglib_trapoffset.c b/nuttx/graphics/nxglib/nxglib_trapoffset.c deleted file mode 100644 index a90631f06..000000000 --- a/nuttx/graphics/nxglib/nxglib_trapoffset.c +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_trapoffset.c - * - * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_trapoffset - * - * Description: - * Offset the trapezoid position by the specified dx, dy values. - * - ****************************************************************************/ - -void nxgl_trapoffset(FAR struct nxgl_trapezoid_s *dest, - FAR const struct nxgl_trapezoid_s *src, - nxgl_coord_t dx, nxgl_coord_t dy) -{ - nxgl_runoffset(&dest->top, &src->top, dx, dy); - nxgl_runoffset(&dest->bot, &src->bot, dx, dy); -} diff --git a/nuttx/graphics/nxglib/nxglib_vectoradd.c b/nuttx/graphics/nxglib/nxglib_vectoradd.c deleted file mode 100644 index 7da5eb137..000000000 --- a/nuttx/graphics/nxglib/nxglib_vectoradd.c +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_vectoradd.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_vectoradd - * - * Description: - * Add two 2x1 vectors and save the result to a third. - * - ****************************************************************************/ - -void nxgl_vectoradd(FAR struct nxgl_point_s *dest, - FAR const struct nxgl_point_s *v1, - FAR const struct nxgl_point_s *v2) -{ - dest->x = v1->x + v2->x; - dest->y = v1->y + v2->y; -} - - diff --git a/nuttx/graphics/nxglib/nxglib_vectsubtract.c b/nuttx/graphics/nxglib/nxglib_vectsubtract.c deleted file mode 100644 index c830a1a33..000000000 --- a/nuttx/graphics/nxglib/nxglib_vectsubtract.c +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** - * graphics/nxglib/nxsglib_vectorsubtract.c - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_vectsubtract - * - * Description: - * Add subtract vector v2 from vector v1 and return the result in vector dest - * - ****************************************************************************/ - -void nxgl_vectsubtract(FAR struct nxgl_point_s *dest, - FAR const struct nxgl_point_s *v1, - FAR const struct nxgl_point_s *v2) -{ - dest->x = v1->x - v2->x; - dest->y = v1->y - v2->y; -} - - diff --git a/nuttx/graphics/nxglib/nxglib_yuv2rgb.c b/nuttx/graphics/nxglib/nxglib_yuv2rgb.c deleted file mode 100644 index cb4bb9f2f..000000000 --- a/nuttx/graphics/nxglib/nxglib_yuv2rgb.c +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** - * graphics/color/nxglib_yuv2rgb.c - * - * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * 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 <nuttx/config.h> - -#include <stdint.h> -#include <debug.h> -#include <fixedmath.h> - -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -#define b16_P3441 0x0000581a /* 0.344147 */ -#define b16_P7141 0x0000b6d2 /* 0.714142 */ -#define b16_1P402 0x000166ea /* 1.402008 */ -#define b16_1P772 0x0001c5a2 /* 1.722003 */ -#define b16_128P0 0x00800000 /* 128.000000 */ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxgl_yuv2rgb - * - * Description: - * Convert 8-bit RGB triplet to 8-bit YUV triplet - * - ****************************************************************************/ - -void nxgl_yuv2rgb(uint8_t y, uint8_t u, uint8_t v, - uint8_t *r, uint8_t *g, uint8_t *b) -{ - b16_t vm128 = itob16(v) - b16_128P0; - b16_t um128 = itob16(u) - b16_128P0; - - /* Per the JFIF specification: - * - * R = Y + 1.40200 * (V - 128.0) - * G = Y - 0.34414 * (U - 128.0) - 0.71414 * (V - 128.0) - * B = Y + 1.77200 * (U - 128.0) - */ - - *r = (uint8_t)b16toi(itob16(y) + b16muli(b16_1P402, vm128)); - *g = (uint8_t)b16toi(itob16(y) - b16muli(b16_P3441, um128) - b16muli(b16_P7141, vm128)); - *b = (uint8_t)b16toi(itob16(y) + b16muli(b16_1P772, um128)); -} |