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:
@ -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>
|
2004-07-25 Shlomi Fish <shlomif@iglu.org.il>
|
||||||
|
|
||||||
* plug-ins/gimpressionist/: fixed bug #148088: ("Gimpressioinst crashes if
|
* plug-ins/gimpressionist/: fixed bug #148088: ("Gimpressioinst crashes if
|
||||||
|
@ -120,8 +120,7 @@ brushdmenuselect (GtkWidget *widget,
|
|||||||
has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
|
has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
|
||||||
alpha = (has_alpha) ? bpp - 1 : bpp;
|
alpha = (has_alpha) ? bpp - 1 : bpp;
|
||||||
|
|
||||||
if(brushppm.col)
|
ppm_kill (&brushppm);
|
||||||
ppm_kill (&brushppm);
|
|
||||||
ppm_new (&brushppm, x2-x1, y2-y1);
|
ppm_new (&brushppm, x2-x1, y2-y1);
|
||||||
p = &brushppm;
|
p = &brushppm;
|
||||||
|
|
||||||
@ -169,8 +168,7 @@ brushdmenuselect (GtkWidget *widget,
|
|||||||
#if 0
|
#if 0
|
||||||
void dummybrushdmenuselect(GtkWidget *w, gpointer data)
|
void dummybrushdmenuselect(GtkWidget *w, gpointer data)
|
||||||
{
|
{
|
||||||
if(brushppm.col)
|
ppm_kill (&brushppm);
|
||||||
ppm_kill (&brushppm);
|
|
||||||
ppm_new (&brushppm, 10,10);
|
ppm_new (&brushppm, 10,10);
|
||||||
brush_from_file = 0;
|
brush_from_file = 0;
|
||||||
update_brush_preview (NULL);
|
update_brush_preview (NULL);
|
||||||
@ -210,7 +208,7 @@ savebrush (GtkWidget *wg,
|
|||||||
GList *thispath = parsepath ();
|
GList *thispath = parsepath ();
|
||||||
gchar *path;
|
gchar *path;
|
||||||
|
|
||||||
if (! brushppm.col)
|
if (! PPM_IS_INITED (&brushppm))
|
||||||
{
|
{
|
||||||
g_message( _("Can only save drawables!"));
|
g_message( _("Can only save drawables!"));
|
||||||
return;
|
return;
|
||||||
@ -314,7 +312,7 @@ update_brush_preview (const gchar *fn)
|
|||||||
|
|
||||||
if (brush_from_file)
|
if (brush_from_file)
|
||||||
brush_reload (fn, &p);
|
brush_reload (fn, &p);
|
||||||
else if (brushppm.col)
|
else if (PPM_IS_INITED (&brushppm))
|
||||||
ppm_copy (&brushppm, &p);
|
ppm_copy (&brushppm, &p);
|
||||||
|
|
||||||
set_colorbrushes (fn);
|
set_colorbrushes (fn);
|
||||||
|
@ -40,7 +40,7 @@ static ppm_t inalpha = {0,0,NULL};
|
|||||||
|
|
||||||
void infile_copy_to_ppm(ppm_t * p)
|
void infile_copy_to_ppm(ppm_t * p)
|
||||||
{
|
{
|
||||||
if(!infile.col)
|
if (!PPM_IS_INITED (&infile))
|
||||||
grabarea();
|
grabarea();
|
||||||
#if 0
|
#if 0
|
||||||
updatepreview (NULL, (void *)2); /* Force grabarea() */
|
updatepreview (NULL, (void *)2); /* Force grabarea() */
|
||||||
@ -311,7 +311,7 @@ static void gimpressionist_main(void)
|
|||||||
|
|
||||||
gimp_progress_init (_("Painting..."));
|
gimp_progress_init (_("Painting..."));
|
||||||
|
|
||||||
if(!infile.col) {
|
if (!PPM_IS_INITED (&infile)) {
|
||||||
grabarea();
|
grabarea();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,9 +132,9 @@ static void update_orient_map_preview_prev (void)
|
|||||||
guchar gray[3] = {120,120,120};
|
guchar gray[3] = {120,120,120};
|
||||||
guchar white[3] = {255,255,255};
|
guchar white[3] = {255,255,255};
|
||||||
|
|
||||||
if (!nbuffer.col) {
|
if (!PPM_IS_INITED (&nbuffer))
|
||||||
ppm_new (&nbuffer,OMWIDTH,OMHEIGHT);
|
ppm_new (&nbuffer,OMWIDTH,OMHEIGHT);
|
||||||
}
|
|
||||||
fill (&nbuffer, black);
|
fill (&nbuffer, black);
|
||||||
|
|
||||||
for (y = 6; y < OMHEIGHT-4; y += 10)
|
for (y = 6; y < OMHEIGHT-4; y += 10)
|
||||||
|
@ -217,7 +217,7 @@ void load_gimp_brush(const gchar *fn, ppm_t *p)
|
|||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
f = fopen_from_search_path(fn, "rb");
|
f = fopen_from_search_path(fn, "rb");
|
||||||
if(p->col) ppm_kill(p);
|
ppm_kill(p);
|
||||||
|
|
||||||
if(!f) {
|
if(!f) {
|
||||||
fprintf(stderr, "load_gimp_brush: Unable to open file \"%s\"!\n", fn);
|
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");
|
f = fopen_from_search_path(fn, "rb");
|
||||||
|
|
||||||
if(p->col) ppm_kill(p);
|
ppm_kill(p);
|
||||||
|
|
||||||
if(!f) {
|
if(!f) {
|
||||||
fprintf(stderr, "ppm_load: Unable to open file \"%s\"!\n", fn);
|
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)
|
void ppm_copy(ppm_t *s, ppm_t *p)
|
||||||
{
|
{
|
||||||
if(p->col)
|
ppm_kill(p);
|
||||||
ppm_kill(p);
|
|
||||||
p->width = s->width;
|
p->width = s->width;
|
||||||
p->height = s->height;
|
p->height = s->height;
|
||||||
p->col = g_memdup(s->col, p->width * 3 * p->height);
|
p->col = g_memdup(s->col, p->width * 3 * p->height);
|
||||||
|
@ -37,5 +37,7 @@ void blur(ppm_t *p, int xrad, int yrad);
|
|||||||
|
|
||||||
void mkgrayplasma(ppm_t *p, float turb);
|
void mkgrayplasma(ppm_t *p, float turb);
|
||||||
|
|
||||||
|
#define PPM_IS_INITED(ppm_ptr) ((ppm_ptr)->col != NULL)
|
||||||
|
|
||||||
#endif /* #ifndef __PPM_TOOL_H */
|
#endif /* #ifndef __PPM_TOOL_H */
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ updatepreview (GtkWidget *wg, gpointer d)
|
|||||||
#if 0
|
#if 0
|
||||||
guchar buf[PREVIEWSIZE*3];
|
guchar buf[PREVIEWSIZE*3];
|
||||||
|
|
||||||
if(!infile.col && d)
|
if (!PPM_IS_INITED (&infile) && d)
|
||||||
grabarea();
|
grabarea();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ updatepreview (GtkWidget *wg, gpointer d)
|
|||||||
* -- Shlomi Fish
|
* -- Shlomi Fish
|
||||||
* */
|
* */
|
||||||
#if 0
|
#if 0
|
||||||
if(!infile.col && !d) {
|
if (!PPM_IS_INITED (&infile) && !d) {
|
||||||
|
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
for(i = 0; i < PREVIEWSIZE; i++)
|
for(i = 0; i < PREVIEWSIZE; i++)
|
||||||
@ -98,7 +98,7 @@ updatepreview (GtkWidget *wg, gpointer d)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(!backup_ppm.col)
|
if (!PPM_IS_INITED (&backup_ppm))
|
||||||
{
|
{
|
||||||
infile_copy_to_ppm (&backup_ppm);
|
infile_copy_to_ppm (&backup_ppm);
|
||||||
if((backup_ppm.width != PREVIEWSIZE) || (backup_ppm.height != PREVIEWSIZE))
|
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);
|
resize_fast(&alpha_backup_ppm, PREVIEWSIZE, PREVIEWSIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!preview_ppm.col)
|
if (!PPM_IS_INITED (&preview_ppm))
|
||||||
{
|
{
|
||||||
ppm_copy(&backup_ppm, &preview_ppm);
|
ppm_copy(&backup_ppm, &preview_ppm);
|
||||||
if(img_has_alpha)
|
if(img_has_alpha)
|
||||||
|
@ -859,7 +859,7 @@ void repaint(ppm_t *p, ppm_t *a)
|
|||||||
if(relief > 0.001) {
|
if(relief > 0.001) {
|
||||||
scale = runningvals.paperscale / 100.0;
|
scale = runningvals.paperscale / 100.0;
|
||||||
|
|
||||||
if(paper_ppm.col) {
|
if (PPM_IS_INITED (&paper_ppm)) {
|
||||||
tmp = paper_ppm;
|
tmp = paper_ppm;
|
||||||
paper_ppm.col = NULL;
|
paper_ppm.col = NULL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -59,7 +59,7 @@ static void updatesmpreviewprev(void)
|
|||||||
guchar black[3] = {0,0,0};
|
guchar black[3] = {0,0,0};
|
||||||
guchar gray[3] = {120,120,120};
|
guchar gray[3] = {120,120,120};
|
||||||
|
|
||||||
if (!nsbuffer.col)
|
if (! PPM_IS_INITED (&nsbuffer))
|
||||||
{
|
{
|
||||||
ppm_new(&nsbuffer,OMWIDTH,OMHEIGHT);
|
ppm_new(&nsbuffer,OMWIDTH,OMHEIGHT);
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ static void updatesmvectorprev(void)
|
|||||||
if(!ok || (val != last_val))
|
if(!ok || (val != last_val))
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
if(!infile.col)
|
if (!PPM_IS_INITED (&infile))
|
||||||
updatepreview (NULL, (void *)2); /* Force grabarea() */
|
updatepreview (NULL, (void *)2); /* Force grabarea() */
|
||||||
ppm_copy(&infile, &backup);
|
ppm_copy(&infile, &backup);
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user