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

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

enum  {
	LIVE_CHART_BACKGROUND_0_PROPERTY,
	LIVE_CHART_BACKGROUND_VISIBLE_PROPERTY,
	LIVE_CHART_BACKGROUND_COLOR_PROPERTY,
	LIVE_CHART_BACKGROUND_MAIN_COLOR_PROPERTY,
	LIVE_CHART_BACKGROUND_NUM_PROPERTIES
};
static GParamSpec* live_chart_background_properties[LIVE_CHART_BACKGROUND_NUM_PROPERTIES];

struct _LiveChartBackgroundPrivate {
	LiveChartBoundingBox bounding_box;
	gboolean _visible;
	GdkRGBA _main_color;
};

static gint LiveChartBackground_private_offset;
static gpointer live_chart_background_parent_class = NULL;
static LiveChartDrawableIface * live_chart_background_live_chart_drawable_parent_iface = NULL;

static void live_chart_background_real_draw (LiveChartDrawable* base,
                                      cairo_t* ctx,
                                      LiveChartConfig* config);
static void live_chart_background_update_bounding_box (LiveChartBackground* self,
                                                LiveChartConfig* config);
static void live_chart_background_real_get_bounding_box (LiveChartDrawable* base,
                                                  LiveChartBoundingBox* result);
static gboolean _gdk_rgba_equal (const GdkRGBA * s1,
                          const GdkRGBA * s2);
static void live_chart_background_finalize (GObject * obj);
static GType live_chart_background_get_type_once (void);
static void _vala_live_chart_background_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_live_chart_background_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);

static inline gpointer
live_chart_background_get_instance_private (LiveChartBackground* self)
{
	return G_STRUCT_MEMBER_P (self, LiveChartBackground_private_offset);
}

static void
live_chart_background_real_draw (LiveChartDrawable* base,
                                 cairo_t* ctx,
                                 LiveChartConfig* config)
{
	LiveChartBackground * self;
	gboolean _tmp0_;
	gboolean _tmp1_;
#line 33 "../src/background.vala"
	self = (LiveChartBackground*) base;
#line 33 "../src/background.vala"
	g_return_if_fail (ctx != NULL);
#line 33 "../src/background.vala"
	g_return_if_fail (config != NULL);
#line 34 "../src/background.vala"
	_tmp0_ = live_chart_drawable_get_visible ((LiveChartDrawable*) self);
#line 34 "../src/background.vala"
	_tmp1_ = _tmp0_;
#line 34 "../src/background.vala"
	if (_tmp1_) {
#line 79 "background.c"
		gint _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		GdkRGBA _tmp6_ = {0};
		GdkRGBA _tmp7_;
		GdkRGBA _tmp8_ = {0};
		GdkRGBA _tmp9_;
		GdkRGBA _tmp10_ = {0};
		GdkRGBA _tmp11_;
		GdkRGBA _tmp12_ = {0};
		GdkRGBA _tmp13_;
#line 35 "../src/background.vala"
		live_chart_background_update_bounding_box (self, config);
#line 36 "../src/background.vala"
		_tmp2_ = live_chart_config_get_width (config);
#line 36 "../src/background.vala"
		_tmp3_ = _tmp2_;
#line 36 "../src/background.vala"
		_tmp4_ = live_chart_config_get_height (config);
#line 36 "../src/background.vala"
		_tmp5_ = _tmp4_;
#line 36 "../src/background.vala"
		cairo_rectangle (ctx, (gdouble) 0, (gdouble) 0, (gdouble) _tmp3_, (gdouble) _tmp5_);
#line 37 "../src/background.vala"
		live_chart_background_get_color (self, &_tmp6_);
#line 37 "../src/background.vala"
		_tmp7_ = _tmp6_;
#line 37 "../src/background.vala"
		live_chart_background_get_color (self, &_tmp8_);
#line 37 "../src/background.vala"
		_tmp9_ = _tmp8_;
#line 37 "../src/background.vala"
		live_chart_background_get_color (self, &_tmp10_);
#line 37 "../src/background.vala"
		_tmp11_ = _tmp10_;
#line 37 "../src/background.vala"
		live_chart_background_get_color (self, &_tmp12_);
#line 37 "../src/background.vala"
		_tmp13_ = _tmp12_;
#line 37 "../src/background.vala"
		cairo_set_source_rgba (ctx, _tmp7_.red, _tmp9_.green, _tmp11_.blue, _tmp13_.alpha);
#line 38 "../src/background.vala"
		cairo_fill (ctx);
#line 124 "background.c"
	}
}

