diff --git a/src/compositor/mutter/mutter-shaped-texture.c b/src/compositor/mutter/mutter-shaped-texture.c index 31e432339..ed01e9acc 100644 --- a/src/compositor/mutter/mutter-shaped-texture.c +++ b/src/compositor/mutter/mutter-shaped-texture.c @@ -366,6 +366,17 @@ mutter_shaped_texture_paint (ClutterActor *actor) ClutterActorBox alloc; static const ClutterColor white = { 0xff, 0xff, 0xff, 0xff }; + if (!CLUTTER_ACTOR_IS_REALIZED (CLUTTER_ACTOR (stex))) + clutter_actor_realize (CLUTTER_ACTOR (stex)); + + paint_tex = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (stex)); + + tex_width = cogl_texture_get_width (paint_tex); + tex_height = cogl_texture_get_height (paint_tex); + + if (tex_width == 0 || tex_width == 0) /* no contents yet */ + return; + /* If there are no rectangles or multi-texturing isn't supported, fallback to the regular paint method */ if (priv->rectangles->len < 1 @@ -376,11 +387,6 @@ mutter_shaped_texture_paint (ClutterActor *actor) return; } - if (!CLUTTER_ACTOR_IS_REALIZED (CLUTTER_ACTOR (stex))) - clutter_actor_realize (CLUTTER_ACTOR (stex)); - - paint_tex = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (stex)); - if (paint_tex == COGL_INVALID_HANDLE) return; @@ -392,9 +398,6 @@ mutter_shaped_texture_paint (ClutterActor *actor) return; } - tex_width = cogl_texture_get_width (paint_tex); - tex_height = cogl_texture_get_height (paint_tex); - mutter_shaped_texture_ensure_mask (stex); cogl_texture_get_gl_texture (paint_tex, &paint_gl_tex, &paint_target); @@ -512,12 +515,19 @@ mutter_shaped_texture_pick (ClutterActor *actor, { CoglHandle paint_tex; ClutterActorBox alloc; + guint tex_width, tex_height; paint_tex = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (stex)); if (paint_tex == COGL_INVALID_HANDLE) return; + tex_width = cogl_texture_get_width (paint_tex); + tex_height = cogl_texture_get_height (paint_tex); + + if (tex_width == 0 || tex_width == 0) /* no contents yet */ + return; + mutter_shaped_texture_ensure_mask (stex); cogl_color (color);