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

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

enum  {
	LIVE_CHART_STATIC_STATIC_LINE_0_PROPERTY,
	LIVE_CHART_STATIC_STATIC_LINE_NUM_PROPERTIES
};
static GParamSpec* live_chart_static_static_line_properties[LIVE_CHART_STATIC_STATIC_LINE_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))

static gpointer live_chart_static_static_line_parent_class = NULL;

static void live_chart_static_static_line_real_draw (LiveChartStaticStaticSerieRenderer* base,
                                              cairo_t* ctx,
                                              LiveChartConfig* config);
static void live_chart_static_static_line_update_bounding_box (LiveChartStaticStaticLine* self,
                                                        LiveChartStaticStaticPoints* points,
                                                        LiveChartConfig* config);
static GType live_chart_static_static_line_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static gpointer
_g_object_ref0 (gpointer self)
{
#line 9 "../src/static/static_line.vala"
	return self ? g_object_ref (self) : NULL;
#line 38 "static_line.c"
}

LiveChartStaticStaticLine*
live_chart_static_static_line_construct (GType object_type,
                                         LiveChartStaticStaticValues* values)
{
	LiveChartStaticStaticLine * self = NULL;
	LiveChartStaticStaticValues* _tmp0_;
#line 7 "../src/static/static_line.vala"
	g_return_val_if_fail (values != NULL, NULL);
#line 8 "../src/static/static_line.vala"
	self = (LiveChartStaticStaticLine*) live_chart_static_static_serie_renderer_construct (object_type);
#line 9 "../src/static/static_line.vala"
	_tmp0_ = _g_object_ref0 (values);
#line 9 "../src/static/static_line.vala"
	_g_object_unref0 (((LiveChartStaticStaticSerieRenderer*) self)->values);
#line 9 "../src/static/static_line.vala"
	((LiveChartStaticStaticSerieRenderer*) self)->values = _tmp0_;
#line 7 "../src/static/static_line.vala"
	return self;
#line 59 "static_line.c"
}

LiveChartStaticStaticLine*
live_chart_static_static_line_new (LiveChartStaticStaticValues* values)
{
#line 7 "../src/static/static_line.vala"
	return live_chart_static_static_line_construct (LIVE_CHART_STATIC_TYPE_STATIC_LINE, values);
#line 67 "static_line.c"
}

static void
live_chart_static_static_line_real_draw (LiveChartStaticStaticSerieRenderer* base,
                                         cairo_t* ctx,
                                         LiveChartConfig* config)
{
	LiveChartStaticStaticLine * self;
	gboolean _tmp0_;
	gboolean _tmp1_;
#line 12 "../src/static/static_line.vala"
	self = (LiveChartStaticStaticLine*) base;
#line 12 "../src/static/static_line.vala"
	g_return_if_fail (ctx != NULL);
#line 12 "../src/static/static_line.vala"
	g_return_if_fail (config != NULL);
#line 13 "../src/static/static_line.vala"
	_tmp0_ = live_chart_drawable_get_visible ((LiveChartDrawable*) self);
#line 13 "../src/static/static_line.vala"
	_tmp1_ = _tmp0_;
#line 13 "../src/static/static_line.vala"
	if (_tmp1_) {
#line 90 "static_line.c"
		LiveChartStaticStaticPoints* points = NULL;
		LiveChartStaticStaticValues* _tmp2_;
		LiveChartStaticStaticPoints* _tmp3_;
		LiveChartStaticStaticPoints* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
#line 14 "../src/static/static_line.vala"
		_tmp2_ = ((LiveChartStaticStaticSerieRenderer*) self)->values;
#line 14 "../src/static/static_line.vala"
		_tmp3_ = live_chart_static_static_points_create (_tmp2_, config);
#line 14 "../src/static/static_line.vala"
		points = _tmp3_;
#line 15 "../src/static/static_line.vala"
		_tmp4_ = points;
#line 15 "../src/static/static_line.vala"
		_tmp5_ = live_chart_static_static_points_get_size (_tmp4_);
#line 15 "../src/static/static_line.vala"
		_tmp6_ = _tmp5_;
#line 15 "../src/static/static_line.vala"
		if (_tmp6_ > 0) {
#line 111 "static_line.c"
			LiveChartStaticStaticPoints* _tmp7_;
#line 16 "../src/static/static_line.vala"
			_tmp7_ = points;
#line 16 "../src/static/static_line.vala"
			live_chart_static_static_line_draw_line (self, _tmp7_, ctx, config);
#line 17 "../src/static/static_line.vala"
			cairo_stroke (ctx);
#line 119 "static_line.c"
		}
#line 13 "../src/static/static_line.vala"
		_g_object_unref0 (points);
#line 123 "static_line.c"
	}
}

