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

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

enum  {
	LIVE_CHART_SMOOTH_LINE_0_PROPERTY,
	LIVE_CHART_SMOOTH_LINE_REGION_PROPERTY,
	LIVE_CHART_SMOOTH_LINE_NUM_PROPERTIES
};
static GParamSpec* live_chart_smooth_line_properties[LIVE_CHART_SMOOTH_LINE_NUM_PROPERTIES];
#define _live_chart_region_unref0(var) ((var == NULL) ? NULL : (var = (live_chart_region_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _cairo_path_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_path_destroy (var), NULL)))
#define _cairo_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_destroy (var), NULL)))
typedef struct _Block6Data Block6Data;
#define _live_chart_bezier_intersector_unref0(var) ((var == NULL) ? NULL : (var = (live_chart_bezier_intersector_unref (var), NULL)))

struct _LiveChartSmoothLinePrivate {
	LiveChartRegion* _region;
};

struct _Block6Data {
	int _ref_count_;
	LiveChartSmoothLine* self;
	LiveChartBoundaries boundaries;
	cairo_t* ctx;
};

static gint LiveChartSmoothLine_private_offset;
static gpointer live_chart_smooth_line_parent_class = NULL;

static void live_chart_smooth_line_real_draw (LiveChartSerieRenderer* base,
                                       cairo_t* ctx,
                                       LiveChartConfig* config);
static void live_chart_smooth_line_update_bounding_box (LiveChartSmoothLine* self,
                                                 LiveChartPoints* points,
                                                 LiveChartConfig* config);
static void live_chart_smooth_line_generate_intersections (LiveChartSmoothLine* self,
                                                    LiveChartPoint* previous,
                                                    LiveChartPoint* target,
                                                    LiveChartConfig* config,
                                                    LiveChartBezierCurve* curve);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
static gboolean __lambda13_ (Block6Data* _data6_,
                      LiveChartIntersection* intersection);
static gboolean ___lambda13__gee_forall_func (gpointer g,
                                       gpointer self);
static void live_chart_smooth_line_finalize (GObject * obj);
static GType live_chart_smooth_line_get_type_once (void);
static void _vala_live_chart_smooth_line_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec);
static void _vala_live_chart_smooth_line_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_smooth_line_get_instance_private (LiveChartSmoothLine* self)
{
	return G_STRUCT_MEMBER_P (self, LiveChartSmoothLine_private_offset);
}

static gpointer
_g_object_ref0 (gpointer self)
{
#line 10 "../src/smooth_line.vala"
	return self ? g_object_ref (self) : NULL;
#line 82 "smooth_line.c"
}

LiveChartSmoothLine*
live_chart_smooth_line_construct (GType object_type,
                                  LiveChartValues* values)
{
	LiveChartSmoothLine * self = NULL;
	LiveChartValues* _tmp0_;
#line 8 "../src/smooth_line.vala"
	g_return_val_if_fail (values != NULL, NULL);
#line 9 "../src/smooth_line.vala"
	self = (LiveChartSmoothLine*) live_chart_serie_renderer_construct (object_type);
#line 10 "../src/smooth_line.vala"
	_tmp0_ = _g_object_ref0 (values);
#line 10 "../src/smooth_line.vala"
	_g_object_unref0 (((LiveChartSerieRenderer*) self)->values);
#line 10 "../src/smooth_line.vala"
	((LiveChartSerieRenderer*) self)->values = _tmp0_;
#line 8 "../src/smooth_line.vala"
	return self;
#line 103 "smooth_line.c"
}

LiveChartSmoothLine*
live_chart_smooth_line_new (LiveChartValues* values)
{
#line 8 "../src/smooth_line.vala"
	return live_chart_smooth_line_construct (LIVE_CHART_TYPE_SMOOTH_LINE, values);
#line 111 "smooth_line.c"
}

