Fixed handling of gif disposal method (issue #23)
This commit is contained in:
		
							parent
							
								
									55da6fb8dd
								
							
						
					
					
						commit
						3e2523818b
					
				
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @ -1,4 +1,4 @@ | |||||||
| VERSION = git-20111016 | VERSION = git-20111017 | ||||||
| 
 | 
 | ||||||
| CC      = gcc | CC      = gcc | ||||||
| CFLAGS  = -ansi -Wall -pedantic -O2 | CFLAGS  = -ansi -Wall -pedantic -O2 | ||||||
|  | |||||||
							
								
								
									
										10
									
								
								image.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								image.c
									
									
									
									
									
								
							| @ -133,6 +133,7 @@ bool img_load_gif(img_t *img, const fileinfo_t *file) { | |||||||
| 	Imlib_Image *im; | 	Imlib_Image *im; | ||||||
| 	int i, j, bg, r, g, b; | 	int i, j, bg, r, g, b; | ||||||
| 	int x, y, w, h, sw, sh; | 	int x, y, w, h, sw, sh; | ||||||
|  | 	int px, py, pw, ph; | ||||||
| 	int intoffset[] = { 0, 4, 2, 1 }; | 	int intoffset[] = { 0, 4, 2, 1 }; | ||||||
| 	int intjump[] = { 8, 8, 4, 2 }; | 	int intjump[] = { 8, 8, 4, 2 }; | ||||||
| 	int transp = -1; | 	int transp = -1; | ||||||
| @ -156,6 +157,7 @@ bool img_load_gif(img_t *img, const fileinfo_t *file) { | |||||||
| 	bg = gif->SBackGroundColor; | 	bg = gif->SBackGroundColor; | ||||||
| 	sw = gif->SWidth; | 	sw = gif->SWidth; | ||||||
| 	sh = gif->SHeight; | 	sh = gif->SHeight; | ||||||
|  | 	px = py = pw = ph = 0; | ||||||
| 
 | 
 | ||||||
| 	do { | 	do { | ||||||
| 		if (DGifGetRecordType(gif, &rec) == GIF_ERROR) { | 		if (DGifGetRecordType(gif, &rec) == GIF_ERROR) { | ||||||
| @ -218,10 +220,13 @@ bool img_load_gif(img_t *img, const fileinfo_t *file) { | |||||||
| 					if (i < y || i >= y + h || j < x || j >= x + w || | 					if (i < y || i >= y + h || j < x || j >= x + w || | ||||||
| 					    rows[i-y][j-x] == transp) | 					    rows[i-y][j-x] == transp) | ||||||
| 					{ | 					{ | ||||||
| 						if (prev_disposal != 2 && prev_frame != NULL) | 						if (prev_frame != NULL && (prev_disposal != 2 || | ||||||
|  | 						    i < py || i >= py + ph || j < px || j >= px + pw)) | ||||||
|  | 						{ | ||||||
| 							*ptr = prev_frame[i * sw + j]; | 							*ptr = prev_frame[i * sw + j]; | ||||||
| 						else | 						} else { | ||||||
| 							*ptr = bgpixel; | 							*ptr = bgpixel; | ||||||
|  | 						} | ||||||
| 					} else { | 					} else { | ||||||
| 						r = cmap->Colors[rows[i-y][j-x]].Red; | 						r = cmap->Colors[rows[i-y][j-x]].Red; | ||||||
| 						g = cmap->Colors[rows[i-y][j-x]].Green; | 						g = cmap->Colors[rows[i-y][j-x]].Green; | ||||||
| @ -252,6 +257,7 @@ bool img_load_gif(img_t *img, const fileinfo_t *file) { | |||||||
| 			if (disposal != 3) | 			if (disposal != 3) | ||||||
| 				prev_frame = imlib_image_get_data_for_reading_only(); | 				prev_frame = imlib_image_get_data_for_reading_only(); | ||||||
| 			prev_disposal = disposal; | 			prev_disposal = disposal; | ||||||
|  | 			px = x, py = y, pw = w, ph = h; | ||||||
| 
 | 
 | ||||||
| 			if (img->multi.cnt == img->multi.cap) { | 			if (img->multi.cnt == img->multi.cap) { | ||||||
| 				img->multi.cap *= 2; | 				img->multi.cap *= 2; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Bert Münnich
						Bert Münnich