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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
|
/* engine.c generated by valac 0.16.0, the Vala compiler
* generated from engine.vala, do not modify */
#include <glib.h>
#include <glib-object.h>
#include <gdk/gdk.h>
#define PDFPC_RENDERER_CACHE_TYPE_BASE (pdfpc_renderer_cache_base_get_type ())
#define PDFPC_RENDERER_CACHE_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_RENDERER_CACHE_TYPE_BASE, pdfpcRendererCacheBase))
#define PDFPC_RENDERER_CACHE_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_RENDERER_CACHE_TYPE_BASE, pdfpcRendererCacheBaseClass))
#define PDFPC_RENDERER_CACHE_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_RENDERER_CACHE_TYPE_BASE))
#define PDFPC_RENDERER_CACHE_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_RENDERER_CACHE_TYPE_BASE))
#define PDFPC_RENDERER_CACHE_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_RENDERER_CACHE_TYPE_BASE, pdfpcRendererCacheBaseClass))
typedef struct _pdfpcRendererCacheBase pdfpcRendererCacheBase;
typedef struct _pdfpcRendererCacheBaseClass pdfpcRendererCacheBaseClass;
typedef struct _pdfpcRendererCacheBasePrivate pdfpcRendererCacheBasePrivate;
#define PDFPC_METADATA_TYPE_BASE (pdfpc_metadata_base_get_type ())
#define PDFPC_METADATA_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_METADATA_TYPE_BASE, pdfpcMetadataBase))
#define PDFPC_METADATA_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_METADATA_TYPE_BASE, pdfpcMetadataBaseClass))
#define PDFPC_METADATA_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_METADATA_TYPE_BASE))
#define PDFPC_METADATA_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_METADATA_TYPE_BASE))
#define PDFPC_METADATA_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_METADATA_TYPE_BASE, pdfpcMetadataBaseClass))
typedef struct _pdfpcMetadataBase pdfpcMetadataBase;
typedef struct _pdfpcMetadataBaseClass pdfpcMetadataBaseClass;
#define PDFPC_RENDERER_CACHE_SIMPLE_TYPE_ENGINE (pdfpc_renderer_cache_simple_engine_get_type ())
#define PDFPC_RENDERER_CACHE_SIMPLE_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_RENDERER_CACHE_SIMPLE_TYPE_ENGINE, pdfpcRendererCacheSimpleEngine))
#define PDFPC_RENDERER_CACHE_SIMPLE_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_RENDERER_CACHE_SIMPLE_TYPE_ENGINE, pdfpcRendererCacheSimpleEngineClass))
#define PDFPC_RENDERER_CACHE_SIMPLE_IS_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_RENDERER_CACHE_SIMPLE_TYPE_ENGINE))
#define PDFPC_RENDERER_CACHE_SIMPLE_IS_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_RENDERER_CACHE_SIMPLE_TYPE_ENGINE))
#define PDFPC_RENDERER_CACHE_SIMPLE_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_RENDERER_CACHE_SIMPLE_TYPE_ENGINE, pdfpcRendererCacheSimpleEngineClass))
typedef struct _pdfpcRendererCacheSimpleEngine pdfpcRendererCacheSimpleEngine;
typedef struct _pdfpcRendererCacheSimpleEngineClass pdfpcRendererCacheSimpleEngineClass;
typedef struct _pdfpcRendererCacheSimpleEnginePrivate pdfpcRendererCacheSimpleEnginePrivate;
#define _g_mutex_free0(var) ((var == NULL) ? NULL : (var = (g_mutex_free (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
struct _pdfpcRendererCacheBase {
GObject parent_instance;
pdfpcRendererCacheBasePrivate * priv;
pdfpcMetadataBase* metadata;
};
struct _pdfpcRendererCacheBaseClass {
GObjectClass parent_class;
void (*store) (pdfpcRendererCacheBase* self, guint index, GdkPixmap* pixmap);
GdkPixmap* (*retrieve) (pdfpcRendererCacheBase* self, guint index);
};
struct _pdfpcRendererCacheSimpleEngine {
pdfpcRendererCacheBase parent_instance;
pdfpcRendererCacheSimpleEnginePrivate * priv;
GdkPixmap** storage;
gint storage_length1;
GMutex* mutex;
};
struct _pdfpcRendererCacheSimpleEngineClass {
pdfpcRendererCacheBaseClass parent_class;
};
static gpointer pdfpc_renderer_cache_simple_engine_parent_class = NULL;
GType pdfpc_renderer_cache_base_get_type (void) G_GNUC_CONST;
GType pdfpc_metadata_base_get_type (void) G_GNUC_CONST;
GType pdfpc_renderer_cache_simple_engine_get_type (void) G_GNUC_CONST;
enum {
PDFPC_RENDERER_CACHE_SIMPLE_ENGINE_DUMMY_PROPERTY
};
pdfpcRendererCacheSimpleEngine* pdfpc_renderer_cache_simple_engine_new (pdfpcMetadataBase* metadata);
pdfpcRendererCacheSimpleEngine* pdfpc_renderer_cache_simple_engine_construct (GType object_type, pdfpcMetadataBase* metadata);
pdfpcRendererCacheBase* pdfpc_renderer_cache_base_construct (GType object_type, pdfpcMetadataBase* metadata);
guint pdfpc_metadata_base_get_slide_count (pdfpcMetadataBase* self);
static void pdfpc_renderer_cache_simple_engine_real_store (pdfpcRendererCacheBase* base, guint index, GdkPixmap* pixmap);
static GdkPixmap* pdfpc_renderer_cache_simple_engine_real_retrieve (pdfpcRendererCacheBase* base, guint index);
static void pdfpc_renderer_cache_simple_engine_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
/**
* Initialize the cache store
*/
pdfpcRendererCacheSimpleEngine* pdfpc_renderer_cache_simple_engine_construct (GType object_type, pdfpcMetadataBase* metadata) {
pdfpcRendererCacheSimpleEngine * self = NULL;
pdfpcMetadataBase* _tmp0_;
GMutex* _tmp1_;
pdfpcMetadataBase* _tmp2_;
guint _tmp3_ = 0U;
GdkPixmap** _tmp4_ = NULL;
GMutex* _tmp5_;
g_return_val_if_fail (metadata != NULL, NULL);
_tmp0_ = metadata;
self = (pdfpcRendererCacheSimpleEngine*) pdfpc_renderer_cache_base_construct (object_type, _tmp0_);
_tmp1_ = self->mutex;
g_mutex_lock (_tmp1_);
_tmp2_ = ((pdfpcRendererCacheBase*) self)->metadata;
_tmp3_ = pdfpc_metadata_base_get_slide_count (_tmp2_);
_tmp4_ = g_new0 (GdkPixmap*, _tmp3_ + 1);
self->storage = (_vala_array_free (self->storage, self->storage_length1, (GDestroyNotify) g_object_unref), NULL);
self->storage = _tmp4_;
self->storage_length1 = _tmp3_;
_tmp5_ = self->mutex;
g_mutex_unlock (_tmp5_);
return self;
}
pdfpcRendererCacheSimpleEngine* pdfpc_renderer_cache_simple_engine_new (pdfpcMetadataBase* metadata) {
return pdfpc_renderer_cache_simple_engine_construct (PDFPC_RENDERER_CACHE_SIMPLE_TYPE_ENGINE, metadata);
}
/**
* Store a pixmap in the cache using the given index as identifier
*/
static gpointer _g_object_ref0 (gpointer self) {
return self ? g_object_ref (self) : NULL;
}
static void pdfpc_renderer_cache_simple_engine_real_store (pdfpcRendererCacheBase* base, guint index, GdkPixmap* pixmap) {
pdfpcRendererCacheSimpleEngine * self;
GMutex* _tmp0_;
GdkPixmap** _tmp1_;
gint _tmp1__length1;
guint _tmp2_;
GdkPixmap* _tmp3_;
GdkPixmap* _tmp4_;
GdkPixmap* _tmp5_;
GMutex* _tmp6_;
self = (pdfpcRendererCacheSimpleEngine*) base;
g_return_if_fail (pixmap != NULL);
_tmp0_ = self->mutex;
g_mutex_lock (_tmp0_);
_tmp1_ = self->storage;
_tmp1__length1 = self->storage_length1;
_tmp2_ = index;
_tmp3_ = pixmap;
_tmp4_ = _g_object_ref0 (_tmp3_);
_g_object_unref0 (_tmp1_[_tmp2_]);
_tmp1_[_tmp2_] = _tmp4_;
_tmp5_ = _tmp1_[_tmp2_];
_tmp6_ = self->mutex;
g_mutex_unlock (_tmp6_);
}
/**
* Retrieve a stored pixmap from the cache.
*
* If no item with the given index is available null is returned
*/
static GdkPixmap* pdfpc_renderer_cache_simple_engine_real_retrieve (pdfpcRendererCacheBase* base, guint index) {
pdfpcRendererCacheSimpleEngine * self;
GdkPixmap* result = NULL;
GdkPixmap** _tmp0_;
gint _tmp0__length1;
guint _tmp1_;
GdkPixmap* _tmp2_;
GdkPixmap* _tmp3_;
self = (pdfpcRendererCacheSimpleEngine*) base;
_tmp0_ = self->storage;
_tmp0__length1 = self->storage_length1;
_tmp1_ = index;
_tmp2_ = _tmp0_[_tmp1_];
_tmp3_ = _g_object_ref0 (_tmp2_);
result = _tmp3_;
return result;
}
static void pdfpc_renderer_cache_simple_engine_class_init (pdfpcRendererCacheSimpleEngineClass * klass) {
pdfpc_renderer_cache_simple_engine_parent_class = g_type_class_peek_parent (klass);
PDFPC_RENDERER_CACHE_BASE_CLASS (klass)->store = pdfpc_renderer_cache_simple_engine_real_store;
PDFPC_RENDERER_CACHE_BASE_CLASS (klass)->retrieve = pdfpc_renderer_cache_simple_engine_real_retrieve;
G_OBJECT_CLASS (klass)->finalize = pdfpc_renderer_cache_simple_engine_finalize;
}
static void pdfpc_renderer_cache_simple_engine_instance_init (pdfpcRendererCacheSimpleEngine * self) {
GMutex* _tmp0_;
self->storage = NULL;
_tmp0_ = g_mutex_new ();
self->mutex = _tmp0_;
}
static void pdfpc_renderer_cache_simple_engine_finalize (GObject* obj) {
pdfpcRendererCacheSimpleEngine * self;
self = PDFPC_RENDERER_CACHE_SIMPLE_ENGINE (obj);
self->storage = (_vala_array_free (self->storage, self->storage_length1, (GDestroyNotify) g_object_unref), NULL);
_g_mutex_free0 (self->mutex);
G_OBJECT_CLASS (pdfpc_renderer_cache_simple_engine_parent_class)->finalize (obj);
}
/**
* Cache store which simply holds all given items in memory.
*/
GType pdfpc_renderer_cache_simple_engine_get_type (void) {
static volatile gsize pdfpc_renderer_cache_simple_engine_type_id__volatile = 0;
if (g_once_init_enter (&pdfpc_renderer_cache_simple_engine_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (pdfpcRendererCacheSimpleEngineClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdfpc_renderer_cache_simple_engine_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdfpcRendererCacheSimpleEngine), 0, (GInstanceInitFunc) pdfpc_renderer_cache_simple_engine_instance_init, NULL };
GType pdfpc_renderer_cache_simple_engine_type_id;
pdfpc_renderer_cache_simple_engine_type_id = g_type_register_static (PDFPC_RENDERER_CACHE_TYPE_BASE, "pdfpcRendererCacheSimpleEngine", &g_define_type_info, 0);
g_once_init_leave (&pdfpc_renderer_cache_simple_engine_type_id__volatile, pdfpc_renderer_cache_simple_engine_type_id);
}
return pdfpc_renderer_cache_simple_engine_type_id__volatile;
}
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
if ((array != NULL) && (destroy_func != NULL)) {
int i;
for (i = 0; i < array_length; i = i + 1) {
if (((gpointer*) array)[i] != NULL) {
destroy_func (((gpointer*) array)[i]);
}
}
}
}
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
_vala_array_destroy (array, array_length, destroy_func);
g_free (array);
}
|