void
live_chart_static_static_line_draw_line (LiveChartStaticStaticLine* self,
                                         LiveChartStaticStaticPoints* points,
                                         cairo_t* ctx,
                                         LiveChartConfig* config)
{
	LiveChartPath* _tmp0_;
	LiveChartPath* _tmp1_;
	LiveChartPoint first_point = {0};
	LiveChartPoint _tmp2_ = {0};
	LiveChartPoint _tmp3_;
	LiveChartPoint _tmp4_;
	LiveChartPoint _tmp5_;
	LiveChartPoint _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
#line 22 "../src/static/static_line.vala"
	g_return_if_fail (self != NULL);
#line 22 "../src/static/static_line.vala"
	g_return_if_fail (points != NULL);
#line 22 "../src/static/static_line.vala"
	g_return_if_fail (ctx != NULL);
#line 22 "../src/static/static_line.vala"
	g_return_if_fail (config != NULL);
#line 23 "../src/static/static_line.vala"
	_tmp0_ = live_chart_static_static_serie_renderer_get_line ((LiveChartStaticStaticSerieRenderer*) self);
#line 23 "../src/static/static_line.vala"
	_tmp1_ = _tmp0_;
#line 23 "../src/static/static_line.vala"
	live_chart_path_configure (_tmp1_, ctx);
#line 25 "../src/static/static_line.vala"
	live_chart_static_static_points_first (points, &_tmp2_);
#line 25 "../src/static/static_line.vala"
	first_point = _tmp2_;
#line 27 "../src/static/static_line.vala"
	live_chart_static_static_line_update_bounding_box (self, points, config);
#line 28 "../src/static/static_line.vala"
	live_chart_static_static_serie_renderer_debug ((LiveChartStaticStaticSerieRenderer*) self, ctx);
#line 30 "../src/static/static_line.vala"
	_tmp3_ = first_point;
#line 30 "../src/static/static_line.vala"
	_tmp4_ = first_point;
#line 30 "../src/static/static_line.vala"
	cairo_move_to (ctx, _tmp3_.x, _tmp4_.y);
#line 31 "../src/static/static_line.vala"
	_tmp5_ = first_point;
#line 31 "../src/static/static_line.vala"
	_tmp6_ = first_point;
#line 31 "../src/static/static_line.vala"
	_tmp7_ = g_strdup_printf ("Draw point %f, %f", _tmp5_.x, _tmp6_.y);
#line 31 "../src/static/static_line.vala"
	_tmp8_ = _tmp7_;
#line 31 "../src/static/static_line.vala"
	g_message ("static_line.vala:31: %s", _tmp8_);
#line 31 "../src/static/static_line.vala"
	_g_free0 (_tmp8_);
#line 183 "static_line.c"
	{
		gint pos = 0;
#line 32 "../src/static/static_line.vala"
		pos = 0;
#line 188 "static_line.c"
		{
			gboolean _tmp9_ = FALSE;
#line 32 "../src/static/static_line.vala"
			_tmp9_ = TRUE;
#line 32 "../src/static/static_line.vala"
			while (TRUE) {
#line 195 "static_line.c"
				gint _tmp11_;
				gint _tmp12_;
				LiveChartPoint current_point = {0};
				LiveChartPoint _tmp13_ = {0};
				LiveChartPoint next_point = {0};
				LiveChartPoint _tmp14_ = {0};
				LiveChartPoint _tmp15_;
				LiveChartPoint _tmp18_;
				LiveChartPoint _tmp19_;
				gchar* _tmp20_;
				gchar* _tmp21_;
				LiveChartPoint _tmp22_;
				LiveChartPoint _tmp23_;
#line 32 "../src/static/static_line.vala"
				if (!_tmp9_) {
#line 211 "static_line.c"
					gint _tmp10_;
#line 32 "../src/static/static_line.vala"
					_tmp10_ = pos;
#line 32 "../src/static/static_line.vala"
					pos = _tmp10_ + 1;
#line 217 "static_line.c"
				}
#line 32 "../src/static/static_line.vala"
				_tmp9_ = FALSE;
#line 32 "../src/static/static_line.vala"
				_tmp11_ = live_chart_static_static_points_get_size (points);
#line 32 "../src/static/static_line.vala"
				_tmp12_ = _tmp11_;
#line 32 "../src/static/static_line.vala"
				if (!(pos < (_tmp12_ - 1))) {
#line 32 "../src/static/static_line.vala"
					break;
#line 229 "static_line.c"
				}
#line 33 "../src/static/static_line.vala"
				live_chart_static_static_points_get (points, pos, &_tmp13_);
#line 33 "../src/static/static_line.vala"
				current_point = _tmp13_;
#line 34 "../src/static/static_line.vala"
				live_chart_static_static_points_after (points, pos, &_tmp14_);
#line 34 "../src/static/static_line.vala"
				next_point = _tmp14_;
#line 35 "../src/static/static_line.vala"
				_tmp15_ = current_point;
#line 35 "../src/static/static_line.vala"
				if (live_chart_static_static_serie_renderer_is_out_of_area ((LiveChartStaticStaticSerieRenderer*) self, &_tmp15_)) {
#line 243 "static_line.c"
					LiveChartPoint _tmp16_;
					LiveChartPoint _tmp17_;
#line 36 "../src/static/static_line.vala"
					g_message ("static_line.vala:36: #########################Out of area");
#line 37 "../src/static/static_line.vala"
					_tmp16_ = current_point;
#line 37 "../src/static/static_line.vala"
					_tmp17_ = current_point;
#line 37 "../src/static/static_line.vala"
					cairo_move_to (ctx, _tmp16_.x, _tmp17_.y);
#line 38 "../src/static/static_line.vala"
					continue;
#line 256 "static_line.c"
				}
#line 40 "../src/static/static_line.vala"
				_tmp18_ = next_point;
#line 40 "../src/static/static_line.vala"
				_tmp19_ = next_point;
#line 40 "../src/static/static_line.vala"
				_tmp20_ = g_strdup_printf ("Draw point %f, %f as pos %d", _tmp18_.x, _tmp19_.y, pos);
#line 40 "../src/static/static_line.vala"
				_tmp21_ = _tmp20_;
#line 40 "../src/static/static_line.vala"
				g_message ("static_line.vala:40: %s", _tmp21_);
#line 40 "../src/static/static_line.vala"
				_g_free0 (_tmp21_);
#line 41 "../src/static/static_line.vala"
				_tmp22_ = next_point;
#line 41 "../src/static/static_line.vala"
				_tmp23_ = next_point;
#line 41 "../src/static/static_line.vala"
				cairo_line_to (ctx, _tmp22_.x, _tmp23_.y);
#line 276 "static_line.c"
			}
		}
	}
}

