Fix numerous errors in trapezoid rendering and wide line drawing algorithms
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3840 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
e185a02245
commit
b9adbc1d99
@ -1971,4 +1971,4 @@
|
|||||||
* arch/arm/src/lpc17xx/chip.h: Fix some chip memory configuration errors
|
* arch/arm/src/lpc17xx/chip.h: Fix some chip memory configuration errors
|
||||||
for the LPC1764, LPC1756, and LPC1754 (submitted by Li Zhuoy (Lzzy))
|
for the LPC1764, LPC1756, and LPC1754 (submitted by Li Zhuoy (Lzzy))
|
||||||
* arch/arm/src/lpc17xx/lpc17_can.h: Revised CAN driver submitted by
|
* arch/arm/src/lpc17xx/lpc17_can.h: Revised CAN driver submitted by
|
||||||
Li Zhuoy (Lzzy).
|
Li Zhuoy (Lzzy). The driver now supports both CAN1 and CAN2.
|
||||||
|
@ -524,6 +524,38 @@ CONFIG_EXAMPLES_NX_CLIENTPRIO=80
|
|||||||
CONFIG_EXAMPLES_NX_SERVERPRIO=120
|
CONFIG_EXAMPLES_NX_SERVERPRIO=120
|
||||||
CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
|
CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
|
||||||
|
|
||||||
|
#
|
||||||
|
# Settings for examples/nxlines
|
||||||
|
#
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_BUILTIN -- Build the NXLINES example as a "built-in"
|
||||||
|
# that can be executed from the NSH command line
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_VPLANE -- The plane to select from the frame-
|
||||||
|
# buffer driver for use in the test. Default: 0
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_DEVNO - The LCD device to select from the LCD
|
||||||
|
# driver for use in the test: Default: 0
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_BGCOLOR -- The color of the background. Default
|
||||||
|
# depends on CONFIG_EXAMPLES_NXLINES_BPP.
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_LINEWIDTH - Selects the width of the lines in
|
||||||
|
# pixels (default: 16)
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the lines drawn in the
|
||||||
|
# background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP.
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_BPP -- Pixels per pixel to use. Valid options
|
||||||
|
# include 2, 4, 8, 16, 24, and 32. Default is 16.
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_EXTERNINIT - The driver for the graphics device on
|
||||||
|
# this platform requires some unusual initialization. This is the
|
||||||
|
# for, for example, SPI LCD/OLED devices. If this configuration is
|
||||||
|
# selected, then the platform code must provide an LCD initialization
|
||||||
|
# function.
|
||||||
|
#
|
||||||
|
CONFIG_EXAMPLES_NXLINES_BUILTIN=n
|
||||||
|
CONFIG_EXAMPLES_NXLINES_VPLANE=0
|
||||||
|
CONFIG_EXAMPLES_NXLINES_DEVNO=0
|
||||||
|
#CONFIG_EXAMPLES_NXLINES_BGCOLOR=
|
||||||
|
CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
|
||||||
|
#CONFIG_EXAMPLES_NXLINES_LINECOLOR=
|
||||||
|
CONFIG_EXAMPLES_NXLINES_BPP=CONFIG_SIM_FBBPP
|
||||||
|
CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
|
||||||
|
|
||||||
#
|
#
|
||||||
# Settings for examples/mount
|
# Settings for examples/mount
|
||||||
CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
|
CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
|
||||||
|
@ -1132,6 +1132,38 @@ CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
|
|||||||
CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
|
CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
|
||||||
CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
|
CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
|
||||||
|
|
||||||
|
#
|
||||||
|
# Settings for examples/nxlines
|
||||||
|
#
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_BUILTIN -- Build the NXLINES example as a "built-in"
|
||||||
|
# that can be executed from the NSH command line
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_VPLANE -- The plane to select from the frame-
|
||||||
|
# buffer driver for use in the test. Default: 0
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_DEVNO - The LCD device to select from the LCD
|
||||||
|
# driver for use in the test: Default: 0
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_BGCOLOR -- The color of the background. Default
|
||||||
|
# depends on CONFIG_EXAMPLES_NXLINES_BPP.
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_LINEWIDTH - Selects the width of the lines in
|
||||||
|
# pixels (default: 16)
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the lines drawn in the
|
||||||
|
# background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP.
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_BPP -- Pixels per pixel to use. Valid options
|
||||||
|
# include 2, 4, 8, 16, 24, and 32. Default is 16.
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_EXTERNINIT - The driver for the graphics device on
|
||||||
|
# this platform requires some unusual initialization. This is the
|
||||||
|
# for, for example, SPI LCD/OLED devices. If this configuration is
|
||||||
|
# selected, then the platform code must provide an LCD initialization
|
||||||
|
# function.
|
||||||
|
#
|
||||||
|
CONFIG_EXAMPLES_NXLINES_BUILTIN=n
|
||||||
|
CONFIG_EXAMPLES_NXLINES_VPLANE=0
|
||||||
|
CONFIG_EXAMPLES_NXLINES_DEVNO=0
|
||||||
|
CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
|
||||||
|
CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
|
||||||
|
CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
|
||||||
|
CONFIG_EXAMPLES_NXLINES_BPP=16
|
||||||
|
CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
|
||||||
|
|
||||||
#
|
#
|
||||||
# Settings for examples/usbstorage
|
# Settings for examples/usbstorage
|
||||||
#
|
#
|
||||||
|
@ -1083,6 +1083,38 @@ CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
|
|||||||
CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
|
CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
|
||||||
CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
|
CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
|
||||||
|
|
||||||
|
#
|
||||||
|
# Settings for examples/nxlines
|
||||||
|
#
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_BUILTIN -- Build the NXLINES example as a "built-in"
|
||||||
|
# that can be executed from the NSH command line
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_VPLANE -- The plane to select from the frame-
|
||||||
|
# buffer driver for use in the test. Default: 0
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_DEVNO - The LCD device to select from the LCD
|
||||||
|
# driver for use in the test: Default: 0
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_BGCOLOR -- The color of the background. Default
|
||||||
|
# depends on CONFIG_EXAMPLES_NXLINES_BPP.
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_LINEWIDTH - Selects the width of the lines in
|
||||||
|
# pixels (default: 16)
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the lines drawn in the
|
||||||
|
# background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP.
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_BPP -- Pixels per pixel to use. Valid options
|
||||||
|
# include 2, 4, 8, 16, 24, and 32. Default is 16.
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_EXTERNINIT - The driver for the graphics device on
|
||||||
|
# this platform requires some unusual initialization. This is the
|
||||||
|
# for, for example, SPI LCD/OLED devices. If this configuration is
|
||||||
|
# selected, then the platform code must provide an LCD initialization
|
||||||
|
# function.
|
||||||
|
#
|
||||||
|
CONFIG_EXAMPLES_NXLINES_BUILTIN=n
|
||||||
|
CONFIG_EXAMPLES_NXLINES_VPLANE=0
|
||||||
|
CONFIG_EXAMPLES_NXLINES_DEVNO=0
|
||||||
|
CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
|
||||||
|
CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
|
||||||
|
CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
|
||||||
|
CONFIG_EXAMPLES_NXLINES_BPP=16
|
||||||
|
CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
|
||||||
|
|
||||||
#
|
#
|
||||||
# Stack and heap information
|
# Stack and heap information
|
||||||
#
|
#
|
||||||
|
@ -1143,6 +1143,38 @@ CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
|
|||||||
CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
|
CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
|
||||||
CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
|
CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
|
||||||
|
|
||||||
|
#
|
||||||
|
# Settings for examples/nxlines
|
||||||
|
#
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_BUILTIN -- Build the NXLINES example as a "built-in"
|
||||||
|
# that can be executed from the NSH command line
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_VPLANE -- The plane to select from the frame-
|
||||||
|
# buffer driver for use in the test. Default: 0
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_DEVNO - The LCD device to select from the LCD
|
||||||
|
# driver for use in the test: Default: 0
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_BGCOLOR -- The color of the background. Default
|
||||||
|
# depends on CONFIG_EXAMPLES_NXLINES_BPP.
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_LINEWIDTH - Selects the width of the lines in
|
||||||
|
# pixels (default: 16)
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the lines drawn in the
|
||||||
|
# background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP.
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_BPP -- Pixels per pixel to use. Valid options
|
||||||
|
# include 2, 4, 8, 16, 24, and 32. Default is 16.
|
||||||
|
# CONFIG_EXAMPLES_NXLINES_EXTERNINIT - The driver for the graphics device on
|
||||||
|
# this platform requires some unusual initialization. This is the
|
||||||
|
# for, for example, SPI LCD/OLED devices. If this configuration is
|
||||||
|
# selected, then the platform code must provide an LCD initialization
|
||||||
|
# function.
|
||||||
|
#
|
||||||
|
CONFIG_EXAMPLES_NXLINES_BUILTIN=n
|
||||||
|
CONFIG_EXAMPLES_NXLINES_VPLANE=0
|
||||||
|
CONFIG_EXAMPLES_NXLINES_DEVNO=0
|
||||||
|
CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
|
||||||
|
CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
|
||||||
|
CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
|
||||||
|
CONFIG_EXAMPLES_NXLINES_BPP=16
|
||||||
|
CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
|
||||||
|
|
||||||
#
|
#
|
||||||
# Stack and heap information
|
# Stack and heap information
|
||||||
#
|
#
|
||||||
|
@ -133,6 +133,15 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)(
|
|||||||
|
|
||||||
if (y1 < bounds->pt1.y)
|
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 */
|
/* Calculate the x values for the new top run */
|
||||||
|
|
||||||
int dy = bounds->pt1.y - y1;
|
int dy = bounds->pt1.y - y1;
|
||||||
@ -147,6 +156,15 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)(
|
|||||||
|
|
||||||
if (y2 > bounds->pt2.y)
|
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 */
|
/* Clip and re-calculate the number of rows to render */
|
||||||
|
|
||||||
y2 = bounds->pt2.y;
|
y2 = bounds->pt2.y;
|
||||||
|
@ -132,6 +132,15 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)
|
|||||||
|
|
||||||
if (topy < bounds->pt1.y)
|
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 */
|
/* Calculate the x values for the new top run */
|
||||||
|
|
||||||
dy = bounds->pt1.y - topy;
|
dy = bounds->pt1.y - topy;
|
||||||
@ -145,6 +154,15 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)
|
|||||||
|
|
||||||
if (boty > bounds->pt2.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 */
|
/* Calculate the x values for the new bottom run */
|
||||||
|
|
||||||
dy = boty - bounds->pt2.y;
|
dy = boty - bounds->pt2.y;
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
* Name: nxgl_runoffset
|
* Name: nxgl_runoffset
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Offset the run position by the specified dx, dy values.
|
* Offset the run position by the specified (integer) dx, dy values.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ void nxgl_runoffset(FAR struct nxgl_run_s *dest,
|
|||||||
nxgl_coord_t dx, nxgl_coord_t dy)
|
nxgl_coord_t dx, nxgl_coord_t dy)
|
||||||
{
|
{
|
||||||
b16_t b16dx = itob16(dx);
|
b16_t b16dx = itob16(dx);
|
||||||
dest->x1 += b16dx;
|
dest->x1 = src->x1 + b16dx;
|
||||||
dest->x2 += b16dx;
|
dest->x2 = src->x2 + b16dx;
|
||||||
dest->y += dy;
|
dest->y = src->y + dy;
|
||||||
}
|
}
|
||||||
|
@ -112,15 +112,16 @@ int nxgl_splitline(FAR struct nxgl_vector_s *vector,
|
|||||||
nxgl_coord_t linewidth)
|
nxgl_coord_t linewidth)
|
||||||
{
|
{
|
||||||
struct nxgl_vector_s line;
|
struct nxgl_vector_s line;
|
||||||
struct nxgl_point_s pt;
|
|
||||||
nxgl_coord_t iheight;
|
nxgl_coord_t iheight;
|
||||||
nxgl_coord_t iwidth;
|
nxgl_coord_t iwidth;
|
||||||
|
nxgl_coord_t iy;
|
||||||
nxgl_coord_t triheight;
|
nxgl_coord_t triheight;
|
||||||
nxgl_coord_t adjwidth;
|
|
||||||
nxgl_coord_t xoffset;
|
|
||||||
nxgl_coord_t halfoffset;
|
|
||||||
nxgl_coord_t halfheight;
|
nxgl_coord_t halfheight;
|
||||||
|
b16_t adjwidth;
|
||||||
|
b16_t xoffset;
|
||||||
|
b16_t halfoffset;
|
||||||
b16_t angle;
|
b16_t angle;
|
||||||
|
b16_t b16x;
|
||||||
|
|
||||||
/* First, check the linewidth */
|
/* First, check the linewidth */
|
||||||
|
|
||||||
@ -226,13 +227,17 @@ int nxgl_splitline(FAR struct nxgl_vector_s *vector,
|
|||||||
|
|
||||||
angle = b16atan2(itob16(iheight), itob16(iwidth));
|
angle = b16atan2(itob16(iheight), itob16(iwidth));
|
||||||
triheight = b16toi(linewidth * b16cos(angle));
|
triheight = b16toi(linewidth * b16cos(angle));
|
||||||
adjwidth = b16toi(b16divb16(itob16(linewidth), b16sin(angle)));
|
adjwidth = b16divb16(itob16(linewidth), b16sin(angle));
|
||||||
xoffset = (linewidth * linewidth + (adjwidth >> 1)) / adjwidth;
|
xoffset = itob16(linewidth * linewidth);
|
||||||
|
xoffset = b16divb16(xoffset, adjwidth);
|
||||||
|
|
||||||
halfoffset = (xoffset >> 1);
|
halfoffset = (xoffset >> 1);
|
||||||
halfheight = (triheight >> 1);
|
halfheight = (triheight >> 1);
|
||||||
|
|
||||||
/* Return the top triangle (if there is one) */
|
/* Return the top triangle (if there is one). NOTE that the horizontal
|
||||||
|
* (z) positions are represented with 16 bits of fraction. The vertical
|
||||||
|
* (y) positions, on the other hand, are integer.
|
||||||
|
*/
|
||||||
|
|
||||||
if (triheight > 0)
|
if (triheight > 0)
|
||||||
{
|
{
|
||||||
@ -240,53 +245,53 @@ int nxgl_splitline(FAR struct nxgl_vector_s *vector,
|
|||||||
{
|
{
|
||||||
/* Line is going "south east" */
|
/* Line is going "south east" */
|
||||||
|
|
||||||
pt.x = line.pt1.x - halfoffset;
|
b16x = itob16(line.pt1.x) - halfoffset;
|
||||||
pt.y = line.pt1.y + halfheight;
|
iy = line.pt1.y + halfheight;
|
||||||
|
|
||||||
traps[0].top.x1 = pt.x + xoffset;
|
traps[0].top.x1 = b16x + xoffset;
|
||||||
traps[0].top.x2 = traps[0].top.x1;
|
traps[0].top.x2 = traps[0].top.x1;
|
||||||
traps[0].top.y = pt.y - triheight + 1;
|
traps[0].top.y = iy - triheight + 1;
|
||||||
traps[0].bot.x1 = pt.x;
|
traps[0].bot.x1 = b16x;
|
||||||
traps[0].bot.x2 = pt.x + adjwidth - 1;
|
traps[0].bot.x2 = b16x + adjwidth - b16ONE;
|
||||||
traps[0].bot.y = pt.y;
|
traps[0].bot.y = iy;
|
||||||
|
|
||||||
pt.x = line.pt2.x + halfoffset;
|
b16x = itob16(line.pt2.x) + halfoffset;
|
||||||
pt.y = line.pt2.y - halfheight;
|
iy = itob16(line.pt2.y) - halfheight;
|
||||||
|
|
||||||
traps[2].top.x1 = pt.x - adjwidth + 1;
|
traps[2].top.x1 = b16x - adjwidth + b16ONE;
|
||||||
traps[2].top.x2 = pt.x;
|
traps[2].top.x2 = b16x;
|
||||||
traps[2].top.y = pt.y;
|
traps[2].top.y = iy;
|
||||||
traps[2].bot.x1 = pt.x - xoffset;
|
traps[2].bot.x1 = b16x - xoffset;
|
||||||
traps[2].bot.x2 = traps[2].bot.x1;
|
traps[2].bot.x2 = traps[2].bot.x1;
|
||||||
traps[2].bot.y = pt.y + triheight - 1;
|
traps[2].bot.y = iy + triheight - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Line is going "south west" */
|
/* Line is going "south west" */
|
||||||
|
|
||||||
pt.x = line.pt1.x + halfoffset;
|
b16x = itob16(line.pt1.x) + halfoffset;
|
||||||
pt.y = line.pt1.y + halfheight;
|
iy = itob16(line.pt1.y) + halfheight;
|
||||||
|
|
||||||
traps[0].top.x1 = pt.x - xoffset;
|
traps[0].top.x1 = b16x - xoffset;
|
||||||
traps[0].top.x2 = traps[0].top.x1;
|
traps[0].top.x2 = traps[0].top.x1;
|
||||||
traps[0].top.y = pt.y - triheight + 1;
|
traps[0].top.y = iy - triheight + 1;
|
||||||
traps[0].bot.x1 = pt.x - adjwidth + 1;
|
traps[0].bot.x1 = b16x - adjwidth + b16ONE;
|
||||||
traps[0].bot.x2 = pt.x;
|
traps[0].bot.x2 = b16x;
|
||||||
traps[0].bot.y = pt.y;
|
traps[0].bot.y = iy;
|
||||||
|
|
||||||
pt.x = line.pt2.x - halfoffset;
|
b16x = itob16(line.pt2.x) - halfoffset;
|
||||||
pt.y = line.pt2.y - halfheight;
|
iy = itob16(line.pt2.y) - halfheight;
|
||||||
|
|
||||||
traps[2].top.x1 = pt.x;
|
traps[2].top.x1 = b16x;
|
||||||
traps[2].top.x2 = pt.x + adjwidth - 1;
|
traps[2].top.x2 = b16x + adjwidth - b16ONE;
|
||||||
traps[2].top.y = pt.y;
|
traps[2].top.y = iy;
|
||||||
traps[2].bot.x1 = pt.x + xoffset;
|
traps[2].bot.x1 = b16x + xoffset;
|
||||||
traps[2].bot.x2 = traps[2].bot.x1;
|
traps[2].bot.x2 = traps[2].bot.x1;
|
||||||
traps[2].bot.y = pt.y + triheight - 1;
|
traps[2].bot.y = iy + triheight - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The center parallelogram is the horizontal edge of each triangle.
|
/* The center parallelogram is the horizontal edge of each triangle.
|
||||||
* Note the minor inefficency: that horizontal edge is drawn twice.
|
* Note the minor inefficency: that horizontal edges are drawn twice.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
traps[1].top.x1 = traps[0].bot.x1;
|
traps[1].top.x1 = traps[0].bot.x1;
|
||||||
@ -304,11 +309,11 @@ int nxgl_splitline(FAR struct nxgl_vector_s *vector,
|
|||||||
* bottom. Just return the center parallelogram.
|
* bottom. Just return the center parallelogram.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
traps[1].top.x1 = line.pt1.x - halfoffset;
|
traps[1].top.x1 = itob16(line.pt1.x) - halfoffset;
|
||||||
traps[1].top.x2 = traps[1].top.x1 + adjwidth - 1;
|
traps[1].top.x2 = traps[1].top.x1 + adjwidth - 1;
|
||||||
traps[1].top.y = line.pt1.y;
|
traps[1].top.y = line.pt1.y;
|
||||||
|
|
||||||
traps[1].bot.x1 = line.pt2.x - halfoffset;
|
traps[1].bot.x1 = itob16(line.pt2.x) - halfoffset;
|
||||||
traps[1].bot.x2 = traps[1].bot.x1 + adjwidth - 1;
|
traps[1].bot.x2 = traps[1].bot.x1 + adjwidth - 1;
|
||||||
traps[1].bot.y = line.pt2.y;
|
traps[1].bot.y = line.pt2.y;
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user