rendernode: Bail if matrix is invalid

Invalid matrices are okay in GSK (and GL), but not in Cairo.

Testcase included.
This commit is contained in:
Benjamin Otte
2020-12-24 06:32:17 +01:00
parent db08bccb11
commit dee863dbb2
4 changed files with 27 additions and 0 deletions

View File

@@ -2755,6 +2755,16 @@ gsk_transform_node_draw (GskRenderNode *node,
ctm.xx, ctm.yx,
ctm.xy, ctm.yy,
ctm.x0, ctm.y0));
if (xx * yy == xy * yx)
{
/* broken matrix here. This can happen during transitions
* (like when flipping an axis at the point where scale == 0)
* and just means that nothing should be drawn.
* But Cairo thows lots of ugly errors instead of silently
* going on. So We silently go on.
*/
return;
}
cairo_transform (cr, &ctm);
gsk_render_node_draw (self->child, cr);

View File

@@ -0,0 +1,16 @@
transform {
/* break the transform on purpose, because
this is valid in GSK and should result
in nothing being drawn. */
transform: scale(0);
child: color {
color: red;
bounds: 0 0 100 100;
}
}
/* make sure the rendering has a size */
color {
color: transparent;
bounds: 0 0 1 1;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

View File

@@ -48,6 +48,7 @@ compare_render_tests = [
'empty-shadow',
'empty-texture',
'empty-transform',
'invalid-transform',
'opacity_clip',
'outset_shadow_offset_both',
'outset_shadow_offset_x',