converted checks for initialization of ppm's done by checking the "col"

* plug-ins/gimpressionist/: converted checks for initialization of
ppm's done by checking the "col" buffer, to macro calls.
This commit is contained in:
Shlomi Fish
2004-07-25 18:12:49 +00:00
parent 5559b6223e
commit 95cf883274
9 changed files with 25 additions and 21 deletions

View File

@ -1,3 +1,8 @@
2004-07-25 Shlomi Fish <shlomif@iglu.org.il>
* plug-ins/gimpressionist/: converted checks for initialization of
ppm's done by checking the "col" buffer, to macro calls.
2004-07-25 Shlomi Fish <shlomif@iglu.org.il>
* plug-ins/gimpressionist/: fixed bug #148088: ("Gimpressioinst crashes if

View File

@ -120,8 +120,7 @@ brushdmenuselect (GtkWidget *widget,
has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
alpha = (has_alpha) ? bpp - 1 : bpp;
if(brushppm.col)
ppm_kill (&brushppm);
ppm_kill (&brushppm);
ppm_new (&brushppm, x2-x1, y2-y1);
p = &brushppm;
@ -169,8 +168,7 @@ brushdmenuselect (GtkWidget *widget,
#if 0
void dummybrushdmenuselect(GtkWidget *w, gpointer data)
{
if(brushppm.col)
ppm_kill (&brushppm);
ppm_kill (&brushppm);
ppm_new (&brushppm, 10,10);
brush_from_file = 0;
update_brush_preview (NULL);
@ -210,7 +208,7 @@ savebrush (GtkWidget *wg,
GList *thispath = parsepath ();
gchar *path;
if (! brushppm.col)
if (! PPM_IS_INITED (&brushppm))
{
g_message( _("Can only save drawables!"));
return;
@ -314,7 +312,7 @@ update_brush_preview (const gchar *fn)
if (brush_from_file)
brush_reload (fn, &p);
else if (brushppm.col)
else if (PPM_IS_INITED (&brushppm))
ppm_copy (&brushppm, &p);
set_colorbrushes (fn);

View File

@ -40,7 +40,7 @@ static ppm_t inalpha = {0,0,NULL};
void infile_copy_to_ppm(ppm_t * p)
{
if(!infile.col)
if (!PPM_IS_INITED (&infile))
grabarea();
#if 0
updatepreview (NULL, (void *)2); /* Force grabarea() */
@ -311,7 +311,7 @@ static void gimpressionist_main(void)
gimp_progress_init (_("Painting..."));
if(!infile.col) {
if (!PPM_IS_INITED (&infile)) {
grabarea();
}

View File

@ -132,9 +132,9 @@ static void update_orient_map_preview_prev (void)
guchar gray[3] = {120,120,120};
guchar white[3] = {255,255,255};
if (!nbuffer.col) {
if (!PPM_IS_INITED (&nbuffer))
ppm_new (&nbuffer,OMWIDTH,OMHEIGHT);
}
fill (&nbuffer, black);
for (y = 6; y < OMHEIGHT-4; y += 10)

View File

@ -217,7 +217,7 @@ void load_gimp_brush(const gchar *fn, ppm_t *p)
int x, y;
f = fopen_from_search_path(fn, "rb");
if(p->col) ppm_kill(p);
ppm_kill(p);
if(!f) {
fprintf(stderr, "load_gimp_brush: Unable to open file \"%s\"!\n", fn);
@ -258,7 +258,7 @@ void ppm_load(const char *fn, ppm_t *p)
f = fopen_from_search_path(fn, "rb");
if(p->col) ppm_kill(p);
ppm_kill(p);
if(!f) {
fprintf(stderr, "ppm_load: Unable to open file \"%s\"!\n", fn);
@ -323,8 +323,7 @@ void fill(ppm_t *p, guchar *c)
void ppm_copy(ppm_t *s, ppm_t *p)
{
if(p->col)
ppm_kill(p);
ppm_kill(p);
p->width = s->width;
p->height = s->height;
p->col = g_memdup(s->col, p->width * 3 * p->height);

View File

@ -37,5 +37,7 @@ void blur(ppm_t *p, int xrad, int yrad);
void mkgrayplasma(ppm_t *p, float turb);
#define PPM_IS_INITED(ppm_ptr) ((ppm_ptr)->col != NULL)
#endif /* #ifndef __PPM_TOOL_H */

View File

@ -77,7 +77,7 @@ updatepreview (GtkWidget *wg, gpointer d)
#if 0
guchar buf[PREVIEWSIZE*3];
if(!infile.col && d)
if (!PPM_IS_INITED (&infile) && d)
grabarea();
#endif
@ -87,7 +87,7 @@ updatepreview (GtkWidget *wg, gpointer d)
* -- Shlomi Fish
* */
#if 0
if(!infile.col && !d) {
if (!PPM_IS_INITED (&infile) && !d) {
memset(buf, 0, sizeof(buf));
for(i = 0; i < PREVIEWSIZE; i++)
@ -98,7 +98,7 @@ updatepreview (GtkWidget *wg, gpointer d)
else
#endif
{
if(!backup_ppm.col)
if (!PPM_IS_INITED (&backup_ppm))
{
infile_copy_to_ppm (&backup_ppm);
if((backup_ppm.width != PREVIEWSIZE) || (backup_ppm.height != PREVIEWSIZE))
@ -110,7 +110,7 @@ updatepreview (GtkWidget *wg, gpointer d)
resize_fast(&alpha_backup_ppm, PREVIEWSIZE, PREVIEWSIZE);
}
}
if(!preview_ppm.col)
if (!PPM_IS_INITED (&preview_ppm))
{
ppm_copy(&backup_ppm, &preview_ppm);
if(img_has_alpha)

View File

@ -859,7 +859,7 @@ void repaint(ppm_t *p, ppm_t *a)
if(relief > 0.001) {
scale = runningvals.paperscale / 100.0;
if(paper_ppm.col) {
if (PPM_IS_INITED (&paper_ppm)) {
tmp = paper_ppm;
paper_ppm.col = NULL;
} else {

View File

@ -59,7 +59,7 @@ static void updatesmpreviewprev(void)
guchar black[3] = {0,0,0};
guchar gray[3] = {120,120,120};
if (!nsbuffer.col)
if (! PPM_IS_INITED (&nsbuffer))
{
ppm_new(&nsbuffer,OMWIDTH,OMHEIGHT);
}
@ -108,7 +108,7 @@ static void updatesmvectorprev(void)
if(!ok || (val != last_val))
{
#if 0
if(!infile.col)
if (!PPM_IS_INITED (&infile))
updatepreview (NULL, (void *)2); /* Force grabarea() */
ppm_copy(&infile, &backup);
#else