From 5a35484e715d33763472ea473096a40b87ed126c Mon Sep 17 00:00:00 2001 From: Bert Date: Sat, 26 Feb 2011 13:16:14 +0100 Subject: Align big images on top-left corner --- Makefile | 2 +- image.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7d49245..ee2a045 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ all: sxiv -VERSION=git-20110225 +VERSION=git-20110226 CC?=gcc PREFIX?=/usr/local diff --git a/image.c b/image.c index 628f0a3..5a69c20 100644 --- a/image.c +++ b/image.c @@ -162,7 +162,14 @@ void img_render(img_t *img, win_t *win) { if (!img->re) { /* rendered for the first time */ img->re = 1; - img_center(img, win); + if (img->zoom * img->w <= win->w) + img->x = (win->w - img->w * img->zoom) / 2; + else + img->x = 0; + if (img->zoom * img->h <= win->h) + img->y = (win->h - img->h * img->zoom) / 2; + else + img->y = 0; } if (img->checkpan) { -- cgit v1.2.3-54-g00ecf