Implement fill scale mode
This commit is contained in:
		
				
					committed by
					
						
						Berke Kocaoğlu
					
				
			
			
				
	
			
			
			
						parent
						
							1d28627868
						
					
				
				
					commit
					88f77bc59c
				
			@@ -127,6 +127,7 @@ static const keymap_t keys[] = {
 | 
				
			|||||||
	{ 0,            XK_equal,         i_set_zoom,           100 },
 | 
						{ 0,            XK_equal,         i_set_zoom,           100 },
 | 
				
			||||||
	{ 0,            XK_w,             i_fit_to_win,         SCALE_DOWN },
 | 
						{ 0,            XK_w,             i_fit_to_win,         SCALE_DOWN },
 | 
				
			||||||
	{ 0,            XK_W,             i_fit_to_win,         SCALE_FIT },
 | 
						{ 0,            XK_W,             i_fit_to_win,         SCALE_FIT },
 | 
				
			||||||
 | 
						{ 0,            XK_F,             i_fit_to_win,         SCALE_FILL },
 | 
				
			||||||
	{ 0,            XK_e,             i_fit_to_win,         SCALE_WIDTH },
 | 
						{ 0,            XK_e,             i_fit_to_win,         SCALE_WIDTH },
 | 
				
			||||||
	{ 0,            XK_E,             i_fit_to_win,         SCALE_HEIGHT },
 | 
						{ 0,            XK_E,             i_fit_to_win,         SCALE_HEIGHT },
 | 
				
			||||||
	{ 0,            XK_less,          i_rotate,             DEGREE_270 },
 | 
						{ 0,            XK_less,          i_rotate,             DEGREE_270 },
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								image.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								image.c
									
									
									
									
									
								
							@@ -402,6 +402,9 @@ bool img_fit(img_t *img)
 | 
				
			|||||||
	zh = (float) img->win->h / (float) img->h;
 | 
						zh = (float) img->win->h / (float) img->h;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (img->scalemode) {
 | 
						switch (img->scalemode) {
 | 
				
			||||||
 | 
							case SCALE_FILL:
 | 
				
			||||||
 | 
								z = MAX(zw, zh);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
		case SCALE_WIDTH:
 | 
							case SCALE_WIDTH:
 | 
				
			||||||
			z = zw;
 | 
								z = zw;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,7 +44,7 @@ void parse_options(int argc, char **argv)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	int n, opt;
 | 
						int n, opt;
 | 
				
			||||||
	char *end, *s;
 | 
						char *end, *s;
 | 
				
			||||||
	const char *scalemodes = "dfwh";
 | 
						const char *scalemodes = "dfFwh";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	progname = strrchr(argv[0], '/');
 | 
						progname = strrchr(argv[0], '/');
 | 
				
			||||||
	progname = progname ? progname + 1 : argv[0];
 | 
						progname = progname ? progname + 1 : argv[0];
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								sxiv.1
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								sxiv.1
									
									
									
									
									
								
							@@ -97,7 +97,7 @@ may be a floating point number.
 | 
				
			|||||||
.TP
 | 
					.TP
 | 
				
			||||||
.BI "\-s " MODE
 | 
					.BI "\-s " MODE
 | 
				
			||||||
Set scale mode according to MODE character. Supported modes are: [d]own, 
 | 
					Set scale mode according to MODE character. Supported modes are: [d]own, 
 | 
				
			||||||
[f]it, [w]idth, [h]eight.
 | 
					[f]it, [F]ill, [w]idth, [h]eight.
 | 
				
			||||||
.TP
 | 
					.TP
 | 
				
			||||||
.B \-t
 | 
					.B \-t
 | 
				
			||||||
Start in thumbnail mode.
 | 
					Start in thumbnail mode.
 | 
				
			||||||
@@ -311,6 +311,9 @@ Set zoom level to 100%, but fit large images into window.
 | 
				
			|||||||
.B W
 | 
					.B W
 | 
				
			||||||
Fit image to window.
 | 
					Fit image to window.
 | 
				
			||||||
.TP
 | 
					.TP
 | 
				
			||||||
 | 
					.B F
 | 
				
			||||||
 | 
					Fill image to window.
 | 
				
			||||||
 | 
					.TP
 | 
				
			||||||
.B e
 | 
					.B e
 | 
				
			||||||
Fit image to window width.
 | 
					Fit image to window width.
 | 
				
			||||||
.TP
 | 
					.TP
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user