plug-ins/animationplay/animationplay.c plug-ins/CEL/CEL.c

* plug-ins/animationplay/animationplay.c
* plug-ins/CEL/CEL.c
* plug-ins/psd/psd.c
* plug-ins/xd/xd.c: applied gimp-joke-980427-0, warning cleanups

* app/temp_buf.c: applied gimp-entity-980427-0, temp_buf swap speedups and
more robust tempfile handling

-Yosh
This commit is contained in:
Manish Singh 1998-04-28 03:50:21 +00:00
parent 010dc35e8a
commit 9f4f94c6c5
14 changed files with 288 additions and 200 deletions

View File

@ -1,3 +1,13 @@
Mon Apr 27 20:43:14 PDT 1998 Manish Singh <yosh@gimp.org>
* plug-ins/animationplay/animationplay.c
* plug-ins/CEL/CEL.c
* plug-ins/psd/psd.c
* plug-ins/xd/xd.c: applied gimp-joke-980427-0, warning cleanups
* app/temp_buf.c: applied gimp-entity-980427-0, temp_buf swap
speedups and more robust tempfile handling
Mon Apr 27 20:57:26 1998 EDT Matthew Wilson <msw@gimp.org>
* app/curves: Initialize data that is referenced in event handlers

View File

@ -68,10 +68,11 @@ temp_buf_to_color (src_buf, dest_buf)
while (num_bytes--)
{
unsigned char tmpch;
*dest++ = *src++; /* alpha channel */
*dest++ = *src;
*dest++ = *src;
*dest++ = *src++;
*dest++ = tmpch = *src++;
*dest++ = tmpch;
*dest++ = tmpch;
}
}
@ -115,7 +116,7 @@ temp_buf_new (width, height, bytes, x, y, col)
{
long i;
int j;
unsigned char * init, * data;
unsigned char * data;
TempBuf * temp;
temp = (TempBuf *) g_malloc (sizeof (TempBuf));
@ -128,20 +129,45 @@ temp_buf_new (width, height, bytes, x, y, col)
temp->swapped = FALSE;
temp->filename = NULL;
temp->data = temp_buf_allocate (width * height * bytes);
temp->data = data = temp_buf_allocate (width * height * bytes);
/* initialize the data */
if (col)
{
i = width * height;
data = temp->data;
while (i--)
/* First check if we can save a lot of work */
if (bytes == 1)
{
memset (data, *col, width * height);
}
else if ((bytes == 3) && (col[1] == *col) && (*col == col[2]))
{
memset (data, *col, width * height * 3);
}
else if ((bytes == 4) && (col[1] == *col) && (*col == col[2]) && (col[2] == col[3]))
{
memset (data, *col, (width * height) << 2);
}
else
{
/* No, we cannot */
unsigned char * dptr;
/* Fill the first row */
dptr = data;
for (i = width - 1; i >= 0; --i)
{
unsigned char * init;
j = bytes;
init = col;
while (j--)
*data++ = *init++;
*dptr++ = *init++;
}
/* Now copy from it (we set bytes to bytesperrow now) */
bytes *= width;
while (--height)
{
memcpy (dptr, data, bytes);
dptr += bytes;
}
}
}
@ -170,9 +196,8 @@ temp_buf_copy (src, dest)
new = dest;
if (dest->width != src->width || dest->height != src->height)
warning ("In temp_buf_copy, the widths or heights don't match.");
}
/* The temp buf is smart, and can translate between color and gray */
/* (only necessary if not we allocated it */
if (src->bytes != new->bytes)
{
if (src->bytes == 4) /* RGB color */
@ -181,13 +206,13 @@ temp_buf_copy (src, dest)
temp_buf_to_color (src, new);
else
warning ("Cannot convert from indexed color.");
return new;
}
else
{
}
/* make the copy */
length = src->width * src->height * src->bytes;
memcpy (temp_buf_data (new), temp_buf_data (src), length);
}
return new;
}
@ -473,6 +498,7 @@ temp_buf_unswap (buf)
{
struct stat stat_buf;
FILE * fp;
gboolean succ = FALSE;
if (!buf || !buf->swapped)
return;
@ -491,12 +517,18 @@ temp_buf_unswap (buf)
buf->data = temp_buf_allocate (buf->width * buf->height * buf->bytes);
/* Find out if the filename of the swapped data is an existing file... */
/* (buf->filname HAS to be != 0 */
if (!stat (buf->filename, &stat_buf))
{
if ((fp = fopen (buf->filename, "r")))
{
fread (buf->data, buf->width * buf->height * buf->bytes, 1, fp);
size_t blocksRead;
blocksRead = fread (buf->data, buf->width * buf->height * buf->bytes, 1, fp);
fclose (fp);
if (blocksRead != 1)
perror ("Read error on temp buf");
else
succ = TRUE;
}
else
perror ("Error in temp buf caching");
@ -504,10 +536,9 @@ temp_buf_unswap (buf)
/* Delete the swap file */
unlink (buf->filename);
}
else
if (!succ)
warning ("Error in temp buf caching: information swapped to disk was lost!");
if (buf->filename)
g_free (buf->filename); /* free filename */
buf->filename = NULL;
}