static void
live_chart_smooth_line_real_draw (LiveChartSerieRenderer* base,
                                  cairo_t* ctx,
                                  LiveChartConfig* config)
{
	LiveChartSmoothLine * self;
	gboolean _tmp0_;
	gboolean _tmp1_;
#line 13 "../src/smooth_line.vala"
	self = (LiveChartSmoothLine*) base;
#line 13 "../src/smooth_line.vala"
	g_return_if_fail (ctx != NULL);
#line 13 "../src/smooth_line.vala"
	g_return_if_fail (config != NULL);
#line 14 "../src/smooth_line.vala"
	_tmp0_ = live_chart_drawable_get_visible ((LiveChartDrawable*) self);
#line 14 "../src/smooth_line.vala"
	_tmp1_ = _tmp0_;
#line 14 "../src/smooth_line.vala"
	if (_tmp1_) {
#line 134 "smooth_line.c"
		LiveChartPoints* points = NULL;
		LiveChartValues* _tmp2_;
		LiveChartPoints* _tmp3_;
		LiveChartPoints* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
#line 15 "../src/smooth_line.vala"
		_tmp2_ = ((LiveChartSerieRenderer*) self)->values;
#line 15 "../src/smooth_line.vala"
		_tmp3_ = live_chart_points_create (_tmp2_, config);
#line 15 "../src/smooth_line.vala"
		points = _tmp3_;
#line 16 "../src/smooth_line.vala"
		_tmp4_ = points;
#line 16 "../src/smooth_line.vala"
		_tmp5_ = live_chart_points_get_size (_tmp4_);
#line 16 "../src/smooth_line.vala"
		_tmp6_ = _tmp5_;
#line 16 "../src/smooth_line.vala"
		if (_tmp6_ > 0) {
#line 155 "smooth_line.c"
			LiveChartRegion* _tmp7_;
			LiveChartPoints* _tmp8_;
			cairo_path_t* _tmp9_;
			cairo_path_t* _tmp10_;
			LiveChartRegion* _tmp11_;
#line 18 "../src/smooth_line.vala"
			_tmp7_ = self->priv->_region;
#line 18 "../src/smooth_line.vala"
			if (_tmp7_ != NULL) {
#line 19 "../src/smooth_line.vala"
				cairo_push_group (ctx);
#line 167 "smooth_line.c"
			}
#line 22 "../src/smooth_line.vala"
			_tmp8_ = points;
#line 22 "../src/smooth_line.vala"
			_tmp9_ = live_chart_smooth_line_draw_smooth_line (self, _tmp8_, ctx, config);
#line 22 "../src/smooth_line.vala"
			_tmp10_ = _tmp9_;
#line 22 "../src/smooth_line.vala"
			_cairo_path_destroy0 (_tmp10_);
#line 23 "../src/smooth_line.vala"
			cairo_stroke (ctx);
#line 25 "../src/smooth_line.vala"
			_tmp11_ = self->priv->_region;
#line 25 "../src/smooth_line.vala"
			if (_tmp11_ != NULL) {
#line 26 "../src/smooth_line.vala"
				cairo_set_operator (ctx, CAIRO_OPERATOR_ATOP);
#line 27 "../src/smooth_line.vala"
				live_chart_smooth_line_draw_regions_on_line (self, ctx, config);
#line 28 "../src/smooth_line.vala"
				cairo_fill (ctx);
#line 29 "../src/smooth_line.vala"
				cairo_pop_group_to_source (ctx);
#line 30 "../src/smooth_line.vala"
				cairo_paint (ctx);
#line 193 "smooth_line.c"
			}
		}
#line 14 "../src/smooth_line.vala"
		_g_object_unref0 (points);
#line 198 "smooth_line.c"
	}
}