static void
live_chart_background_real_get_bounding_box (LiveChartDrawable* base,
                                             LiveChartBoundingBox* result)
{
	LiveChartBackground * self;
	LiveChartBoundingBox _tmp0_;
#line 42 "../src/background.vala"
	self = (LiveChartBackground*) base;
#line 43 "../src/background.vala"
	_tmp0_ = self->priv->bounding_box;
#line 43 "../src/background.vala"
	*result = _tmp0_;
#line 43 "../src/background.vala"
	return;
#line 142 "background.c"
}

static void
live_chart_background_update_bounding_box (LiveChartBackground* self,
                                           LiveChartConfig* config)
{
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	LiveChartBoundingBox _tmp4_ = {0};
#line 46 "../src/background.vala"
	g_return_if_fail (self != NULL);
#line 46 "../src/background.vala"
	g_return_if_fail (config != NULL);
#line 47 "../src/background.vala"
	_tmp0_ = live_chart_config_get_width (config);
#line 47 "../src/background.vala"
	_tmp1_ = _tmp0_;
#line 47 "../src/background.vala"
	_tmp2_ = live_chart_config_get_height (config);
#line 47 "../src/background.vala"
	_tmp3_ = _tmp2_;
#line 47 "../src/background.vala"
	memset (&_tmp4_, 0, sizeof (LiveChartBoundingBox));
#line 47 "../src/background.vala"
	_tmp4_.x = (gdouble) 0;
#line 47 "../src/background.vala"
	_tmp4_.y = (gdouble) 0;
#line 47 "../src/background.vala"
	_tmp4_.width = (gdouble) _tmp1_;
#line 47 "../src/background.vala"
	_tmp4_.height = (gdouble) _tmp3_;
#line 47 "../src/background.vala"
	self->priv->bounding_box = _tmp4_;
#line 178 "background.c"
}

LiveChartBackground*
live_chart_background_construct (GType object_type)
{
	LiveChartBackground * self = NULL;
#line 4 "../src/background.vala"
	self = (LiveChartBackground*) g_object_new (object_type, NULL);
#line 4 "../src/background.vala"
	return self;
#line 189 "background.c"
}

LiveChartBackground*
live_chart_background_new (void)
{
#line 4 "../src/background.vala"
	return live_chart_background_construct (LIVE_CHART_TYPE_BACKGROUND);
#line 197 "background.c"
}

static gboolean
live_chart_background_real_get_visible (LiveChartDrawable* base)
{
	gboolean result;
	LiveChartBackground* self;
#line 12 "../src/background.vala"
	self = (LiveChartBackground*) base;
#line 12 "../src/background.vala"
	result = self->priv->_visible;
#line 12 "../src/background.vala"
	return result;
#line 211 "background.c"
}

static void
live_chart_background_real_set_visible (LiveChartDrawable* base,
                                        gboolean value)
{
	LiveChartBackground* self;
	gboolean old_value;
#line 12 "../src/background.vala"
	self = (LiveChartBackground*) base;
#line 12 "../src/background.vala"
	old_value = live_chart_background_real_get_visible (base);
#line 12 "../src/background.vala"
	if (old_value != value) {
#line 12 "../src/background.vala"
		self->priv->_visible = value;
#line 12 "../src/background.vala"
		g_object_notify_by_pspec ((GObject *) self, live_chart_background_properties[LIVE_CHART_BACKGROUND_VISIBLE_PROPERTY]);
#line 230 "background.c"
	}
}

