mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
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:
parent
740c2298c6
commit
aecf588d8d
@ -212,6 +212,7 @@ meta_shadow_paint (MetaShadow *shadow,
|
|||||||
cairo_region_t *clip,
|
cairo_region_t *clip,
|
||||||
gboolean clip_strictly)
|
gboolean clip_strictly)
|
||||||
{
|
{
|
||||||
|
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||||
float texture_width = cogl_texture_get_width (shadow->texture);
|
float texture_width = cogl_texture_get_width (shadow->texture);
|
||||||
float texture_height = cogl_texture_get_height (shadow->texture);
|
float texture_height = cogl_texture_get_height (shadow->texture);
|
||||||
int i, j;
|
int i, j;
|
||||||
@ -224,8 +225,6 @@ meta_shadow_paint (MetaShadow *shadow,
|
|||||||
cogl_pipeline_set_color4ub (shadow->pipeline,
|
cogl_pipeline_set_color4ub (shadow->pipeline,
|
||||||
opacity, opacity, opacity, opacity);
|
opacity, opacity, opacity, opacity);
|
||||||
|
|
||||||
cogl_set_source (shadow->pipeline);
|
|
||||||
|
|
||||||
if (shadow->scale_width)
|
if (shadow->scale_width)
|
||||||
{
|
{
|
||||||
n_x = 3;
|
n_x = 3;
|
||||||
@ -309,10 +308,12 @@ meta_shadow_paint (MetaShadow *shadow,
|
|||||||
if (overlap == CAIRO_REGION_OVERLAP_IN ||
|
if (overlap == CAIRO_REGION_OVERLAP_IN ||
|
||||||
(overlap == CAIRO_REGION_OVERLAP_PART && !clip_strictly))
|
(overlap == CAIRO_REGION_OVERLAP_PART && !clip_strictly))
|
||||||
{
|
{
|
||||||
cogl_rectangle_with_texture_coords (dest_x[i], dest_y[j],
|
cogl_framebuffer_draw_textured_rectangle (framebuffer,
|
||||||
dest_x[i + 1], dest_y[j + 1],
|
shadow->pipeline,
|
||||||
src_x[i], src_y[j],
|
dest_x[i], dest_y[j],
|
||||||
src_x[i + 1], src_y[j + 1]);
|
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)
|
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_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;
|
src_y[j + 1] * (rect.y + rect.height - dest_rect.y)) / dest_rect.height;
|
||||||
|
|
||||||
cogl_rectangle_with_texture_coords (rect.x, rect.y,
|
cogl_framebuffer_draw_textured_rectangle (framebuffer,
|
||||||
rect.x + rect.width, rect.y + rect.height,
|
shadow->pipeline,
|
||||||
src_x1, src_y1, src_x2, src_y2);
|
rect.x, rect.y,
|
||||||
|
rect.x + rect.width, rect.y + rect.height,
|
||||||
|
src_x1, src_y1, src_x2, src_y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_destroy (intersection);
|
cairo_region_destroy (intersection);
|
||||||
|
Loading…
Reference in New Issue
Block a user