mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 18:22:45 +00:00 
			
		
		
		
	PNGLoader: Add load_png_from_memory method
This commit is contained in:
		
							parent
							
								
									814346606f
								
							
						
					
					
						commit
						bfde6acd8c
					
				
					 2 changed files with 9 additions and 0 deletions
				
			
		|  | @ -112,6 +112,14 @@ RefPtr<GraphicsBitmap> load_png(const StringView& path) | ||||||
|     return bitmap; |     return bitmap; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | RefPtr<GraphicsBitmap> load_png_from_memory(const u8* data, size_t length) | ||||||
|  | { | ||||||
|  |     auto bitmap = load_png_impl(data, length); | ||||||
|  |     if (bitmap) | ||||||
|  |         bitmap->set_mmap_name(String::format("GraphicsBitmap [%dx%d] - Decoded PNG: <memory>", bitmap->width(), bitmap->height())); | ||||||
|  |     return bitmap; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| [[gnu::always_inline]] static inline u8 paeth_predictor(int a, int b, int c) | [[gnu::always_inline]] static inline u8 paeth_predictor(int a, int b, int c) | ||||||
| { | { | ||||||
|     int p = a + b - c; |     int p = a + b - c; | ||||||
|  |  | ||||||
|  | @ -3,3 +3,4 @@ | ||||||
| #include <LibDraw/GraphicsBitmap.h> | #include <LibDraw/GraphicsBitmap.h> | ||||||
| 
 | 
 | ||||||
| RefPtr<GraphicsBitmap> load_png(const StringView& path); | RefPtr<GraphicsBitmap> load_png(const StringView& path); | ||||||
|  | RefPtr<GraphicsBitmap> load_png_from_memory(const u8*, size_t); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Conrad Pankoff
						Conrad Pankoff