View File

@ -68,10 +68,11 @@ temp_buf_to_color (src_buf, dest_buf)
while (num_bytes--)
{
unsigned char tmpch;
*dest++ = *src++; /* alpha channel */
*dest++ = *src;
*dest++ = *src;
*dest++ = *src++;
*dest++ = tmpch = *src++;
*dest++ = tmpch;
*dest++ = tmpch;
}
}
@ -115,7 +116,7 @@ temp_buf_new (width, height, bytes, x, y, col)
{
long i;
int j;
unsigned char * init, * data;
unsigned char * data;
TempBuf * temp;
temp = (TempBuf *) g_malloc (sizeof (TempBuf));
@ -128,20 +129,45 @@ temp_buf_new (width, height, bytes, x, y, col)
temp->swapped = FALSE;
temp->filename = NULL;
temp->data = temp_buf_allocate (width * height * bytes);
temp->data = data = temp_buf_allocate (width * height * bytes);
/* initialize the data */
if (col)
{
i = width * height;
data = temp->data;
while (i--)
/* First check if we can save a lot of work */
if (bytes == 1)
{
memset (data, *col, width * height);
}
else if ((bytes == 3) && (col[1] == *col) && (*col == col[2]))
{
memset (data, *col, width * height * 3);
}
else if ((bytes == 4) && (col[1] == *col) && (*col == col[2]) && (col[2] == col[3]))
{
memset (data, *col, (width * height) << 2);
}
else
{
/* No, we cannot */
unsigned char * dptr;
/* Fill the first row */
dptr = data;
for (i = width - 1; i >= 0; --i)
{
unsigned char * init;
j = bytes;
init = col;
while (j--)
*data++ = *init++;
*dptr++ = *init++;
}
/* Now copy from it (we set bytes to bytesperrow now) */
bytes *= width;
while (--height)
{
memcpy (dptr, data, bytes);
dptr += bytes;
}
}
}
@ -170,9 +196,8 @@ temp_buf_copy (src, dest)
new = dest;
if (dest->width != src->width || dest->height != src->height)
warning ("In temp_buf_copy, the widths or heights don't match.");
}
/* The temp buf is smart, and can translate between color and gray */
/* (only necessary if not we allocated it */
if (src->bytes != new->bytes)
{
if (src->bytes == 4) /* RGB color */
@ -181,13 +206,13 @@ temp_buf_copy (src, dest)
temp_buf_to_color (src, new);
else
warning ("Cannot convert from indexed color.");
return new;
}
else
{
}
/* make the copy */
length = src->width * src->height * src->bytes;
memcpy (temp_buf_data (new), temp_buf_data (src), length);
}
return new;
}
@ -473,6 +498,7 @@ temp_buf_unswap (buf)
{
struct stat stat_buf;
FILE * fp;
gboolean succ = FALSE;
if (!buf || !buf->swapped)
return;
@ -491,12 +517,18 @@ temp_buf_unswap (buf)
buf->data = temp_buf_allocate (buf->width * buf->height * buf->bytes);
/* Find out if the filename of the swapped data is an existing file... */
/* (buf->filname HAS to be != 0 */
if (!stat (buf->filename, &stat_buf))
{
if ((fp = fopen (buf->filename, "r")))
{
fread (buf->data, buf->width * buf->height * buf->bytes, 1, fp);
size_t blocksRead;
blocksRead = fread (buf->data, buf->width * buf->height * buf->bytes, 1, fp);
fclose (fp);
if (blocksRead != 1)
perror ("Read error on temp buf");
else
succ = TRUE;
}
else
perror ("Error in temp buf caching");
@ -504,10 +536,9 @@ temp_buf_unswap (buf)
/* Delete the swap file */
unlink (buf->filename);
}
else
if (!succ)
warning ("Error in temp buf caching: information swapped to disk was lost!");
if (buf->filename)
g_free (buf->filename); /* free filename */
buf->filename = NULL;
}

