merged inmarket

ugfx_release_2.6
Joel Bodenmann 2013-04-03 15:34:48 +02:00
commit b386962981
6 changed files with 43 additions and 8 deletions

View File

@ -22,12 +22,22 @@
#include "hal.h"
#include "gfx.h"
#ifdef WIN32
#define USE_MEMORY_FILE FALSE // Can be true or false for Win32
#else
#define USE_MEMORY_FILE TRUE // Non-Win32 - use the compiled in image
#endif
#if USE_MEMORY_FILE
#include "test-pal8.h"
#endif
static gdispImage myImage;
int main(void) {
coord_t swidth, sheight;
halInit(); // Initialise the Hardware
halInit(); // Initialize the Hardware
chSysInit(); // Initialize the OS
gdispInit(); // Initialize the display
@ -38,7 +48,11 @@ int main(void) {
sheight = gdispGetHeight();
// Set up IO for our image
#if USE_MEMORY_FILE
gdispImageSetMemoryReader(&myImage, test_pal8);
#else
gdispImageSetSimulFileReader(&myImage, "test-pal8.bmp");
#endif
gdispImageOpen(&myImage);
gdispImageDraw(&myImage, 0, 0, swidth, sheight, 0, 0);

View File

@ -135,7 +135,7 @@ extern "C" {
*
* @note Always returns TRUE for a Memory Reader
*/
bool_t gdispImageSetMemoryReader(gdispImage *img, const char *memimage);
bool_t gdispImageSetMemoryReader(gdispImage *img, const void *memimage);
/**
* @brief Sets the io fields in the image structure to routines

View File

@ -88,10 +88,10 @@ static void ImageMemoryClose(struct gdispImageIO *pio) {
static const gdispImageIOFunctions ImageMemoryFunctions =
{ ImageMemoryRead, ImageMemorySeek, ImageMemoryClose };
bool_t gdispImageSetMemoryReader(gdispImage *img, const char *memimage) {
bool_t gdispImageSetMemoryReader(gdispImage *img, const void *memimage) {
img->io.fns = &ImageMemoryFunctions;
img->io.pos = 0;
img->io.fd = (void *)memimage;
img->io.fd = memimage;
return TRUE;
}

Binary file not shown.

View File

@ -46,7 +46,7 @@ static char *filenameof(char *fname) {
static char *clean4c(char *fname) {
char *p;
while((p = strpbrk(fname, "-+ `~!@#$%^&*(){}[]|:;'\",<>?/|="))) *p = '_';
while((p = strpbrk(fname, "-+ `~!@#$%^&*(){}[]|:;'\",<>?/|=.\\"))) *p = '_';
return fname;
}
@ -66,7 +66,7 @@ size_t len;
size_t i;
/* Default values for our parameters */
opt_progname = argv[0];
opt_progname = filenameof(argv[0]);
opt_inputfile = 0;
opt_outputfile = 0;
opt_arrayname = 0;
@ -79,6 +79,7 @@ size_t i;
if (argv[0][0] == '-') {
while (*++(argv[0])) {
switch(argv[0][0]) {
case '?': case 'h': goto usage;
case 'b': opt_breakblocks = 1; break;
case 'c': opt_const = "const "; break;
case 's': opt_static = "static "; break;
@ -97,6 +98,7 @@ size_t i;
fprintf(stderr, "Usage:\n\t%s -?\n"
"\t%s [-bs] [-n name] [inputfile] [outputfile]\n"
"\t\t-?\tThis help\n"
"\t\t-h\tThis help\n"
"\t\t-b\tBreak the arrays for compilers that won't handle large arrays\n"
"\t\t-c\tDeclare the arrays as const (useful to ensure they end up in Flash)\n"
"\t\t-s\tDeclare the arrays as static\n"
@ -136,14 +138,33 @@ size_t i;
} else
f_output = stdout;
/* Set the array name */
/* Print the comment header */
fprintf(f_output, "/**\n * This file was generated ");
if (opt_inputfile) fprintf(f_output, "from \"%s\" ", opt_inputfile);
fprintf(f_output, "using...\n *\n *\t%s", opt_progname);
if (opt_arrayname || opt_static[0] || opt_const[0] || opt_breakblocks) {
fprintf(f_output, " -");
if (opt_breakblocks) fprintf(f_output, "b");
if (opt_const[0]) fprintf(f_output, "c");
if (opt_static[0]) fprintf(f_output, "s");
if (opt_arrayname) fprintf(f_output, "n %s", opt_arrayname);
}
if (opt_inputfile) fprintf(f_output, " %s", opt_inputfile);
if (opt_outputfile) fprintf(f_output, " %s", opt_outputfile);
fprintf(f_output, "\n *\n */\n");
/*
* Set the array name.
* We do this after printing opt_inputfile for the last time as we
* modify opt_inputfile in place to generate opt_arrayname.
*/
if (!opt_arrayname) {
if (opt_inputfile)
opt_arrayname = filenameof(opt_inputfile);
if (!opt_arrayname || !opt_arrayname[0])
opt_arrayname = "filearray";
opt_arrayname = clean4c(opt_arrayname);
}
opt_arrayname = clean4c(opt_arrayname);
/* Read the file processing 1K at a time */
blocknum = 0;