1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
/*
* gulkan
* Copyright 2018 Collabora Ltd.
* Author: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
* SPDX-License-Identifier: MIT
*/
#include "gulkan.h"
static GdkPixbuf *
load_gdk_pixbuf ()
{
GError *error = NULL;
GdkPixbuf * pixbuf_rgb =
gdk_pixbuf_new_from_resource ("/res/cat.jpg", &error);
g_assert_null (error);
GdkPixbuf *pixbuf = gdk_pixbuf_add_alpha (pixbuf_rgb, FALSE, 0, 0, 0);
g_object_unref (pixbuf_rgb);
return pixbuf;
}
static void
_test_pixbuf ()
{
GdkPixbuf * pixbuf = load_gdk_pixbuf ();
g_assert_nonnull (pixbuf);
g_object_unref (pixbuf);
}
static void
_test_pixbuf_texture ()
{
GdkPixbuf * pixbuf = load_gdk_pixbuf ();
g_assert_nonnull (pixbuf);
GulkanClient *client = gulkan_client_new ();
g_assert_nonnull (client);
GulkanTexture *texture =
gulkan_texture_new_from_pixbuf (client, pixbuf,
VK_FORMAT_R8G8B8A8_UNORM,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
FALSE);
g_assert_nonnull (texture);
g_object_unref (texture);
g_object_unref (client);
g_object_unref (pixbuf);
}
int
main ()
{
_test_pixbuf ();
_test_pixbuf_texture ();
return 0;
}
|