summaryrefslogtreecommitdiff
path: root/nuttx/graphics/nxglib/nxglib_filltrapezoid.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-11-30 18:52:14 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-11-30 18:52:14 +0000
commit69ef693d6f964404ef5d278f2f29ab7d26022f04 (patch)
treef887bf513a8c177d5d1e9a46f1315b460e0e9b93 /nuttx/graphics/nxglib/nxglib_filltrapezoid.c
parent80d2acc36b46011fde95cb9f12f2b3d4f44e9683 (diff)
downloadpx4-nuttx-69ef693d6f964404ef5d278f2f29ab7d26022f04.tar.gz
px4-nuttx-69ef693d6f964404ef5d278f2f29ab7d26022f04.tar.bz2
px4-nuttx-69ef693d6f964404ef5d278f2f29ab7d26022f04.zip
There is at least some X11 output now
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1361 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/graphics/nxglib/nxglib_filltrapezoid.c')
-rw-r--r--nuttx/graphics/nxglib/nxglib_filltrapezoid.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/nuttx/graphics/nxglib/nxglib_filltrapezoid.c b/nuttx/graphics/nxglib/nxglib_filltrapezoid.c
index 35ded6139..b20b46570 100644
--- a/nuttx/graphics/nxglib/nxglib_filltrapezoid.c
+++ b/nuttx/graphics/nxglib/nxglib_filltrapezoid.c
@@ -117,6 +117,12 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)(
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 */
dx1dy = b16divi((trap->bot.x1 - x1), nrows);
@@ -124,28 +130,31 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)(
/* Perform vertical clipping */
- y1 = trap->top.y;
if (y1 < bounds->pt1.y)
{
+ /* 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;
}
- y2 = trap->bot.y;
if (y2 > bounds->pt2.y)
{
- y2 = bounds->pt2.y;
- }
+ /* Clip and re-calculate the number of rows to render */
- /* Then calculate the number of rows to render */
-
- nrows = y2 - y1 + 1;
+ y2 = bounds->pt2.y;
+ nrows = y2 - y1 + 1;
+ }
/* Get the address of the first byte on the first line */
- line = pinfo->fbmem + y1 * stride ;
+ line = pinfo->fbmem + y1 * stride ;
/* Then fill the trapezoid line-by-line */