2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>

* configure.ac: Enable debug messages also when
	--enable-debug is set to "minimum".

	* clutter/Makefile.am:
	* clutter/clutter-debug.h: Move all debugging macros inside
	this private header; make all debug macros depend on the
	CLUTTER_ENABLE_DEBUG compile time define, controlled by
	the --enable-debug configure switch; add G_LOG_DOMAIN define.

	* clutter/clutter-main.c: Clean up the debug stuff; add
	command line argument parsing using GOption; the debug
	messages now are triggered like this:

	  CLUTTER_DEBUG=section:section:... clutter-app
	
	or like this:

	  clutter-app --clutter-debug=section:section:...
	
	where "section" is one of the sections listed in clutter-main.c,
	or "all", for all sections; each section is bound to a flag,
	which can be used to define a domain when adding a debug note
	using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
	just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
	CLUTTER_NOTE() is used like this:

	  CLUTTER_NOTE (DOMAIN, log-function);
	
	where log function is g_printerr(), g_message(), g_warning(),
	g_critical() or directly g_log() - for instance:

	  CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));

	will print the warning only if the "pango" flag has been
	set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
	command line argument.

	similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
	command line switch; also, the --display and --screen command
	line switches have been added: the first overrides the DISPLAY
	envvar and the second controls the X screen used by Clutter to
	get the root window on the display.

	* clutter/clutter-main.h:
	* clutter/clutter-main.c: Add extended support for GOption
	in Clutter; use clutter_init_with_args() to let Clutter
	parse your own command line arguments; use instead
	clutter_get_option_group() to get the GOptionGroup used by
	Clutter if you want to do the parsing yourself with
	g_option_context_parse(). The init sequence has been verified,
	updated and moved into common functions where possible.

	* clutter/pango/pangoclutter-render.c:
	* clutter/*.c: Include "clutter-debug.h" where needed; use
	CLUTTER_NOTE() instead of CLUTTER_DBG().

	* examples/super-oh.c: Use the new clutter_init_with_args()
	function, and add a --num-hands command line switch to
	the SuperOH example code controlling the number of hands at
	runtime.
This commit is contained in:
Emmanuele Bassi
2006-11-21 21:27:53 +00:00
parent ff84406143
commit e4b9a507e3
21 changed files with 721 additions and 220 deletions

View File

@ -43,7 +43,8 @@
#include "clutter-marshal.h"
#include "clutter-feature.h"
#include "clutter-util.h"
#include "clutter-private.h" /* for DBG */
#include "clutter-private.h"
#include "clutter-debug.h"
#include <GL/glx.h>
#include <GL/gl.h>
@ -114,7 +115,7 @@ can_create (int width,
{
GLint new_width = 0;
CLUTTER_DBG("checking %ix%i", width, height);
CLUTTER_NOTE (TEXTURE, g_message ("checking %ix%i", width, height));
glTexImage2D (GL_PROXY_TEXTURE_2D, 0, GL_RGBA,
width, height, 0 /* border */,
@ -194,11 +195,15 @@ texture_init_tiles (ClutterTexture *texture)
&& (x_pot - priv->width < priv->max_tile_waste)
&& (y_pot - priv->height < priv->max_tile_waste)))
{
CLUTTER_DBG("x_pot:%i - width:%i < max_waste:%i",
x_pot, priv->width, priv->max_tile_waste);
CLUTTER_NOTE (TEXTURE, g_message ("x_pot:%i - width:%i < max_waste:%i",
x_pot,
priv->width,
priv->max_tile_waste));
CLUTTER_DBG("y_pot:%i - height:%i < max_waste:%i",
y_pot, priv->height, priv->max_tile_waste);
CLUTTER_NOTE (TEXTURE, g_message ("y_pot:%i - height:%i < max_waste:%i",
y_pot,
priv->height,
priv->max_tile_waste));
if (x_pot > y_pot)
x_pot /= 2;
@ -222,10 +227,12 @@ texture_init_tiles (ClutterTexture *texture)
priv->y_tiles = g_new (ClutterTextureTileDimention, priv->n_y_tiles);
tile_dimension (priv->height, y_pot, priv->max_tile_waste, priv->y_tiles);
CLUTTER_DBG("x_pot:%i, width:%i, y_pot:%i, height: %i max_waste:%i, "
" n_x_tiles: %i, n_y_tiles: %i",
x_pot, priv->width, y_pot, priv->height, priv->max_tile_waste,
priv->n_x_tiles, priv->n_y_tiles);
CLUTTER_NOTE (TEXTURE,
g_message ("x_pot:%i, width:%i, y_pot:%i, height: %i "
"max_waste:%i, n_x_tiles: %i, n_y_tiles: %i",
x_pot, priv->width, y_pot, priv->height,
priv->max_tile_waste,
priv->n_x_tiles, priv->n_y_tiles));
}
@ -301,8 +308,9 @@ texture_render_to_gl_quad (ClutterTexture *texture,
actual_w = priv->x_tiles[x].size - priv->x_tiles[x].waste;
actual_h = priv->y_tiles[y].size - priv->y_tiles[y].waste;
CLUTTER_DBG("rendering text tile x: %i, y: %i - %ix%i",
x, y, actual_w, actual_h);
CLUTTER_NOTE (TEXTURE,
g_message ("rendering text tile x: %i, y: %i - %ix%i",
x, y, actual_w, actual_h));
tx = (float) actual_w / priv->x_tiles[x].size;
ty = (float) actual_h / priv->y_tiles[y].size;
@ -390,7 +398,7 @@ texture_upload_data (ClutterTexture *texture,
create_textures = TRUE;
}
CLUTTER_DBG("syncing for single tile");
CLUTTER_NOTE (TEXTURE, g_message ("syncing for single tile"));
glBindTexture(priv->target_type, priv->tiles[0]);
@ -449,8 +457,9 @@ texture_upload_data (ClutterTexture *texture,
/* Multiple tiled texture */
CLUTTER_DBG("syncing for multiple tiles for %ix%i pixbuf",
priv->width, priv->height);
CLUTTER_NOTE (TEXTURE,
g_message ("syncing for multiple tiles for %ix%i pixbuf",
priv->width, priv->height));
g_return_if_fail (priv->x_tiles != NULL && priv->y_tiles != NULL);
@ -485,13 +494,12 @@ texture_upload_data (ClutterTexture *texture,
src_h = priv->height - priv->y_tiles[y].pos;
}
CLUTTER_DBG("copying tile %i,%i - %ix%i to 0,0 %ix%i",
priv->x_tiles[x].pos,
priv->y_tiles[y].pos,
src_w,
src_h,
priv->x_tiles[x].size,
priv->y_tiles[y].size);
CLUTTER_NOTE (TEXTURE,
g_message ("copying tile %i,%i - %ix%i to 0,0 %ix%i",
priv->x_tiles[x].pos, priv->y_tiles[y].pos,
src_w, src_h,
priv->x_tiles[x].size,
priv->y_tiles[y].size));
for (dy = 0; dy < src_h; dy++)
{
@ -588,7 +596,7 @@ clutter_texture_unrealize (ClutterActor *actor)
texture_free_gl_resources (texture);
CLUTTER_DBG("Texture unrealized");
CLUTTER_NOTE (TEXTURE, g_message ("Texture unrealized"));
}
static void
@ -616,14 +624,16 @@ clutter_texture_realize (ClutterActor *actor)
/* Dont allow realization with no pixbuf - note set_pixbuf/data
* will set realize flags.
*/
CLUTTER_DBG("*** Texture has no image data cannot realize ***");
CLUTTER_DBG("*** flags %i ***", actor->flags);
CLUTTER_NOTE (TEXTURE,
g_warning ("Texture has no image data cannot realize"));
CLUTTER_NOTE (TEXTURE, g_message ("flags %i", actor->flags));
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
CLUTTER_DBG("*** flags %i ***", actor->flags);
CLUTTER_NOTE (TEXTURE, g_message ("flags %i", actor->flags));
return;
}
CLUTTER_DBG("Texture realized");
CLUTTER_NOTE (TEXTURE, g_message ("Texture realized"));
}
static void
@ -645,9 +655,10 @@ clutter_texture_paint (ClutterActor *self)
gint x1, y1, x2, y2;
guint8 opacity;
CLUTTER_DBG("@@@ for '%s' @@@",
clutter_actor_get_name(self) ?
clutter_actor_get_name(self) : "unknown");
CLUTTER_NOTE (PAINT,
g_message ("@@@ for '%s' @@@",
clutter_actor_get_name (self) ? clutter_actor_get_name (self)
: "unknown"));
glPushMatrix();
glEnable(GL_BLEND);
@ -656,7 +667,7 @@ clutter_texture_paint (ClutterActor *self)
opacity = clutter_actor_get_opacity(self);
CLUTTER_DBG("setting opacity to %i\n", opacity);
CLUTTER_NOTE (PAINT, g_message ("setting opacity to %i\n", opacity));
glColor4ub(255, 255, 255, opacity);
clutter_actor_get_coords (self, &x1, &y1, &x2, &y2);
@ -730,7 +741,8 @@ clutter_texture_set_property (GObject *object,
&& priv->tiled == TRUE)
priv->target_type = GL_TEXTURE_2D;
CLUTTER_DBG("Texture is tiled ? %i", priv->tiled);
CLUTTER_NOTE (TEXTURE, g_message ("Texture is tiled ? %s",
priv->tiled ? "yes" : "no"));
break;
case PROP_MAX_TILE_WASTE:
priv->max_tile_waste = g_value_get_int (value);
@ -1167,7 +1179,9 @@ clutter_texture_set_from_data (ClutterTexture *texture,
texture_init_tiles (texture);
}
CLUTTER_DBG("set size %ix%i\n", priv->width, priv->height);
CLUTTER_NOTE (TEXTURE, g_message ("set size %ix%i\n",
priv->width,
priv->height));
texture_upload_data (texture, data, has_alpha,
width, height, rowstride, bpp);