From ae03d56700475ec9b7396f5b05fb583e1d5b137a Mon Sep 17 00:00:00 2001
From: Gregory Nutt
Date: Sun, 5 Apr 2015 08:50:01 -0600
Subject: [PATCH] Add a 'capped' boolean parameter to all drawline/drawLine
functions/methods. The idea is that this will produce better joining between
lines
---
Documentation/NXGraphicsSubsystem.html | 17 ++++++++++----
TODO | 32 +++++++++++++++-----------
include/nuttx/nx/nx.h | 7 ++++--
include/nuttx/nx/nxtk.h | 12 +++++++---
libnx/nx/nx_drawcircle.c | 6 ++---
libnx/nx/nx_drawline.c | 7 ++++--
libnx/nxtk/nxtk_drawcircletoolbar.c | 6 ++---
libnx/nxtk/nxtk_drawcirclewindow.c | 6 ++---
libnx/nxtk/nxtk_drawlinetoolbar.c | 7 ++++--
libnx/nxtk/nxtk_drawlinewindow.c | 7 ++++--
10 files changed, 69 insertions(+), 38 deletions(-)
diff --git a/Documentation/NXGraphicsSubsystem.html b/Documentation/NXGraphicsSubsystem.html
index c8c3e0b83b..d13a115b50 100644
--- a/Documentation/NXGraphicsSubsystem.html
+++ b/Documentation/NXGraphicsSubsystem.html
@@ -12,7 +12,7 @@
NX Graphics Subsystem
- Last Updated: December 28, 2013
+ Last Updated: April 5, 2015
@@ -1759,7 +1759,8 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
#include <nuttx/nx/nx.h>
int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
- nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
+ nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
+ bool capped);
Description:
@@ -1780,6 +1781,8 @@ int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
The width of the line
color
The color to use to fill the line
+ capped
+ Draw a circular cap both ends of the line to support better line joins
@@ -2385,7 +2388,8 @@ int nxtk_filltrapwindow(NXTKWINDOW hfwnd,
#include <nuttx/nx/nxtk.h>
int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
- nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
+ nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
+ bool capped);
Draw a circular cap both ends of the line to support better line joins
diff --git a/TODO b/TODO
index d0d4027f34..373a586f73 100644
--- a/TODO
+++ b/TODO
@@ -880,20 +880,24 @@ o Network (net/, drivers/net)
should be eliminated). This applies to almost all Ethernet
drivers:
- ARCHITECTURE CONFIG_NET_NOINTS
- C5471 NO
- STM32 YES <<
- TIVA/LM3S NO
- TIVA/TM4C YES <<
- eZ80 NO
- LPC17xx YES <<
- DMxxx NIC NO
- PIC32 NO
- RGMP NO
- SAM3/4 YES <<
- SAMA5D3 NO
- SAMA5D4 YES <<
- SIM N/A << Doesn't support interrupts
+ ARCHITECTURE CONFIG_NET_NOINTS? ADDRESS FILTER SUPPORT?
+ C5471 NO NO
+ STM32 YES YES
+ TIVA ----------------------- ------
+ LM3S NO NO
+ TM4C YES YES
+ eZ80 NO NO
+ LPC17xx YES (could be issues) YES (not tested)
+ DMxxx NIC NO NO
+ PIC32 NO NO
+ RGMP ??? ???
+ SAM3/4 YES YES
+ SAMA5D ----------------------- ------
+ EMACA NO YES (not tested)
+ EMACB YES YES
+ GMAC NO YES (not tested)
+ SAMV7 YES YES
+ SIM N/A (No interrupts) NO
The general outline of how this might be done is included in
drivers/net/skeleton.c
diff --git a/include/nuttx/nx/nx.h b/include/nuttx/nx/nx.h
index 6093a0878a..6f8077f618 100644
--- a/include/nuttx/nx/nx.h
+++ b/include/nuttx/nx/nx.h
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/nx/nx.h
*
- * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -776,6 +776,8 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
* vector - Describes the line to be drawn
* width - The width of the line
* color - The color to use to fill the line
+ * capped - Draw a circular cap both ends of the line to support better
+ * line joins
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
@@ -783,7 +785,8 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
****************************************************************************/
int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
- nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
+ nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
+ bool capped);
/****************************************************************************
* Name: nx_drawcircle
diff --git a/include/nuttx/nx/nxtk.h b/include/nuttx/nx/nxtk.h
index eb0d9df6f6..7b7d762126 100644
--- a/include/nuttx/nx/nxtk.h
+++ b/include/nuttx/nx/nxtk.h
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/nx/nxtk.h
*
- * Copyright (C) 2008-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -354,6 +354,8 @@ EXTERN int nxtk_filltrapwindow(NXTKWINDOW hfwnd,
* vector - Describes the line to be drawn
* width - The width of the line
* color - The color to use to fill the line
+ * capped - Draw a circular cap both ends of the line to support better
+ * line joins
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
@@ -363,7 +365,8 @@ EXTERN int nxtk_filltrapwindow(NXTKWINDOW hfwnd,
EXTERN int nxtk_drawlinewindow(NXTKWINDOW hfwnd,
FAR struct nxgl_vector_s *vector,
nxgl_coord_t width,
- nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
+ nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
+ bool capped);
/****************************************************************************
* Name: nxtk_drawcirclewindow
@@ -598,6 +601,8 @@ EXTERN int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoi
* vector - Describes the line to be drawn
* width - The width of the line
* color - The color to use to fill the line
+ * capped - Draw a circular cap both ends of the line to support better
+ * line joins
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
@@ -607,7 +612,8 @@ EXTERN int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoi
EXTERN int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd,
FAR struct nxgl_vector_s *vector,
nxgl_coord_t width,
- nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
+ nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
+ bool capped);
/****************************************************************************
* Name: nxtk_drawcircletoolbar
diff --git a/libnx/nx/nx_drawcircle.c b/libnx/nx/nx_drawcircle.c
index 97f0a4e3f3..ea279a45de 100644
--- a/libnx/nx/nx_drawcircle.c
+++ b/libnx/nx/nx_drawcircle.c
@@ -1,7 +1,7 @@
/****************************************************************************
* libnx/nx/nx_drawcircle.c
*
- * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -128,7 +128,7 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
vector.pt1.y = pts[i].y;
vector.pt2.x = pts[i+1].x;
vector.pt2.y = pts[i+1].y;
- ret = nx_drawline(hwnd, &vector, width, color);
+ ret = nx_drawline(hwnd, &vector, width, color, true);
if (ret != OK)
{
return ret;
@@ -141,5 +141,5 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
vector.pt1.y = pts[POINT_337p5].y;
vector.pt2.x = pts[POINT_0p0].x;
vector.pt2.y = pts[POINT_0p0].y;
- return nx_drawline(hwnd, &vector, width, color);
+ return nx_drawline(hwnd, &vector, width, color, true);
}
diff --git a/libnx/nx/nx_drawline.c b/libnx/nx/nx_drawline.c
index ac47a44181..f29c3b6097 100644
--- a/libnx/nx/nx_drawline.c
+++ b/libnx/nx/nx_drawline.c
@@ -1,7 +1,7 @@
/****************************************************************************
* libnx/nx/nx_drawline.c
*
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -83,6 +83,8 @@
* vector - Describes the line to be drawn
* width - The width of the line
* color - The color to use to fill the line
+ * capped - Draw a circular cap both ends of the line to support better
+ * line joins
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
@@ -90,7 +92,8 @@
****************************************************************************/
int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
- nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
+ nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
+ bool capped)
{
struct nxgl_trapezoid_s trap[3];
struct nxgl_rect_s rect;
diff --git a/libnx/nxtk/nxtk_drawcircletoolbar.c b/libnx/nxtk/nxtk_drawcircletoolbar.c
index fa7905cd48..3aab9fd6e5 100644
--- a/libnx/nxtk/nxtk_drawcircletoolbar.c
+++ b/libnx/nxtk/nxtk_drawcircletoolbar.c
@@ -1,7 +1,7 @@
/****************************************************************************
* libnx/nxtk/nxtk_drawcircletoolbar.c
*
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -128,7 +128,7 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cent
vector.pt1.y = pts[i].y;
vector.pt2.x = pts[i+1].x;
vector.pt2.y = pts[i+1].y;
- ret = nxtk_drawlinetoolbar(hfwnd, &vector, width, color);
+ ret = nxtk_drawlinetoolbar(hfwnd, &vector, width, color, true);
if (ret != OK)
{
return ret;
@@ -141,5 +141,5 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cent
vector.pt1.y = pts[POINT_337p5].y;
vector.pt2.x = pts[POINT_0p0].x;
vector.pt2.y = pts[POINT_0p0].y;
- return nxtk_drawlinetoolbar(hfwnd, &vector, width, color);
+ return nxtk_drawlinetoolbar(hfwnd, &vector, width, color, true);
}
diff --git a/libnx/nxtk/nxtk_drawcirclewindow.c b/libnx/nxtk/nxtk_drawcirclewindow.c
index ec0fe63121..38435d9438 100644
--- a/libnx/nxtk/nxtk_drawcirclewindow.c
+++ b/libnx/nxtk/nxtk_drawcirclewindow.c
@@ -1,7 +1,7 @@
/****************************************************************************
* libnx/nxtk/nxtk_drawcirclewindow.c
*
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -128,7 +128,7 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cente
vector.pt1.y = pts[i].y;
vector.pt2.x = pts[i+1].x;
vector.pt2.y = pts[i+1].y;
- ret = nxtk_drawlinewindow(hfwnd, &vector, width, color);
+ ret = nxtk_drawlinewindow(hfwnd, &vector, width, color, true);
if (ret != OK)
{
return ret;
@@ -141,5 +141,5 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cente
vector.pt1.y = pts[POINT_337p5].y;
vector.pt2.x = pts[POINT_0p0].x;
vector.pt2.y = pts[POINT_0p0].y;
- return nxtk_drawlinewindow(hfwnd, &vector, width, color);
+ return nxtk_drawlinewindow(hfwnd, &vector, width, color, true);
}
diff --git a/libnx/nxtk/nxtk_drawlinetoolbar.c b/libnx/nxtk/nxtk_drawlinetoolbar.c
index 2bcb8b8904..8c2810ce38 100644
--- a/libnx/nxtk/nxtk_drawlinetoolbar.c
+++ b/libnx/nxtk/nxtk_drawlinetoolbar.c
@@ -1,7 +1,7 @@
/****************************************************************************
* libnx/nxtk/nxtk_drawlinetoolbar.c
*
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -85,6 +85,8 @@
* vector - Describes the line to be drawn
* width - The width of the line
* color - The color to use to fill the line
+ * capped - Draw a circular cap both ends of the line to support better
+ * line joins
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
@@ -92,7 +94,8 @@
****************************************************************************/
int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
- nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
+ nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
+ bool capped)
{
struct nxgl_trapezoid_s trap[3];
diff --git a/libnx/nxtk/nxtk_drawlinewindow.c b/libnx/nxtk/nxtk_drawlinewindow.c
index 176f60b822..8183bf79de 100644
--- a/libnx/nxtk/nxtk_drawlinewindow.c
+++ b/libnx/nxtk/nxtk_drawlinewindow.c
@@ -1,7 +1,7 @@
/****************************************************************************
* libnx/nxtk/nxtk_drawlinewindow.c
*
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -84,6 +84,8 @@
* vector - Describes the line to be drawn
* width - The width of the line
* color - The color to use to fill the line
+ * capped - Draw a circular cap both ends of the line to support better
+ * line joins
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
@@ -91,7 +93,8 @@
****************************************************************************/
int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
- nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
+ nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
+ bool capped)
{
struct nxgl_trapezoid_s trap[3];