diff options
author | inmarket <andrewh@inmarket.com.au> | 2014-02-03 18:02:23 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2014-02-03 18:02:23 +1000 |
commit | d0b363bb125d0913246796a597ecea4aeb8d578b (patch) | |
tree | 66f69c1a83b7c6a4407964ded39dcec4b1dc91c1 /src | |
parent | a6c22fc364c25e8673488f0f5c36e3538546d898 (diff) | |
parent | d869d9b3b80cb9ab2314840b2fa274e89e5342db (diff) | |
download | uGFX-d0b363bb125d0913246796a597ecea4aeb8d578b.tar.gz uGFX-d0b363bb125d0913246796a597ecea4aeb8d578b.tar.bz2 uGFX-d0b363bb125d0913246796a597ecea4aeb8d578b.zip |
Merge branch 'master' into gfile
Diffstat (limited to 'src')
-rw-r--r-- | src/gdisp/gdisp.c | 24 | ||||
-rw-r--r-- | src/gfx.c | 12 | ||||
-rw-r--r-- | src/gtimer/gtimer.c | 3 |
3 files changed, 34 insertions, 5 deletions
diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c index 3031c455..949bedaf 100644 --- a/src/gdisp/gdisp.c +++ b/src/gdisp/gdisp.c @@ -2769,8 +2769,14 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co #if GDISP_NEED_ANTIALIAS && GDISP_HARDWARE_PIXELREAD static void drawcharline(int16_t x, int16_t y, uint8_t count, uint8_t alpha, void *state) { #define GD ((GDisplay *)state) - if (y < GD->t.clipy0 || y >= GD->t.clipy1) + if (y < GD->t.clipy0 || y >= GD->t.clipy1 || x+count <= GD->t.clipx0 || x >= GD->t.clipx1) return; + if (x < GD->t.clipx0) { + count -= GD->t.clipx0 - x; + x = GD->t.clipx0; + } + if (x+count > GD->t.clipx1) + count = GD->t.clipx1 - x; if (alpha == 255) { GD->p.x = x; GD->p.y = y; GD->p.x1 = x+count-1; GD->p.color = GD->t.color; hline_clip(GD); @@ -2786,8 +2792,14 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co #else static void drawcharline(int16_t x, int16_t y, uint8_t count, uint8_t alpha, void *state) { #define GD ((GDisplay *)state) - if (y < GD->t.clipy0 || y >= GD->t.clipy1) + if (y < GD->t.clipy0 || y >= GD->t.clipy1 || x+count <= GD->t.clipx0 || x >= GD->t.clipx1) return; + if (x < GD->t.clipx0) { + count -= GD->t.clipx0 - x; + x = GD->t.clipx0; + } + if (x+count > GD->t.clipx1) + count = GD->t.clipx1 - x; if (alpha > 0x80) { // A best approximation when using anti-aliased fonts but we can't actually draw them anti-aliased GD->p.x = x; GD->p.y = y; GD->p.x1 = x+count-1; GD->p.color = GD->t.color; hline_clip(GD); @@ -2799,8 +2811,14 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co #if GDISP_NEED_ANTIALIAS static void fillcharline(int16_t x, int16_t y, uint8_t count, uint8_t alpha, void *state) { #define GD ((GDisplay *)state) - if (y < GD->t.clipy0 || y >= GD->t.clipy1) + if (y < GD->t.clipy0 || y >= GD->t.clipy1 || x+count <= GD->t.clipx0 || x >= GD->t.clipx1) return; + if (x < GD->t.clipx0) { + count -= GD->t.clipx0 - x; + x = GD->t.clipx0; + } + if (x+count > GD->t.clipx1) + count = GD->t.clipx1 - x; if (alpha == 255) { GD->p.color = GD->t.color; } else { @@ -15,6 +15,8 @@ #include "gfx.h" +static bool_t initDone = FALSE; + /* These init functions are defined by each module but not published */ extern void _gosInit(void); extern void _gosDeinit(void); @@ -57,6 +59,11 @@ extern void _gosDeinit(void); void gfxInit(void) { + /* Ensure we only initialise once */ + if (initDone) + return; + initDone = TRUE; + // These must be initialised in the order of their dependancies _gosInit(); @@ -91,8 +98,11 @@ void gfxInit(void) void gfxDeinit(void) { - // We deinitialise the opposit way as we initialised + if (!initDone) + return; + initDone = FALSE; + // We deinitialise the opposite way as we initialised #if GFX_USE_GAUDOUT _gaudoutDeinit(); #endif diff --git a/src/gtimer/gtimer.c b/src/gtimer/gtimer.c index 3f772e39..3e0b6966 100644 --- a/src/gtimer/gtimer.c +++ b/src/gtimer/gtimer.c @@ -128,6 +128,7 @@ void _gtimerDeinit(void) {
gfxSemDestroy(&waitsem);
gfxMutexDestroy(&mutex);
+ // Need to destroy GTimer thread here
}
void gtimerInit(GTimer* pt)
@@ -137,7 +138,7 @@ void gtimerInit(GTimer* pt) void gtimerDeinit(GTimer* pt)
{
- (void)pt;
+ gtimerStop(pt);
}
void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, bool_t periodic, delaytime_t millisec) {
|