diff options
author | inmarket <andrewh@inmarket.com.au> | 2013-07-01 17:37:34 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2013-07-01 17:37:34 +1000 |
commit | 956af8d3cbfb5a0bb9a3768eaf4a0c199e791dfb (patch) | |
tree | 9cbbff103a87e59cdd8badea22e4d791e10936dd | |
parent | 57d3632e36fe2ab55589207a84c29544b15bd2c3 (diff) | |
parent | dd43a37b9b981bd01bb19d921dafa22d7126f927 (diff) | |
download | uGFX-956af8d3cbfb5a0bb9a3768eaf4a0c199e791dfb.tar.gz uGFX-956af8d3cbfb5a0bb9a3768eaf4a0c199e791dfb.tar.bz2 uGFX-956af8d3cbfb5a0bb9a3768eaf4a0c199e791dfb.zip |
Merge branch 'master' into GWIN
-rw-r--r-- | include/gdisp/image.h | 15 | ||||
-rw-r--r-- | src/gdisp/image.c | 8 |
2 files changed, 22 insertions, 1 deletions
diff --git a/include/gdisp/image.h b/include/gdisp/image.h index 696500a6..ea8a02d4 100644 --- a/include/gdisp/image.h +++ b/include/gdisp/image.h @@ -185,7 +185,7 @@ extern "C" { gdispImageError gdispImageOpen(gdispImage *img); /** - * @brief Close an image and release any dynamicly allocated working storage. + * @brief Close an image and release any dynamically allocated working storage. * * @param[in] img The image structure * @@ -196,6 +196,19 @@ extern "C" { void gdispImageClose(gdispImage *img); /** + * @brief Is an image open. + * @return TRUE if the image is currently open. + * + * @param[in] img The image structure + * + * @note Be careful with calling this on an uninitialized image structure as the image + * will contain random data which may be interpreted as meaning the image + * is open. Clearing the Image structure to 0's will guarantee the image + * is seen as being closed. + */ + bool_t gdispImageIsOpen(gdispImage *img); + + /** * @brief Set the background color of the image. * * @param[in] img The image structure diff --git a/src/gdisp/image.c b/src/gdisp/image.c index fec05147..efeb6ad1 100644 --- a/src/gdisp/image.c +++ b/src/gdisp/image.c @@ -184,6 +184,14 @@ void gdispImageClose(gdispImage *img) { img->fns->close(img); else img->io.fns->close(&img->io); + img->type = GDISP_IMAGE_TYPE_UNKNOWN; + img->flags = 0; + img->fns = 0; + img->priv = 0; +} + +bool_t gdispImageIsOpen(gdispImage *img) { + return img->type != GDISP_IMAGE_TYPE_UNKNOWN && img->fns != 0; } void gdispImageSetBgColor(gdispImage *img, color_t bgcolor) { |