From aecf588d8d7e1fd4bfb8ca04e3b13b92ee5b112a Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 8 Nov 2018 19:25:21 -0200 Subject: [PATCH] shadow-factory: Replace implicit API by explicit counterparts MetaShadow.paint() uses Cogl implicit APIs (cogl_rectangle* ones, in this case) to paint shadows with the shadow pipeline. Replace those calls by cogl_framebuffer_draw_textured_rectangle() calls, that achieve the exact same result but with the non-deprecated API. --- src/compositor/meta-shadow-factory.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/compositor/meta-shadow-factory.c b/src/compositor/meta-shadow-factory.c index 38594aebd..40f69faf6 100644 --- a/src/compositor/meta-shadow-factory.c +++ b/src/compositor/meta-shadow-factory.c @@ -212,6 +212,7 @@ meta_shadow_paint (MetaShadow *shadow, cairo_region_t *clip, gboolean clip_strictly) { + CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer (); float texture_width = cogl_texture_get_width (shadow->texture); float texture_height = cogl_texture_get_height (shadow->texture); int i, j; @@ -224,8 +225,6 @@ meta_shadow_paint (MetaShadow *shadow, cogl_pipeline_set_color4ub (shadow->pipeline, opacity, opacity, opacity, opacity); - cogl_set_source (shadow->pipeline); - if (shadow->scale_width) { n_x = 3; @@ -309,10 +308,12 @@ meta_shadow_paint (MetaShadow *shadow, if (overlap == CAIRO_REGION_OVERLAP_IN || (overlap == CAIRO_REGION_OVERLAP_PART && !clip_strictly)) { - cogl_rectangle_with_texture_coords (dest_x[i], dest_y[j], - dest_x[i + 1], dest_y[j + 1], - src_x[i], src_y[j], - src_x[i + 1], src_y[j + 1]); + cogl_framebuffer_draw_textured_rectangle (framebuffer, + shadow->pipeline, + dest_x[i], dest_y[j], + dest_x[i + 1], dest_y[j + 1], + src_x[i], src_y[j], + src_x[i + 1], src_y[j + 1]); } else if (overlap == CAIRO_REGION_OVERLAP_PART) { @@ -343,9 +344,11 @@ meta_shadow_paint (MetaShadow *shadow, src_y2 = (src_y[j] * (dest_rect.y + dest_rect.height - (rect.y + rect.height)) + src_y[j + 1] * (rect.y + rect.height - dest_rect.y)) / dest_rect.height; - cogl_rectangle_with_texture_coords (rect.x, rect.y, - rect.x + rect.width, rect.y + rect.height, - src_x1, src_y1, src_x2, src_y2); + cogl_framebuffer_draw_textured_rectangle (framebuffer, + shadow->pipeline, + rect.x, rect.y, + rect.x + rect.width, rect.y + rect.height, + src_x1, src_y1, src_x2, src_y2); } cairo_region_destroy (intersection);