Change point and point_t to gPoint

release/v2.9
inmarket 2018-07-08 10:43:30 +10:00
parent e8b789bfb1
commit 7e95acb731
17 changed files with 49 additions and 45 deletions

View File

@ -6,7 +6,6 @@
FEATURE: Added config vars GINPUT_TOUCH_CALIBRATION_FONT1 and GINPUT_TOUCH_CALIBRATION_FONT2
FEATURE: Added config vars GINPUT_TOUCH_CALIBRATION_TITLE and GINPUT_TOUCH_CALIBRATION_ERROR
FIX: Fixed ensuring the clock is fully started in STM32LTDC based boards
FIX: Fixed compiler error in ST7735 driver
FIX: Added support for negative baseline_x in fonts
FIX: Fixed some word wrapping issues
FIX: Fixed drawing of 3x3 pixel boxes
@ -17,9 +16,10 @@ CHANGE: Added GFX_RED, GFX_BLUE, GFX_GREEN etc to replace V2.x Red, Gree, Blue
CHANGE: Added GFXON/GFXOFF to replace V2.x TRUE/FALSE for configuration options.
CHANGE: Added gBool type and gTrue/gFalse to replace TRUE/FALSE for booleans.
CHANGE: Added types gI8, gU8 .. gI32, gU32 to replace V2.x int8_t etc
CHANGE: Added types gPtr and gPtrDiff
FEATURE: Added types gPtr and gPtrDiff
FEATURE: Added gI64 and gU64 when the compiler supports it. GFX_TYPE_64 macro is defined as GFXON if it does.
FEATURE: Fixed headers to ensure size_t, NULL are always defined. size_t is not used as it may be 64bit.
CHANGE: Added type gPoint to replace V2.x point and point_t
FIX: Added gfxRealloc() to Qt port
FIX: Fixed UC1610 driver private area initialisation
FIX: Fixed ST7735 driver and added kapacuk changes

View File

