texture: don't use a static bool to gate warning

in create_pick_material we were using a static boolean to gate when we
show a warning, but that would mean if the problem recurs between
different textures then the warning will only be shown once. We now have
a private bitfield flag instead, just so we don't spew millions of
warnings if the problem is recurring.
This commit is contained in:
Robert Bragg 2010-05-28 17:11:31 +01:00
parent 589c8d9579
commit d0c743787d

View File

@ -93,6 +93,7 @@ struct _ClutterTexturePrivate
guint load_async_set : 1; /* used to make load_async possible */
guint pick_with_alpha : 1;
guint pick_with_alpha_supported : 1;
guint seen_create_pick_material_warning : 1;
};
struct _ClutterTextureAsyncData
@ -550,6 +551,8 @@ gen_texcoords_and_draw_cogl_rectangle (ClutterActor *self)
static CoglHandle
create_pick_material (ClutterActor *self)
{
ClutterTexture *texture = CLUTTER_TEXTURE (self);
ClutterTexturePrivate *priv = texture->priv;
CoglHandle pick_material = cogl_material_new ();
GError *error = NULL;
@ -558,11 +561,10 @@ create_pick_material (ClutterActor *self)
" MODULATE (CONSTANT, TEXTURE[A])",
&error))
{
static gboolean seen_warning = FALSE;
if (!seen_warning)
if (!priv->seen_create_pick_material_warning)
g_warning ("Error setting up texture combine for shaped "
"texture picking: %s", error->message);
seen_warning = TRUE;
priv->seen_create_pick_material_warning = TRUE;
g_error_free (error);
cogl_handle_unref (pick_material);
return COGL_INVALID_HANDLE;
@ -1226,6 +1228,7 @@ clutter_texture_init (ClutterTexture *self)
priv->keep_aspect_ratio = FALSE;
priv->pick_with_alpha = FALSE;
priv->pick_with_alpha_supported = TRUE;
priv->seen_create_pick_material_warning = FALSE;
}
/**