/* gitg-diff-image-overlay.c generated by valac 0.35.5.2-9e6c0, the Vala compiler
 * generated from gitg-diff-image-overlay.vala, do not modify */

/*
 * This file is part of gitg
 *
 * Copyright (C) 2016 - Jesse van den Kieboom
 *
 * gitg is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * gitg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with gitg. If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <float.h>
#include <math.h>
#include <cairo.h>
#include <gdk/gdk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>


#define GITG_TYPE_DIFF_IMAGE_COMPOSITE (gitg_diff_image_composite_get_type ())
#define GITG_DIFF_IMAGE_COMPOSITE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DIFF_IMAGE_COMPOSITE, GitgDiffImageComposite))
#define GITG_DIFF_IMAGE_COMPOSITE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_DIFF_IMAGE_COMPOSITE, GitgDiffImageCompositeClass))
#define GITG_IS_DIFF_IMAGE_COMPOSITE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DIFF_IMAGE_COMPOSITE))
#define GITG_IS_DIFF_IMAGE_COMPOSITE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_DIFF_IMAGE_COMPOSITE))
#define GITG_DIFF_IMAGE_COMPOSITE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_DIFF_IMAGE_COMPOSITE, GitgDiffImageCompositeClass))

typedef struct _GitgDiffImageComposite GitgDiffImageComposite;
typedef struct _GitgDiffImageCompositeClass GitgDiffImageCompositeClass;
typedef struct _GitgDiffImageCompositePrivate GitgDiffImageCompositePrivate;

#define GITG_TYPE_DIFF_IMAGE_OVERLAY (gitg_diff_image_overlay_get_type ())
#define GITG_DIFF_IMAGE_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DIFF_IMAGE_OVERLAY, GitgDiffImageOverlay))
#define GITG_DIFF_IMAGE_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_DIFF_IMAGE_OVERLAY, GitgDiffImageOverlayClass))
#define GITG_IS_DIFF_IMAGE_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DIFF_IMAGE_OVERLAY))
#define GITG_IS_DIFF_IMAGE_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_DIFF_IMAGE_OVERLAY))
#define GITG_DIFF_IMAGE_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_DIFF_IMAGE_OVERLAY, GitgDiffImageOverlayClass))

typedef struct _GitgDiffImageOverlay GitgDiffImageOverlay;
typedef struct _GitgDiffImageOverlayClass GitgDiffImageOverlayClass;
typedef struct _GitgDiffImageOverlayPrivate GitgDiffImageOverlayPrivate;

#define GITG_TYPE_DIFF_IMAGE_SURFACE_CACHE (gitg_diff_image_surface_cache_get_type ())
#define GITG_DIFF_IMAGE_SURFACE_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DIFF_IMAGE_SURFACE_CACHE, GitgDiffImageSurfaceCache))
#define GITG_IS_DIFF_IMAGE_SURFACE_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DIFF_IMAGE_SURFACE_CACHE))
#define GITG_DIFF_IMAGE_SURFACE_CACHE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GITG_TYPE_DIFF_IMAGE_SURFACE_CACHE, GitgDiffImageSurfaceCacheIface))

typedef struct _GitgDiffImageSurfaceCache GitgDiffImageSurfaceCache;
typedef struct _GitgDiffImageSurfaceCacheIface GitgDiffImageSurfaceCacheIface;
#define _cairo_surface_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_surface_destroy (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GitgDiffImageComposite {
	GtkDrawingArea parent_instance;
	GitgDiffImageCompositePrivate * priv;
};

struct _GitgDiffImageCompositeClass {
	GtkDrawingAreaClass parent_class;
};

struct _GitgDiffImageOverlay {
	GitgDiffImageComposite parent_instance;
	GitgDiffImageOverlayPrivate * priv;
};

struct _GitgDiffImageOverlayClass {
	GitgDiffImageCompositeClass parent_class;
};

struct _GitgDiffImageOverlayPrivate {
	gdouble d_alpha;
};

struct _GitgDiffImageSurfaceCacheIface {
	GTypeInterface parent_iface;
	cairo_surface_t* (*get_old_surface) (GitgDiffImageSurfaceCache* self, GdkWindow* window);
	cairo_surface_t* (*get_new_surface) (GitgDiffImageSurfaceCache* self, GdkWindow* window);
	GdkPixbuf* (*get_old_pixbuf) (GitgDiffImageSurfaceCache* self);
	void (*set_old_pixbuf) (GitgDiffImageSurfaceCache* self, GdkPixbuf* value);
	GdkPixbuf* (*get_new_pixbuf) (GitgDiffImageSurfaceCache* self);
	void (*set_new_pixbuf) (GitgDiffImageSurfaceCache* self, GdkPixbuf* value);
	GdkWindow* (*get_window) (GitgDiffImageSurfaceCache* self);
	void (*set_window) (GitgDiffImageSurfaceCache* self, GdkWindow* value);
};


static gpointer gitg_diff_image_overlay_parent_class = NULL;

GType gitg_diff_image_composite_get_type (void) G_GNUC_CONST;
GType gitg_diff_image_overlay_get_type (void) G_GNUC_CONST;
#define GITG_DIFF_IMAGE_OVERLAY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GITG_TYPE_DIFF_IMAGE_OVERLAY, GitgDiffImageOverlayPrivate))
enum  {
	GITG_DIFF_IMAGE_OVERLAY_DUMMY_PROPERTY,
	GITG_DIFF_IMAGE_OVERLAY_ALPHA
};
static gboolean gitg_diff_image_overlay_real_draw (GtkWidget* base, cairo_t* cr);
void gitg_diff_image_composite_get_sizing (GitgDiffImageComposite* self, gint width, gint* image_width, gint* image_height);
GType gitg_diff_image_surface_cache_get_type (void) G_GNUC_CONST;
GitgDiffImageSurfaceCache* gitg_diff_image_composite_get_cache (GitgDiffImageComposite* self);
cairo_surface_t* gitg_diff_image_surface_cache_get_old_surface (GitgDiffImageSurfaceCache* self, GdkWindow* window);
cairo_surface_t* gitg_diff_image_surface_cache_get_new_surface (GitgDiffImageSurfaceCache* self, GdkWindow* window);
static void gitg_diff_image_overlay_real_realize (GtkWidget* base);
GitgDiffImageOverlay* gitg_diff_image_overlay_new (void);
GitgDiffImageOverlay* gitg_diff_image_overlay_construct (GType object_type);
GitgDiffImageComposite* gitg_diff_image_composite_new (void);
GitgDiffImageComposite* gitg_diff_image_composite_construct (GType object_type);
gdouble gitg_diff_image_overlay_get_alpha (GitgDiffImageOverlay* self);
void gitg_diff_image_overlay_set_alpha (GitgDiffImageOverlay* self, gdouble value);
static void gitg_diff_image_overlay_finalize (GObject * obj);
static void _vala_gitg_diff_image_overlay_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gitg_diff_image_overlay_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static gpointer _g_object_ref0 (gpointer self) {
#line 46 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	return self ? g_object_ref (self) : NULL;
#line 131 "gitg-diff-image-overlay.c"
}


static gboolean gitg_diff_image_overlay_real_draw (GtkWidget* base, cairo_t* cr) {
	GitgDiffImageOverlay * self;
	gboolean result = FALSE;
	cairo_t* _tmp0_;
	GdkWindow* window;
	GdkWindow* _tmp1_;
	GdkWindow* _tmp2_;
	GtkAllocation alloc = {0};
	GtkAllocation _tmp3_ = {0};
	gint image_width = 0;
	gint image_height = 0;
	GtkAllocation _tmp4_;
	gint _tmp5_;
	gint _tmp6_ = 0;
	gint _tmp7_ = 0;
	cairo_surface_t* old_surface;
	GitgDiffImageSurfaceCache* _tmp8_;
	GitgDiffImageSurfaceCache* _tmp9_;
	GdkWindow* _tmp10_;
	cairo_surface_t* _tmp11_;
	cairo_surface_t* new_surface;
	GitgDiffImageSurfaceCache* _tmp12_;
	GitgDiffImageSurfaceCache* _tmp13_;
	GdkWindow* _tmp14_;
	cairo_surface_t* _tmp15_;
	gint x;
	GtkAllocation _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	gint y;
	gboolean _tmp19_ = FALSE;
	cairo_surface_t* _tmp20_;
	gboolean _tmp28_ = FALSE;
	cairo_surface_t* _tmp29_;
#line 42 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	self = (GitgDiffImageOverlay*) base;
#line 42 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	g_return_val_if_fail (cr != NULL, FALSE);
#line 44 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp0_ = cr;
#line 44 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	GTK_WIDGET_CLASS (gitg_diff_image_overlay_parent_class)->draw ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GITG_TYPE_DIFF_IMAGE_COMPOSITE, GitgDiffImageComposite), _tmp0_);
#line 46 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp1_ = gtk_widget_get_window ((GtkWidget*) self);
#line 46 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp2_ = _g_object_ref0 (_tmp1_);
#line 46 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	window = _tmp2_;
#line 49 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	gtk_widget_get_allocation ((GtkWidget*) self, &_tmp3_);
#line 49 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	alloc = _tmp3_;
#line 52 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp4_ = alloc;
#line 52 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp5_ = _tmp4_.width;
#line 52 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	gitg_diff_image_composite_get_sizing ((GitgDiffImageComposite*) self, _tmp5_, &_tmp6_, &_tmp7_);
#line 52 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	image_width = _tmp6_;
#line 52 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	image_height = _tmp7_;
#line 54 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp8_ = gitg_diff_image_composite_get_cache ((GitgDiffImageComposite*) self);
#line 54 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp9_ = _tmp8_;
#line 54 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp10_ = window;
#line 54 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp11_ = gitg_diff_image_surface_cache_get_old_surface (_tmp9_, _tmp10_);
#line 54 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	old_surface = _tmp11_;
#line 55 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp12_ = gitg_diff_image_composite_get_cache ((GitgDiffImageComposite*) self);
#line 55 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp13_ = _tmp12_;
#line 55 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp14_ = window;
#line 55 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp15_ = gitg_diff_image_surface_cache_get_new_surface (_tmp13_, _tmp14_);
#line 55 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	new_surface = _tmp15_;
#line 57 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp16_ = alloc;
#line 57 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp17_ = _tmp16_.width;
#line 57 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp18_ = image_width;
#line 57 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	x = (_tmp17_ - _tmp18_) / 2;
#line 58 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	y = 0;
#line 60 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp20_ = old_surface;
#line 60 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	if (_tmp20_ != NULL) {
#line 231 "gitg-diff-image-overlay.c"
		gdouble _tmp21_;
#line 60 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp21_ = self->priv->d_alpha;
#line 60 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp19_ = _tmp21_ != ((gdouble) 1);
#line 237 "gitg-diff-image-overlay.c"
	} else {
#line 60 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp19_ = FALSE;
#line 241 "gitg-diff-image-overlay.c"
	}
#line 60 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	if (_tmp19_) {
#line 245 "gitg-diff-image-overlay.c"
		cairo_t* _tmp22_;
		cairo_surface_t* _tmp23_;
		gint _tmp24_;
		gint _tmp25_;
		cairo_t* _tmp26_;
		gdouble _tmp27_;
#line 62 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp22_ = cr;
#line 62 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp23_ = old_surface;
#line 62 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp24_ = x;
#line 62 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp25_ = y;
#line 62 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		cairo_set_source_surface (_tmp22_, _tmp23_, (gdouble) _tmp24_, (gdouble) _tmp25_);
#line 63 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp26_ = cr;
#line 63 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp27_ = self->priv->d_alpha;
#line 63 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		cairo_paint_with_alpha (_tmp26_, 1 - _tmp27_);
#line 268 "gitg-diff-image-overlay.c"
	}
#line 66 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp29_ = new_surface;
#line 66 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	if (_tmp29_ != NULL) {
#line 274 "gitg-diff-image-overlay.c"
		gdouble _tmp30_;
#line 66 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp30_ = self->priv->d_alpha;
#line 66 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp28_ = _tmp30_ != ((gdouble) 0);
#line 280 "gitg-diff-image-overlay.c"
	} else {
#line 66 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp28_ = FALSE;
#line 284 "gitg-diff-image-overlay.c"
	}
#line 66 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	if (_tmp28_) {
#line 288 "gitg-diff-image-overlay.c"
		cairo_t* _tmp31_;
		cairo_surface_t* _tmp32_;
		gint _tmp33_;
		gint _tmp34_;
		cairo_t* _tmp35_;
		gdouble _tmp36_;
#line 68 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp31_ = cr;
#line 68 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp32_ = new_surface;
#line 68 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp33_ = x;
#line 68 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp34_ = y;
#line 68 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		cairo_set_source_surface (_tmp31_, _tmp32_, (gdouble) _tmp33_, (gdouble) _tmp34_);
#line 69 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp35_ = cr;
#line 69 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp36_ = self->priv->d_alpha;
#line 69 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		cairo_paint_with_alpha (_tmp35_, _tmp36_);
#line 311 "gitg-diff-image-overlay.c"
	}
#line 72 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	result = TRUE;
#line 72 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_cairo_surface_destroy0 (new_surface);
#line 72 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_cairo_surface_destroy0 (old_surface);
#line 72 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_g_object_unref0 (window);
#line 72 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	return result;
#line 323 "gitg-diff-image-overlay.c"
}


static void gitg_diff_image_overlay_real_realize (GtkWidget* base) {
	GitgDiffImageOverlay * self;
#line 75 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	self = (GitgDiffImageOverlay*) base;
#line 77 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	GTK_WIDGET_CLASS (gitg_diff_image_overlay_parent_class)->realize ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GITG_TYPE_DIFF_IMAGE_COMPOSITE, GitgDiffImageComposite));
#line 78 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	gtk_widget_queue_resize ((GtkWidget*) self);
#line 335 "gitg-diff-image-overlay.c"
}


GitgDiffImageOverlay* gitg_diff_image_overlay_construct (GType object_type) {
	GitgDiffImageOverlay * self = NULL;
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	self = (GitgDiffImageOverlay*) gitg_diff_image_composite_construct (object_type);
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	return self;
#line 345 "gitg-diff-image-overlay.c"
}


GitgDiffImageOverlay* gitg_diff_image_overlay_new (void) {
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	return gitg_diff_image_overlay_construct (GITG_TYPE_DIFF_IMAGE_OVERLAY);
#line 352 "gitg-diff-image-overlay.c"
}


gdouble gitg_diff_image_overlay_get_alpha (GitgDiffImageOverlay* self) {
	gdouble result;
	gdouble _tmp0_;
#line 26 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	g_return_val_if_fail (self != NULL, 0.0);
#line 26 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	_tmp0_ = self->priv->d_alpha;
#line 26 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	result = _tmp0_;
#line 26 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	return result;
#line 367 "gitg-diff-image-overlay.c"
}


void gitg_diff_image_overlay_set_alpha (GitgDiffImageOverlay* self, gdouble value) {
#line 28 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	g_return_if_fail (self != NULL);
#line 28 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	if (gitg_diff_image_overlay_get_alpha (self) != value) {
#line 376 "gitg-diff-image-overlay.c"
		gdouble newalpha;
		gdouble _tmp0_;
		gdouble _tmp1_;
		gdouble _tmp2_;
		gdouble _tmp3_;
		gdouble _tmp4_;
#line 30 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp0_ = value;
#line 30 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp1_ = MIN (_tmp0_, (gdouble) 1);
#line 30 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp2_ = MAX ((gdouble) 0, _tmp1_);
#line 30 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		newalpha = _tmp2_;
#line 32 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp3_ = newalpha;
#line 32 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		_tmp4_ = self->priv->d_alpha;
#line 32 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		if (_tmp3_ != _tmp4_) {
#line 397 "gitg-diff-image-overlay.c"
			gdouble _tmp5_;
#line 34 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
			_tmp5_ = newalpha;
#line 34 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
			self->priv->d_alpha = _tmp5_;
#line 35 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
			gtk_widget_queue_draw ((GtkWidget*) self);
#line 405 "gitg-diff-image-overlay.c"
		}
#line 28 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		g_object_notify ((GObject *) self, "alpha");
#line 409 "gitg-diff-image-overlay.c"
	}
}


static void gitg_diff_image_overlay_class_init (GitgDiffImageOverlayClass * klass) {
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	gitg_diff_image_overlay_parent_class = g_type_class_peek_parent (klass);
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	g_type_class_add_private (klass, sizeof (GitgDiffImageOverlayPrivate));
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	((GtkWidgetClass *) klass)->draw = gitg_diff_image_overlay_real_draw;
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	((GtkWidgetClass *) klass)->realize = gitg_diff_image_overlay_real_realize;
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_gitg_diff_image_overlay_get_property;
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	G_OBJECT_CLASS (klass)->set_property = _vala_gitg_diff_image_overlay_set_property;
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	G_OBJECT_CLASS (klass)->finalize = gitg_diff_image_overlay_finalize;
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_IMAGE_OVERLAY_ALPHA, g_param_spec_double ("alpha", "alpha", "alpha", -G_MAXDOUBLE, G_MAXDOUBLE, 0.5, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 431 "gitg-diff-image-overlay.c"
}


static void gitg_diff_image_overlay_instance_init (GitgDiffImageOverlay * self) {
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	self->priv = GITG_DIFF_IMAGE_OVERLAY_GET_PRIVATE (self);
#line 438 "gitg-diff-image-overlay.c"
}


static void gitg_diff_image_overlay_finalize (GObject * obj) {
	GitgDiffImageOverlay * self;
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_DIFF_IMAGE_OVERLAY, GitgDiffImageOverlay);
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	G_OBJECT_CLASS (gitg_diff_image_overlay_parent_class)->finalize (obj);
#line 448 "gitg-diff-image-overlay.c"
}


GType gitg_diff_image_overlay_get_type (void) {
	static volatile gsize gitg_diff_image_overlay_type_id__volatile = 0;
	if (g_once_init_enter (&gitg_diff_image_overlay_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GitgDiffImageOverlayClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_diff_image_overlay_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgDiffImageOverlay), 0, (GInstanceInitFunc) gitg_diff_image_overlay_instance_init, NULL };
		GType gitg_diff_image_overlay_type_id;
		gitg_diff_image_overlay_type_id = g_type_register_static (GITG_TYPE_DIFF_IMAGE_COMPOSITE, "GitgDiffImageOverlay", &g_define_type_info, 0);
		g_once_init_leave (&gitg_diff_image_overlay_type_id__volatile, gitg_diff_image_overlay_type_id);
	}
	return gitg_diff_image_overlay_type_id__volatile;
}


static void _vala_gitg_diff_image_overlay_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GitgDiffImageOverlay * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_DIFF_IMAGE_OVERLAY, GitgDiffImageOverlay);
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	switch (property_id) {
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		case GITG_DIFF_IMAGE_OVERLAY_ALPHA:
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		g_value_set_double (value, gitg_diff_image_overlay_get_alpha (self));
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		break;
#line 475 "gitg-diff-image-overlay.c"
		default:
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		break;
#line 481 "gitg-diff-image-overlay.c"
	}
}


static void _vala_gitg_diff_image_overlay_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GitgDiffImageOverlay * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_DIFF_IMAGE_OVERLAY, GitgDiffImageOverlay);
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
	switch (property_id) {
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		case GITG_DIFF_IMAGE_OVERLAY_ALPHA:
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		gitg_diff_image_overlay_set_alpha (self, g_value_get_double (value));
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		break;
#line 497 "gitg-diff-image-overlay.c"
		default:
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 20 "/home/mcatanzaro/Projects/GNOME/gitg/libgitg/gitg-diff-image-overlay.vala"
		break;
#line 503 "gitg-diff-image-overlay.c"
	}
}