static void
live_chart_static_static_line_update_bounding_box (LiveChartStaticStaticLine* self,
                                                   LiveChartStaticStaticPoints* points,
                                                   LiveChartConfig* config)
{
	LiveChartPoint _tmp0_ = {0};
	LiveChartBounds* _tmp1_;
	LiveChartBounds* _tmp2_;
	gdouble _tmp3_;
	gdouble _tmp4_;
	LiveChartPoint _tmp5_ = {0};
	LiveChartPoint _tmp6_ = {0};
	LiveChartBounds* _tmp7_;
	LiveChartBounds* _tmp8_;
	gdouble _tmp9_;
	gdouble _tmp10_;
	LiveChartBounds* _tmp11_;
	LiveChartBounds* _tmp12_;
	gdouble _tmp13_;
	gdouble _tmp14_;
	LiveChartBoundingBox _tmp15_ = {0};
#line 45 "../src/static/static_line.vala"
	g_return_if_fail (self != NULL);
#line 45 "../src/static/static_line.vala"
	g_return_if_fail (points != NULL);
#line 45 "../src/static/static_line.vala"
	g_return_if_fail (config != NULL);
#line 46 "../src/static/static_line.vala"
	live_chart_static_static_points_first (points, &_tmp0_);
#line 46 "../src/static/static_line.vala"
	_tmp1_ = live_chart_static_static_points_get_bounds (points);
#line 46 "../src/static/static_line.vala"
	_tmp2_ = _tmp1_;
#line 46 "../src/static/static_line.vala"
	_tmp3_ = live_chart_bounds_get_lower (_tmp2_);
#line 46 "../src/static/static_line.vala"
	_tmp4_ = _tmp3_;
#line 46 "../src/static/static_line.vala"
	live_chart_static_static_points_last (points, &_tmp5_);
#line 46 "../src/static/static_line.vala"
	live_chart_static_static_points_first (points, &_tmp6_);
#line 46 "../src/static/static_line.vala"
	_tmp7_ = live_chart_static_static_points_get_bounds (points);
#line 46 "../src/static/static_line.vala"
	_tmp8_ = _tmp7_;
#line 46 "../src/static/static_line.vala"
	_tmp9_ = live_chart_bounds_get_upper (_tmp8_);
#line 46 "../src/static/static_line.vala"
	_tmp10_ = _tmp9_;
#line 46 "../src/static/static_line.vala"
	_tmp11_ = live_chart_static_static_points_get_bounds (points);
#line 46 "../src/static/static_line.vala"
	_tmp12_ = _tmp11_;
#line 46 "../src/static/static_line.vala"
	_tmp13_ = live_chart_bounds_get_lower (_tmp12_);
#line 46 "../src/static/static_line.vala"
	_tmp14_ = _tmp13_;
#line 46 "../src/static/static_line.vala"
	memset (&_tmp15_, 0, sizeof (LiveChartBoundingBox));
#line 46 "../src/static/static_line.vala"
	_tmp15_.x = _tmp0_.x;
#line 46 "../src/static/static_line.vala"
	_tmp15_.y = _tmp4_;
#line 46 "../src/static/static_line.vala"
	_tmp15_.width = _tmp5_.x - _tmp6_.x;
#line 46 "../src/static/static_line.vala"
	_tmp15_.height = _tmp10_ - _tmp14_;
#line 46 "../src/static/static_line.vala"
	((LiveChartStaticStaticSerieRenderer*) self)->bounding_box = _tmp15_;
#line 351 "static_line.c"
}

