lib: decode pixman_format_t into cairo_format_t

This commit is contained in:
Christian Hergert 2023-02-11 09:19:29 -08:00
parent 204271fafd
commit 2a0f0be8c0

View File

@ -199,10 +199,21 @@ mks_paintable_listener_update (MksPaintable *self,
GVariant *bytes, GVariant *bytes,
MksQemuListener *listener) MksQemuListener *listener)
{ {
cairo_format_t format;
g_assert (MKS_IS_PAINTABLE (self)); g_assert (MKS_IS_PAINTABLE (self));
g_assert (G_IS_DBUS_METHOD_INVOCATION (invocation)); g_assert (G_IS_DBUS_METHOD_INVOCATION (invocation));
g_assert (MKS_QEMU_IS_LISTENER (listener)); g_assert (MKS_QEMU_IS_LISTENER (listener));
if (!(format = _pixman_format_to_cairo_format (pixman_format)))
{
g_dbus_method_invocation_return_error_literal (invocation,
G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
"Pixman format not supported");
return TRUE;
}
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self)); gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
g_print ("Update {%d,%d,%d,%d}\n", x, y, width, height); g_print ("Update {%d,%d,%d,%d}\n", x, y, width, height);
@ -221,12 +232,22 @@ mks_paintable_listener_scanout (MksPaintable *self,
GVariant *bytes, GVariant *bytes,
MksQemuListener *listener) MksQemuListener *listener)
{ {
cairo_format_t format;
gboolean size_changed; gboolean size_changed;
g_assert (MKS_IS_PAINTABLE (self)); g_assert (MKS_IS_PAINTABLE (self));
g_assert (G_IS_DBUS_METHOD_INVOCATION (invocation)); g_assert (G_IS_DBUS_METHOD_INVOCATION (invocation));
g_assert (MKS_QEMU_IS_LISTENER (listener)); g_assert (MKS_QEMU_IS_LISTENER (listener));
if (!(format = _pixman_format_to_cairo_format (pixman_format)))
{
g_dbus_method_invocation_return_error_literal (invocation,
G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
"Pixman format not supported");
return TRUE;
}
size_changed = width != self->width || height != self->height; size_changed = width != self->width || height != self->height;
g_print ("Scannout!\n"); g_print ("Scannout!\n");