mirror of https://github.com/GNOME/gimp.git
tools/pdbgen/pdb/progress.pdb applied slightly modified patch from
2006-02-20 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/progress.pdb * libgimp/gimpprogress.[ch]: applied slightly modified patch from Stephane Chauveau. Wraps the gimp_progress_update() PDB call so that redundant progress updates are suppressed in libgimp. This gives a noticeable speedup for all plug-ins that update the progress too often (bug #331470). * libgimp/gimpprogress_pdb.[ch]: regenerated.
This commit is contained in:
parent
ee34dfa57e
commit
37fdbeacad
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2006-02-20 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* tools/pdbgen/pdb/progress.pdb
|
||||
|
||||
* libgimp/gimpprogress.[ch]: applied slightly modified patch from
|
||||
Stephane Chauveau. Wraps the gimp_progress_update() PDB call so
|
||||
that redundant progress updates are suppressed in libgimp. This
|
||||
gives a noticeable speedup for all plug-ins that update the
|
||||
progress too often (bug #331470).
|
||||
|
||||
* libgimp/gimpprogress_pdb.[ch]: regenerated.
|
||||
|
||||
2006-02-20 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimp/gimpplugin.c (gimp_plugin_icon_register): added a cast to
|
||||
|
|
|
@ -51,7 +51,10 @@ static void gimp_temp_progress_run (const gchar *name,
|
|||
|
||||
/* private variables */
|
||||
|
||||
static GHashTable *gimp_progress_ht = NULL;
|
||||
static GHashTable * gimp_progress_ht = NULL;
|
||||
|
||||
static gdouble gimp_progress_current = 0.0;
|
||||
static const gdouble gimp_progress_step = (1.0 / 300.0);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
@ -214,6 +217,26 @@ gimp_progress_uninstall (const gchar *progress_callback)
|
|||
return user_data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_progress_init:
|
||||
* @message: Message to use in the progress dialog.
|
||||
*
|
||||
* Initializes the progress bar for the current plug-in.
|
||||
*
|
||||
* Initializes the progress bar for the current plug-in. It is only
|
||||
* valid to call this procedure from a plug-in.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*/
|
||||
gboolean
|
||||
gimp_progress_init (const gchar *message)
|
||||
{
|
||||
gimp_progress_current = 0.0;
|
||||
|
||||
return _gimp_progress_init (message);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_progress_init_printf:
|
||||
* @format: a standard printf() format string
|
||||
|
@ -285,6 +308,43 @@ gimp_progress_set_text_printf (const gchar *format,
|
|||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_progress_update:
|
||||
* @percentage: Percentage of progress completed (in the range from 0.0 to 1.0).
|
||||
*
|
||||
* Updates the progress bar for the current plug-in.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*/
|
||||
gboolean
|
||||
gimp_progress_update (gdouble percentage)
|
||||
{
|
||||
gboolean changed;
|
||||
|
||||
if (percentage <= 0.0)
|
||||
{
|
||||
changed = (gimp_progress_current != 0.0);
|
||||
percentage = 0.0;
|
||||
}
|
||||
else if (percentage >= 1.0)
|
||||
{
|
||||
changed = (gimp_progress_current != 1.0);
|
||||
percentage = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
changed =
|
||||
(fabs (gimp_progress_current - percentage) > gimp_progress_step);
|
||||
}
|
||||
|
||||
if (! changed)
|
||||
return TRUE;
|
||||
|
||||
gimp_progress_current = percentage;
|
||||
|
||||
return _gimp_progress_update (gimp_progress_current);
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
|
|
|
@ -57,11 +57,15 @@ const gchar * gimp_progress_install_vtable (const GimpProgressVtable *vtable,
|
|||
gpointer user_data);
|
||||
gpointer gimp_progress_uninstall (const gchar *progress_callback);
|
||||
|
||||
gboolean gimp_progress_init (const gchar *message);
|
||||
gboolean gimp_progress_init_printf (const gchar *format,
|
||||
...) G_GNUC_PRINTF (1, 2);
|
||||
|
||||
gboolean gimp_progress_set_text_printf (const gchar *format,
|
||||
...) G_GNUC_PRINTF (1, 2);
|
||||
|
||||
gboolean gimp_progress_update (gdouble percentage);
|
||||
|
||||
|
||||
#ifndef GIMP_DISABLE_DEPRECATED
|
||||
typedef void (* GimpProgressStartCallback) (const gchar *message,
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "gimp.h"
|
||||
|
||||
/**
|
||||
* gimp_progress_init:
|
||||
* _gimp_progress_init:
|
||||
* @message: Message to use in the progress dialog.
|
||||
|
||||
*
|
||||
|
@ -38,7 +38,7 @@
|
|||
* Returns: TRUE on success.
|
||||
*/
|
||||
gboolean
|
||||
gimp_progress_init (const gchar *message)
|
||||
_gimp_progress_init (const gchar *message)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
|
@ -58,7 +58,7 @@ gimp_progress_init (const gchar *message)
|
|||
}
|
||||
|
||||
/**
|
||||
* gimp_progress_update:
|
||||
* _gimp_progress_update:
|
||||
* @percentage: Percentage of progress completed which must be between 0.0 and 1.0.
|
||||
*
|
||||
* Updates the progress bar for the current plug-in.
|
||||
|
@ -69,7 +69,7 @@ gimp_progress_init (const gchar *message)
|
|||
* Returns: TRUE on success.
|
||||
*/
|
||||
gboolean
|
||||
gimp_progress_update (gdouble percentage)
|
||||
_gimp_progress_update (gdouble percentage)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
|
|
|
@ -29,8 +29,8 @@ G_BEGIN_DECLS
|
|||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
gboolean gimp_progress_init (const gchar *message);
|
||||
gboolean gimp_progress_update (gdouble percentage);
|
||||
gboolean _gimp_progress_init (const gchar *message) G_GNUC_INTERNAL;
|
||||
gboolean _gimp_progress_update (gdouble percentage) G_GNUC_INTERNAL;
|
||||
gboolean gimp_progress_pulse (void);
|
||||
gboolean gimp_progress_set_text (const gchar *message);
|
||||
gint gimp_progress_get_window_handle (void);
|
||||
|
|
|
@ -42,7 +42,7 @@ HELP
|
|||
&std_pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
{ name => 'message', type => 'string', null_ok => 1,
|
||||
{ name => 'message', type => 'string', null_ok => 1, wrap => 1,
|
||||
desc => 'Message to use in the progress dialog' },
|
||||
{ name => 'gdisplay', type => 'int32',
|
||||
desc => 'GimpDisplay to update progressbar in, or -1 for a seperate
|
||||
|
@ -76,7 +76,7 @@ HELP
|
|||
&std_pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
{ name => 'percentage', type => 'float',
|
||||
{ name => 'percentage', type => 'float', wrap => 1,
|
||||
desc => 'Percentage of progress completed which must be between 0.0 and 1.0' }
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue