Slightly refactored flipping
This commit is contained in:
		
							parent
							
								
									ba0a5b89fa
								
							
						
					
					
						commit
						4c40cc24bc
					
				
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @ -1,4 +1,4 @@ | |||||||
| VERSION = git-20120418 | VERSION = git-20120506 | ||||||
| 
 | 
 | ||||||
| CC      = gcc | CC      = gcc | ||||||
| CFLAGS  = -ansi -Wall -pedantic -O2 | CFLAGS  = -ansi -Wall -pedantic -O2 | ||||||
|  | |||||||
							
								
								
									
										14
									
								
								commands.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								commands.c
									
									
									
									
									
								
							| @ -343,18 +343,14 @@ bool i_rotate(arg_t a) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool i_flip(arg_t a) { | bool i_flip(arg_t a) { | ||||||
| 	flip_t flp = (flip_t) a; | 	flipdir_t dir = (flipdir_t) a; | ||||||
| 
 | 
 | ||||||
| 	if (mode == MODE_IMAGE) { | 	if (mode == MODE_IMAGE) { | ||||||
| 		if (flp == FLIP_HORIZONTAL) { | 		img_flip(&img, dir); | ||||||
| 			img_flip_horizontal(&img); | 		return true; | ||||||
| 			return true; | 	} else { | ||||||
| 		} else if (flp == FLIP_VERTICAL) { | 		return false; | ||||||
| 			img_flip_vertical(&img); |  | ||||||
| 			return true; |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| 	return false; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool i_toggle_antialias(arg_t a) { | bool i_toggle_antialias(arg_t a) { | ||||||
|  | |||||||
							
								
								
									
										25
									
								
								image.c
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								image.c
									
									
									
									
									
								
							| @ -642,26 +642,23 @@ void img_rotate_right(img_t *img) { | |||||||
| 	img_rotate(img, 1); | 	img_rotate(img, 1); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void img_flip(img_t *img, int f) { | void img_flip(img_t *img, flipdir_t d) { | ||||||
| 	if (img == NULL || img->im == NULL || img->win == NULL) | 	if (img == NULL || img->im == NULL) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	imlib_context_set_image(img->im); | 	imlib_context_set_image(img->im); | ||||||
|     if (f == 0) | 
 | ||||||
|         imlib_image_flip_horizontal(); | 	switch (d) { | ||||||
|     else | 		case FLIP_HORIZONTAL: | ||||||
|         imlib_image_flip_vertical(); | 			imlib_image_flip_horizontal(); | ||||||
|  | 			break; | ||||||
|  | 		case FLIP_VERTICAL: | ||||||
|  | 			imlib_image_flip_vertical(); | ||||||
|  | 			break; | ||||||
|  | 	} | ||||||
| 	img->dirty = true; | 	img->dirty = true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void img_flip_horizontal(img_t *img) { |  | ||||||
|     img_flip(img, 0); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void img_flip_vertical(img_t *img) { |  | ||||||
|     img_flip(img, 1); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void img_toggle_antialias(img_t *img) { | void img_toggle_antialias(img_t *img) { | ||||||
| 	if (img == NULL || img->im == NULL) | 	if (img == NULL || img->im == NULL) | ||||||
| 		return; | 		return; | ||||||
|  | |||||||
							
								
								
									
										4
									
								
								image.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								image.h
									
									
									
									
									
								
							| @ -80,9 +80,7 @@ void img_rotate(img_t*, int); | |||||||
| void img_rotate_left(img_t*); | void img_rotate_left(img_t*); | ||||||
| void img_rotate_right(img_t*); | void img_rotate_right(img_t*); | ||||||
| 
 | 
 | ||||||
| void img_flip(img_t*, int); | void img_flip(img_t*, flipdir_t); | ||||||
| void img_flip_horizontal(img_t*); |  | ||||||
| void img_flip_vertical(img_t*); |  | ||||||
| 
 | 
 | ||||||
| void img_toggle_antialias(img_t*); | void img_toggle_antialias(img_t*); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Bert Münnich
						Bert Münnich