cairo_path_t*
live_chart_smooth_line_draw_smooth_line (LiveChartSmoothLine* self,
                                         LiveChartPoints* points,
                                         cairo_t* ctx,
                                         LiveChartConfig* config)
{
	LiveChartIntersections* _tmp0_;
	LiveChartPoint first_point = {0};
	LiveChartPoint _tmp1_ = {0};
	LiveChartPoint _tmp2_;
	LiveChartPoint _tmp3_;
	LiveChartPath* _tmp4_;
	LiveChartPath* _tmp5_;
	cairo_path_t* _tmp32_;
	cairo_path_t* result;
#line 36 "../src/smooth_line.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 36 "../src/smooth_line.vala"
	g_return_val_if_fail (points != NULL, NULL);
#line 36 "../src/smooth_line.vala"
	g_return_val_if_fail (ctx != NULL, NULL);
#line 36 "../src/smooth_line.vala"
	g_return_val_if_fail (config != NULL, NULL);
#line 37 "../src/smooth_line.vala"
	_tmp0_ = live_chart_intersections_new ();
#line 37 "../src/smooth_line.vala"
	_g_object_unref0 (self->intersections);
#line 37 "../src/smooth_line.vala"
	self->intersections = _tmp0_;
#line 38 "../src/smooth_line.vala"
	live_chart_points_first (points, &_tmp1_);
#line 38 "../src/smooth_line.vala"
	first_point = _tmp1_;
#line 40 "../src/smooth_line.vala"
	live_chart_smooth_line_update_bounding_box (self, points, config);
#line 41 "../src/smooth_line.vala"
	live_chart_serie_renderer_debug ((LiveChartSerieRenderer*) self, ctx);
#line 43 "../src/smooth_line.vala"
	_tmp2_ = first_point;
#line 43 "../src/smooth_line.vala"
	_tmp3_ = first_point;
#line 43 "../src/smooth_line.vala"
	cairo_move_to (ctx, _tmp2_.x, _tmp3_.y);
#line 44 "../src/smooth_line.vala"
	_tmp4_ = live_chart_serie_renderer_get_line ((LiveChartSerieRenderer*) self);
#line 44 "../src/smooth_line.vala"
	_tmp5_ = _tmp4_;
#line 44 "../src/smooth_line.vala"
	live_chart_path_configure (_tmp5_, ctx);
#line 251 "smooth_line.c"
	{
		gint pos = 0;
#line 46 "../src/smooth_line.vala"
		pos = 0;
#line 256 "smooth_line.c"
		{
			gboolean _tmp6_ = FALSE;
#line 46 "../src/smooth_line.vala"
			_tmp6_ = TRUE;
#line 46 "../src/smooth_line.vala"
			while (TRUE) {
#line 263 "smooth_line.c"
				gint _tmp8_;
				gint _tmp9_;
				LiveChartPoint previous_point = {0};
				LiveChartPoint _tmp10_ = {0};
				LiveChartPoint target_point = {0};
				LiveChartPoint _tmp11_ = {0};
				LiveChartPoint _tmp12_;
				LiveChartBezierCurve curve = {0};
				LiveChartPoint _tmp13_;
				LiveChartPoint _tmp14_;
				LiveChartBezierCurve _tmp15_ = {0};
				LiveChartBezierCurve _tmp16_;
				LiveChartCoord _tmp17_;
				LiveChartBezierCurve _tmp18_;
				LiveChartCoord _tmp19_;
				LiveChartBezierCurve _tmp20_;
				LiveChartCoord _tmp21_;
				LiveChartBezierCurve _tmp22_;
				LiveChartCoord _tmp23_;
				LiveChartBezierCurve _tmp24_;
				LiveChartCoord _tmp25_;
				LiveChartBezierCurve _tmp26_;
				LiveChartCoord _tmp27_;
				LiveChartRegion* _tmp28_;
#line 46 "../src/smooth_line.vala"
				if (!_tmp6_) {
#line 290 "smooth_line.c"
					gint _tmp7_;
#line 46 "../src/smooth_line.vala"
					_tmp7_ = pos;
#line 46 "../src/smooth_line.vala"
					pos = _tmp7_ + 1;
#line 296 "smooth_line.c"
				}
#line 46 "../src/smooth_line.vala"
				_tmp6_ = FALSE;
#line 46 "../src/smooth_line.vala"
				_tmp8_ = live_chart_points_get_size (points);
#line 46 "../src/smooth_line.vala"
				_tmp9_ = _tmp8_;
#line 46 "../src/smooth_line.vala"
				if (!(pos <= (_tmp9_ - 1))) {
#line 46 "../src/smooth_line.vala"
					break;
#line 308 "smooth_line.c"
				}
#line 48 "../src/smooth_line.vala"
				live_chart_points_get (points, pos, &_tmp10_);
#line 48 "../src/smooth_line.vala"
				previous_point = _tmp10_;
#line 49 "../src/smooth_line.vala"
				live_chart_points_after (points, pos, &_tmp11_);
#line 49 "../src/smooth_line.vala"
				target_point = _tmp11_;
#line 51 "../src/smooth_line.vala"
				_tmp12_ = previous_point;
#line 51 "../src/smooth_line.vala"
				if (live_chart_serie_renderer_is_out_of_area ((LiveChartSerieRenderer*) self, &_tmp12_)) {
#line 52 "../src/smooth_line.vala"
					continue;
#line 324 "smooth_line.c"
				}
#line 55 "../src/smooth_line.vala"
				_tmp13_ = previous_point;
#line 55 "../src/smooth_line.vala"
				_tmp14_ = target_point;
#line 55 "../src/smooth_line.vala"
				live_chart_build_bezier_curve_from_points (&_tmp13_, &_tmp14_, &_tmp15_);
#line 55 "../src/smooth_line.vala"
				curve = _tmp15_;
#line 57 "../src/smooth_line.vala"
				_tmp16_ = curve;
#line 57 "../src/smooth_line.vala"
				_tmp17_ = _tmp16_.c1;
#line 57 "../src/smooth_line.vala"
				_tmp18_ = curve;
#line 57 "../src/smooth_line.vala"
				_tmp19_ = _tmp18_.c1;
#line 57 "../src/smooth_line.vala"
				_tmp20_ = curve;
#line 57 "../src/smooth_line.vala"
				_tmp21_ = _tmp20_.c2;
#line 57 "../src/smooth_line.vala"
				_tmp22_ = curve;
#line 57 "../src/smooth_line.vala"
				_tmp23_ = _tmp22_.c2;
#line 57 "../src/smooth_line.vala"
				_tmp24_ = curve;
#line 57 "../src/smooth_line.vala"
				_tmp25_ = _tmp24_.c3;
#line 57 "../src/smooth_line.vala"
				_tmp26_ = curve;
#line 57 "../src/smooth_line.vala"
				_tmp27_ = _tmp26_.c3;
#line 57 "../src/smooth_line.vala"
				cairo_curve_to (ctx, _tmp17_.x, _tmp19_.y, _tmp21_.x, _tmp23_.y, _tmp25_.x, _tmp27_.y);
#line 62 "../src/smooth_line.vala"
				_tmp28_ = self->priv->_region;
#line 62 "../src/smooth_line.vala"
				if (_tmp28_ != NULL) {
#line 364 "smooth_line.c"
					LiveChartPoint _tmp29_;
					LiveChartPoint _tmp30_;
					LiveChartBezierCurve _tmp31_;
#line 63 "../src/smooth_line.vala"
					_tmp29_ = previous_point;
#line 63 "../src/smooth_line.vala"
					_tmp30_ = target_point;
#line 63 "../src/smooth_line.vala"
					_tmp31_ = curve;
#line 63 "../src/smooth_line.vala"
					live_chart_smooth_line_generate_intersections (self, &_tmp29_, &_tmp30_, config, &_tmp31_);
#line 376 "smooth_line.c"
				}
			}
		}
	}
#line 67 "../src/smooth_line.vala"
	_tmp32_ = cairo_copy_path (ctx);
#line 67 "../src/smooth_line.vala"
	result = _tmp32_;
#line 67 "../src/smooth_line.vala"
	return result;
#line 387 "smooth_line.c"
}

static gpointer
_cairo_reference0 (gpointer self)
{
#line 70 "../src/smooth_line.vala"
	return self ? cairo_reference (self) : NULL;
#line 395 "smooth_line.c"
}

static Block6Data*
block6_data_ref (Block6Data* _data6_)
{
#line 70 "../src/smooth_line.vala"
	g_atomic_int_inc (&_data6_->_ref_count_);
#line 70 "../src/smooth_line.vala"
	return _data6_;
#line 405 "smooth_line.c"
}

static void
block6_data_unref (void * _userdata_)
{
	Block6Data* _data6_;
	_data6_ = (Block6Data*) _userdata_;
#line 70 "../src/smooth_line.vala"
	if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
#line 415 "smooth_line.c"
		LiveChartSmoothLine* self;
#line 70 "../src/smooth_line.vala"
		self = _data6_->self;
#line 70 "../src/smooth_line.vala"
		_cairo_destroy0 (_data6_->ctx);
#line 70 "../src/smooth_line.vala"
		_g_object_unref0 (self);
#line 70 "../src/smooth_line.vala"
		g_slice_free (Block6Data, _data6_);
#line 425 "smooth_line.c"
	}
}

static gboolean
__lambda13_ (Block6Data* _data6_,
             LiveChartIntersection* intersection)
{
	LiveChartSmoothLine* self;
	gboolean result;
#line 72 "../src/smooth_line.vala"
	self = _data6_->self;
#line 73 "../src/smooth_line.vala"
	if (intersection != NULL) {
#line 439 "smooth_line.c"
		gdouble _tmp0_;
		gdouble _tmp1_;
		LiveChartBoundaries _tmp2_;
		LiveChartBoundary _tmp3_;
		gdouble _tmp4_;
		gdouble _tmp5_;
		gdouble _tmp6_;
		gdouble _tmp7_;
		LiveChartBoundaries _tmp8_;
		LiveChartRegion* _tmp9_;
		LiveChartRegion* _tmp10_;
		GdkRGBA _tmp11_ = {0};
		GdkRGBA _tmp12_;
		LiveChartRegion* _tmp13_;
		LiveChartRegion* _tmp14_;
		GdkRGBA _tmp15_ = {0};
		GdkRGBA _tmp16_;
		LiveChartRegion* _tmp17_;
		LiveChartRegion* _tmp18_;
		GdkRGBA _tmp19_ = {0};
		GdkRGBA _tmp20_;
		LiveChartRegion* _tmp21_;
		LiveChartRegion* _tmp22_;
		GdkRGBA _tmp23_ = {0};
		GdkRGBA _tmp24_;
#line 74 "../src/smooth_line.vala"
		_tmp0_ = live_chart_intersection_get_start_x (intersection);
#line 74 "../src/smooth_line.vala"
		_tmp1_ = _tmp0_;
#line 74 "../src/smooth_line.vala"
		_tmp2_ = _data6_->boundaries;
#line 74 "../src/smooth_line.vala"
		_tmp3_ = _tmp2_.y;
#line 74 "../src/smooth_line.vala"
		_tmp4_ = live_chart_intersection_get_end_x (intersection);
#line 74 "../src/smooth_line.vala"
		_tmp5_ = _tmp4_;
#line 74 "../src/smooth_line.vala"
		_tmp6_ = live_chart_intersection_get_start_x (intersection);
#line 74 "../src/smooth_line.vala"
		_tmp7_ = _tmp6_;
#line 74 "../src/smooth_line.vala"
		_tmp8_ = _data6_->boundaries;
#line 74 "../src/smooth_line.vala"
		cairo_rectangle (_data6_->ctx, _tmp1_, (gdouble) _tmp3_.min, _tmp5_ - _tmp7_, (gdouble) _tmp8_.height);
#line 75 "../src/smooth_line.vala"
		_tmp9_ = live_chart_intersection_get_region (intersection);
#line 75 "../src/smooth_line.vala"
		_tmp10_ = _tmp9_;
#line 75 "../src/smooth_line.vala"
		live_chart_region_get_line_color (_tmp10_, &_tmp11_);
#line 75 "../src/smooth_line.vala"
		_tmp12_ = _tmp11_;
#line 75 "../src/smooth_line.vala"
		_tmp13_ = live_chart_intersection_get_region (intersection);
#line 75 "../src/smooth_line.vala"
		_tmp14_ = _tmp13_;
#line 75 "../src/smooth_line.vala"
		live_chart_region_get_line_color (_tmp14_, &_tmp15_);
#line 75 "../src/smooth_line.vala"
		_tmp16_ = _tmp15_;
#line 75 "../src/smooth_line.vala"
		_tmp17_ = live_chart_intersection_get_region (intersection);
#line 75 "../src/smooth_line.vala"
		_tmp18_ = _tmp17_;
#line 75 "../src/smooth_line.vala"
		live_chart_region_get_line_color (_tmp18_, &_tmp19_);
#line 75 "../src/smooth_line.vala"
		_tmp20_ = _tmp19_;
#line 75 "../src/smooth_line.vala"
		_tmp21_ = live_chart_intersection_get_region (intersection);
#line 75 "../src/smooth_line.vala"
		_tmp22_ = _tmp21_;
#line 75 "../src/smooth_line.vala"
		live_chart_region_get_line_color (_tmp22_, &_tmp23_);
#line 75 "../src/smooth_line.vala"
		_tmp24_ = _tmp23_;
#line 75 "../src/smooth_line.vala"
		cairo_set_source_rgba (_data6_->ctx, _tmp12_.red, _tmp16_.green, _tmp20_.blue, _tmp24_.alpha);
#line 519 "smooth_line.c"
	}
#line 77 "../src/smooth_line.vala"
	result = TRUE;
#line 77 "../src/smooth_line.vala"
	_g_object_unref0 (intersection);
#line 77 "../src/smooth_line.vala"
	return result;
#line 527 "smooth_line.c"
}

