From dee863dbb2bb2ed8b5922b2a1f9d5f5dea2dcbcc Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 24 Dec 2020 06:32:17 +0100 Subject: rendernode: Bail if matrix is invalid Invalid matrices are okay in GSK (and GL), but not in Cairo. Testcase included. --- gsk/gskrendernodeimpl.c | 10 ++++++++++ testsuite/gsk/compare/invalid-transform.node | 16 ++++++++++++++++ testsuite/gsk/compare/invalid-transform.png | Bin 0 -> 86 bytes testsuite/gsk/meson.build | 1 + 4 files changed, 27 insertions(+) create mode 100644 testsuite/gsk/compare/invalid-transform.node create mode 100644 testsuite/gsk/compare/invalid-transform.png diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c index aa19233f4e..6d9a3fd50f 100644 --- a/gsk/gskrendernodeimpl.c +++ b/gsk/gskrendernodeimpl.c @@ -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); diff --git a/testsuite/gsk/compare/invalid-transform.node b/testsuite/gsk/compare/invalid-transform.node new file mode 100644 index 0000000000..3e34173c92 --- /dev/null +++ b/testsuite/gsk/compare/invalid-transform.node @@ -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; +} \ No newline at end of file diff --git a/testsuite/gsk/compare/invalid-transform.png b/testsuite/gsk/compare/invalid-transform.png new file mode 100644 index 0000000000..7238a64657 Binary files /dev/null and b/testsuite/gsk/compare/invalid-transform.png differ diff --git a/testsuite/gsk/meson.build b/testsuite/gsk/meson.build index ccd29dff5b..c23d371e3e 100644 --- a/testsuite/gsk/meson.build +++ b/testsuite/gsk/meson.build @@ -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', -- cgit v1.2.1 From 2a8f3716438868e3734b70b30ebbcc7942015585 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 17 Dec 2020 22:20:17 +0100 Subject: gtk-demo: Don't put the search bar in the scroll area 1. That's a bad idea UI wise as you can't see the search after you scrolled. 2. That's a bad idea code-wise because Listviews need to be put into a ScrolledWindow or they won't scroll. --- demos/gtk-demo/main.ui | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/demos/gtk-demo/main.ui b/demos/gtk-demo/main.ui index b4161c9519..b602c9a246 100644 --- a/demos/gtk-demo/main.ui +++ b/demos/gtk-demo/main.ui @@ -53,31 +53,30 @@ - - - 120 - never - 150 + + 220 + vertical - - 220 - vertical - + + window - - window - - - - listview - - - + + + listview + - + + + + + + 120 + never + 150 + 1