static void
live_chart_static_static_line_class_init (LiveChartStaticStaticLineClass * klass,
                                          gpointer klass_data)
{
#line 5 "../src/static/static_line.vala"
	live_chart_static_static_line_parent_class = g_type_class_peek_parent (klass);
#line 5 "../src/static/static_line.vala"
	((LiveChartStaticStaticSerieRendererClass *) klass)->draw = (void (*) (LiveChartStaticStaticSerieRenderer*, cairo_t*, LiveChartConfig*)) live_chart_static_static_line_real_draw;
#line 362 "static_line.c"
}

static void
live_chart_static_static_line_instance_init (LiveChartStaticStaticLine * self,
                                             gpointer klass)
{
}

static GType
live_chart_static_static_line_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (LiveChartStaticStaticLineClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_static_static_line_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartStaticStaticLine), 0, (GInstanceInitFunc) live_chart_static_static_line_instance_init, NULL };
	GType live_chart_static_static_line_type_id;
	live_chart_static_static_line_type_id = g_type_register_static (LIVE_CHART_STATIC_TYPE_STATIC_SERIE_RENDERER, "LiveChartStaticStaticLine", &g_define_type_info, 0);
	return live_chart_static_static_line_type_id;
}

GType
live_chart_static_static_line_get_type (void)
{
	static volatile gsize live_chart_static_static_line_type_id__once = 0;
	if (g_once_init_enter (&live_chart_static_static_line_type_id__once)) {
		GType live_chart_static_static_line_type_id;
		live_chart_static_static_line_type_id = live_chart_static_static_line_get_type_once ();
		g_once_init_leave (&live_chart_static_static_line_type_id__once, live_chart_static_static_line_type_id);
	}
	return live_chart_static_static_line_type_id__once;
}

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;
}