void
live_chart_background_get_color (LiveChartBackground* self,
                                 GdkRGBA * result)
{
	GdkRGBA _tmp0_;
#line 15 "../src/background.vala"
	g_return_if_fail (self != NULL);
#line 16 "../src/background.vala"
	_tmp0_ = self->priv->_main_color;
#line 16 "../src/background.vala"
	*result = _tmp0_;
#line 16 "../src/background.vala"
	return;
#line 247 "background.c"
}

void
live_chart_background_set_color (LiveChartBackground* self,
                                 GdkRGBA * value)
{
	GdkRGBA _tmp0_;
#line 18 "../src/background.vala"
	g_return_if_fail (self != NULL);
#line 19 "../src/background.vala"
	_tmp0_ = *value;
#line 19 "../src/background.vala"
	live_chart_background_set_main_color (self, &_tmp0_);
#line 18 "../src/background.vala"
	g_object_notify_by_pspec ((GObject *) self, live_chart_background_properties[LIVE_CHART_BACKGROUND_COLOR_PROPERTY]);
#line 263 "background.c"
}

void
live_chart_background_get_main_color (LiveChartBackground* self,
                                      GdkRGBA * result)
{
	GdkRGBA _tmp0_;
#line 25 "../src/background.vala"
	g_return_if_fail (self != NULL);
#line 25 "../src/background.vala"
	_tmp0_ = self->priv->_main_color;
#line 25 "../src/background.vala"
	*result = _tmp0_;
#line 25 "../src/background.vala"
	return;
#line 279 "background.c"
}

static gboolean
_gdk_rgba_equal (const GdkRGBA * s1,
                 const GdkRGBA * s2)
{
#line 25 "../src/background.vala"
	if (s1 == s2) {
#line 25 "../src/background.vala"
		return TRUE;
#line 290 "background.c"
	}
#line 25 "../src/background.vala"
	if (s1 == NULL) {
#line 25 "../src/background.vala"
		return FALSE;
#line 296 "background.c"
	}
#line 25 "../src/background.vala"
	if (s2 == NULL) {
#line 25 "../src/background.vala"
		return FALSE;
#line 302 "background.c"
	}
#line 25 "../src/background.vala"
	if (s1->red != s2->red) {
#line 25 "../src/background.vala"
		return FALSE;
#line 308 "background.c"
	}
#line 25 "../src/background.vala"
	if (s1->green != s2->green) {
#line 25 "../src/background.vala"
		return FALSE;
#line 314 "background.c"
	}
#line 25 "../src/background.vala"
	if (s1->blue != s2->blue) {
#line 25 "../src/background.vala"
		return FALSE;
#line 320 "background.c"
	}
#line 25 "../src/background.vala"
	if (s1->alpha != s2->alpha) {
#line 25 "../src/background.vala"
		return FALSE;
#line 326 "background.c"
	}
#line 25 "../src/background.vala"
	return TRUE;
#line 330 "background.c"
}

void
live_chart_background_set_main_color (LiveChartBackground* self,
                                      GdkRGBA * value)
{
	GdkRGBA old_value;
#line 25 "../src/background.vala"
	g_return_if_fail (self != NULL);
#line 25 "../src/background.vala"
	live_chart_background_get_main_color (self, &old_value);
#line 25 "../src/background.vala"
	if (_gdk_rgba_equal (value, &old_value) != TRUE) {
#line 344 "background.c"
		GdkRGBA _tmp0_;
#line 25 "../src/background.vala"
		_tmp0_ = *value;
#line 25 "../src/background.vala"
		self->priv->_main_color = _tmp0_;
#line 25 "../src/background.vala"
		g_object_notify_by_pspec ((GObject *) self, live_chart_background_properties[LIVE_CHART_BACKGROUND_MAIN_COLOR_PROPERTY]);
#line 352 "background.c"
	}
}

