mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:12:43 +00:00 
			
		
		
		
	LibGfx: Use zlib instead of just deflate when loading PNGs
PNGs use deflate with zlib, however we were just skipping the zlib bytes and then piping it into deflate decompressor. Since we have a zlib decompressor, lets use that instead. This has the added benefit of extra error checking.
This commit is contained in:
		
							parent
							
								
									8c99968ec1
								
							
						
					
					
						commit
						c3d4fbb2a5
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -28,7 +28,7 @@ | |||
| #include <AK/Endian.h> | ||||
| #include <AK/LexicalPath.h> | ||||
| #include <AK/MappedFile.h> | ||||
| #include <LibCompress/Gzip.h> | ||||
| #include <LibCompress/Zlib.h> | ||||
| #include <LibGfx/PNGLoader.h> | ||||
| #include <fcntl.h> | ||||
| #include <math.h> | ||||
|  | @ -777,7 +777,7 @@ static bool decode_png_bitmap(PNGLoadingContext& context) | |||
|     if (context.color_type == 3 && context.palette_data.is_empty()) | ||||
|         return false; // Didn't see a PLTE chunk for a palettized image, or it was empty.
 | ||||
| 
 | ||||
|     auto result = Compress::DeflateDecompressor::decompress_all(context.compressed_data.span().slice(2)); | ||||
|     auto result = Compress::Zlib::decompress_all(context.compressed_data.span()); | ||||
|     if (!result.has_value()) { | ||||
|         context.state = PNGLoadingContext::State::Error; | ||||
|         return false; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Luke
						Luke