app: rename GimpParallelRunAsyncFunc to GimpRunAsyncFunc
... and move it to core-type.h, in preparation for next commit.
(cherry picked from commit f25a8934fa
)
This commit is contained in:
@ -256,6 +256,9 @@ typedef gboolean (* GimpObjectFilterFunc) (GimpObject *object,
|
|||||||
typedef gint64 (* GimpMemsizeFunc) (gpointer instance,
|
typedef gint64 (* GimpMemsizeFunc) (gpointer instance,
|
||||||
gint64 *gui_size);
|
gint64 *gui_size);
|
||||||
|
|
||||||
|
typedef void (* GimpRunAsyncFunc) (GimpAsync *async,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
|
||||||
/* structs */
|
/* structs */
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
GimpAsync *async;
|
GimpAsync *async;
|
||||||
gint priority;
|
gint priority;
|
||||||
GimpParallelRunAsyncFunc func;
|
GimpRunAsyncFunc func;
|
||||||
gpointer user_data;
|
gpointer user_data;
|
||||||
GDestroyNotify user_data_destroy_func;
|
GDestroyNotify user_data_destroy_func;
|
||||||
} GimpParallelRunAsyncTask;
|
} GimpParallelRunAsyncTask;
|
||||||
@ -129,7 +129,7 @@ gimp_parallel_exit (Gimp *gimp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GimpAsync *
|
GimpAsync *
|
||||||
gimp_parallel_run_async (GimpParallelRunAsyncFunc func,
|
gimp_parallel_run_async (GimpRunAsyncFunc func,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
return gimp_parallel_run_async_full (0, func, user_data, NULL);
|
return gimp_parallel_run_async_full (0, func, user_data, NULL);
|
||||||
@ -137,7 +137,7 @@ gimp_parallel_run_async (GimpParallelRunAsyncFunc func,
|
|||||||
|
|
||||||
GimpAsync *
|
GimpAsync *
|
||||||
gimp_parallel_run_async_full (gint priority,
|
gimp_parallel_run_async_full (gint priority,
|
||||||
GimpParallelRunAsyncFunc func,
|
GimpRunAsyncFunc func,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GDestroyNotify user_data_destroy_func)
|
GDestroyNotify user_data_destroy_func)
|
||||||
{
|
{
|
||||||
@ -182,7 +182,7 @@ gimp_parallel_run_async_full (gint priority,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GimpAsync *
|
GimpAsync *
|
||||||
gimp_parallel_run_async_independent (GimpParallelRunAsyncFunc func,
|
gimp_parallel_run_async_independent (GimpRunAsyncFunc func,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
return gimp_parallel_run_async_independent_full (0, func, user_data);
|
return gimp_parallel_run_async_independent_full (0, func, user_data);
|
||||||
@ -190,7 +190,7 @@ gimp_parallel_run_async_independent (GimpParallelRunAsyncFunc func,
|
|||||||
|
|
||||||
GimpAsync *
|
GimpAsync *
|
||||||
gimp_parallel_run_async_independent_full (gint priority,
|
gimp_parallel_run_async_independent_full (gint priority,
|
||||||
GimpParallelRunAsyncFunc func,
|
GimpRunAsyncFunc func,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GimpAsync *async;
|
GimpAsync *async;
|
||||||
|
@ -22,23 +22,19 @@
|
|||||||
#define __GIMP_PARALLEL_H__
|
#define __GIMP_PARALLEL_H__
|
||||||
|
|
||||||
|
|
||||||
typedef void (* GimpParallelRunAsyncFunc) (GimpAsync *async,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
|
|
||||||
void gimp_parallel_init (Gimp *gimp);
|
void gimp_parallel_init (Gimp *gimp);
|
||||||
void gimp_parallel_exit (Gimp *gimp);
|
void gimp_parallel_exit (Gimp *gimp);
|
||||||
|
|
||||||
GimpAsync * gimp_parallel_run_async (GimpParallelRunAsyncFunc func,
|
GimpAsync * gimp_parallel_run_async (GimpRunAsyncFunc func,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
GimpAsync * gimp_parallel_run_async_full (gint priority,
|
GimpAsync * gimp_parallel_run_async_full (gint priority,
|
||||||
GimpParallelRunAsyncFunc func,
|
GimpRunAsyncFunc func,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GDestroyNotify user_data_destroy_func);
|
GDestroyNotify user_data_destroy_func);
|
||||||
GimpAsync * gimp_parallel_run_async_independent (GimpParallelRunAsyncFunc func,
|
GimpAsync * gimp_parallel_run_async_independent (GimpRunAsyncFunc func,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
GimpAsync * gimp_parallel_run_async_independent_full (gint priority,
|
GimpAsync * gimp_parallel_run_async_independent_full (gint priority,
|
||||||
GimpParallelRunAsyncFunc func,
|
GimpRunAsyncFunc func,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
|
|
||||||
@ -49,47 +45,47 @@ extern "C++"
|
|||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
template <class ParallelRunAsyncFunc>
|
template <class RunAsyncFunc>
|
||||||
inline GimpAsync *
|
inline GimpAsync *
|
||||||
gimp_parallel_run_async (ParallelRunAsyncFunc func)
|
gimp_parallel_run_async (RunAsyncFunc func)
|
||||||
{
|
{
|
||||||
ParallelRunAsyncFunc *func_copy = g_new (ParallelRunAsyncFunc, 1);
|
RunAsyncFunc *func_copy = g_new (RunAsyncFunc, 1);
|
||||||
|
|
||||||
new (func_copy) ParallelRunAsyncFunc (func);
|
new (func_copy) RunAsyncFunc (func);
|
||||||
|
|
||||||
return gimp_parallel_run_async_full (0,
|
return gimp_parallel_run_async_full (0,
|
||||||
[] (GimpAsync *async,
|
[] (GimpAsync *async,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
ParallelRunAsyncFunc *func_copy =
|
RunAsyncFunc *func_copy =
|
||||||
(ParallelRunAsyncFunc *) user_data;
|
(RunAsyncFunc *) user_data;
|
||||||
|
|
||||||
(*func_copy) (async);
|
(*func_copy) (async);
|
||||||
|
|
||||||
func_copy->~ParallelRunAsyncFunc ();
|
func_copy->~RunAsyncFunc ();
|
||||||
g_free (func_copy);
|
g_free (func_copy);
|
||||||
},
|
},
|
||||||
func_copy,
|
func_copy,
|
||||||
[] (gpointer user_data)
|
[] (gpointer user_data)
|
||||||
{
|
{
|
||||||
ParallelRunAsyncFunc *func_copy =
|
RunAsyncFunc *func_copy =
|
||||||
(ParallelRunAsyncFunc *) user_data;
|
(RunAsyncFunc *) user_data;
|
||||||
|
|
||||||
func_copy->~ParallelRunAsyncFunc ();
|
func_copy->~RunAsyncFunc ();
|
||||||
g_free (func_copy);
|
g_free (func_copy);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ParallelRunAsyncFunc,
|
template <class RunAsyncFunc,
|
||||||
class DestroyFunc>
|
class DestroyFunc>
|
||||||
inline GimpAsync *
|
inline GimpAsync *
|
||||||
gimp_parallel_run_async_full (gint priority,
|
gimp_parallel_run_async_full (gint priority,
|
||||||
ParallelRunAsyncFunc func,
|
RunAsyncFunc func,
|
||||||
DestroyFunc destroy_func)
|
DestroyFunc destroy_func)
|
||||||
{
|
{
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
ParallelRunAsyncFunc func;
|
RunAsyncFunc func;
|
||||||
DestroyFunc destroy_func;
|
DestroyFunc destroy_func;
|
||||||
} Funcs;
|
} Funcs;
|
||||||
|
|
||||||
@ -122,33 +118,33 @@ gimp_parallel_run_async_full (gint priority,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ParallelRunAsyncFunc>
|
template <class RunAsyncFunc>
|
||||||
inline GimpAsync *
|
inline GimpAsync *
|
||||||
gimp_parallel_run_async_independent_full (gint priority,
|
gimp_parallel_run_async_independent_full (gint priority,
|
||||||
ParallelRunAsyncFunc func)
|
RunAsyncFunc func)
|
||||||
{
|
{
|
||||||
ParallelRunAsyncFunc *func_copy = g_new (ParallelRunAsyncFunc, 1);
|
RunAsyncFunc *func_copy = g_new (RunAsyncFunc, 1);
|
||||||
|
|
||||||
new (func_copy) ParallelRunAsyncFunc (func);
|
new (func_copy) RunAsyncFunc (func);
|
||||||
|
|
||||||
return gimp_parallel_run_async_independent_full (priority,
|
return gimp_parallel_run_async_independent_full (priority,
|
||||||
[] (GimpAsync *async,
|
[] (GimpAsync *async,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
ParallelRunAsyncFunc *func_copy =
|
RunAsyncFunc *func_copy =
|
||||||
(ParallelRunAsyncFunc *) user_data;
|
(RunAsyncFunc *) user_data;
|
||||||
|
|
||||||
(*func_copy) (async);
|
(*func_copy) (async);
|
||||||
|
|
||||||
func_copy->~ParallelRunAsyncFunc ();
|
func_copy->~RunAsyncFunc ();
|
||||||
g_free (func_copy);
|
g_free (func_copy);
|
||||||
},
|
},
|
||||||
func_copy);
|
func_copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ParallelRunAsyncFunc>
|
template <class RunAsyncFunc>
|
||||||
inline GimpAsync *
|
inline GimpAsync *
|
||||||
gimp_parallel_run_async_independent (ParallelRunAsyncFunc func)
|
gimp_parallel_run_async_independent (RunAsyncFunc func)
|
||||||
{
|
{
|
||||||
return gimp_parallel_run_async_independent_full (0, func);
|
return gimp_parallel_run_async_independent_full (0, func);
|
||||||
}
|
}
|
||||||
|
@ -413,7 +413,7 @@ gimp_drawable_get_sub_preview_async (GimpDrawable *drawable,
|
|||||||
|
|
||||||
return gimp_parallel_run_async_full (
|
return gimp_parallel_run_async_full (
|
||||||
+1,
|
+1,
|
||||||
(GimpParallelRunAsyncFunc) gimp_drawable_get_sub_preview_async_func,
|
(GimpRunAsyncFunc) gimp_drawable_get_sub_preview_async_func,
|
||||||
sub_preview_data_new (
|
sub_preview_data_new (
|
||||||
gimp_drawable_get_preview_format (drawable),
|
gimp_drawable_get_preview_format (drawable),
|
||||||
buffer,
|
buffer,
|
||||||
|
@ -354,7 +354,7 @@ gimp_histogram_calculate_async (GimpHistogram *histogram,
|
|||||||
}
|
}
|
||||||
|
|
||||||
histogram->priv->calculate_async = gimp_parallel_run_async (
|
histogram->priv->calculate_async = gimp_parallel_run_async (
|
||||||
(GimpParallelRunAsyncFunc) gimp_histogram_calculate_internal,
|
(GimpRunAsyncFunc) gimp_histogram_calculate_internal,
|
||||||
context);
|
context);
|
||||||
|
|
||||||
gimp_async_add_callback (
|
gimp_async_add_callback (
|
||||||
|
@ -664,7 +664,7 @@ gimp_line_art_prepare_async (GimpLineArt *line_art,
|
|||||||
|
|
||||||
async = gimp_parallel_run_async_full (
|
async = gimp_parallel_run_async_full (
|
||||||
priority,
|
priority,
|
||||||
(GimpParallelRunAsyncFunc) gimp_line_art_prepare_async_func,
|
(GimpRunAsyncFunc) gimp_line_art_prepare_async_func,
|
||||||
data, (GDestroyNotify) line_art_data_free);
|
data, (GDestroyNotify) line_art_data_free);
|
||||||
|
|
||||||
return async;
|
return async;
|
||||||
|
@ -540,7 +540,7 @@ gui_wait (Gimp *gimp,
|
|||||||
{
|
{
|
||||||
/* listens for a cancellation request */
|
/* listens for a cancellation request */
|
||||||
input_async = gimp_parallel_run_async_independent (
|
input_async = gimp_parallel_run_async_independent (
|
||||||
(GimpParallelRunAsyncFunc) gui_wait_input_async,
|
(GimpRunAsyncFunc) gui_wait_input_async,
|
||||||
input_pipe);
|
input_pipe);
|
||||||
|
|
||||||
while (! gimp_waitable_wait_for (waitable, 0.1 * G_TIME_SPAN_SECOND))
|
while (! gimp_waitable_wait_for (waitable, 0.1 * G_TIME_SPAN_SECOND))
|
||||||
|
@ -334,7 +334,7 @@ gimp_font_factory_load (GimpFontFactory *factory,
|
|||||||
*/
|
*/
|
||||||
async = gimp_parallel_run_async_independent_full (
|
async = gimp_parallel_run_async_independent_full (
|
||||||
+10,
|
+10,
|
||||||
(GimpParallelRunAsyncFunc) gimp_font_factory_load_async,
|
(GimpRunAsyncFunc) gimp_font_factory_load_async,
|
||||||
config);
|
config);
|
||||||
|
|
||||||
gimp_async_add_callback_for_object (
|
gimp_async_add_callback_for_object (
|
||||||
|
@ -4570,7 +4570,7 @@ gimp_dashboard_log_stop_recording (GimpDashboard *dashboard,
|
|||||||
GimpAsync *async;
|
GimpAsync *async;
|
||||||
|
|
||||||
async = gimp_parallel_run_async_independent (
|
async = gimp_parallel_run_async_independent (
|
||||||
(GimpParallelRunAsyncFunc) gimp_dashboard_log_write_address_map,
|
(GimpRunAsyncFunc) gimp_dashboard_log_write_address_map,
|
||||||
dashboard);
|
dashboard);
|
||||||
|
|
||||||
gimp_wait (priv->gimp, GIMP_WAITABLE (async),
|
gimp_wait (priv->gimp, GIMP_WAITABLE (async),
|
||||||
|
Reference in New Issue
Block a user