/* gitg-diff-image-composite.c generated by valac 0.34.7, the Vala compiler
 * generated from gitg-diff-image-composite.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 <gdk/gdk.h>
#include <cairo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <float.h>
#include <math.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_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 _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _cairo_surface_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_surface_destroy (var), NULL)))

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

struct _GitgDiffImageCompositeClass {
	GtkDrawingAreaClass parent_class;
};

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

struct _GitgDiffImageCompositePrivate {
	GitgDiffImageSurfaceCache* _cache;
};


static gpointer gitg_diff_image_composite_parent_class = NULL;

GType gitg_diff_image_composite_get_type (void) G_GNUC_CONST;
GType gitg_diff_image_surface_cache_get_type (void) G_GNUC_CONST;
#define GITG_DIFF_IMAGE_COMPOSITE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GITG_TYPE_DIFF_IMAGE_COMPOSITE, GitgDiffImageCompositePrivate))
enum  {
	GITG_DIFF_IMAGE_COMPOSITE_DUMMY_PROPERTY,
	GITG_DIFF_IMAGE_COMPOSITE_CACHE
};
static void gitg_diff_image_composite_get_natural_size (GitgDiffImageComposite* self, gint* image_width, gint* image_height);
GitgDiffImageSurfaceCache* gitg_diff_image_composite_get_cache (GitgDiffImageComposite* self);
GdkPixbuf* gitg_diff_image_surface_cache_get_old_pixbuf (GitgDiffImageSurfaceCache* self);
cairo_surface_t* gitg_diff_image_surface_cache_get_old_surface (GitgDiffImageSurfaceCache* self, GdkWindow* window);
void gitg_diff_image_composite_get_sizing (GitgDiffImageComposite* self, gint width, gint* image_width, gint* image_height);
static void gitg_diff_image_composite_real_get_preferred_width (GtkWidget* base, gint* minimum_width, gint* natural_width);
static void gitg_diff_image_composite_real_get_preferred_height_for_width (GtkWidget* base, gint width, gint* minimum_height, gint* natural_height);
static GtkSizeRequestMode gitg_diff_image_composite_real_get_request_mode (GtkWidget* base);
static gboolean gitg_diff_image_composite_real_draw (GtkWidget* base, cairo_t* cr);
static void gitg_diff_image_composite_real_realize (GtkWidget* base);
GitgDiffImageComposite* gitg_diff_image_composite_new (void);
GitgDiffImageComposite* gitg_diff_image_composite_construct (GType object_type);
void gitg_diff_image_composite_set_cache (GitgDiffImageComposite* self, GitgDiffImageSurfaceCache* value);
static void gitg_diff_image_composite_finalize (GObject* obj);
static void _vala_gitg_diff_image_composite_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gitg_diff_image_composite_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static gpointer _g_object_ref0 (gpointer self) {
#line 26 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	return self ? g_object_ref (self) : NULL;
#line 111 "gitg-diff-image-composite.c"
}


static void gitg_diff_image_composite_get_natural_size (GitgDiffImageComposite* self, gint* image_width, gint* image_height) {
	gint _vala_image_width = 0;
	gint _vala_image_height = 0;
	GdkPixbuf* pixbuf = NULL;
	GitgDiffImageSurfaceCache* _tmp0_ = NULL;
	GdkPixbuf* _tmp1_ = NULL;
	GdkPixbuf* _tmp2_ = NULL;
	GdkPixbuf* _tmp3_ = NULL;
	GdkPixbuf* _tmp4_ = NULL;
	GdkWindow* window = NULL;
	GdkWindow* _tmp5_ = NULL;
	GdkWindow* _tmp6_ = NULL;
	gdouble xscale = 0.0;
	gdouble yscale = 0.0;
	GdkWindow* _tmp7_ = NULL;
	GdkPixbuf* _tmp14_ = NULL;
	gint _tmp15_ = 0;
	gdouble _tmp16_ = 0.0;
	GdkPixbuf* _tmp17_ = NULL;
	gint _tmp18_ = 0;
	gdouble _tmp19_ = 0.0;
#line 24 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	g_return_if_fail (self != NULL);
#line 26 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp0_ = self->priv->_cache;
#line 26 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp1_ = gitg_diff_image_surface_cache_get_old_pixbuf (_tmp0_);
#line 26 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp2_ = _tmp1_;
#line 26 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp3_ = _g_object_ref0 (_tmp2_);
#line 26 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	pixbuf = _tmp3_;
#line 28 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp4_ = pixbuf;
#line 28 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	if (_tmp4_ == NULL) {
#line 30 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		_vala_image_width = 0;
#line 31 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		_vala_image_height = 0;
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		_g_object_unref0 (pixbuf);
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		if (image_width) {
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
			*image_width = _vala_image_width;
#line 162 "gitg-diff-image-composite.c"
		}
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		if (image_height) {
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
			*image_height = _vala_image_height;
#line 168 "gitg-diff-image-composite.c"
		}
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		return;
#line 172 "gitg-diff-image-composite.c"
	}
#line 36 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp5_ = gtk_widget_get_window ((GtkWidget*) self);
#line 36 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp6_ = _g_object_ref0 (_tmp5_);
#line 36 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	window = _tmp6_;
#line 38 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	xscale = (gdouble) 1;
#line 38 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	yscale = (gdouble) 1;
#line 40 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp7_ = window;
#line 40 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	if (_tmp7_ != NULL) {
#line 188 "gitg-diff-image-composite.c"
		GitgDiffImageSurfaceCache* _tmp8_ = NULL;
		GdkWindow* _tmp9_ = NULL;
		cairo_surface_t* _tmp10_ = NULL;
		cairo_surface_t* _tmp11_ = NULL;
		gdouble _tmp12_ = 0.0;
		gdouble _tmp13_ = 0.0;
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		_tmp8_ = self->priv->_cache;
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		_tmp9_ = gtk_widget_get_window ((GtkWidget*) self);
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		_tmp10_ = gitg_diff_image_surface_cache_get_old_surface (_tmp8_, _tmp9_);
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		_tmp11_ = _tmp10_;
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		cairo_surface_get_device_scale (_tmp11_, &_tmp12_, &_tmp13_);
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		xscale = _tmp12_;
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		yscale = _tmp13_;
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		_cairo_surface_destroy0 (_tmp11_);
#line 211 "gitg-diff-image-composite.c"
	}
#line 45 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp14_ = pixbuf;
#line 45 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp15_ = gdk_pixbuf_get_width (_tmp14_);
#line 45 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp16_ = xscale;
#line 45 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_vala_image_width = (gint) (_tmp15_ / _tmp16_);
#line 46 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp17_ = pixbuf;
#line 46 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp18_ = gdk_pixbuf_get_height (_tmp17_);
#line 46 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp19_ = yscale;
#line 46 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_vala_image_height = (gint) (_tmp18_ / _tmp19_);
#line 24 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_g_object_unref0 (window);
#line 24 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_g_object_unref0 (pixbuf);
#line 24 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	if (image_width) {
#line 24 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		*image_width = _vala_image_width;
#line 237 "gitg-diff-image-composite.c"
	}
#line 24 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	if (image_height) {
#line 24 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		*image_height = _vala_image_height;
#line 243 "gitg-diff-image-composite.c"
	}
}


void gitg_diff_image_composite_get_sizing (GitgDiffImageComposite* self, gint width, gint* image_width, gint* image_height) {
	gint _vala_image_width = 0;
	gint _vala_image_height = 0;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
#line 49 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	g_return_if_fail (self != NULL);
#line 51 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	gitg_diff_image_composite_get_natural_size (self, &_tmp0_, &_tmp1_);
#line 51 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_vala_image_width = _tmp0_;
#line 51 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_vala_image_height = _tmp1_;
#line 54 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp2_ = _vala_image_width;
#line 54 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp3_ = width;
#line 54 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	if (_tmp2_ > _tmp3_) {
#line 269 "gitg-diff-image-composite.c"
		gint _tmp4_ = 0;
		gint _tmp5_ = 0;
		gint _tmp6_ = 0;
		gint _tmp7_ = 0;
#line 56 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		_tmp4_ = _vala_image_height;
#line 56 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		_tmp5_ = width;
#line 56 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		_tmp6_ = _vala_image_width;
#line 56 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		_vala_image_height = _tmp4_ * (_tmp5_ / _tmp6_);
#line 57 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		_tmp7_ = width;
#line 57 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		_vala_image_width = _tmp7_;
#line 286 "gitg-diff-image-composite.c"
	}
#line 49 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	if (image_width) {
#line 49 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		*image_width = _vala_image_width;
#line 292 "gitg-diff-image-composite.c"
	}
#line 49 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	if (image_height) {
#line 49 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		*image_height = _vala_image_height;
#line 298 "gitg-diff-image-composite.c"
	}
}


static void gitg_diff_image_composite_real_get_preferred_width (GtkWidget* base, gint* minimum_width, gint* natural_width) {
	GitgDiffImageComposite * self;
	gint _vala_minimum_width = 0;
	gint _vala_natural_width = 0;
	gint natural_height = 0;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
#line 61 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	self = (GitgDiffImageComposite*) base;
#line 65 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	gitg_diff_image_composite_get_natural_size (self, &_tmp0_, &_tmp1_);
#line 65 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_vala_natural_width = _tmp0_;
#line 65 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	natural_height = _tmp1_;
#line 66 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_vala_minimum_width = 0;
#line 61 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	if (minimum_width) {
#line 61 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		*minimum_width = _vala_minimum_width;
#line 324 "gitg-diff-image-composite.c"
	}
#line 61 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	if (natural_width) {
#line 61 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		*natural_width = _vala_natural_width;
#line 330 "gitg-diff-image-composite.c"
	}
}


static void gitg_diff_image_composite_real_get_preferred_height_for_width (GtkWidget* base, gint width, gint* minimum_height, gint* natural_height) {
	GitgDiffImageComposite * self;
	gint _vala_minimum_height = 0;
	gint _vala_natural_height = 0;
	gint image_width = 0;
	gint image_height = 0;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
#line 69 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	self = (GitgDiffImageComposite*) base;
#line 73 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp0_ = width;
#line 73 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	gitg_diff_image_composite_get_sizing (self, _tmp0_, &_tmp1_, &_tmp2_);
#line 73 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	image_width = _tmp1_;
#line 73 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	image_height = _tmp2_;
#line 75 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_vala_minimum_height = image_height;
#line 76 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_vala_natural_height = image_height;
#line 69 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	if (minimum_height) {
#line 69 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		*minimum_height = _vala_minimum_height;
#line 362 "gitg-diff-image-composite.c"
	}
#line 69 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	if (natural_height) {
#line 69 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		*natural_height = _vala_natural_height;
#line 368 "gitg-diff-image-composite.c"
	}
}


static GtkSizeRequestMode gitg_diff_image_composite_real_get_request_mode (GtkWidget* base) {
	GitgDiffImageComposite * self;
	GtkSizeRequestMode result = 0;
#line 79 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	self = (GitgDiffImageComposite*) base;
#line 81 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	result = GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
#line 81 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	return result;
#line 382 "gitg-diff-image-composite.c"
}


static gboolean gitg_diff_image_composite_real_draw (GtkWidget* base, cairo_t* cr) {
	GitgDiffImageComposite * self;
	gboolean result = FALSE;
	GtkAllocation alloc = {0};
	GtkAllocation _tmp0_ = {0};
	GtkStyleContext* ctx = NULL;
	GtkStyleContext* _tmp1_ = NULL;
	GtkStyleContext* _tmp2_ = NULL;
	cairo_t* _tmp3_ = NULL;
	GtkAllocation _tmp4_ = {0};
	gint _tmp5_ = 0;
	GtkAllocation _tmp6_ = {0};
	gint _tmp7_ = 0;
	GtkAllocation _tmp8_ = {0};
	gint _tmp9_ = 0;
	GtkAllocation _tmp10_ = {0};
	gint _tmp11_ = 0;
#line 84 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	self = (GitgDiffImageComposite*) base;
#line 84 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	g_return_val_if_fail (cr != NULL, FALSE);
#line 87 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	gtk_widget_get_allocation ((GtkWidget*) self, &_tmp0_);
#line 87 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	alloc = _tmp0_;
#line 89 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp1_ = gtk_widget_get_style_context ((GtkWidget*) self);
#line 89 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp2_ = _g_object_ref0 (_tmp1_);
#line 89 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	ctx = _tmp2_;
#line 91 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp3_ = cr;
#line 91 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp4_ = alloc;
#line 91 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp5_ = _tmp4_.x;
#line 91 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp6_ = alloc;
#line 91 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp7_ = _tmp6_.y;
#line 91 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp8_ = alloc;
#line 91 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp9_ = _tmp8_.width;
#line 91 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp10_ = alloc;
#line 91 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp11_ = _tmp10_.height;
#line 91 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	gtk_render_background (ctx, _tmp3_, (gdouble) _tmp5_, (gdouble) _tmp7_, (gdouble) _tmp9_, (gdouble) _tmp11_);
#line 92 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	result = TRUE;
#line 92 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_g_object_unref0 (ctx);
#line 92 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	return result;
#line 443 "gitg-diff-image-composite.c"
}


static void gitg_diff_image_composite_real_realize (GtkWidget* base) {
	GitgDiffImageComposite * self;
#line 95 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	self = (GitgDiffImageComposite*) base;
#line 97 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	GTK_WIDGET_CLASS (gitg_diff_image_composite_parent_class)->realize ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_drawing_area_get_type (), GtkDrawingArea));
#line 98 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	gtk_widget_queue_resize ((GtkWidget*) self);
#line 455 "gitg-diff-image-composite.c"
}


GitgDiffImageComposite* gitg_diff_image_composite_construct (GType object_type) {
	GitgDiffImageComposite * self = NULL;
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	self = (GitgDiffImageComposite*) g_object_new (object_type, NULL);
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	return self;
#line 465 "gitg-diff-image-composite.c"
}


GitgDiffImageComposite* gitg_diff_image_composite_new (void) {
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	return gitg_diff_image_composite_construct (GITG_TYPE_DIFF_IMAGE_COMPOSITE);
#line 472 "gitg-diff-image-composite.c"
}


GitgDiffImageSurfaceCache* gitg_diff_image_composite_get_cache (GitgDiffImageComposite* self) {
	GitgDiffImageSurfaceCache* result;
	GitgDiffImageSurfaceCache* _tmp0_ = NULL;
#line 22 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 22 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp0_ = self->priv->_cache;
#line 22 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	result = _tmp0_;
#line 22 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	return result;
#line 487 "gitg-diff-image-composite.c"
}


void gitg_diff_image_composite_set_cache (GitgDiffImageComposite* self, GitgDiffImageSurfaceCache* value) {
	GitgDiffImageSurfaceCache* _tmp0_ = NULL;
	GitgDiffImageSurfaceCache* _tmp1_ = NULL;
#line 22 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	g_return_if_fail (self != NULL);
#line 22 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp0_ = value;
#line 22 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_tmp1_ = _g_object_ref0 (_tmp0_);
#line 22 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_g_object_unref0 (self->priv->_cache);
#line 22 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	self->priv->_cache = _tmp1_;
#line 22 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	g_object_notify ((GObject *) self, "cache");
#line 506 "gitg-diff-image-composite.c"
}


static void gitg_diff_image_composite_class_init (GitgDiffImageCompositeClass * klass) {
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	gitg_diff_image_composite_parent_class = g_type_class_peek_parent (klass);
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	g_type_class_add_private (klass, sizeof (GitgDiffImageCompositePrivate));
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	((GtkWidgetClass *) klass)->get_preferred_width = (void (*)(GtkWidget*, gint*, gint*)) gitg_diff_image_composite_real_get_preferred_width;
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	((GtkWidgetClass *) klass)->get_preferred_height_for_width = (void (*)(GtkWidget*, gint, gint*, gint*)) gitg_diff_image_composite_real_get_preferred_height_for_width;
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	((GtkWidgetClass *) klass)->get_request_mode = (GtkSizeRequestMode (*)(GtkWidget*)) gitg_diff_image_composite_real_get_request_mode;
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	((GtkWidgetClass *) klass)->draw = (gboolean (*)(GtkWidget*, cairo_t*)) gitg_diff_image_composite_real_draw;
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	((GtkWidgetClass *) klass)->realize = (void (*)(GtkWidget*)) gitg_diff_image_composite_real_realize;
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_gitg_diff_image_composite_get_property;
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	G_OBJECT_CLASS (klass)->set_property = _vala_gitg_diff_image_composite_set_property;
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	G_OBJECT_CLASS (klass)->finalize = gitg_diff_image_composite_finalize;
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_IMAGE_COMPOSITE_CACHE, g_param_spec_object ("cache", "cache", "cache", GITG_TYPE_DIFF_IMAGE_SURFACE_CACHE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 533 "gitg-diff-image-composite.c"
}


static void gitg_diff_image_composite_instance_init (GitgDiffImageComposite * self) {
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	self->priv = GITG_DIFF_IMAGE_COMPOSITE_GET_PRIVATE (self);
#line 540 "gitg-diff-image-composite.c"
}


static void gitg_diff_image_composite_finalize (GObject* obj) {
	GitgDiffImageComposite * self;
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_DIFF_IMAGE_COMPOSITE, GitgDiffImageComposite);
#line 22 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	_g_object_unref0 (self->priv->_cache);
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	G_OBJECT_CLASS (gitg_diff_image_composite_parent_class)->finalize (obj);
#line 552 "gitg-diff-image-composite.c"
}


GType gitg_diff_image_composite_get_type (void) {
	static volatile gsize gitg_diff_image_composite_type_id__volatile = 0;
	if (g_once_init_enter (&gitg_diff_image_composite_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GitgDiffImageCompositeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_diff_image_composite_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgDiffImageComposite), 0, (GInstanceInitFunc) gitg_diff_image_composite_instance_init, NULL };
		GType gitg_diff_image_composite_type_id;
		gitg_diff_image_composite_type_id = g_type_register_static (gtk_drawing_area_get_type (), "GitgDiffImageComposite", &g_define_type_info, 0);
		g_once_init_leave (&gitg_diff_image_composite_type_id__volatile, gitg_diff_image_composite_type_id);
	}
	return gitg_diff_image_composite_type_id__volatile;
}


static void _vala_gitg_diff_image_composite_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GitgDiffImageComposite * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_DIFF_IMAGE_COMPOSITE, GitgDiffImageComposite);
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	switch (property_id) {
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		case GITG_DIFF_IMAGE_COMPOSITE_CACHE:
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		g_value_set_object (value, gitg_diff_image_composite_get_cache (self));
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		break;
#line 579 "gitg-diff-image-composite.c"
		default:
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		break;
#line 585 "gitg-diff-image-composite.c"
	}
}


static void _vala_gitg_diff_image_composite_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GitgDiffImageComposite * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_DIFF_IMAGE_COMPOSITE, GitgDiffImageComposite);
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
	switch (property_id) {
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		case GITG_DIFF_IMAGE_COMPOSITE_CACHE:
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		gitg_diff_image_composite_set_cache (self, g_value_get_object (value));
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		break;
#line 601 "gitg-diff-image-composite.c"
		default:
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 20 "/home/jesse/dev/gitg/libgitg/gitg-diff-image-composite.vala"
		break;
#line 607 "gitg-diff-image-composite.c"
	}
}