@ -33,7 +33,7 @@
#define FRAME_DELAY 100 /* The interframe delay in milliseconds */
// Our shape definition
static const point shape[] = {
static const gPoint shape[] = {
{ 10, 10 },
{ 10, 15 },
{ 17, 17 },
@ -49,8 +49,8 @@ static const point shape[] = {
#define NUM_POINTS (sizeof(shape)/sizeof(shape[0]))
// Where we put our calculated points
static point result[NUM_POINTS];
static point oldresult[NUM_POINTS];
static gPoint result[NUM_POINTS];
static gPoint oldresult[NUM_POINTS];
// Make fixed point and floating point options look pretty similar
#if GMISC_NEED_MATRIXFLOAT2D

View File

@ -31,7 +31,7 @@
#include "math.h"
// A set of data points that will be displayed in the graph
static const point data[5] = {
static const gPoint data[5] = {
{ -40, -40 },
{ 70, 40 },
{ 140, 60 },

View File

@ -100,7 +100,7 @@ typedef struct UC8173Lut {
}
typedef struct FBpriv {
point_t fa0, fa1;
gPoint fa0, fa1;
LLDCOLOR_TYPE fb[FB_PAGE_TYPES * FB_PAGES];
} FBpriv;

View File

@ -2985,8 +2985,8 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
}
#if GDISP_NEED_CONVEX_POLYGON
void gdispGDrawPoly(GDisplay *g, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt, color_t color) {
const point *epnt, *p;
void gdispGDrawPoly(GDisplay *g, coord_t tx, coord_t ty, const gPoint *pntarray, unsigned cnt, color_t color) {
const gPoint *epnt, *p;
epnt = &pntarray[cnt-1];
@ -3001,8 +3001,8 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
MUTEX_EXIT(g);
}
void gdispGFillConvexPoly(GDisplay *g, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt, color_t color) {
const point *lpnt, *rpnt, *epnts;
void gdispGFillConvexPoly(GDisplay *g, coord_t tx, coord_t ty, const gPoint *pntarray, unsigned cnt, color_t color) {
const gPoint *lpnt, *rpnt, *epnts;
fixed lx, rx, lk, rk;
coord_t y, ymax, lxc, rxc;
@ -3187,7 +3187,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
* (0,0) ----------------------------------- (d)
* pt0 pt3
*/
point pntarray[4];
gPoint pntarray[4];
pntarray[0].x = 0;
pntarray[0].y = 0;
@ -3210,7 +3210,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
* \ /
* pt0 -------------------pt7
*/
point pntarray[8];
gPoint pntarray[8];
coord_t nx2, ny2;
/* Magic numbers:

View File

@ -45,13 +45,13 @@ typedef int16_t coord_t;
/*===========================================================================*/
/**
* @struct point
* @struct gPoint
* @brief Type for a 2D point on the screen.
*/
typedef struct point {
typedef struct gPoint {
coord_t x; /**< The x coordinate of the point. */
coord_t y; /**< The y coordinate of the point. */
} point, point_t;
} gPoint;
/**
* @enum justify
@ -855,7 +855,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
*
* @api
*/
void gdispGDrawPoly(GDisplay *g, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt, color_t color);
void gdispGDrawPoly(GDisplay *g, coord_t tx, coord_t ty, const gPoint *pntarray, unsigned cnt, color_t color);
#define gdispDrawPoly(x,y,p,i,c) gdispGDrawPoly(GDISP,x,y,p,i,c)
/**
@ -879,7 +879,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
*
* @api
*/
void gdispGFillConvexPoly(GDisplay *g, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt, color_t color);
void gdispGFillConvexPoly(GDisplay *g, coord_t tx, coord_t ty, const gPoint *pntarray, unsigned cnt, color_t color);
#define gdispFillConvexPoly(x,y,p,i,c) gdispGFillConvexPoly(GDISP,x,y,p,i,c)
/**
@ -1228,6 +1228,10 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
#include "gdisp_pixmap.h"
#endif
/* V2 compatibility */
#if GFX_COMPAT_V2
typedef gPoint point, point_t;
#endif
#endif /* GFX_USE_GDISP */

View File

@ -50,7 +50,7 @@ typedef struct GMouse {
#define GMOUSE_FLG_FINGERMODE 0x0020 // Mouse is currently in finger mode
#define GMOUSE_FLG_NEEDREAD 0x0040 // The mouse needs reading
#define GMOUSE_FLG_DRIVER_FIRST 0x0100 // The first flag available for the driver
point clickpos; // The position of the last click event
gPoint clickpos; // The position of the last click event
systemticks_t clicktime; // The time of the last click event
GDisplay * display; // The display the mouse is associated with
#if !GINPUT_TOUCH_NOCALIBRATE

View File

@ -351,7 +351,7 @@ static void MousePoll(void *param) {
#error "GINPUT: GFX_USE_GDISP must be defined when calibration is required"
#endif
static GFXINLINE void CalibrationCrossDraw(GMouse *m, const point *pp) {
static GFXINLINE void CalibrationCrossDraw(GMouse *m, const gPoint *pp) {
gdispGDrawLine(m->display, pp->x-CALIBRATION_CROSS_RADIUS, pp->y, pp->x-CALIBRATION_CROSS_INNERGAP, pp->y, CALIBRATION_CROSS_COLOR1);
gdispGDrawLine(m->display, pp->x+CALIBRATION_CROSS_INNERGAP, pp->y, pp->x+CALIBRATION_CROSS_RADIUS, pp->y, CALIBRATION_CROSS_COLOR1);
gdispGDrawLine(m->display, pp->x, pp->y-CALIBRATION_CROSS_RADIUS, pp->x, pp->y-CALIBRATION_CROSS_INNERGAP, CALIBRATION_CROSS_COLOR1);
@ -366,11 +366,11 @@ static void MousePoll(void *param) {
gdispGDrawLine(m->display, pp->x+CALIBRATION_CROSS_RADIUS, pp->y-CALIBRATION_CROSS_RADIUS, pp->x+CALIBRATION_CROSS_RADIUS, pp->y-CALIBRATION_CROSS_RADIUS/2, CALIBRATION_CROSS_COLOR2);
}
static GFXINLINE void CalibrationCrossClear(GMouse *m, const point *pp) {
static GFXINLINE void CalibrationCrossClear(GMouse *m, const gPoint *pp) {
gdispGFillArea(m->display, pp->x - CALIBRATION_CROSS_RADIUS, pp->y - CALIBRATION_CROSS_RADIUS, CALIBRATION_CROSS_RADIUS*2+1, CALIBRATION_CROSS_RADIUS*2+1, CALIBRATION_BACKGROUND);
}
static GFXINLINE void CalibrationCalculate(GMouse *m, const point *cross, const point *points) {
static GFXINLINE void CalibrationCalculate(GMouse *m, const gPoint *cross, const gPoint *points) {
float dx;
coord_t c0, c1, c2;
(void) m;
@ -463,8 +463,8 @@ static void MousePoll(void *param) {
static uint32_t CalibrateMouse(GMouse *m) {
coord_t w, h;
point cross[4]; // The locations of the test points on the display
point points[4]; // The x, y readings obtained from the mouse for each test point
gPoint cross[4]; // The locations of the test points on the display
gPoint points[4]; // The x, y readings obtained from the mouse for each test point
uint32_t err;
#if GDISP_NEED_TEXT
font_t font1, font2;

View File

@ -26,7 +26,7 @@
/*===========================================================================*/
// Forward definition
typedef struct point point;
typedef struct gPoint gPoint;
/**
* @brief Sample data formats
@ -249,7 +249,7 @@ typedef int32_t fixed;
*
* @api
*/
void gmiscMatrixFloat2DApplyToPoints(point *dst, const point *src, const MatrixFloat2D *m, int cnt);
void gmiscMatrixFloat2DApplyToPoints(gPoint *dst, const gPoint *src, const MatrixFloat2D *m, int cnt);
/**
* @brief Set the 2D matrix to the identity matrix
@ -367,7 +367,7 @@ typedef int32_t fixed;
*
* @api
*/
void gmiscMatrixFixed2DApplyToPoints(point *dst, const point *src, const MatrixFixed2D *m, int cnt);
void gmiscMatrixFixed2DApplyToPoints(gPoint *dst, const gPoint *src, const MatrixFixed2D *m, int cnt);
/**
* @brief Set the 2D matrix to the identity matrix
@ -476,7 +476,7 @@ typedef int32_t fixed;
*
* @api
*/
gBool gmiscHittestPoly(const point *pntarray, unsigned cnt, const point *p);
gBool gmiscHittestPoly(const gPoint *pntarray, unsigned cnt, const gPoint *p);
#endif // GMISC_NEED_HITTEST_POLY
#endif /* GFX_USE_MISC */

View File

@ -18,7 +18,7 @@
* the function returns 1. If the point c is on the segment, the function
* returns 0. If they don't intersect, it returns 2.
*/
static char _pointCrossingSegment(const point *a, const point *b, const point *c) {
static char _pointCrossingSegment(const gPoint *a, const gPoint *b, const gPoint *c) {
/* If both points are left from our point, it won't intersect */
if (a->x < c->x && b->x < c->x) {
return -1;
@ -64,7 +64,7 @@ static char _pointCrossingSegment(const point *a, const point *b, const point *c
return -1;
}
gBool gmiscHittestPoly(const point *pntarray, unsigned cnt, const point *p) {
gBool gmiscHittestPoly(const gPoint *pntarray, unsigned cnt, const gPoint *p) {
unsigned i = 0;
uint8_t nbrIntersection = 0;
int8_t crossResult;

View File

@ -91,7 +91,7 @@ void gmiscMatrixFloat2DApplyRotation(MatrixFloat2D *dst, const MatrixFloat2D *sr
}
}
void gmiscMatrixFloat2DApplyToPoints(point *dst, const point *src, const MatrixFloat2D *m, int cnt) {
void gmiscMatrixFloat2DApplyToPoints(gPoint *dst, const gPoint *src, const MatrixFloat2D *m, int cnt) {
float x;
for( ;cnt--; dst++, src++) {
@ -177,7 +177,7 @@ void gmiscMatrixFixed2DApplyShear(MatrixFixed2D *dst, const MatrixFixed2D *src,
}
#endif
void gmiscMatrixFixed2DApplyToPoints(point *dst, const point *src, const MatrixFixed2D *m, int cnt) {
void gmiscMatrixFixed2DApplyToPoints(gPoint *dst, const gPoint *src, const MatrixFixed2D *m, int cnt) {
coord_t x;
for( ;cnt--; dst++, src++) {

View File

@ -384,13 +384,13 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
#endif
#if GDISP_NEED_CONVEX_POLYGON
void gwinDrawPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt) {
void gwinDrawPoly(GHandle gh, coord_t tx, coord_t ty, const gPoint *pntarray, unsigned cnt) {
if (!_gwinDrawStart(gh)) return;
gdispGDrawPoly(gh->display, tx+gh->x, ty+gh->y, pntarray, cnt, gh->color);
_gwinDrawEnd(gh);
}
void gwinFillConvexPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt) {
void gwinFillConvexPoly(GHandle gh, coord_t tx, coord_t ty, const gPoint *pntarray, unsigned cnt) {
if (!_gwinDrawStart(gh)) return;
gdispGFillConvexPoly(gh->display, tx+gh->x, ty+gh->y, pntarray, cnt, gh->color);
_gwinDrawEnd(gh);

View File

@ -987,7 +987,7 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
*
* @api
*/
void gwinDrawPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt);
void gwinDrawPoly(GHandle gh, coord_t tx, coord_t ty, const gPoint *pntarray, unsigned cnt);
/**
* @brief Fill a convex polygon
@ -1010,7 +1010,7 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
*
* @api
*/
void gwinFillConvexPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt);
void gwinFillConvexPoly(GHandle gh, coord_t tx, coord_t ty, const gPoint *pntarray, unsigned cnt);
/**
* @brief Draw a thick line in the window

View File

@ -247,7 +247,7 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
#if GDISP_NEED_CONVEX_POLYGON
void gwinButtonDraw_ArrowUp(GWidgetObject *gw, void *param) {
const GColorSet * pcol;
point arw[7];
gPoint arw[7];
(void) param;
@ -298,7 +298,7 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
void gwinButtonDraw_ArrowDown(GWidgetObject *gw, void *param) {
const GColorSet * pcol;
point arw[7];
gPoint arw[7];
(void) param;
@ -349,7 +349,7 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
void gwinButtonDraw_ArrowLeft(GWidgetObject *gw, void *param) {
const GColorSet * pcol;
point arw[7];
gPoint arw[7];
(void) param;
@ -400,7 +400,7 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
void gwinButtonDraw_ArrowRight(GWidgetObject *gw, void *param) {
const GColorSet * pcol;
point arw[7];
gPoint arw[7];
(void) param;

View File

@ -301,10 +301,10 @@ void gwinGraphDrawPoint(GHandle gh, coord_t x, coord_t y) {
#undef gg
}
void gwinGraphDrawPoints(GHandle gh, const point *points, unsigned count) {
void gwinGraphDrawPoints(GHandle gh, const gPoint *points, unsigned count) {
#define gg ((GGraphObject *)gh)
unsigned i;
const point *p;
const gPoint *p;
if (gh->vmt != &graphVMT || !_gwinDrawStart(gh))
return;

View File

@ -174,7 +174,7 @@ void gwinGraphDrawPoint(GHandle gh, coord_t x, coord_t y);
*
* @api
*/
void gwinGraphDrawPoints(GHandle gh, const point *points, unsigned count);
void gwinGraphDrawPoints(GHandle gh, const gPoint *points, unsigned count);
#endif /* _GWIN_GRAPH_H */
/** @} */

View File

@ -710,8 +710,8 @@ void gwinListDefaultDraw(GWidgetObject* gw, void* param) {
coord_t sy;
#endif
#if GDISP_NEED_CONVEX_POLYGON
static const point upArrow[] = { {0, LST_ARROW_SZ}, {LST_ARROW_SZ, LST_ARROW_SZ}, {LST_ARROW_SZ/2, 0} };
static const point downArrow[] = { {0, 0}, {LST_ARROW_SZ, 0}, {LST_ARROW_SZ/2, LST_ARROW_SZ} };
static const gPoint upArrow[] = { {0, LST_ARROW_SZ}, {LST_ARROW_SZ, LST_ARROW_SZ}, {LST_ARROW_SZ/2, 0} };
static const gPoint downArrow[] = { {0, 0}, {LST_ARROW_SZ, 0}, {LST_ARROW_SZ/2, LST_ARROW_SZ} };
#endif
(void)param;