static gboolean
___lambda13__gee_forall_func (gpointer g,
                              gpointer self)
{
	gboolean result;
	result = __lambda13_ (self, (LiveChartIntersection*) g);
#line 72 "../src/smooth_line.vala"
	return result;
#line 538 "smooth_line.c"
}

void
live_chart_smooth_line_draw_regions_on_line (LiveChartSmoothLine* self,
                                             cairo_t* ctx,
                                             LiveChartConfig* config)
{
	Block6Data* _data6_;
	cairo_t* _tmp0_;
	LiveChartBoundaries _tmp1_ = {0};
	LiveChartIntersections* _tmp2_;
#line 70 "../src/smooth_line.vala"
	g_return_if_fail (self != NULL);
#line 70 "../src/smooth_line.vala"
	g_return_if_fail (ctx != NULL);
#line 70 "../src/smooth_line.vala"
	g_return_if_fail (config != NULL);
#line 70 "../src/smooth_line.vala"
	_data6_ = g_slice_new0 (Block6Data);
#line 70 "../src/smooth_line.vala"
	_data6_->_ref_count_ = 1;
#line 70 "../src/smooth_line.vala"
	_data6_->self = g_object_ref (self);
#line 70 "../src/smooth_line.vala"
	_tmp0_ = _cairo_reference0 (ctx);
#line 70 "../src/smooth_line.vala"
	_cairo_destroy0 (_data6_->ctx);
#line 70 "../src/smooth_line.vala"
	_data6_->ctx = _tmp0_;
#line 71 "../src/smooth_line.vala"
	live_chart_config_boundaries (config, &_tmp1_);
#line 71 "../src/smooth_line.vala"
	_data6_->boundaries = _tmp1_;
#line 72 "../src/smooth_line.vala"
	_tmp2_ = self->intersections;
#line 72 "../src/smooth_line.vala"
	live_chart_intersections_foreach (_tmp2_, ___lambda13__gee_forall_func, _data6_);
#line 70 "../src/smooth_line.vala"
	block6_data_unref (_data6_);
#line 70 "../src/smooth_line.vala"
	_data6_ = NULL;
#line 580 "smooth_line.c"
}

