lib: make cairo formats conditional

This commit is contained in:
Christian Hergert 2023-02-17 16:27:36 -08:00
parent a38ab5834e
commit 4c7711823a
3 changed files with 14 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include <gtk/gtk.h>
#include "mks-cairo-framebuffer-private.h"
#include "mks-util-private.h"
#define TILE_WIDTH 128
#define TILE_HEIGHT 128
@ -216,8 +217,10 @@ mks_cairo_framebuffer_constructed (GObject *object)
case CAIRO_FORMAT_A1:
case CAIRO_FORMAT_RGB16_565:
case CAIRO_FORMAT_RGB30:
#if _CAIRO_CHECK_VERSION(1, 17, 2)
case CAIRO_FORMAT_RGB96F:
case CAIRO_FORMAT_RGBA128F:
#endif
case CAIRO_FORMAT_INVALID:
default:
g_warning ("Unsupported memory format from cairo format: 0x%x",

View File

@ -32,6 +32,7 @@
#include "mks-dmabuf-paintable-private.h"
#include "mks-paintable-private.h"
#include "mks-qemu.h"
#include "mks-util-private.h"
#include "mks-marshal.h"
@ -68,10 +69,13 @@ _pixman_format_to_cairo_format (guint pixman_format)
{
switch (pixman_format)
{
#if _CAIRO_CHECK_VERSION(1, 17, 2)
case PIXMAN_rgba_float:
return CAIRO_FORMAT_RGBA128F;
case PIXMAN_rgb_float:
return CAIRO_FORMAT_RGB96F;
#endif
case PIXMAN_a8r8g8b8:
return CAIRO_FORMAT_ARGB32;
case PIXMAN_x2r10g10b10:

View File

@ -20,10 +20,17 @@
#pragma once
#include <cairo.h>
#include <gdk/gdk.h>
G_BEGIN_DECLS
#define _CAIRO_CHECK_VERSION(major, minor, micro) \
(CAIRO_VERSION_MAJOR > (major) || \
(CAIRO_VERSION_MAJOR == (major) && CAIRO_VERSION_MINOR > (minor)) || \
(CAIRO_VERSION_MAJOR == (major) && CAIRO_VERSION_MINOR == (minor) && \
CAIRO_VERSION_MICRO >= (micro)))
gboolean mks_scroll_event_is_inverted (GdkEvent *event);
G_END_DECLS