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


#include <glib.h>
#include <glib-object.h>


#define PDFPC_RENDERER_CACHE_PNG_TYPE_ITEM (pdfpc_renderer_cache_png_item_get_type ())
#define PDFPC_RENDERER_CACHE_PNG_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_RENDERER_CACHE_PNG_TYPE_ITEM, pdfpcRendererCachePNGItem))
#define PDFPC_RENDERER_CACHE_PNG_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_RENDERER_CACHE_PNG_TYPE_ITEM, pdfpcRendererCachePNGItemClass))
#define PDFPC_RENDERER_CACHE_PNG_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_RENDERER_CACHE_PNG_TYPE_ITEM))
#define PDFPC_RENDERER_CACHE_PNG_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_RENDERER_CACHE_PNG_TYPE_ITEM))
#define PDFPC_RENDERER_CACHE_PNG_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_RENDERER_CACHE_PNG_TYPE_ITEM, pdfpcRendererCachePNGItemClass))

typedef struct _pdfpcRendererCachePNGItem pdfpcRendererCachePNGItem;
typedef struct _pdfpcRendererCachePNGItemClass pdfpcRendererCachePNGItemClass;
typedef struct _pdfpcRendererCachePNGItemPrivate pdfpcRendererCachePNGItemPrivate;

struct _pdfpcRendererCachePNGItem {
	GObject parent_instance;
	pdfpcRendererCachePNGItemPrivate * priv;
	guint8* data;
	gint data_length1;
};

struct _pdfpcRendererCachePNGItemClass {
	GObjectClass parent_class;
};


static gpointer pdfpc_renderer_cache_png_item_parent_class = NULL;

GType pdfpc_renderer_cache_png_item_get_type (void) G_GNUC_CONST;
enum  {
	PDFPC_RENDERER_CACHE_PNG_ITEM_DUMMY_PROPERTY
};
pdfpcRendererCachePNGItem* pdfpc_renderer_cache_png_item_new (guint8* data, int data_length1);
pdfpcRendererCachePNGItem* pdfpc_renderer_cache_png_item_construct (GType object_type, guint8* data, int data_length1);
static guint8* _vala_array_dup3 (guint8* self, int length);
guint8* pdfpc_renderer_cache_png_item_get_png_data (pdfpcRendererCachePNGItem* self, int* result_length1);
static guint8* _vala_array_dup4 (guint8* self, int length);
gint pdfpc_renderer_cache_png_item_get_length (pdfpcRendererCachePNGItem* self);
static void pdfpc_renderer_cache_png_item_finalize (GObject* obj);


/**
         * Create the item from a uchar array
         */
static guint8* _vala_array_dup3 (guint8* self, int length) {
	return g_memdup (self, length * sizeof (guint8));
}


pdfpcRendererCachePNGItem* pdfpc_renderer_cache_png_item_construct (GType object_type, guint8* data, int data_length1) {
	pdfpcRendererCachePNGItem * self = NULL;
	guint8* _tmp0_;
	gint _tmp0__length1;
	guint8* _tmp1_;
	gint _tmp1__length1;
	self = (pdfpcRendererCachePNGItem*) g_object_new (object_type, NULL);
	_tmp0_ = data;
	_tmp0__length1 = data_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup3 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_);
	_tmp1__length1 = _tmp0__length1;
	self->data = (g_free (self->data), NULL);
	self->data = _tmp1_;
	self->data_length1 = _tmp1__length1;
	return self;
}


pdfpcRendererCachePNGItem* pdfpc_renderer_cache_png_item_new (guint8* data, int data_length1) {
	return pdfpc_renderer_cache_png_item_construct (PDFPC_RENDERER_CACHE_PNG_TYPE_ITEM, data, data_length1);
}


/**
         * Return the stored data
         */
static guint8* _vala_array_dup4 (guint8* self, int length) {
	return g_memdup (self, length * sizeof (guint8));
}


guint8* pdfpc_renderer_cache_png_item_get_png_data (pdfpcRendererCachePNGItem* self, int* result_length1) {
	guint8* result = NULL;
	guint8* _tmp0_;
	gint _tmp0__length1;
	guint8* _tmp1_;
	gint _tmp1__length1;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->data;
	_tmp0__length1 = self->data_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup4 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_);
	_tmp1__length1 = _tmp0__length1;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}


/**
         * Shortcut to retrieve the length of the stored dataset
         */
gint pdfpc_renderer_cache_png_item_get_length (pdfpcRendererCachePNGItem* self) {
	gint result = 0;
	guint8* _tmp0_;
	gint _tmp0__length1;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->data;
	_tmp0__length1 = self->data_length1;
	result = _tmp0__length1;
	return result;
}


static void pdfpc_renderer_cache_png_item_class_init (pdfpcRendererCachePNGItemClass * klass) {
	pdfpc_renderer_cache_png_item_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = pdfpc_renderer_cache_png_item_finalize;
}


static void pdfpc_renderer_cache_png_item_instance_init (pdfpcRendererCachePNGItem * self) {
}


static void pdfpc_renderer_cache_png_item_finalize (GObject* obj) {
	pdfpcRendererCachePNGItem * self;
	self = PDFPC_RENDERER_CACHE_PNG_ITEM (obj);
	self->data = (g_free (self->data), NULL);
	G_OBJECT_CLASS (pdfpc_renderer_cache_png_item_parent_class)->finalize (obj);
}


/**
     * PNG picture data stored by the PNG cache engine.
     */
GType pdfpc_renderer_cache_png_item_get_type (void) {
	static volatile gsize pdfpc_renderer_cache_png_item_type_id__volatile = 0;
	if (g_once_init_enter (&pdfpc_renderer_cache_png_item_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (pdfpcRendererCachePNGItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdfpc_renderer_cache_png_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdfpcRendererCachePNGItem), 0, (GInstanceInitFunc) pdfpc_renderer_cache_png_item_instance_init, NULL };
		GType pdfpc_renderer_cache_png_item_type_id;
		pdfpc_renderer_cache_png_item_type_id = g_type_register_static (G_TYPE_OBJECT, "pdfpcRendererCachePNGItem", &g_define_type_info, 0);
		g_once_init_leave (&pdfpc_renderer_cache_png_item_type_id__volatile, pdfpc_renderer_cache_png_item_type_id);
	}
	return pdfpc_renderer_cache_png_item_type_id__volatile;
}



