aboutsummaryrefslogtreecommitdiffstats
path: root/demos/modules/gdisp/images_animated/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'demos/modules/gdisp/images_animated/main.c')
-rw-r--r--demos/modules/gdisp/images_animated/main.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/demos/modules/gdisp/images_animated/main.c b/demos/modules/gdisp/images_animated/main.c
index 9b2b5d2c..039cf584 100644
--- a/demos/modules/gdisp/images_animated/main.c
+++ b/demos/modules/gdisp/images_animated/main.c
@@ -29,23 +29,20 @@
#include "gfx.h"
+/**
+ * The image file must be stored on a GFILE file-system.
+ * Use either GFILE_NEED_NATIVEFS or GFILE_NEED_ROMFS (or both).
+ *
+ * The ROMFS uses the file "romfs_files.h" to describe the set of files in the ROMFS.
+ */
+
#define USE_IMAGE_CACHE FALSE // Only if you want to get performance at the expense of RAM
#define MY_BG_COLOR RGB2COLOR(220, 220, 255) // Pale blue so we can see the transparent parts
-#ifdef WIN32
- #define USE_MEMORY_FILE TRUE // Can be true or false for Win32
-#else
- #define USE_MEMORY_FILE TRUE // Non-Win32 - use the compiled in image
-#endif
+static gdispImage myImage;
#define SHOW_ERROR(color) gdispFillArea(errx, erry, errcx, errcy, color)
-#if USE_MEMORY_FILE
- #include "testanim.h"
-#endif
-
-static gdispImage myImage;
-
/**
* This demo display the animated gif (either directly from a file or from a
* file encoded in flash.
@@ -75,13 +72,8 @@ int main(void) {
errcy = sheight;
// Set up IO for our image
-#if USE_MEMORY_FILE
- gdispImageSetMemoryReader(&myImage, testanim);
-#else
- gdispImageSetFileReader(&myImage, "testanim.gif");
-#endif
+ if (!(gdispImageOpenFile(&myImage, "testanim.gif") & GDISP_IMAGE_ERR_UNRECOVERABLE)) {
- if (gdispImageOpen(&myImage) == GDISP_IMAGE_ERR_OK) {
gdispImageSetBgColor(&myImage, MY_BG_COLOR);
// Adjust the error indicator area if necessary
if (myImage.width > errx && myImage.height < sheight) {