Taken from https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/subprojects/gst-plugins-good/tests/examples/cairo/cairo_overlay.c?ref_type=heads