mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-06-19 01:58:39 +02:00
cogl: Fix crash when specifying only mask surface
Cogl enters into an infinite recursion if a texture is specified for layer 1 of a pipeline but no texture is specified for layer 0. This works around the bug by setting the mask texture on layer 0 if there is no source texture. Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
This commit is contained in:
parent
75d843208c
commit
fc8e68b37a
1 changed files with 12 additions and 3 deletions
|
|
@ -1746,6 +1746,7 @@ get_source_mask_operator_destination_pipeline (const cairo_pattern_t *mask,
|
|||
{
|
||||
cairo_cogl_template_type template_type;
|
||||
CoglPipeline *pipeline;
|
||||
int layer_counter = 0;
|
||||
|
||||
switch ((int)source->type)
|
||||
{
|
||||
|
|
@ -1783,7 +1784,10 @@ get_source_mask_operator_destination_pipeline (const cairo_pattern_t *mask,
|
|||
&attributes);
|
||||
if (!texture)
|
||||
goto BAIL;
|
||||
set_layer_texture_with_attributes (pipeline, 0, texture, &attributes);
|
||||
set_layer_texture_with_attributes (pipeline,
|
||||
layer_counter++,
|
||||
texture,
|
||||
&attributes);
|
||||
cogl_object_unref (texture);
|
||||
}
|
||||
|
||||
|
|
@ -1796,7 +1800,9 @@ get_source_mask_operator_destination_pipeline (const cairo_pattern_t *mask,
|
|||
solid_pattern->color.green * solid_pattern->color.alpha,
|
||||
solid_pattern->color.blue * solid_pattern->color.alpha,
|
||||
solid_pattern->color.alpha);
|
||||
cogl_pipeline_set_layer_combine_constant (pipeline, 1, &color);
|
||||
cogl_pipeline_set_layer_combine_constant (pipeline,
|
||||
layer_counter++,
|
||||
&color);
|
||||
} else {
|
||||
cairo_cogl_texture_attributes_t attributes;
|
||||
CoglTexture *texture =
|
||||
|
|
@ -1806,7 +1812,10 @@ get_source_mask_operator_destination_pipeline (const cairo_pattern_t *mask,
|
|||
&attributes);
|
||||
if (!texture)
|
||||
goto BAIL;
|
||||
set_layer_texture_with_attributes (pipeline, 1, texture, &attributes);
|
||||
set_layer_texture_with_attributes (pipeline,
|
||||
layer_counter++,
|
||||
texture,
|
||||
&attributes);
|
||||
cogl_object_unref (texture);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue