|  |  |  | @ -985,14 +985,14 @@ static unsigned char stbiw__paeth(int a, int b, int c) | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | // @OPTIMIZE: provide an option that always forces left-predict or paeth predict
 | 
			
		
	
		
			
				
					|  |  |  |  | static void stbiw__encode_png_line(unsigned char *pixels, int stride_bytes, int width, int height, int y, int n, int filter_type, signed char *line_buffer) | 
			
		
	
		
			
				
					|  |  |  |  | static void stbiw__encode_png_line(const unsigned char *pixels, int stride_bytes, int width, int height, int y, int n, int filter_type, signed char *line_buffer) | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |  |    static int mapping[] = { 0,1,2,3,4 }; | 
			
		
	
		
			
				
					|  |  |  |  |    static int firstmap[] = { 0,1,0,5,6 }; | 
			
		
	
		
			
				
					|  |  |  |  |    int *mymap = (y != 0) ? mapping : firstmap; | 
			
		
	
		
			
				
					|  |  |  |  |    int i; | 
			
		
	
		
			
				
					|  |  |  |  |    int type = mymap[filter_type]; | 
			
		
	
		
			
				
					|  |  |  |  |    unsigned char *z = pixels + stride_bytes * (stbi__flip_vertically_on_write ? height-1-y : y); | 
			
		
	
		
			
				
					|  |  |  |  |    const unsigned char *z = pixels + stride_bytes * (stbi__flip_vertically_on_write ? height-1-y : y); | 
			
		
	
		
			
				
					|  |  |  |  |    int signed_stride = stbi__flip_vertically_on_write ? -stride_bytes : stride_bytes; | 
			
		
	
		
			
				
					|  |  |  |  |    for (i = 0; i < n; ++i) { | 
			
		
	
		
			
				
					|  |  |  |  |       switch (type) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -1018,7 +1018,7 @@ static void stbiw__encode_png_line(unsigned char *pixels, int stride_bytes, int | 
			
		
	
		
			
				
					|  |  |  |  |    } | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | unsigned char *stbi_write_png_to_mem(unsigned char *pixels, int stride_bytes, int x, int y, int n, int *out_len) | 
			
		
	
		
			
				
					|  |  |  |  | unsigned char *stbi_write_png_to_mem(const unsigned char *pixels, int stride_bytes, int x, int y, int n, int *out_len) | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |  |    int force_filter = stbi_write_force_png_filter; | 
			
		
	
		
			
				
					|  |  |  |  |    int ctype[5] = { -1, 0, 4, 2, 6 }; | 
			
		
	
	
		
			
				
					|  |  |  | @ -1109,7 +1109,7 @@ STBIWDEF int stbi_write_png(char const *filename, int x, int y, int comp, const | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |  |    FILE *f; | 
			
		
	
		
			
				
					|  |  |  |  |    int len; | 
			
		
	
		
			
				
					|  |  |  |  |    unsigned char *png = stbi_write_png_to_mem((unsigned char *) data, stride_bytes, x, y, comp, &len); | 
			
		
	
		
			
				
					|  |  |  |  |    unsigned char *png = stbi_write_png_to_mem((const unsigned char *) data, stride_bytes, x, y, comp, &len); | 
			
		
	
		
			
				
					|  |  |  |  |    if (png == NULL) return 0; | 
			
		
	
		
			
				
					|  |  |  |  | #ifdef STBI_MSC_SECURE_CRT | 
			
		
	
		
			
				
					|  |  |  |  |    if (fopen_s(&f, filename, "wb")) | 
			
		
	
	
		
			
				
					|  |  |  | @ -1128,7 +1128,7 @@ STBIWDEF int stbi_write_png(char const *filename, int x, int y, int comp, const | 
			
		
	
		
			
				
					|  |  |  |  | STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int stride_bytes) | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |  |    int len; | 
			
		
	
		
			
				
					|  |  |  |  |    unsigned char *png = stbi_write_png_to_mem((unsigned char *) data, stride_bytes, x, y, comp, &len); | 
			
		
	
		
			
				
					|  |  |  |  |    unsigned char *png = stbi_write_png_to_mem((const unsigned char *) data, stride_bytes, x, y, comp, &len); | 
			
		
	
		
			
				
					|  |  |  |  |    if (png == NULL) return 0; | 
			
		
	
		
			
				
					|  |  |  |  |    func(context, png, len); | 
			
		
	
		
			
				
					|  |  |  |  |    STBIW_FREE(png); | 
			
		
	
	
		
			
				
					|  |  |  | 
 |