mirror of
				https://github.com/KartKrewDev/RingRacers.git
				synced 2025-10-30 08:01:28 +00:00 
			
		
		
		
	tRNS chunk fix
Fixes a faulty check not properly detecting the presence of a tRNS chunk.
This commit is contained in:
		
							parent
							
								
									96edcff902
								
							
						
					
					
						commit
						4563722695
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -984,8 +984,8 @@ static png_bytep *PNG_Read(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				for (i = 0; i < 256; i++)
 | 
									for (i = 0; i < 256; i++)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					UINT32 rgb = R_PutRgbaRGBA(pal->red, pal->green, pal->blue, 0xFF);
 | 
										byteColor_t *curpal = &(pMasterPalette[i].s);
 | 
				
			||||||
					if (rgb != pMasterPalette[i].rgba)
 | 
										if (pal->red != curpal->red || pal->green != curpal->green || pal->blue != curpal->blue)
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						usepal = false;
 | 
											usepal = false;
 | 
				
			||||||
						break;
 | 
											break;
 | 
				
			||||||
| 
						 | 
					@ -1001,12 +1001,12 @@ static png_bytep *PNG_Read(
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			png_get_tRNS(png_ptr, png_info_ptr, &trans, &trans_num, &trans_values);
 | 
								png_get_tRNS(png_ptr, png_info_ptr, &trans, &trans_num, &trans_values);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (trans && trans_num == 256)
 | 
								if (trans && trans_num > 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				INT32 i;
 | 
									INT32 i;
 | 
				
			||||||
				for (i = 0; i < trans_num; i++)
 | 
									for (i = 0; i < trans_num; i++)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					// libpng will transform this image into RGB even if
 | 
										// libpng will transform this image into RGBA even if
 | 
				
			||||||
					// the transparent index does not exist in the image,
 | 
										// the transparent index does not exist in the image,
 | 
				
			||||||
					// and there is no way around that.
 | 
										// and there is no way around that.
 | 
				
			||||||
					if (trans[i] < 0xFF)
 | 
										if (trans[i] < 0xFF)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue