summaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-02-03 14:32:02 +0100
committerBert <ber.t@gmx.com>2011-02-03 14:32:02 +0100
commitbad9a70a48ff38f0d1e22fdedfcaa2241882a0bf (patch)
tree863ed44c8a15c634da65ae48d1c35767e3afd09c /image.c
parent12a94cc40ef0f155a9c99dea915cd3807d760441 (diff)
downloadnsxiv-bad9a70a48ff38f0d1e22fdedfcaa2241882a0bf.tar.zst
Display filesize in window title
Diffstat (limited to 'image.c')
-rw-r--r--image.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/image.c b/image.c
index 13df76a..c7e9e3a 100644
--- a/image.c
+++ b/image.c
@@ -73,7 +73,6 @@ int img_check(const char *filename) {
if ((ret = _imlib_load_image(filename)))
imlib_free_image();
-
return ret;
}
@@ -194,12 +193,19 @@ int img_fit(img_t *img, win_t *win) {
return oz != img->zoom;
}
-void img_center(img_t *img, win_t *win) {
+int img_center(img_t *img, win_t *win) {
+ int ox, oy;
+
if (!img || !win)
- return;
+ return 0;
+
+ ox = img->x;
+ oy = img->y;
img->x = (win->w - img->w * img->zoom) / 2;
img->y = (win->h - img->h * img->zoom) / 2;
+
+ return ox != img->x || oy != img->y;
}
int img_zoom(img_t *img, float z) {
@@ -231,7 +237,6 @@ int img_zoom_in(img_t *img) {
if (zoom_levels[i] > img->zoom * 100.0)
return img_zoom(img, zoom_levels[i] / 100.0);
}
-
return 0;
}
@@ -245,7 +250,6 @@ int img_zoom_out(img_t *img) {
if (zoom_levels[i] < img->zoom * 100.0)
return img_zoom(img, zoom_levels[i] / 100.0);
}
-
return 0;
}
@@ -284,11 +288,11 @@ int img_pan(img_t *img, win_t *win, pandir_t dir) {
return 0;
}
-int img_rotate(img_t *img, win_t *win, int d) {
+void img_rotate(img_t *img, win_t *win, int d) {
int ox, oy, tmp;
if (!img || !win)
- return 0;
+ return;
ox = d == 1 ? img->x : win->w - img->x - img->w * img->zoom;
oy = d == 3 ? img->y : win->h - img->y - img->h * img->zoom;
@@ -303,24 +307,20 @@ int img_rotate(img_t *img, win_t *win, int d) {
img->h = tmp;
img->checkpan = 1;
-
- return 1;
}
-int img_rotate_left(img_t *img, win_t *win) {
- return img_rotate(img, win, 3);
+void img_rotate_left(img_t *img, win_t *win) {
+ img_rotate(img, win, 3);
}
-int img_rotate_right(img_t *img, win_t *win) {
- return img_rotate(img, win, 1);
+void img_rotate_right(img_t *img, win_t *win) {
+ img_rotate(img, win, 1);
}
-int img_toggle_antialias(img_t *img) {
+void img_toggle_antialias(img_t *img) {
if (!img)
- return 0;
+ return;
img->aa ^= 1;
imlib_context_set_anti_alias(img->aa);
-
- return 1;
}