"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/gd_xbm.c" between
libgd-2.2.4.tar.gz and libgd-2.2.5.tar.gz

About: LibGD is a library for the dynamic creation of images by programmers (PNG, JPEG, GIF, WebP, XPM, BMP support).

gd_xbm.c  (libgd-2.2.4):gd_xbm.c  (libgd-2.2.5)
skipping to change at line 42 skipping to change at line 42
pointer to a file containing the desired pointer to a file containing the desired
image. <gdImageCreateFromXbm> returns a <gdImagePtr> to the new image. <gdImageCreateFromXbm> returns a <gdImagePtr> to the new
image, or NULL if unable to load the image (most often because the image, or NULL if unable to load the image (most often because the
file is corrupt or does not contain an X bitmap format file is corrupt or does not contain an X bitmap format
image). <gdImageCreateFromXbm> does not close the file. image). <gdImageCreateFromXbm> does not close the file.
You can inspect the sx and sy members of the image to determine You can inspect the sx and sy members of the image to determine
its size. The image must eventually be destroyed using its size. The image must eventually be destroyed using
<gdImageDestroy>. <gdImageDestroy>.
X11 X bitmaps (which define a char[]) as well as X10 X bitmaps (which define
a short[]) are supported.
Parameters: Parameters:
fd - The input FILE pointer fd - The input FILE pointer
Returns: Returns:
A pointer to the new image or NULL if an error occurred. A pointer to the new image or NULL if an error occurred.
Example: Example:
(start code) (start code)
skipping to change at line 110 skipping to change at line 113
if ( sscanf(fline, "static unsigned char %s = {", iname) == 1 if ( sscanf(fline, "static unsigned char %s = {", iname) == 1
|| sscanf(fline, "static char %s = {", iname) == 1) || sscanf(fline, "static char %s = {", iname) == 1)
{ {
max_bit = 128; max_bit = 128;
} else if (sscanf(fline, "static unsigned short %s = {", iname) == 1 } else if (sscanf(fline, "static unsigned short %s = {", iname) == 1
|| sscanf(fline, "static short %s = {", i name) == 1) || sscanf(fline, "static short %s = {", i name) == 1)
{ {
max_bit = 32768; max_bit = 32768;
} }
if (max_bit) { if (max_bit) {
bytes = (width * height / 8) + 1; bytes = (width + 7) / 8 * height;
if (!bytes) { if (!bytes) {
return 0; return 0;
} }
if (!(type = strrchr(iname, '_'))) { if (!(type = strrchr(iname, '_'))) {
type = iname; type = iname;
} else { } else {
type++; type++;
} }
if (!strcmp("bits[]", type)) { if (!strcmp("bits[]", type)) {
break; break;
skipping to change at line 204 skipping to change at line 207
va_start(args, format); va_start(args, format);
len = vsnprintf(buf, sizeof(buf)-1, format, args); len = vsnprintf(buf, sizeof(buf)-1, format, args);
va_end(args); va_end(args);
out->putBuf(out, buf, len); out->putBuf(out, buf, len);
} }
/* }}} */ /* }}} */
/* The compiler will optimize strlen(constant) to a constant number. */ /* The compiler will optimize strlen(constant) to a constant number. */
#define gdCtxPuts(out, s) out->putBuf(out, s, strlen(s)) #define gdCtxPuts(out, s) out->putBuf(out, s, strlen(s))
/* {{{ gdImageXbmCtx */ /**
/* * Function: gdImageXbmCtx
Function: gdImageXbmCtx *
*/ * Writes an image to an IO context in X11 bitmap format.
*
* Parameters:
*
* image - The <gdImagePtr> to write.
* file_name - The prefix of the XBM's identifiers. Illegal characters are
* automatically stripped.
* gd - Which color to use as forground color. All pixels with another
* color are unset.
* out - The <gdIOCtx> to write the image file to.
*
*/
BGD_DECLARE(void) gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOC tx * out) BGD_DECLARE(void) gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOC tx * out)
{ {
int x, y, c, b, sx, sy, p; int x, y, c, b, sx, sy, p;
char *name, *f; char *name, *f;
size_t i, l; size_t i, l;
name = file_name; name = file_name;
if ((f = strrchr(name, '/')) != NULL) name = f+1; if ((f = strrchr(name, '/')) != NULL) name = f+1;
if ((f = strrchr(name, '\\')) != NULL) name = f+1; if ((f = strrchr(name, '\\')) != NULL) name = f+1;
name = strdup(name); name = strdup(name);
skipping to change at line 283 skipping to change at line 297
p++; p++;
gdCtxPrintf(out, "0x%02X", c); gdCtxPrintf(out, "0x%02X", c);
c = 0; c = 0;
} else { } else {
b <<= 1; b <<= 1;
} }
} }
} }
gdCtxPuts(out, "};\n"); gdCtxPuts(out, "};\n");
} }
/* }}} */
 End of changes. 4 change blocks. 
5 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)