aboutsummaryrefslogtreecommitdiffstats
path: root/image.c
blob: ebfb7783eed4dfe6df7c57bd94af3d895b26f669 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* See LICENSE file for copyright and license details. */
#include "common.h"

GdkPixbuf *transformed_image = NULL;

static void
forget_transformed_image(void)
{
	if (transformed_image) {
		g_object_unref(transformed_image);
		transformed_image = NULL;
	}
}

GdkPixbuf *
get_image(void)
{
	struct file *file = get_file();
	if (!file || !file->image) {
		forget_transformed_image();
		return NULL;
	}
	return transformed_image ? transformed_image : file->image;
}

GdkPixbuf *
get_original_image(void)
{
	struct file *file = get_file();
	if (!file || !file->image) {
		forget_transformed_image();
		return NULL;
	}
	return file->image;
}