diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-12-02 20:02:59 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-12-02 20:02:59 +0000 |
commit | aebaefc303f12beb92c4da219411bdb00aa4e03c (patch) | |
tree | 770fd1403c0aaf22a23220a4f95f689de9f8cf70 /nuttx/graphics/nxglib | |
parent | 124c331605b174afc08f7ef498209952b4a1dbc5 (diff) | |
download | px4-nuttx-aebaefc303f12beb92c4da219411bdb00aa4e03c.tar.gz px4-nuttx-aebaefc303f12beb92c4da219411bdb00aa4e03c.tar.bz2 px4-nuttx-aebaefc303f12beb92c4da219411bdb00aa4e03c.zip |
Don't keep sizes in rectangles
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1392 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/graphics/nxglib')
-rw-r--r-- | nuttx/graphics/nxglib/Make.defs | 2 | ||||
-rw-r--r-- | nuttx/graphics/nxglib/nxglib_copyrectangle.c | 4 | ||||
-rw-r--r-- | nuttx/graphics/nxglib/nxglib_fillrectangle.c | 4 | ||||
-rw-r--r-- | nuttx/graphics/nxglib/nxglib_filltrapezoid.c | 4 | ||||
-rw-r--r-- | nuttx/graphics/nxglib/nxglib_moverectangle.c | 4 | ||||
-rw-r--r-- | nuttx/graphics/nxglib/nxglib_rectsize.c | 83 |
6 files changed, 92 insertions, 9 deletions
diff --git a/nuttx/graphics/nxglib/Make.defs b/nuttx/graphics/nxglib/Make.defs index 1c66d85a8..86b086e8c 100644 --- a/nuttx/graphics/nxglib/Make.defs +++ b/nuttx/graphics/nxglib/Make.defs @@ -54,7 +54,7 @@ RCOPY2_CSRCS = nxglib_copyrectangle_8bpp.c nxglib_copyrectangle_16bpp.c \ RECT_CSRCS = nxglib_rectcopy.c nxglib_rectoffset.c nxglib_vectoradd.c \ nxglib_vectsubtract.c nxglib_rectintersect.c \ nxglib_nonintersecting.c nxglib_rectunion.c nxglib_rectinside.c \ - nxglib_rectoverlap.c nxglib_nullrect.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 diff --git a/nuttx/graphics/nxglib/nxglib_copyrectangle.c b/nuttx/graphics/nxglib/nxglib_copyrectangle.c index 1feb0c7a9..8a13260c6 100644 --- a/nuttx/graphics/nxglib/nxglib_copyrectangle.c +++ b/nuttx/graphics/nxglib/nxglib_copyrectangle.c @@ -104,8 +104,8 @@ void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX) /* Get the dimensions of the rectange to fill: height in rows and width in bytes */ - width = NXGL_SCALEX(dest->pt2.x - dest->pt1.x); - rows = dest->pt2.y - dest->pt1.y; + width = NXGL_SCALEX(dest->pt2.x - dest->pt1.x + 1); + rows = dest->pt2.y - dest->pt1.y + 1; #if NXGLIB_BITSPERPIXEL < 8 # ifdef CONFIG_NXGL_PACKEDMSFIRST diff --git a/nuttx/graphics/nxglib/nxglib_fillrectangle.c b/nuttx/graphics/nxglib/nxglib_fillrectangle.c index 2ed923b95..ee8b6dd01 100644 --- a/nuttx/graphics/nxglib/nxglib_fillrectangle.c +++ b/nuttx/graphics/nxglib/nxglib_fillrectangle.c @@ -104,8 +104,8 @@ void NXGL_FUNCNAME(nxgl_fillrectangle,NXGLIB_SUFFIX) /* Get the dimensions of the rectange to fill in pixels */ - width = rect->pt2.x - rect->pt1.x; - rows = rect->pt2.y - rect->pt1.y; + 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 */ diff --git a/nuttx/graphics/nxglib/nxglib_filltrapezoid.c b/nuttx/graphics/nxglib/nxglib_filltrapezoid.c index ff7eb492b..231671735 100644 --- a/nuttx/graphics/nxglib/nxglib_filltrapezoid.c +++ b/nuttx/graphics/nxglib/nxglib_filltrapezoid.c @@ -125,8 +125,8 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)( /* Calculate the slope of the left and right side of the trapezoid */ - dx1dy = b16divi((trap->bot.x1 - x1), nrows); - dx2dy = b16divi((trap->bot.x2 - x2), nrows); + dx1dy = b16divi((trap->bot.x1 - x1), nrows - 1); + dx2dy = b16divi((trap->bot.x2 - x2), nrows - 1); /* Perform vertical clipping */ diff --git a/nuttx/graphics/nxglib/nxglib_moverectangle.c b/nuttx/graphics/nxglib/nxglib_moverectangle.c index b9579e3f5..c39c1c560 100644 --- a/nuttx/graphics/nxglib/nxglib_moverectangle.c +++ b/nuttx/graphics/nxglib/nxglib_moverectangle.c @@ -147,8 +147,8 @@ void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX) /* Get the dimensions of the rectange to fill: height in rows and width in bytes */ - width = NXGL_SCALEX(rect->pt2.x - rect->pt1.x); - rows = rect->pt2.y - rect->pt1.y; + width = NXGL_SCALEX(rect->pt2.x - rect->pt1.x + 1); + rows = rect->pt2.y - rect->pt1.y + 1; #if NXGLIB_BITSPERPIXEL < 8 # ifdef CONFIG_NXGL_PACKEDMSFIRST diff --git a/nuttx/graphics/nxglib/nxglib_rectsize.c b/nuttx/graphics/nxglib/nxglib_rectsize.c new file mode 100644 index 000000000..f41a7b9c9 --- /dev/null +++ b/nuttx/graphics/nxglib/nxglib_rectsize.c @@ -0,0 +1,83 @@ +/**************************************************************************** + * graphics/nxglib/nxglib_rectsize.c + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * + * 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 <nuttx/fb.h> +#include <nuttx/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; +} |