static void
live_chart_background_class_init (LiveChartBackgroundClass * klass,
                                  gpointer klass_data)
{
#line 4 "../src/background.vala"
	live_chart_background_parent_class = g_type_class_peek_parent (klass);
#line 4 "../src/background.vala"
	g_type_class_adjust_private_offset (klass, &LiveChartBackground_private_offset);
#line 4 "../src/background.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_live_chart_background_get_property;
#line 4 "../src/background.vala"
	G_OBJECT_CLASS (klass)->set_property = _vala_live_chart_background_set_property;
#line 4 "../src/background.vala"
	G_OBJECT_CLASS (klass)->finalize = live_chart_background_finalize;
#line 4 "../src/background.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_BACKGROUND_VISIBLE_PROPERTY, live_chart_background_properties[LIVE_CHART_BACKGROUND_VISIBLE_PROPERTY] = g_param_spec_boolean ("visible", "visible", "visible", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 4 "../src/background.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_BACKGROUND_COLOR_PROPERTY, live_chart_background_properties[LIVE_CHART_BACKGROUND_COLOR_PROPERTY] = g_param_spec_boxed ("color", "color", "color", gdk_rgba_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 4 "../src/background.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_BACKGROUND_MAIN_COLOR_PROPERTY, live_chart_background_properties[LIVE_CHART_BACKGROUND_MAIN_COLOR_PROPERTY] = g_param_spec_boxed ("main-color", "main-color", "main-color", gdk_rgba_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_DEPRECATED));
#line 376 "background.c"
}

static void
live_chart_background_live_chart_drawable_interface_init (LiveChartDrawableIface * iface,
                                                          gpointer iface_data)
{
#line 4 "../src/background.vala"
	live_chart_background_live_chart_drawable_parent_iface = g_type_interface_peek_parent (iface);
#line 4 "../src/background.vala"
	iface->draw = (void (*) (LiveChartDrawable*, cairo_t*, LiveChartConfig*)) live_chart_background_real_draw;
#line 4 "../src/background.vala"
	iface->get_bounding_box = (void (*) (LiveChartDrawable*, LiveChartBoundingBox*)) live_chart_background_real_get_bounding_box;
#line 4 "../src/background.vala"
	iface->get_visible = live_chart_background_real_get_visible;
#line 4 "../src/background.vala"
	iface->set_visible = live_chart_background_real_set_visible;
#line 393 "background.c"
}

static void
live_chart_background_instance_init (LiveChartBackground * self,
                                     gpointer klass)
{
	LiveChartBoundingBox _tmp0_ = {0};
	GdkRGBA _tmp1_ = {0};
#line 4 "../src/background.vala"
	self->priv = live_chart_background_get_instance_private (self);
#line 5 "../src/background.vala"
	memset (&_tmp0_, 0, sizeof (LiveChartBoundingBox));
#line 5 "../src/background.vala"
	_tmp0_.x = (gdouble) 0;
#line 5 "../src/background.vala"
	_tmp0_.y = (gdouble) 0;
#line 5 "../src/background.vala"
	_tmp0_.width = (gdouble) 0;
#line 5 "../src/background.vala"
	_tmp0_.height = (gdouble) 0;
#line 5 "../src/background.vala"
	self->priv->bounding_box = _tmp0_;
#line 12 "../src/background.vala"
	self->priv->_visible = TRUE;
#line 24 "../src/background.vala"
	memset (&_tmp1_, 0, sizeof (GdkRGBA));
#line 24 "../src/background.vala"
	_tmp1_.red = 0.1;
#line 24 "../src/background.vala"
	_tmp1_.green = 0.1;
#line 24 "../src/background.vala"
	_tmp1_.blue = 0.1;
#line 24 "../src/background.vala"
	_tmp1_.alpha = 1.0;
#line 24 "../src/background.vala"
	self->priv->_main_color = _tmp1_;
#line 430 "background.c"
}

static void
live_chart_background_finalize (GObject * obj)
{
	LiveChartBackground * self;
#line 4 "../src/background.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, LIVE_CHART_TYPE_BACKGROUND, LiveChartBackground);
#line 4 "../src/background.vala"
	G_OBJECT_CLASS (live_chart_background_parent_class)->finalize (obj);
#line 441 "background.c"
}

