/* image_utils.c generated by valac 0.56.19, the Vala compiler
 * generated from image_utils.vala, do not modify */

#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdk.h>
#include <glib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))

VALA_EXTERN GdkTexture* dc_texture_from_pixbuf (GdkPixbuf* pixbuf);

GdkTexture*
dc_texture_from_pixbuf (GdkPixbuf* pixbuf)
{
	GdkMemoryFormat _tmp0_ = 0;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GdkMemoryFormat format = 0;
	gint _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	GBytes* _tmp7_;
	GBytes* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	GdkMemoryTexture* _tmp11_;
	GdkTexture* _tmp12_;
	GdkTexture* result;
	g_return_val_if_fail (pixbuf != NULL, NULL);
	_tmp1_ = gdk_pixbuf_get_has_alpha (pixbuf);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		_tmp0_ = GDK_MEMORY_R8G8B8A8;
	} else {
		_tmp0_ = GDK_MEMORY_R8G8B8;
	}
	format = _tmp0_;
	_tmp3_ = gdk_pixbuf_get_width (pixbuf);
	_tmp4_ = _tmp3_;
	_tmp5_ = gdk_pixbuf_get_height (pixbuf);
	_tmp6_ = _tmp5_;
	_tmp7_ = gdk_pixbuf_read_pixel_bytes (pixbuf);
	_tmp8_ = _tmp7_;
	_tmp9_ = gdk_pixbuf_get_rowstride (pixbuf);
	_tmp10_ = _tmp9_;
	_tmp11_ = (GdkMemoryTexture*) gdk_memory_texture_new (_tmp4_, _tmp6_, format, _tmp8_, (gsize) _tmp10_);
	_tmp12_ = (GdkTexture*) _tmp11_;
	_g_bytes_unref0 (_tmp8_);
	result = _tmp12_;
	return result;
}