static void
live_chart_smooth_line_generate_intersections (LiveChartSmoothLine* self,
                                               LiveChartPoint* previous,
                                               LiveChartPoint* target,
                                               LiveChartConfig* config,
                                               LiveChartBezierCurve* curve)
{
	LiveChartRegion* _tmp0_;
	LiveChartBezierIntersector* _tmp1_;
	LiveChartBezierIntersector* _tmp2_;
	LiveChartIntersections* _tmp3_;
	LiveChartPoint _tmp4_;
	LiveChartPoint _tmp5_;
	LiveChartBezierCurve _tmp6_;
#line 81 "../src/smooth_line.vala"
	g_return_if_fail (self != NULL);
#line 81 "../src/smooth_line.vala"
	g_return_if_fail (previous != NULL);
#line 81 "../src/smooth_line.vala"
	g_return_if_fail (target != NULL);
#line 81 "../src/smooth_line.vala"
	g_return_if_fail (config != NULL);
#line 81 "../src/smooth_line.vala"
	g_return_if_fail (curve != NULL);
#line 82 "../src/smooth_line.vala"
	_tmp0_ = self->priv->_region;
#line 82 "../src/smooth_line.vala"
	_tmp1_ = live_chart_bezier_intersector_new (_tmp0_, config);
#line 82 "../src/smooth_line.vala"
	_tmp2_ = _tmp1_;
#line 82 "../src/smooth_line.vala"
	_tmp3_ = self->intersections;
#line 82 "../src/smooth_line.vala"
	_tmp4_ = *previous;
#line 82 "../src/smooth_line.vala"
	_tmp5_ = *target;
#line 82 "../src/smooth_line.vala"
	_tmp6_ = *curve;
#line 82 "../src/smooth_line.vala"
	live_chart_intersector_intersect ((LiveChartIntersector*) _tmp2_, _tmp3_, &_tmp4_, &_tmp5_, &_tmp6_);
#line 82 "../src/smooth_line.vala"
	_live_chart_bezier_intersector_unref0 (_tmp2_);
#line 625 "smooth_line.c"
}