View File

@ -172,7 +172,7 @@ static void run(char *name, int nparams, GParam *param,
static gint32 load_image(char *file, char *brief) {
FILE* fp; /* Read file pointer */
char *progress; /* Title for progress display */
guchar header[32]; /* File header */
gchar header[32]; /* File header */
int height, width, /* Dimensions of image */
colours; /* Number of colours */
@ -306,7 +306,7 @@ static gint32 load_image(char *file, char *brief) {
}
static gint load_palette(FILE *fp, guchar palette[]) {
guchar header[32]; /* File header */
gchar header[32]; /* File header */
guchar buffer[2];
int i, bpp, colours= 0;
@ -342,7 +342,7 @@ static gint load_palette(FILE *fp, guchar palette[]) {
static gint save_image(char *file, char *brief, gint32 image, gint32 layer) {
FILE* fp; /* Write file pointer */
char *progress; /* Title for progress display */
guchar header[32]; /* File header */
gchar header[32]; /* File header */
gint colours, type; /* Number of colours, type of layer */
guchar *buffer, /* Temporary buffer */

View File

@ -162,7 +162,7 @@ gint ncolours;
/* for shaping */
guchar *shape_preview_mask;
gchar *shape_preview_mask;
GtkWidget *shape_window;
GtkWidget *shape_fixed;
GtkPreview *shape_preview;
@ -295,7 +295,7 @@ parse_disposal_tag (char *str)
static void
reshape_from_bitmap(guchar* bitmap)
reshape_from_bitmap(gchar* bitmap)
{
GdkBitmap *shape_mask;

View File

@ -172,7 +172,7 @@ static void run(char *name, int nparams, GParam *param,
static gint32 load_image(char *file, char *brief) {
FILE* fp; /* Read file pointer */
char *progress; /* Title for progress display */
guchar header[32]; /* File header */
gchar header[32]; /* File header */
int height, width, /* Dimensions of image */
colours; /* Number of colours */
@ -306,7 +306,7 @@ static gint32 load_image(char *file, char *brief) {
}
static gint load_palette(FILE *fp, guchar palette[]) {
guchar header[32]; /* File header */
gchar header[32]; /* File header */
guchar buffer[2];
int i, bpp, colours= 0;
@ -342,7 +342,7 @@ static gint load_palette(FILE *fp, guchar palette[]) {
static gint save_image(char *file, char *brief, gint32 image, gint32 layer) {
FILE* fp; /* Write file pointer */
char *progress; /* Title for progress display */
guchar header[32]; /* File header */
gchar header[32]; /* File header */
gint colours, type; /* Number of colours, type of layer */
guchar *buffer, /* Temporary buffer */

View File

@ -162,7 +162,7 @@ gint ncolours;
/* for shaping */
guchar *shape_preview_mask;
gchar *shape_preview_mask;
GtkWidget *shape_window;
GtkWidget *shape_fixed;
GtkPreview *shape_preview;
@ -295,7 +295,7 @@ parse_disposal_tag (char *str)
static void
reshape_from_bitmap(guchar* bitmap)
reshape_from_bitmap(gchar* bitmap)
{
GdkBitmap *shape_mask;

View File

@ -43,6 +43,17 @@
* Revision History:
*
* $Log$
* Revision 1.12 1998/04/28 03:50:16 yosh
* * plug-ins/animationplay/animationplay.c
* * plug-ins/CEL/CEL.c
* * plug-ins/psd/psd.c
* * plug-ins/xd/xd.c: applied gimp-joke-980427-0, warning cleanups
*
* * app/temp_buf.c: applied gimp-entity-980427-0, temp_buf swap speedups and
* more robust tempfile handling
*
* -Yosh
*
* Revision 1.11 1998/04/27 22:00:59 neo
* Updated sharpen and despeckle. Wow, sharpen is balzingly fast now, while
* despeckle is still sort of lame...
@ -139,14 +150,6 @@
#include <libgimp/gimpui.h>
/*
* Macros...
*/
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
/*
* Constants...
*/
@ -704,8 +707,9 @@ despeckle_dialog(void)
gtk_rc_parse(gimp_gtkrc());
gdk_set_use_xshm(gimp_use_xshm());
signal(SIGBUS, SIG_DFL);
signal(SIGSEGV, SIG_DFL);
/* signal(SIGBUS, SIG_DFL);
signal(SIGSEGV, SIG_DFL); */
gtk_preview_set_gamma(gimp_gamma());
gtk_preview_set_install_cmap(gimp_install_cmap());
color_cube = gimp_color_cube();
@ -1165,12 +1169,6 @@ preview_update(void)
static void
preview_exit(void)
{
int row, /* Looping var */
size; /* Size of row buffer */
size = MAX_RADIUS * 2 + 1;
g_free(preview_src);
g_free(preview_dst);
g_free(preview_sort);

View File

@ -172,7 +172,7 @@ typedef struct PsdLayer
gboolean protecttrans;
gboolean visible;
guchar* name;
gchar* name;
gint32 lm_x;
gint32 lm_y;
@ -211,7 +211,7 @@ static PSDimage psd_image;
static struct {
guchar signature[4];
gchar signature[4];
gushort version;
guchar reserved[6];
gushort channels;
@ -247,9 +247,9 @@ static const gchar *prog_name = "PSD";
static void unpack_pb_channel(FILE *fd, guchar *dst, gint32 unpackedlen,
guint32 *offset);
static void decode(long clen, long uclen, gchar *src, gchar *dst, int step);
static void decode(long clen, long uclen, gchar *src, guchar *dst, int step);
static void packbitsdecode(long *clenp, long uclen,
gchar *src, gchar *dst, int step);
gchar *src, guchar *dst, int step);
static void cmyk2rgb(guchar *src, guchar *destp,
long width, long height, int alpha);
static void cmykp2rgb(guchar *src, guchar *destp,
@ -262,9 +262,9 @@ static void xfread(FILE *fd, void *buf, long len, gchar *why);
static void *xmalloc(size_t n);
static void read_whole_file(FILE *fd);
static void reshuffle_cmap(guchar *map256);
static guchar *getpascalstring(FILE *fd, guchar *why);
void throwchunk(size_t n, FILE * fd, guchar *why);
void dumpchunk(size_t n, FILE * fd, guchar *why);
static gchar *getpascalstring(FILE *fd, gchar *why);
void throwchunk(size_t n, FILE * fd, gchar *why);
void dumpchunk(size_t n, FILE * fd, gchar *why);
MAIN()
@ -1382,9 +1382,11 @@ load_image(char *name)
{
FILE *fd;
gboolean want_aux;
char *name_buf, *cmykbuf;
char *name_buf;
unsigned char *cmykbuf;
static int number = 1;
unsigned char *dest, *temp;
char *temp;
guchar *dest;
long channels, nguchars;
psd_imagetype imagetype;
int cmyk = 0, step = 1;
@ -1864,7 +1866,7 @@ load_image(char *name)
static void
decode(long clen, long uclen, char * src, char * dst, int step)
decode(long clen, long uclen, char * src, guchar * dst, int step)
{
gint i, j;
gint32 l;
@ -1893,7 +1895,7 @@ decode(long clen, long uclen, char * src, char * dst, int step)
* Decode a PackBits data stream.
*/
static void
packbitsdecode(long * clenp, long uclen, char * src, char * dst, int step)
packbitsdecode(long * clenp, long uclen, char * src, guchar * dst, int step)
{
gint n, b;
gint32 clen = *clenp;
@ -2023,7 +2025,7 @@ cmykp2rgb(unsigned char * src, unsigned char * dst,
int r, g, b, k;
int i, j;
long n;
char *rp, *gp, *bp, *kp, *ap;
guchar *rp, *gp, *bp, *kp, *ap;
n = width * height;
rp = src;
@ -2081,7 +2083,7 @@ cmyk_to_rgb(gint *c, gint *m, gint *y, gint *k)
void
dumpchunk(size_t n, FILE * fd, guchar *why)
dumpchunk(size_t n, FILE * fd, gchar *why)
{
guint32 i;
@ -2097,9 +2099,9 @@ dumpchunk(size_t n, FILE * fd, guchar *why)
void
throwchunk(size_t n, FILE * fd, guchar *why)
throwchunk(size_t n, FILE * fd, gchar *why)
{
guchar *tmpchunk;
gchar *tmpchunk;
if (n==0)
{
@ -2125,10 +2127,10 @@ getchunk(size_t n, FILE * fd, char *why)
#endif
static guchar *
getpascalstring(FILE *fd, guchar *why)
static gchar *
getpascalstring(FILE *fd, gchar *why)
{
guchar *tmpchunk;
gchar *tmpchunk;
guchar len;
xfread(fd, &len, 1, why);

View File

@ -44,6 +44,17 @@
* Revision History:
*
* $Log$
* Revision 1.6 1998/04/28 03:50:19 yosh
* * plug-ins/animationplay/animationplay.c
* * plug-ins/CEL/CEL.c
* * plug-ins/psd/psd.c
* * plug-ins/xd/xd.c: applied gimp-joke-980427-0, warning cleanups
*
* * app/temp_buf.c: applied gimp-entity-980427-0, temp_buf swap speedups and
* more robust tempfile handling
*
* -Yosh
*
* Revision 1.5 1998/04/27 22:01:01 neo
* Updated sharpen and despeckle. Wow, sharpen is balzingly fast now, while
* despeckle is still sort of lame...
@ -331,8 +342,8 @@ run(char *name, /* I - Name of filter program. */
default :
status = STATUS_CALLING_ERROR;
break;;
};
break;
}
/*
* Sharpen the image...
@ -372,7 +383,7 @@ run(char *name, /* I - Name of filter program. */
}
else
status = STATUS_EXECUTION_ERROR;
};
}
/*
* Reset the current run status...
@ -403,7 +414,7 @@ compute_luts(void)
{
pos_lut[i] = 100 * i / fact;
neg_lut[i] = sharpen_percent * i / 8 / fact;
};
}
}
@ -452,7 +463,7 @@ sharpen(void)
{
src_rows[row] = g_malloc(width * sizeof(guchar));
neg_rows[row] = g_malloc(width * sizeof(guchar));
};
}
dst_row = g_malloc(width * sizeof(guchar));
@ -487,7 +498,7 @@ sharpen(void)
case 4 :
filter = rgba_filter;
break;
};
}
/*
* Sharpen...
@ -528,7 +539,7 @@ sharpen(void)
*/
count --;
};
}
/*
* Now sharpen pixels and save the results...
@ -546,11 +557,11 @@ sharpen(void)
*/
gimp_pixel_rgn_set_row(&dst_rgn, dst_row, sel_x1, y, sel_width);
};
}
if ((y & 15) == 0)
gimp_progress_update((double)(y - sel_y1) / (double)sel_height);
};
}
/*
* OK, we're done. Free all memory used...
@ -560,7 +571,7 @@ sharpen(void)
{
g_free(src_rows[row]);
g_free(neg_rows[row]);
};
}
g_free(dst_row);
@ -841,7 +852,7 @@ preview_update(void)
case 4 :
filter = rgba_filter;
break;
};
}
/*
* Sharpen...
@ -896,7 +907,7 @@ preview_update(void)
else
image_ptr[0] = image_ptr[1] = image_ptr[2] =
check + ((dst_ptr[0] - check) * dst_ptr[1]) / 255;
};
}
break;
case 3 :
@ -931,10 +942,10 @@ preview_update(void)
image_ptr[0] = check + ((dst_ptr[0] - check) * dst_ptr[3]) / 255;
image_ptr[1] = check + ((dst_ptr[1] - check) * dst_ptr[3]) / 255;
image_ptr[2] = check + ((dst_ptr[2] - check) * dst_ptr[3]) / 255;
};
};
}
}
break;
};
}
/*
* Draw the preview image on the screen...
@ -958,9 +969,6 @@ preview_update(void)
static void
preview_exit(void)
{
int row; /* Looping var */
g_free(preview_src);
g_free(preview_neg);
g_free(preview_dst);
@ -1057,7 +1065,7 @@ dialog_iscale_update(GtkAdjustment *adjustment, /* I - New value */
compute_luts();
preview_update();
};
}
}
@ -1090,8 +1098,8 @@ dialog_ientry_update(GtkWidget *widget, /* I - Entry widget */
compute_luts();
preview_update();
};
};
}
}
}
@ -1166,7 +1174,7 @@ gray_filter(int width, /* I - Width of line in pixels */
neg1 ++;
neg2 ++;
width --;
};
}
*dst++ = *src++;
}
@ -1208,7 +1216,7 @@ graya_filter(int width, /* I - Width of line in pixels */
neg1 += 2;
neg2 += 2;
width --;
};
}
*dst++ = *src++;
*dst++ = *src++;
@ -1271,7 +1279,7 @@ rgb_filter(int width, /* I - Width of line in pixels */
neg1 += 3;
neg2 += 3;
width --;
};
}
*dst++ = *src++;
*dst++ = *src++;
@ -1338,7 +1346,7 @@ rgba_filter(int width, /* I - Width of line in pixels */
neg1 += 4;
neg2 += 4;
width --;
};
}
*dst++ = *src++;
*dst++ = *src++;

View File

@ -43,6 +43,17 @@
* Revision History:
*
* $Log$
* Revision 1.12 1998/04/28 03:50:16 yosh
* * plug-ins/animationplay/animationplay.c
* * plug-ins/CEL/CEL.c
* * plug-ins/psd/psd.c
* * plug-ins/xd/xd.c: applied gimp-joke-980427-0, warning cleanups
*
* * app/temp_buf.c: applied gimp-entity-980427-0, temp_buf swap speedups and
* more robust tempfile handling
*
* -Yosh
*
* Revision 1.11 1998/04/27 22:00:59 neo
* Updated sharpen and despeckle. Wow, sharpen is balzingly fast now, while
* despeckle is still sort of lame...
@ -139,14 +150,6 @@
#include <libgimp/gimpui.h>
/*
* Macros...
*/
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
/*
* Constants...
*/
@ -704,8 +707,9 @@ despeckle_dialog(void)
gtk_rc_parse(gimp_gtkrc());
gdk_set_use_xshm(gimp_use_xshm());
signal(SIGBUS, SIG_DFL);
signal(SIGSEGV, SIG_DFL);
/* signal(SIGBUS, SIG_DFL);
signal(SIGSEGV, SIG_DFL); */
gtk_preview_set_gamma(gimp_gamma());
gtk_preview_set_install_cmap(gimp_install_cmap());
color_cube = gimp_color_cube();
@ -1165,12 +1169,6 @@ preview_update(void)
static void
preview_exit(void)
{
int row, /* Looping var */
size; /* Size of row buffer */
size = MAX_RADIUS * 2 + 1;
g_free(preview_src);
g_free(preview_dst);
g_free(preview_sort);

View File

@ -172,7 +172,7 @@ typedef struct PsdLayer
gboolean protecttrans;
gboolean visible;
guchar* name;
gchar* name;
gint32 lm_x;
gint32 lm_y;
@ -211,7 +211,7 @@ static PSDimage psd_image;
static struct {
guchar signature[4];
gchar signature[4];
gushort version;
guchar reserved[6];
gushort channels;
@ -247,9 +247,9 @@ static const gchar *prog_name = "PSD";
static void unpack_pb_channel(FILE *fd, guchar *dst, gint32 unpackedlen,
guint32 *offset);
static void decode(long clen, long uclen, gchar *src, gchar *dst, int step);
static void decode(long clen, long uclen, gchar *src, guchar *dst, int step);
static void packbitsdecode(long *clenp, long uclen,
gchar *src, gchar *dst, int step);
gchar *src, guchar *dst, int step);
static void cmyk2rgb(guchar *src, guchar *destp,
long width, long height, int alpha);
static void cmykp2rgb(guchar *src, guchar *destp,
@ -262,9 +262,9 @@ static void xfread(FILE *fd, void *buf, long len, gchar *why);
static void *xmalloc(size_t n);
static void read_whole_file(FILE *fd);
static void reshuffle_cmap(guchar *map256);
static guchar *getpascalstring(FILE *fd, guchar *why);
void throwchunk(size_t n, FILE * fd, guchar *why);
void dumpchunk(size_t n, FILE * fd, guchar *why);
static gchar *getpascalstring(FILE *fd, gchar *why);
void throwchunk(size_t n, FILE * fd, gchar *why);
void dumpchunk(size_t n, FILE * fd, gchar *why);
MAIN()
@ -1382,9 +1382,11 @@ load_image(char *name)
{
FILE *fd;
gboolean want_aux;
char *name_buf, *cmykbuf;
char *name_buf;
unsigned char *cmykbuf;
static int number = 1;
unsigned char *dest, *temp;
char *temp;
guchar *dest;
long channels, nguchars;
psd_imagetype imagetype;
int cmyk = 0, step = 1;
@ -1864,7 +1866,7 @@ load_image(char *name)
static void
decode(long clen, long uclen, char * src, char * dst, int step)
decode(long clen, long uclen, char * src, guchar * dst, int step)
{
gint i, j;
gint32 l;
@ -1893,7 +1895,7 @@ decode(long clen, long uclen, char * src, char * dst, int step)
* Decode a PackBits data stream.
*/
static void
packbitsdecode(long * clenp, long uclen, char * src, char * dst, int step)
packbitsdecode(long * clenp, long uclen, char * src, guchar * dst, int step)
{
gint n, b;
gint32 clen = *clenp;
@ -2023,7 +2025,7 @@ cmykp2rgb(unsigned char * src, unsigned char * dst,
int r, g, b, k;
int i, j;
long n;
char *rp, *gp, *bp, *kp, *ap;
guchar *rp, *gp, *bp, *kp, *ap;
n = width * height;
rp = src;
@ -2081,7 +2083,7 @@ cmyk_to_rgb(gint *c, gint *m, gint *y, gint *k)
void
dumpchunk(size_t n, FILE * fd, guchar *why)
dumpchunk(size_t n, FILE * fd, gchar *why)
{
guint32 i;
@ -2097,9 +2099,9 @@ dumpchunk(size_t n, FILE * fd, guchar *why)
void
throwchunk(size_t n, FILE * fd, guchar *why)
throwchunk(size_t n, FILE * fd, gchar *why)
{
guchar *tmpchunk;
gchar *tmpchunk;
if (n==0)
{
@ -2125,10 +2127,10 @@ getchunk(size_t n, FILE * fd, char *why)
#endif
static guchar *
getpascalstring(FILE *fd, guchar *why)
static gchar *
getpascalstring(FILE *fd, gchar *why)
{
guchar *tmpchunk;
gchar *tmpchunk;
guchar len;
xfread(fd, &len, 1, why);

View File

@ -44,6 +44,17 @@
* Revision History:
*
* $Log$
* Revision 1.6 1998/04/28 03:50:19 yosh
* * plug-ins/animationplay/animationplay.c
* * plug-ins/CEL/CEL.c
* * plug-ins/psd/psd.c
* * plug-ins/xd/xd.c: applied gimp-joke-980427-0, warning cleanups
*
* * app/temp_buf.c: applied gimp-entity-980427-0, temp_buf swap speedups and
* more robust tempfile handling
*
* -Yosh
*
* Revision 1.5 1998/04/27 22:01:01 neo
* Updated sharpen and despeckle. Wow, sharpen is balzingly fast now, while
* despeckle is still sort of lame...
@ -331,8 +342,8 @@ run(char *name, /* I - Name of filter program. */
default :
status = STATUS_CALLING_ERROR;
break;;
};
break;
}
/*
* Sharpen the image...
@ -372,7 +383,7 @@ run(char *name, /* I - Name of filter program. */
}
else
status = STATUS_EXECUTION_ERROR;
};
}
/*
* Reset the current run status...
@ -403,7 +414,7 @@ compute_luts(void)
{
pos_lut[i] = 100 * i / fact;
neg_lut[i] = sharpen_percent * i / 8 / fact;
};
}
}
@ -452,7 +463,7 @@ sharpen(void)
{
src_rows[row] = g_malloc(width * sizeof(guchar));
neg_rows[row] = g_malloc(width * sizeof(guchar));
};
}
dst_row = g_malloc(width * sizeof(guchar));
@ -487,7 +498,7 @@ sharpen(void)
case 4 :
filter = rgba_filter;
break;
};
}
/*
* Sharpen...
@ -528,7 +539,7 @@ sharpen(void)
*/
count --;
};
}
/*
* Now sharpen pixels and save the results...
@ -546,11 +557,11 @@ sharpen(void)
*/
gimp_pixel_rgn_set_row(&dst_rgn, dst_row, sel_x1, y, sel_width);
};
}
if ((y & 15) == 0)
gimp_progress_update((double)(y - sel_y1) / (double)sel_height);
};
}
/*
* OK, we're done. Free all memory used...
@ -560,7 +571,7 @@ sharpen(void)
{
g_free(src_rows[row]);
g_free(neg_rows[row]);
};
}
g_free(dst_row);
@ -841,7 +852,7 @@ preview_update(void)
case 4 :
filter = rgba_filter;
break;
};
}
/*
* Sharpen...
@ -896,7 +907,7 @@ preview_update(void)
else
image_ptr[0] = image_ptr[1] = image_ptr[2] =
check + ((dst_ptr[0] - check) * dst_ptr[1]) / 255;
};
}
break;
case 3 :
@ -931,10 +942,10 @@ preview_update(void)
image_ptr[0] = check + ((dst_ptr[0] - check) * dst_ptr[3]) / 255;
image_ptr[1] = check + ((dst_ptr[1] - check) * dst_ptr[3]) / 255;
image_ptr[2] = check + ((dst_ptr[2] - check) * dst_ptr[3]) / 255;
};
};
}
}
break;
};
}
/*
* Draw the preview image on the screen...
@ -958,9 +969,6 @@ preview_update(void)
static void
preview_exit(void)
{
int row; /* Looping var */
g_free(preview_src);
g_free(preview_neg);
g_free(preview_dst);
@ -1057,7 +1065,7 @@ dialog_iscale_update(GtkAdjustment *adjustment, /* I - New value */
compute_luts();
preview_update();
};
}
}
@ -1090,8 +1098,8 @@ dialog_ientry_update(GtkWidget *widget, /* I - Entry widget */
compute_luts();
preview_update();
};
};
}
}
}
@ -1166,7 +1174,7 @@ gray_filter(int width, /* I - Width of line in pixels */
neg1 ++;
neg2 ++;
width --;
};
}
*dst++ = *src++;
}
@ -1208,7 +1216,7 @@ graya_filter(int width, /* I - Width of line in pixels */
neg1 += 2;
neg2 += 2;
width --;
};
}
*dst++ = *src++;
*dst++ = *src++;
@ -1271,7 +1279,7 @@ rgb_filter(int width, /* I - Width of line in pixels */
neg1 += 3;
neg2 += 3;
width --;
};
}
*dst++ = *src++;
*dst++ = *src++;
@ -1338,7 +1346,7 @@ rgba_filter(int width, /* I - Width of line in pixels */
neg1 += 4;
neg2 += 4;
width --;
};
}
*dst++ = *src++;
*dst++ = *src++;

View File

@ -68,7 +68,7 @@ GPlugInInfo PLUG_IN_INFO =
run, /* run_proc */
};
MAIN ();
MAIN ()
static void
query ()
@ -510,7 +510,7 @@ get_buffer (XdFile* xd, gchar* ext, gint ver)
sprintf (req, "xdelta-xpm-%d-%d", PREVIEW_MAX_DIM, ver);
key.dptr = req;
key.dptr = (guchar*)req;
key.dsize = strlen (req);
dat = gdbm_fetch (xd->dbf, key);