static GType
live_chart_background_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (LiveChartBackgroundClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_background_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartBackground), 0, (GInstanceInitFunc) live_chart_background_instance_init, NULL };
	static const GInterfaceInfo live_chart_drawable_info = { (GInterfaceInitFunc) live_chart_background_live_chart_drawable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType live_chart_background_type_id;
	live_chart_background_type_id = g_type_register_static (G_TYPE_OBJECT, "LiveChartBackground", &g_define_type_info, 0);
	g_type_add_interface_static (live_chart_background_type_id, LIVE_CHART_TYPE_DRAWABLE, &live_chart_drawable_info);
	LiveChartBackground_private_offset = g_type_add_instance_private (live_chart_background_type_id, sizeof (LiveChartBackgroundPrivate));
	return live_chart_background_type_id;
}

GType
live_chart_background_get_type (void)
{
	static volatile gsize live_chart_background_type_id__once = 0;
	if (g_once_init_enter (&live_chart_background_type_id__once)) {
		GType live_chart_background_type_id;
		live_chart_background_type_id = live_chart_background_get_type_once ();
		g_once_init_leave (&live_chart_background_type_id__once, live_chart_background_type_id);
	}
	return live_chart_background_type_id__once;
}

static void
_vala_live_chart_background_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	LiveChartBackground * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_BACKGROUND, LiveChartBackground);
#line 4 "../src/background.vala"
	switch (property_id) {
#line 4 "../src/background.vala"
		case LIVE_CHART_BACKGROUND_VISIBLE_PROPERTY:
#line 4 "../src/background.vala"
		g_value_set_boolean (value, live_chart_drawable_get_visible ((LiveChartDrawable*) self));
#line 4 "../src/background.vala"
		break;
#line 4 "../src/background.vala"
		case LIVE_CHART_BACKGROUND_COLOR_PROPERTY:
#line 486 "background.c"
		{
			GdkRGBA boxed;
#line 4 "../src/background.vala"
			live_chart_background_get_color (self, &boxed);
#line 4 "../src/background.vala"
			g_value_set_boxed (value, &boxed);
#line 493 "background.c"
		}
#line 4 "../src/background.vala"
		break;
#line 4 "../src/background.vala"
		case LIVE_CHART_BACKGROUND_MAIN_COLOR_PROPERTY:
#line 499 "background.c"
		{
			GdkRGBA boxed;
#line 4 "../src/background.vala"
			live_chart_background_get_main_color (self, &boxed);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
#line 505 "background.c"
			g_value_set_boxed (value, &boxed);
G_GNUC_END_IGNORE_DEPRECATIONS
		}
#line 4 "../src/background.vala"
		break;
#line 511 "background.c"
		default:
#line 4 "../src/background.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 4 "../src/background.vala"
		break;
#line 517 "background.c"
	}
}

static void
_vala_live_chart_background_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	LiveChartBackground * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_BACKGROUND, LiveChartBackground);
#line 4 "../src/background.vala"
	switch (property_id) {
#line 4 "../src/background.vala"
		case LIVE_CHART_BACKGROUND_VISIBLE_PROPERTY:
#line 4 "../src/background.vala"
		live_chart_drawable_set_visible ((LiveChartDrawable*) self, g_value_get_boolean (value));
#line 4 "../src/background.vala"
		break;
#line 4 "../src/background.vala"
		case LIVE_CHART_BACKGROUND_COLOR_PROPERTY:
#line 4 "../src/background.vala"
		live_chart_background_set_color (self, g_value_get_boxed (value));
#line 4 "../src/background.vala"
		break;
#line 4 "../src/background.vala"
		case LIVE_CHART_BACKGROUND_MAIN_COLOR_PROPERTY:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
#line 546 "background.c"
		live_chart_background_set_main_color (self, g_value_get_boxed (value));
G_GNUC_END_IGNORE_DEPRECATIONS
#line 4 "../src/background.vala"
		break;
#line 551 "background.c"
		default:
#line 4 "../src/background.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 4 "../src/background.vala"
		break;
#line 557 "background.c"
	}
}

