Krolyxon
Commit 1576eb4

Branches

Refs →

nsxiv1576eb4

Refactored img_open and img_check

Author
Bert
Date
2011-02-01 16:10 +0100
Parent
5a68242
Commit
1576eb4e17d4eaaf64fed88592b71c22b3af6fa2

+12 −10

1 file changed

  1. M image.c +12 −10
M image.c View
@@ -52,7 +52,7 @@ void img_free(img_t* img) {
5252 imlib_free_image();
5353 }
5454
55−int img_check(const char *filename) {
55+int _imlib_load_image(const char *filename) {
5656 Imlib_Image *im;
5757
5858 if (!filename)
@@ -65,28 +65,30 @@ int img_check(const char *filename) {
6565
6666 imlib_context_set_image(im);
6767 imlib_image_set_changes_on_disk();
68− imlib_free_image();
69−
68+
7069 return 1;
7170 }
7271
73−int img_load(img_t *img, const char *filename) {
74− Imlib_Image *im;
72+int img_check(const char *filename) {
73+ int ret;
74+
75+ if ((ret = _imlib_load_image(filename)))
76+ imlib_free_image();
7577
78+ return ret;
79+}
80+
81+int img_load(img_t *img, const char *filename) {
7682 if (!img || !filename)
7783 return 0;
7884
7985 if (imlib_context_get_image())
8086 imlib_free_image();
8187
82− if (!(im = imlib_load_image(filename))) {
83− WARN("could not open image: %s", filename);
88+ if (!_imlib_load_image(filename))
8489 return 0;
85− }
8690
87− imlib_context_set_image(im);
8891 imlib_context_set_anti_alias(img->aa);
89− imlib_image_set_changes_on_disk();
9092
9193 img->re = 0;
9294 img->checkpan = 0;