static void
live_chart_smooth_line_update_bounding_box (LiveChartSmoothLine* self,
                                            LiveChartPoints* 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 85 "../src/smooth_line.vala"
	g_return_if_fail (self != NULL);
#line 85 "../src/smooth_line.vala"
	g_return_if_fail (points != NULL);
#line 85 "../src/smooth_line.vala"
	g_return_if_fail (config != NULL);
#line 86 "../src/smooth_line.vala"
	live_chart_points_first (points, &_tmp0_);
#line 86 "../src/smooth_line.vala"
	_tmp1_ = live_chart_points_get_bounds (points);
#line 86 "../src/smooth_line.vala"
	_tmp2_ = _tmp1_;
#line 86 "../src/smooth_line.vala"
	_tmp3_ = live_chart_bounds_get_lower (_tmp2_);
#line 86 "../src/smooth_line.vala"
	_tmp4_ = _tmp3_;
#line 86 "../src/smooth_line.vala"
	live_chart_points_last (points, &_tmp5_);
#line 86 "../src/smooth_line.vala"
	live_chart_points_first (points, &_tmp6_);
#line 86 "../src/smooth_line.vala"
	_tmp7_ = live_chart_points_get_bounds (points);
#line 86 "../src/smooth_line.vala"
	_tmp8_ = _tmp7_;
#line 86 "../src/smooth_line.vala"
	_tmp9_ = live_chart_bounds_get_upper (_tmp8_);
#line 86 "../src/smooth_line.vala"
	_tmp10_ = _tmp9_;
#line 86 "../src/smooth_line.vala"
	_tmp11_ = live_chart_points_get_bounds (points);
#line 86 "../src/smooth_line.vala"
	_tmp12_ = _tmp11_;
#line 86 "../src/smooth_line.vala"
	_tmp13_ = live_chart_bounds_get_lower (_tmp12_);
#line 86 "../src/smooth_line.vala"
	_tmp14_ = _tmp13_;
#line 86 "../src/smooth_line.vala"
	memset (&_tmp15_, 0, sizeof (LiveChartBoundingBox));
#line 86 "../src/smooth_line.vala"
	_tmp15_.x = _tmp0_.x;
#line 86 "../src/smooth_line.vala"
	_tmp15_.y = _tmp4_;
#line 86 "../src/smooth_line.vala"
	_tmp15_.width = _tmp5_.x - _tmp6_.x;
#line 86 "../src/smooth_line.vala"
	_tmp15_.height = _tmp10_ - _tmp14_;
#line 86 "../src/smooth_line.vala"
	((LiveChartSerieRenderer*) self)->bounding_box = _tmp15_;
#line 697 "smooth_line.c"
}

LiveChartRegion*
live_chart_smooth_line_get_region (LiveChartSmoothLine* self)
{
	LiveChartRegion* result;
	LiveChartRegion* _tmp0_;
#line 6 "../src/smooth_line.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 6 "../src/smooth_line.vala"
	_tmp0_ = self->priv->_region;
#line 6 "../src/smooth_line.vala"
	result = _tmp0_;
#line 6 "../src/smooth_line.vala"
	return result;
#line 713 "smooth_line.c"
}

static gpointer
_live_chart_region_ref0 (gpointer self)
{
#line 6 "../src/smooth_line.vala"
	return self ? live_chart_region_ref (self) : NULL;
#line 721 "smooth_line.c"
}

void
live_chart_smooth_line_set_region (LiveChartSmoothLine* self,
                                   LiveChartRegion* value)
{
	LiveChartRegion* old_value;
#line 6 "../src/smooth_line.vala"
	g_return_if_fail (self != NULL);
#line 6 "../src/smooth_line.vala"
	old_value = live_chart_smooth_line_get_region (self);
#line 6 "../src/smooth_line.vala"
	if (old_value != value) {
#line 735 "smooth_line.c"
		LiveChartRegion* _tmp0_;
#line 6 "../src/smooth_line.vala"
		_tmp0_ = _live_chart_region_ref0 (value);
#line 6 "../src/smooth_line.vala"
		_live_chart_region_unref0 (self->priv->_region);
#line 6 "../src/smooth_line.vala"
		self->priv->_region = _tmp0_;
#line 6 "../src/smooth_line.vala"
		g_object_notify_by_pspec ((GObject *) self, live_chart_smooth_line_properties[LIVE_CHART_SMOOTH_LINE_REGION_PROPERTY]);
#line 745 "smooth_line.c"
	}
}

static void
live_chart_smooth_line_class_init (LiveChartSmoothLineClass * klass,
                                   gpointer klass_data)
{
#line 4 "../src/smooth_line.vala"
	live_chart_smooth_line_parent_class = g_type_class_peek_parent (klass);
#line 4 "../src/smooth_line.vala"
	g_type_class_adjust_private_offset (klass, &LiveChartSmoothLine_private_offset);
#line 4 "../src/smooth_line.vala"
	((LiveChartSerieRendererClass *) klass)->draw = (void (*) (LiveChartSerieRenderer*, cairo_t*, LiveChartConfig*)) live_chart_smooth_line_real_draw;
#line 4 "../src/smooth_line.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_live_chart_smooth_line_get_property;
#line 4 "../src/smooth_line.vala"
	G_OBJECT_CLASS (klass)->set_property = _vala_live_chart_smooth_line_set_property;
#line 4 "../src/smooth_line.vala"
	G_OBJECT_CLASS (klass)->finalize = live_chart_smooth_line_finalize;
#line 4 "../src/smooth_line.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_SMOOTH_LINE_REGION_PROPERTY, live_chart_smooth_line_properties[LIVE_CHART_SMOOTH_LINE_REGION_PROPERTY] = live_chart_param_spec_region ("region", "region", "region", LIVE_CHART_TYPE_REGION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 767 "smooth_line.c"
}

static void
live_chart_smooth_line_instance_init (LiveChartSmoothLine * self,
                                      gpointer klass)
{
	LiveChartIntersections* _tmp0_;
#line 4 "../src/smooth_line.vala"
	self->priv = live_chart_smooth_line_get_instance_private (self);
#line 6 "../src/smooth_line.vala"
	self->priv->_region = NULL;
#line 7 "../src/smooth_line.vala"
	_tmp0_ = live_chart_intersections_new ();
#line 7 "../src/smooth_line.vala"
	self->intersections = _tmp0_;
#line 783 "smooth_line.c"
}

static void
live_chart_smooth_line_finalize (GObject * obj)
{
	LiveChartSmoothLine * self;
#line 4 "../src/smooth_line.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, LIVE_CHART_TYPE_SMOOTH_LINE, LiveChartSmoothLine);
#line 6 "../src/smooth_line.vala"
	_live_chart_region_unref0 (self->priv->_region);
#line 7 "../src/smooth_line.vala"
	_g_object_unref0 (self->intersections);
#line 4 "../src/smooth_line.vala"
	G_OBJECT_CLASS (live_chart_smooth_line_parent_class)->finalize (obj);
#line 798 "smooth_line.c"
}

static GType
live_chart_smooth_line_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (LiveChartSmoothLineClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_smooth_line_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartSmoothLine), 0, (GInstanceInitFunc) live_chart_smooth_line_instance_init, NULL };
	GType live_chart_smooth_line_type_id;
	live_chart_smooth_line_type_id = g_type_register_static (LIVE_CHART_TYPE_SERIE_RENDERER, "LiveChartSmoothLine", &g_define_type_info, 0);
	LiveChartSmoothLine_private_offset = g_type_add_instance_private (live_chart_smooth_line_type_id, sizeof (LiveChartSmoothLinePrivate));
	return live_chart_smooth_line_type_id;
}

GType
live_chart_smooth_line_get_type (void)
{
	static volatile gsize live_chart_smooth_line_type_id__once = 0;
	if (g_once_init_enter (&live_chart_smooth_line_type_id__once)) {
		GType live_chart_smooth_line_type_id;
		live_chart_smooth_line_type_id = live_chart_smooth_line_get_type_once ();
		g_once_init_leave (&live_chart_smooth_line_type_id__once, live_chart_smooth_line_type_id);
	}
	return live_chart_smooth_line_type_id__once;
}

static void
_vala_live_chart_smooth_line_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec)
{
	LiveChartSmoothLine * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_SMOOTH_LINE, LiveChartSmoothLine);
#line 4 "../src/smooth_line.vala"
	switch (property_id) {
#line 4 "../src/smooth_line.vala"
		case LIVE_CHART_SMOOTH_LINE_REGION_PROPERTY:
#line 4 "../src/smooth_line.vala"
		live_chart_value_set_region (value, live_chart_smooth_line_get_region (self));
#line 4 "../src/smooth_line.vala"
		break;
#line 839 "smooth_line.c"
		default:
#line 4 "../src/smooth_line.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 4 "../src/smooth_line.vala"
		break;
#line 845 "smooth_line.c"
	}
}

static void
_vala_live_chart_smooth_line_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec)
{
	LiveChartSmoothLine * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_SMOOTH_LINE, LiveChartSmoothLine);
#line 4 "../src/smooth_line.vala"
	switch (property_id) {
#line 4 "../src/smooth_line.vala"
		case LIVE_CHART_SMOOTH_LINE_REGION_PROPERTY:
#line 4 "../src/smooth_line.vala"
		live_chart_smooth_line_set_region (self, live_chart_value_get_region (value));
#line 4 "../src/smooth_line.vala"
		break;
#line 865 "smooth_line.c"
		default:
#line 4 "../src/smooth_line.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 4 "../src/smooth_line.vala"
		break;
#line 871 "smooth_line.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;
}

