Commit c15b3b4a authored by Jasper St. Pierre's avatar Jasper St. Pierre

shaped-texture: Fix the logic when the blended region is empty

When the blended region was empty, meaning we didn't have to paint
anything blended -- the case for an app update -- was drawing the
entire window blended, because of a think-o in the complex and
complicated logic.

Fix this so that we don't draw anything for the blended region when
empty.
parent e1acb69c
...@@ -430,53 +430,65 @@ meta_shaped_texture_paint (ClutterActor *actor) ...@@ -430,53 +430,65 @@ meta_shaped_texture_paint (ClutterActor *actor)
} }
/* Now, go ahead and paint the blended parts. */ /* Now, go ahead and paint the blended parts. */
{
CoglPipeline *blended_pipeline; /* We have three cases:
* 1) blended_region has rectangles - paint the rectangles.
if (priv->mask_texture == NULL) * 2) blended_region is empty - don't paint anything
{ * 3) blended_region is NULL - paint fully-blended.
blended_pipeline = get_unmasked_pipeline (ctx); *
} * 1) and 3) are the times where we have to paint stuff. This tests
else * for 1) and 3).
{ */
blended_pipeline = get_masked_pipeline (ctx); if (blended_region == NULL || !cairo_region_is_empty (blended_region))
cogl_pipeline_set_layer_texture (blended_pipeline, 1, priv->mask_texture); {
cogl_pipeline_set_layer_filters (blended_pipeline, 1, filter, filter); CoglPipeline *blended_pipeline;
}
if (priv->mask_texture == NULL)
cogl_pipeline_set_layer_texture (blended_pipeline, 0, paint_tex); {
cogl_pipeline_set_layer_filters (blended_pipeline, 0, filter, filter); blended_pipeline = get_unmasked_pipeline (ctx);
}
CoglColor color; else
cogl_color_init_from_4ub (&color, opacity, opacity, opacity, opacity); {
cogl_pipeline_set_color (blended_pipeline, &color); blended_pipeline = get_masked_pipeline (ctx);
cogl_pipeline_set_layer_texture (blended_pipeline, 1, priv->mask_texture);
if (blended_region != NULL && !cairo_region_is_empty (blended_region)) cogl_pipeline_set_layer_filters (blended_pipeline, 1, filter, filter);
{ }
int i;
int n_rects = cairo_region_num_rectangles (blended_region); cogl_pipeline_set_layer_texture (blended_pipeline, 0, paint_tex);
cogl_pipeline_set_layer_filters (blended_pipeline, 0, filter, filter);
for (i = 0; i < n_rects; i++)
{ CoglColor color;
cairo_rectangle_int_t rect; cogl_color_init_from_4ub (&color, opacity, opacity, opacity, opacity);
cairo_region_get_rectangle (blended_region, i, &rect); cogl_pipeline_set_color (blended_pipeline, &color);
if (!gdk_rectangle_intersect (&tex_rect, &rect, &rect)) if (blended_region != NULL)
continue; {
/* 1) blended_region is NULL and not empty. Paint the rectangles. */
paint_clipped_rectangle (fb, blended_pipeline, &rect, &alloc); int i;
} int n_rects = cairo_region_num_rectangles (blended_region);
}
else for (i = 0; i < n_rects; i++)
{ {
cogl_framebuffer_draw_rectangle (fb, blended_pipeline, cairo_rectangle_int_t rect;
0, 0, cairo_region_get_rectangle (blended_region, i, &rect);
alloc.x2 - alloc.x1,
alloc.y2 - alloc.y1); if (!gdk_rectangle_intersect (&tex_rect, &rect, &rect))
} continue;
cogl_object_unref (blended_pipeline); paint_clipped_rectangle (fb, blended_pipeline, &rect, &alloc);
} }
}
else
{
/* 3) blended_region is NULL. Do a full paint. */
cogl_framebuffer_draw_rectangle (fb, blended_pipeline,
0, 0,
alloc.x2 - alloc.x1,
alloc.y2 - alloc.y1);
}
cogl_object_unref (blended_pipeline);
}
if (blended_region != NULL) if (blended_region != NULL)
cairo_region_destroy (blended_region); cairo_region_destroy (blended_region);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment