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.
This commit is contained in:
Georges Basile Stavracas Neto 2018-11-08 19:25:21 -02:00
parent 740c2298c6
commit aecf588d8d
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385

View File

@ -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);