plug-ins: cleanup in the recently GEGL-ported plug-ins

Mostly formatting consistency paranoia.
This commit is contained in:
Michael Natterer 2012-11-27 20:58:05 +01:00
parent e61b1f7603
commit 67dda14e77
15 changed files with 62 additions and 69 deletions

View File

@ -192,15 +192,14 @@ run (const gchar *name,
GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
INIT_I18N ();
gegl_init (NULL, NULL);
*nreturn_vals = 1;
*return_vals = values;
run_mode = param[0].data.d_int32;
INIT_I18N ();
gegl_init (NULL, NULL);
if (run_mode == GIMP_RUN_NONINTERACTIVE && n_params != 3)
{
status = GIMP_PDB_CALLING_ERROR;

View File

@ -96,7 +96,7 @@ query (void)
"Tim Newsome <nuisance@cmu.edu>",
"1997",
N_("ASCII art"),
"*",
"RGB*, GRAY*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
@ -144,29 +144,28 @@ run (const gchar *name,
GimpExportReturn export = GIMP_EXPORT_CANCEL;
INIT_I18N ();
gegl_init (NULL, NULL);
/* Set us up to return a status. */
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
run_mode = param[0].data.d_int32;
image_ID = param[1].data.d_int32;
drawable_ID = param[2].data.d_int32;
/* eventually export the image */
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY, FALSE);
export = gimp_export_image (&image_ID, &drawable_ID, NULL,
(GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA ));
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
if (export == GIMP_EXPORT_CANCEL)
{
values[0].data.d_status = GIMP_PDB_CANCEL;

View File

@ -151,7 +151,7 @@ query (void)
"Tim Newsome, Jens Lautenbacher, Sven Neumann",
"1997-2000",
N_("GIMP brush"),
"*",
"RGB*, GRAY*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
@ -221,8 +221,9 @@ run (const gchar *name,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY, FALSE);
export = gimp_export_image (&image_ID, &drawable_ID, NULL,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
if (export == GIMP_EXPORT_CANCEL)
{

View File

@ -196,15 +196,14 @@ run (const gchar *name,
GError *error = NULL;
gint i;
run_mode = param[0].data.d_int32;
INIT_I18N ();
gegl_init (NULL, NULL);
run_mode = param[0].data.d_int32;
*nreturn_vals = 1;
*return_vals = values;
gegl_init (NULL, NULL);
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;

View File

@ -188,7 +188,6 @@ run (const gchar *name,
gint32 image_ID;
INIT_I18N ();
gegl_init (NULL, NULL);
*nreturn_vals = 1;

View File

@ -196,12 +196,11 @@ run (const gchar *name,
GimpExportReturn export = GIMP_EXPORT_CANCEL;
GError *error = NULL;
run_mode = param[0].data.d_int32;
INIT_I18N ();
gegl_init (NULL, NULL);
run_mode = param[0].data.d_int32;
*nreturn_vals = 1;
*return_vals = values;

View File

@ -222,19 +222,17 @@ save_image (const gchar *filename,
GeglBuffer *buffer,
GError **error)
{
const Babl *format = babl_format ("R'G'B'A u8");
gint row, col, cols, rows, x, y;
gint colcount, colspan, rowspan;
gint *palloc;
guchar *buf, *buf2;
gchar *width, *height;
FILE *fp;
const Babl *format = babl_format ("R'G'B'A u8");
gint row, col, cols, rows, x, y;
gint colcount, colspan, rowspan;
gint *palloc;
guchar *buf, *buf2;
gchar *width, *height;
FILE *fp;
cols = gegl_buffer_get_width (buffer);
rows = gegl_buffer_get_height (buffer);
palloc = g_new (int, rows * cols);
fp = g_fopen (filename, "w");
if (! fp)
@ -242,10 +240,11 @@ save_image (const gchar *filename,
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));
g_free (palloc);
return FALSE;
}
palloc = g_new (int, rows * cols);
if (gtmvals.fulldoc)
{
fprintf (fp, "<HTML>\n<HEAD><TITLE>%s</TITLE></HEAD>\n<BODY>\n",

View File

@ -407,12 +407,11 @@ run (const gchar *name,
GError *error = NULL;
INIT_I18N ();
gegl_init (NULL, NULL);
*nreturn_vals = 1;
*return_vals = values;
gegl_init (NULL, NULL);
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;

View File

@ -110,7 +110,7 @@ static void run (const gchar *name,
static gboolean load_dialog (TIFF *tif,
TiffSelectedPages *pages);
static gint32 load_image (const gchar *filename,
TIFF *tif,
TiffSelectedPages *pages,
@ -210,15 +210,14 @@ run (const gchar *name,
gint32 image;
TiffSelectedPages pages;
run_mode = param[0].data.d_int32;
INIT_I18N ();
gegl_init (NULL, NULL);
run_mode = param[0].data.d_int32;
*nreturn_vals = 1;
*return_vals = values;
gegl_init (NULL, NULL);
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;

View File

@ -85,16 +85,15 @@ run (const gchar *name,
gint32 drawable_id;
gint x, y, width, height;
INIT_I18N();
gegl_init (NULL, NULL);
*nreturn_vals = 1;
*return_vals = values;
gegl_init (NULL, NULL);
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
INIT_I18N();
drawable_id = param[2].data.d_drawable;
if (gimp_drawable_mask_intersect (drawable_id, &x, &y, &width, &height))

View File

@ -288,23 +288,22 @@ run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals)
{
GimpRunMode run_mode = param[0].data.d_int32;
static GimpParam values[2];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
GdkScreen *screen = NULL;
gint32 image_ID;
static GimpParam values[2];
INIT_I18N ();
gegl_init (NULL, NULL);
/* initialize the return of the status */
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
run_mode = param[0].data.d_int32;
*nreturn_vals = 1;
*return_vals = values;
INIT_I18N ();
gegl_init (NULL, NULL);
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
/* how are we running today? */
switch (run_mode)

View File

@ -164,14 +164,14 @@ run (const gchar *name,
GimpExportReturn export = GIMP_EXPORT_CANCEL;
GError *error = NULL;
run_mode = param[0].data.d_int32;
INIT_I18N ();
gegl_init (NULL, NULL);
INIT_I18N ();
run_mode = param[0].data.d_int32;
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;

View File

@ -126,6 +126,7 @@ run (const gchar *name,
gint32 image_ID;
GError *error = NULL;
INIT_I18N ();
gegl_init (NULL, NULL);
*nreturn_vals = 1;
@ -136,8 +137,6 @@ run (const gchar *name,
if (strcmp (name, LOAD_PROC) == 0)
{
INIT_I18N ();
image_ID = load_image (param[1].data.d_string, &error);
if (image_ID != -1)

View File

@ -139,7 +139,7 @@ query (void)
"Copyright 1997-1998 by Michael Sweet",
PLUG_IN_VERSION,
N_("Silicon Graphics IRIS image"),
"*",
"RGB*, GRAY*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args),
0,
@ -165,17 +165,17 @@ run (const gchar *name,
GimpExportReturn export = GIMP_EXPORT_CANCEL;
GError *error = NULL;
INIT_I18N ();
gegl_init (NULL, NULL);
run_mode = param[0].data.d_int32;
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
INIT_I18N ();
gegl_init (NULL, NULL);
if (strcmp (name, LOAD_PROC) == 0)
{
image_ID = load_image (param[1].data.d_string, &error);
@ -203,10 +203,10 @@ run (const gchar *name,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY, FALSE);
export = gimp_export_image (&image_ID, &drawable_ID, NULL,
(GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA));
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
if (export == GIMP_EXPORT_CANCEL)
{
values[0].data.d_status = GIMP_PDB_CANCEL;
@ -546,20 +546,24 @@ save_image (const gchar *filename,
zsize = 1;
format = babl_format ("Y' u8");
break;
case GIMP_GRAYA_IMAGE:
zsize = 2;
format = babl_format ("Y'A u8");
break;
case GIMP_RGB_IMAGE:
case GIMP_INDEXED_IMAGE:
zsize = 3;
format = babl_format ("R'G'B' u8");
break;
case GIMP_RGBA_IMAGE:
case GIMP_INDEXEDA_IMAGE:
format = babl_format ("R'G'B'A u8");
zsize = 4;
break;
default:
return FALSE;
}

View File

@ -152,12 +152,11 @@ run (const gchar *name,
gint32 image_ID;
GError *error = NULL;
run_mode = param[0].data.d_int32;
INIT_I18N ();
gegl_init (NULL, NULL);
run_mode = param[0].data.d_int32;
*nreturn_vals = 1;
*return_vals = values;