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

#include "livechart_static.h"
#include <glib.h>
#include <cairo-gobject.h>
#include <float.h>
#include <math.h>
#include <string.h>
#include <glib-object.h>
#include <gdk/gdk.h>
#include <stdlib.h>

#define LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_VIRTUAL_LEFT_PADDING -200

enum  {
	LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_0_PROPERTY,
	LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_VISIBLE_PROPERTY,
	LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_LINE_PROPERTY,
	LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_NUM_PROPERTIES
};
static GParamSpec* live_chart_static_static_serie_renderer_properties[LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _LiveChartStaticStaticSerieRendererPrivate {
	gboolean _visible;
	LiveChartPath* _line;
};

static gint LiveChartStaticStaticSerieRenderer_private_offset;
static gpointer live_chart_static_static_serie_renderer_parent_class = NULL;
static LiveChartDrawableIface * live_chart_static_static_serie_renderer_live_chart_drawable_parent_iface = NULL;

static void live_chart_static_static_serie_renderer_real_draw (LiveChartStaticStaticSerieRenderer* self,
                                                        cairo_t* ctx,
                                                        LiveChartConfig* config);
static void live_chart_static_static_serie_renderer_real_get_bounding_box (LiveChartDrawable* base,
                                                                    LiveChartBoundingBox* result);
static void live_chart_static_static_serie_renderer_finalize (GObject * obj);
static GType live_chart_static_static_serie_renderer_get_type_once (void);
static void _vala_live_chart_static_static_serie_renderer_get_property (GObject * object,
                                                                 guint property_id,
                                                                 GValue * value,
                                                                 GParamSpec * pspec);
static void _vala_live_chart_static_static_serie_renderer_set_property (GObject * object,
                                                                 guint property_id,
                                                                 const GValue * value,
                                                                 GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
live_chart_static_static_serie_renderer_get_instance_private (LiveChartStaticStaticSerieRenderer* self)
{
	return G_STRUCT_MEMBER_P (self, LiveChartStaticStaticSerieRenderer_private_offset);
}

LiveChartStaticStaticSerieRenderer*
live_chart_static_static_serie_renderer_construct (GType object_type)
{
	LiveChartStaticStaticSerieRenderer * self = NULL;
	GdkRGBA _tmp0_ = {0};
	LiveChartPath* _tmp1_;
	LiveChartPath* _tmp2_;
#line 14 "../src/static/static_serie_renderer.vala"
	self = (LiveChartStaticStaticSerieRenderer*) g_object_new (object_type, NULL);
#line 15 "../src/static/static_serie_renderer.vala"
	_tmp0_.red = 1.0;
#line 15 "../src/static/static_serie_renderer.vala"
	_tmp0_.green = 1.0;
#line 15 "../src/static/static_serie_renderer.vala"
	_tmp0_.blue = 1.0;
#line 15 "../src/static/static_serie_renderer.vala"
	_tmp0_.alpha = 1.0;
#line 15 "../src/static/static_serie_renderer.vala"
	_tmp1_ = live_chart_path_new ((gdouble) 1, &_tmp0_, TRUE, NULL);
#line 15 "../src/static/static_serie_renderer.vala"
	_tmp2_ = _tmp1_;
#line 15 "../src/static/static_serie_renderer.vala"
	live_chart_static_static_serie_renderer_set_line (self, _tmp2_);
#line 15 "../src/static/static_serie_renderer.vala"
	_g_object_unref0 (_tmp2_);
#line 14 "../src/static/static_serie_renderer.vala"
	return self;
#line 87 "static_serie_renderer.c"
}

static gpointer
_g_object_ref0 (gpointer self)
{
#line 27 "../src/static/static_serie_renderer.vala"
	return self ? g_object_ref (self) : NULL;
#line 95 "static_serie_renderer.c"
}

LiveChartStaticStaticValues*
live_chart_static_static_serie_renderer_get_values (LiveChartStaticStaticSerieRenderer* self)
{
	LiveChartStaticStaticValues* _tmp0_;
	LiveChartStaticStaticValues* _tmp1_;
	LiveChartStaticStaticValues* result;
#line 26 "../src/static/static_serie_renderer.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 27 "../src/static/static_serie_renderer.vala"
	_tmp0_ = self->values;
#line 27 "../src/static/static_serie_renderer.vala"
	_tmp1_ = _g_object_ref0 (_tmp0_);
#line 27 "../src/static/static_serie_renderer.vala"
	result = _tmp1_;
#line 27 "../src/static/static_serie_renderer.vala"
	return result;
#line 114 "static_serie_renderer.c"
}

static void
live_chart_static_static_serie_renderer_real_draw (LiveChartStaticStaticSerieRenderer* self,
                                                   cairo_t* ctx,
                                                   LiveChartConfig* config)
{
#line 30 "../src/static/static_serie_renderer.vala"
	g_critical ("Type `%s' does not implement abstract method `live_chart_static_static_serie_renderer_draw'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
#line 30 "../src/static/static_serie_renderer.vala"
	return;
#line 126 "static_serie_renderer.c"
}

void
live_chart_static_static_serie_renderer_draw (LiveChartStaticStaticSerieRenderer* self,
                                              cairo_t* ctx,
                                              LiveChartConfig* config)
{
	LiveChartStaticStaticSerieRendererClass* _klass_;
#line 30 "../src/static/static_serie_renderer.vala"
	g_return_if_fail (self != NULL);
#line 30 "../src/static/static_serie_renderer.vala"
	_klass_ = LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_GET_CLASS (self);
#line 30 "../src/static/static_serie_renderer.vala"
	if (_klass_->draw) {
#line 30 "../src/static/static_serie_renderer.vala"
		_klass_->draw (self, ctx, config);
#line 143 "static_serie_renderer.c"
	}
}

static void
live_chart_static_static_serie_renderer_real_get_bounding_box (LiveChartDrawable* base,
                                                               LiveChartBoundingBox* result)
{
	LiveChartStaticStaticSerieRenderer * self;
	LiveChartBoundingBox _tmp0_;
#line 31 "../src/static/static_serie_renderer.vala"
	self = (LiveChartStaticStaticSerieRenderer*) base;
#line 32 "../src/static/static_serie_renderer.vala"
	_tmp0_ = self->bounding_box;
#line 32 "../src/static/static_serie_renderer.vala"
	*result = _tmp0_;
#line 32 "../src/static/static_serie_renderer.vala"
	return;
#line 161 "static_serie_renderer.c"
}

void
live_chart_static_static_serie_renderer_debug (LiveChartStaticStaticSerieRenderer* self,
                                               cairo_t* ctx)
{
	gchar* debug = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
#line 35 "../src/static/static_serie_renderer.vala"
	g_return_if_fail (self != NULL);
#line 35 "../src/static/static_serie_renderer.vala"
	g_return_if_fail (ctx != NULL);
#line 36 "../src/static/static_serie_renderer.vala"
	_tmp0_ = g_getenv ("LIVE_CHART_DEBUG");
#line 36 "../src/static/static_serie_renderer.vala"
	_tmp1_ = g_strdup (_tmp0_);
#line 36 "../src/static/static_serie_renderer.vala"
	debug = _tmp1_;
#line 37 "../src/static/static_serie_renderer.vala"
	_tmp2_ = debug;
#line 37 "../src/static/static_serie_renderer.vala"
	if (_tmp2_ != NULL) {
#line 186 "static_serie_renderer.c"
		LiveChartBoundingBox _tmp3_;
		LiveChartBoundingBox _tmp4_;
		LiveChartBoundingBox _tmp5_;
		LiveChartBoundingBox _tmp6_;
#line 38 "../src/static/static_serie_renderer.vala"
		_tmp3_ = self->bounding_box;
#line 38 "../src/static/static_serie_renderer.vala"
		_tmp4_ = self->bounding_box;
#line 38 "../src/static/static_serie_renderer.vala"
		_tmp5_ = self->bounding_box;
#line 38 "../src/static/static_serie_renderer.vala"
		_tmp6_ = self->bounding_box;
#line 38 "../src/static/static_serie_renderer.vala"
		cairo_rectangle (ctx, _tmp3_.x, _tmp4_.y, _tmp5_.width, _tmp6_.height);
#line 39 "../src/static/static_serie_renderer.vala"
		cairo_stroke (ctx);
#line 203 "static_serie_renderer.c"
	}
#line 35 "../src/static/static_serie_renderer.vala"
	_g_free0 (debug);
#line 207 "static_serie_renderer.c"
}

gboolean
live_chart_static_static_serie_renderer_is_out_of_area (LiveChartStaticStaticSerieRenderer* self,
                                                        LiveChartPoint* point)
{
	LiveChartPoint _tmp0_;
	gboolean result;
#line 43 "../src/static/static_serie_renderer.vala"
	g_return_val_if_fail (self != NULL, FALSE);
#line 43 "../src/static/static_serie_renderer.vala"
	g_return_val_if_fail (point != NULL, FALSE);
#line 44 "../src/static/static_serie_renderer.vala"
	_tmp0_ = *point;
#line 44 "../src/static/static_serie_renderer.vala"
	result = _tmp0_.x < ((gdouble) LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_VIRTUAL_LEFT_PADDING);
#line 44 "../src/static/static_serie_renderer.vala"
	return result;
#line 226 "static_serie_renderer.c"
}

static gboolean
live_chart_static_static_serie_renderer_real_get_visible (LiveChartDrawable* base)
{
	gboolean result;
	LiveChartStaticStaticSerieRenderer* self;
#line 10 "../src/static/static_serie_renderer.vala"
	self = (LiveChartStaticStaticSerieRenderer*) base;
#line 10 "../src/static/static_serie_renderer.vala"
	result = self->priv->_visible;
#line 10 "../src/static/static_serie_renderer.vala"
	return result;
#line 240 "static_serie_renderer.c"
}

static void
live_chart_static_static_serie_renderer_real_set_visible (LiveChartDrawable* base,
                                                          gboolean value)
{
	LiveChartStaticStaticSerieRenderer* self;
	gboolean old_value;
#line 10 "../src/static/static_serie_renderer.vala"
	self = (LiveChartStaticStaticSerieRenderer*) base;
#line 10 "../src/static/static_serie_renderer.vala"
	old_value = live_chart_static_static_serie_renderer_real_get_visible (base);
#line 10 "../src/static/static_serie_renderer.vala"
	if (old_value != value) {
#line 10 "../src/static/static_serie_renderer.vala"
		self->priv->_visible = value;
#line 10 "../src/static/static_serie_renderer.vala"
		g_object_notify_by_pspec ((GObject *) self, live_chart_static_static_serie_renderer_properties[LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_VISIBLE_PROPERTY]);
#line 259 "static_serie_renderer.c"
	}
}

LiveChartPath*
live_chart_static_static_serie_renderer_get_line (LiveChartStaticStaticSerieRenderer* self)
{
	LiveChartPath* result;
	LiveChartPath* _tmp0_;
#line 12 "../src/static/static_serie_renderer.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 12 "../src/static/static_serie_renderer.vala"
	_tmp0_ = self->priv->_line;
#line 12 "../src/static/static_serie_renderer.vala"
	result = _tmp0_;
#line 12 "../src/static/static_serie_renderer.vala"
	return result;
#line 276 "static_serie_renderer.c"
}

void
live_chart_static_static_serie_renderer_set_line (LiveChartStaticStaticSerieRenderer* self,
                                                  LiveChartPath* value)
{
	LiveChartPath* old_value;
#line 12 "../src/static/static_serie_renderer.vala"
	g_return_if_fail (self != NULL);
#line 12 "../src/static/static_serie_renderer.vala"
	old_value = live_chart_static_static_serie_renderer_get_line (self);
#line 12 "../src/static/static_serie_renderer.vala"
	if (old_value != value) {
#line 290 "static_serie_renderer.c"
		LiveChartPath* _tmp0_;
#line 12 "../src/static/static_serie_renderer.vala"
		_tmp0_ = _g_object_ref0 (value);
#line 12 "../src/static/static_serie_renderer.vala"
		_g_object_unref0 (self->priv->_line);
#line 12 "../src/static/static_serie_renderer.vala"
		self->priv->_line = _tmp0_;
#line 12 "../src/static/static_serie_renderer.vala"
		g_object_notify_by_pspec ((GObject *) self, live_chart_static_static_serie_renderer_properties[LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_LINE_PROPERTY]);
#line 300 "static_serie_renderer.c"
	}
}

static void
live_chart_static_static_serie_renderer_class_init (LiveChartStaticStaticSerieRendererClass * klass,
                                                    gpointer klass_data)
{
#line 6 "../src/static/static_serie_renderer.vala"
	live_chart_static_static_serie_renderer_parent_class = g_type_class_peek_parent (klass);
#line 6 "../src/static/static_serie_renderer.vala"
	g_type_class_adjust_private_offset (klass, &LiveChartStaticStaticSerieRenderer_private_offset);
#line 6 "../src/static/static_serie_renderer.vala"
	((LiveChartStaticStaticSerieRendererClass *) klass)->draw = (void (*) (LiveChartStaticStaticSerieRenderer*, cairo_t*, LiveChartConfig*)) live_chart_static_static_serie_renderer_real_draw;
#line 6 "../src/static/static_serie_renderer.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_live_chart_static_static_serie_renderer_get_property;
#line 6 "../src/static/static_serie_renderer.vala"
	G_OBJECT_CLASS (klass)->set_property = _vala_live_chart_static_static_serie_renderer_set_property;
#line 6 "../src/static/static_serie_renderer.vala"
	G_OBJECT_CLASS (klass)->finalize = live_chart_static_static_serie_renderer_finalize;
#line 6 "../src/static/static_serie_renderer.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_VISIBLE_PROPERTY, live_chart_static_static_serie_renderer_properties[LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_VISIBLE_PROPERTY] = g_param_spec_boolean ("visible", "visible", "visible", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 6 "../src/static/static_serie_renderer.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_LINE_PROPERTY, live_chart_static_static_serie_renderer_properties[LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_LINE_PROPERTY] = g_param_spec_object ("line", "line", "line", LIVE_CHART_TYPE_PATH, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 324 "static_serie_renderer.c"
}

static void
live_chart_static_static_serie_renderer_live_chart_drawable_interface_init (LiveChartDrawableIface * iface,
                                                                            gpointer iface_data)
{
#line 6 "../src/static/static_serie_renderer.vala"
	live_chart_static_static_serie_renderer_live_chart_drawable_parent_iface = g_type_interface_peek_parent (iface);
#line 6 "../src/static/static_serie_renderer.vala"
	iface->draw = (void (*) (LiveChartDrawable*, cairo_t*, LiveChartConfig*)) live_chart_static_static_serie_renderer_draw;
#line 6 "../src/static/static_serie_renderer.vala"
	iface->get_bounding_box = (void (*) (LiveChartDrawable*, LiveChartBoundingBox*)) live_chart_static_static_serie_renderer_real_get_bounding_box;
#line 6 "../src/static/static_serie_renderer.vala"
	iface->get_visible = live_chart_static_static_serie_renderer_real_get_visible;
#line 6 "../src/static/static_serie_renderer.vala"
	iface->set_visible = live_chart_static_static_serie_renderer_real_set_visible;
#line 341 "static_serie_renderer.c"
}

static void
live_chart_static_static_serie_renderer_instance_init (LiveChartStaticStaticSerieRenderer * self,
                                                       gpointer klass)
{
	LiveChartBoundingBox _tmp0_ = {0};
#line 6 "../src/static/static_serie_renderer.vala"
	self->priv = live_chart_static_static_serie_renderer_get_instance_private (self);
#line 10 "../src/static/static_serie_renderer.vala"
	self->priv->_visible = TRUE;
#line 18 "../src/static/static_serie_renderer.vala"
	memset (&_tmp0_, 0, sizeof (LiveChartBoundingBox));
#line 18 "../src/static/static_serie_renderer.vala"
	_tmp0_.x = (gdouble) 0;
#line 18 "../src/static/static_serie_renderer.vala"
	_tmp0_.y = (gdouble) 0;
#line 18 "../src/static/static_serie_renderer.vala"
	_tmp0_.width = (gdouble) 0;
#line 18 "../src/static/static_serie_renderer.vala"
	_tmp0_.height = (gdouble) 0;
#line 18 "../src/static/static_serie_renderer.vala"
	self->bounding_box = _tmp0_;
#line 365 "static_serie_renderer.c"
}

static void
live_chart_static_static_serie_renderer_finalize (GObject * obj)
{
	LiveChartStaticStaticSerieRenderer * self;
#line 6 "../src/static/static_serie_renderer.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, LIVE_CHART_STATIC_TYPE_STATIC_SERIE_RENDERER, LiveChartStaticStaticSerieRenderer);
#line 12 "../src/static/static_serie_renderer.vala"
	_g_object_unref0 (self->priv->_line);
#line 25 "../src/static/static_serie_renderer.vala"
	_g_object_unref0 (self->values);
#line 6 "../src/static/static_serie_renderer.vala"
	G_OBJECT_CLASS (live_chart_static_static_serie_renderer_parent_class)->finalize (obj);
#line 380 "static_serie_renderer.c"
}

static GType
live_chart_static_static_serie_renderer_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (LiveChartStaticStaticSerieRendererClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_static_static_serie_renderer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartStaticStaticSerieRenderer), 0, (GInstanceInitFunc) live_chart_static_static_serie_renderer_instance_init, NULL };
	static const GInterfaceInfo live_chart_drawable_info = { (GInterfaceInitFunc) live_chart_static_static_serie_renderer_live_chart_drawable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType live_chart_static_static_serie_renderer_type_id;
	live_chart_static_static_serie_renderer_type_id = g_type_register_static (G_TYPE_OBJECT, "LiveChartStaticStaticSerieRenderer", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	g_type_add_interface_static (live_chart_static_static_serie_renderer_type_id, LIVE_CHART_TYPE_DRAWABLE, &live_chart_drawable_info);
	LiveChartStaticStaticSerieRenderer_private_offset = g_type_add_instance_private (live_chart_static_static_serie_renderer_type_id, sizeof (LiveChartStaticStaticSerieRendererPrivate));
	return live_chart_static_static_serie_renderer_type_id;
}

GType
live_chart_static_static_serie_renderer_get_type (void)
{
	static volatile gsize live_chart_static_static_serie_renderer_type_id__once = 0;
	if (g_once_init_enter (&live_chart_static_static_serie_renderer_type_id__once)) {
		GType live_chart_static_static_serie_renderer_type_id;
		live_chart_static_static_serie_renderer_type_id = live_chart_static_static_serie_renderer_get_type_once ();
		g_once_init_leave (&live_chart_static_static_serie_renderer_type_id__once, live_chart_static_static_serie_renderer_type_id);
	}
	return live_chart_static_static_serie_renderer_type_id__once;
}

static void
_vala_live_chart_static_static_serie_renderer_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec)
{
	LiveChartStaticStaticSerieRenderer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_STATIC_TYPE_STATIC_SERIE_RENDERER, LiveChartStaticStaticSerieRenderer);
#line 6 "../src/static/static_serie_renderer.vala"
	switch (property_id) {
#line 6 "../src/static/static_serie_renderer.vala"
		case LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_VISIBLE_PROPERTY:
#line 6 "../src/static/static_serie_renderer.vala"
		g_value_set_boolean (value, live_chart_drawable_get_visible ((LiveChartDrawable*) self));
#line 6 "../src/static/static_serie_renderer.vala"
		break;
#line 6 "../src/static/static_serie_renderer.vala"
		case LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_LINE_PROPERTY:
#line 6 "../src/static/static_serie_renderer.vala"
		g_value_set_object (value, live_chart_static_static_serie_renderer_get_line (self));
#line 6 "../src/static/static_serie_renderer.vala"
		break;
#line 429 "static_serie_renderer.c"
		default:
#line 6 "../src/static/static_serie_renderer.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 6 "../src/static/static_serie_renderer.vala"
		break;
#line 435 "static_serie_renderer.c"
	}
}

static void
_vala_live_chart_static_static_serie_renderer_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec)
{
	LiveChartStaticStaticSerieRenderer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_STATIC_TYPE_STATIC_SERIE_RENDERER, LiveChartStaticStaticSerieRenderer);
#line 6 "../src/static/static_serie_renderer.vala"
	switch (property_id) {
#line 6 "../src/static/static_serie_renderer.vala"
		case LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_VISIBLE_PROPERTY:
#line 6 "../src/static/static_serie_renderer.vala"
		live_chart_drawable_set_visible ((LiveChartDrawable*) self, g_value_get_boolean (value));
#line 6 "../src/static/static_serie_renderer.vala"
		break;
#line 6 "../src/static/static_serie_renderer.vala"
		case LIVE_CHART_STATIC_STATIC_SERIE_RENDERER_LINE_PROPERTY:
#line 6 "../src/static/static_serie_renderer.vala"
		live_chart_static_static_serie_renderer_set_line (self, g_value_get_object (value));
#line 6 "../src/static/static_serie_renderer.vala"
		break;
#line 461 "static_serie_renderer.c"
		default:
#line 6 "../src/static/static_serie_renderer.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 6 "../src/static/static_serie_renderer.vala"
		break;
#line 467 "static_serie_renderer.c"
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

