Clean up whitespace, indentation and comments

This commit is contained in:
Emmanuele Bassi 2009-12-11 20:17:58 +00:00
parent 86ce92eec1
commit d2ea7cd6a8

View File

@ -354,19 +354,6 @@ clutter_get_motion_events_enabled (void)
guint _clutter_pix_to_id (guchar pixel[4]); guint _clutter_pix_to_id (guchar pixel[4]);
static inline void init_bits (void)
{
ClutterMainContext *ctx;
static gboolean done = FALSE;
if (G_LIKELY (done))
return;
ctx = _clutter_context_get_default ();
done = TRUE;
}
void void
_clutter_id_to_color (guint id, ClutterColor *col) _clutter_id_to_color (guint id, ClutterColor *col)
{ {
@ -378,8 +365,10 @@ _clutter_id_to_color (guint id, ClutterColor *col)
/* compute the numbers we'll store in the components */ /* compute the numbers we'll store in the components */
red = (id >> (ctx->fb_g_mask_used+ctx->fb_b_mask_used)) red = (id >> (ctx->fb_g_mask_used+ctx->fb_b_mask_used))
& (0xff >> (8-ctx->fb_r_mask_used)); & (0xff >> (8-ctx->fb_r_mask_used));
green = (id >> ctx->fb_b_mask_used) & (0xff >> (8-ctx->fb_g_mask_used)); green = (id >> ctx->fb_b_mask_used)
blue = (id) & (0xff >> (8-ctx->fb_b_mask_used)); & (0xff >> (8-ctx->fb_g_mask_used));
blue = (id)
& (0xff >> (8-ctx->fb_b_mask_used));
/* shift left bits a bit and add one, this circumvents /* shift left bits a bit and add one, this circumvents
* at least some potential rounding errors in GL/GLES * at least some potential rounding errors in GL/GLES
@ -456,7 +445,8 @@ _clutter_pixel_to_id (guchar pixel[4])
blue = blue >> (ctx->fb_b_mask - ctx->fb_b_mask_used); blue = blue >> (ctx->fb_b_mask - ctx->fb_b_mask_used);
/* combine the correct per component values into the final id */ /* combine the correct per component values into the final id */
id = blue + (green << ctx->fb_b_mask_used) id = blue
+ (green << ctx->fb_b_mask_used)
+ (red << (ctx->fb_b_mask_used + ctx->fb_g_mask_used)); + (red << (ctx->fb_b_mask_used + ctx->fb_g_mask_used));
return id; return id;
@ -498,28 +488,34 @@ read_pixels_to_file (char *filename_stem,
NULL); /* callback data */ NULL); /* callback data */
if (pixbuf) if (pixbuf)
{ {
char *filename = char *filename = g_strdup_printf ("%s-%05d.png",
g_strdup_printf ("%s-%05d.png", filename_stem, read_count); filename_stem,
read_count);
GError *error = NULL; GError *error = NULL;
if (!gdk_pixbuf_save (pixbuf, filename, "png", &error, NULL)) if (!gdk_pixbuf_save (pixbuf, filename, "png", &error, NULL))
{ {
g_warning ("Failed to save pick buffer to file %s: %s", g_warning ("Failed to save pick buffer to file %s: %s",
filename, error->message); filename, error->message);
g_error_free (error); g_error_free (error);
} }
g_free (filename); g_free (filename);
g_object_unref (pixbuf); g_object_unref (pixbuf);
read_count++; read_count++;
} }
#else #else /* !USE_GDKPIXBUF */
{
static gboolean seen = FALSE; static gboolean seen = FALSE;
if (!seen) if (!seen)
{ {
g_warning ("dumping buffers to an image isn't supported on platforms " g_warning ("dumping buffers to an image isn't supported on platforms "
"without gdk pixbuf support\n"); "without gdk pixbuf support\n");
seen = TRUE; seen = TRUE;
} }
#endif }
#endif /* USE_GDKPIXBUF */
} }
ClutterActor * ClutterActor *
@ -780,14 +776,14 @@ clutter_main (void)
static void static void
clutter_threads_impl_lock (void) clutter_threads_impl_lock (void)
{ {
if (clutter_threads_mutex) if (G_LIKELY (clutter_threads_mutex != NULL))
g_mutex_lock (clutter_threads_mutex); g_mutex_lock (clutter_threads_mutex);
} }
static void static void
clutter_threads_impl_unlock (void) clutter_threads_impl_unlock (void)
{ {
if (clutter_threads_mutex) if (G_LIKELY (clutter_threads_mutex != NULL))
g_mutex_unlock (clutter_threads_mutex); g_mutex_unlock (clutter_threads_mutex);
} }
@ -802,6 +798,8 @@ clutter_threads_impl_unlock (void)
* *
* This function must be called before clutter_init(). * This function must be called before clutter_init().
* *
* It is safe to call this function multiple times.
*
* Since: 0.4 * Since: 0.4
*/ */
void void
@ -810,6 +808,9 @@ clutter_threads_init (void)
if (!g_thread_supported ()) if (!g_thread_supported ())
g_error ("g_thread_init() must be called before clutter_threads_init()"); g_error ("g_thread_init() must be called before clutter_threads_init()");
if (clutter_threads_mutex != NULL)
return;
clutter_threads_mutex = g_mutex_new (); clutter_threads_mutex = g_mutex_new ();
if (!clutter_threads_lock) if (!clutter_threads_lock)
@ -1253,6 +1254,7 @@ _clutter_context_get_default (void)
ClutterCntx = ctx = g_new0 (ClutterMainContext, 1); ClutterCntx = ctx = g_new0 (ClutterMainContext, 1);
/* create the default backend */
ctx->backend = g_object_new (_clutter_backend_impl_get_type (), NULL); ctx->backend = g_object_new (_clutter_backend_impl_get_type (), NULL);
ctx->is_initialized = FALSE; ctx->is_initialized = FALSE;
@ -1414,7 +1416,7 @@ clutter_init_real (GError **error)
resolution = clutter_backend_get_resolution (ctx->backend); resolution = clutter_backend_get_resolution (ctx->backend);
cogl_pango_font_map_set_resolution (ctx->font_map, resolution); cogl_pango_font_map_set_resolution (ctx->font_map, resolution);
if (G_LIKELY (!clutter_disable_mipmap_text)) if (!clutter_disable_mipmap_text)
cogl_pango_font_map_set_use_mipmapping (ctx->font_map, TRUE); cogl_pango_font_map_set_use_mipmapping (ctx->font_map, TRUE);
clutter_text_direction = clutter_get_text_direction (); clutter_text_direction = clutter_get_text_direction ();