mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 05:52:46 +00:00 
			
		
		
		
	LibDraw: Create purgeable GraphicsBitmap in the PNG decoder
Also add ImageDecoder APIs for controlling the volatile flag.
This commit is contained in:
		
							parent
							
								
									77ae98a9b6
								
							
						
					
					
						commit
						7cc4b90b16
					
				
					 3 changed files with 21 additions and 1 deletions
				
			
		|  | @ -515,7 +515,7 @@ static bool decode_png_bitmap(PNGLoadingContext& context) | |||
| #ifdef PNG_STOPWATCH_DEBUG | ||||
|         Stopwatch sw("load_png_impl: create bitmap"); | ||||
| #endif | ||||
|         context.bitmap = GraphicsBitmap::create(context.has_alpha() ? GraphicsBitmap::Format::RGBA32 : GraphicsBitmap::Format::RGB32, { context.width, context.height }); | ||||
|         context.bitmap = GraphicsBitmap::create_purgeable(context.has_alpha() ? GraphicsBitmap::Format::RGBA32 : GraphicsBitmap::Format::RGB32, { context.width, context.height }); | ||||
|     } | ||||
| 
 | ||||
|     unfilter(context); | ||||
|  | @ -701,3 +701,16 @@ RefPtr<GraphicsBitmap> PNGImageDecoderPlugin::bitmap() | |||
|     ASSERT(m_context->bitmap); | ||||
|     return m_context->bitmap; | ||||
| } | ||||
| 
 | ||||
| void PNGImageDecoderPlugin::set_volatile() | ||||
| { | ||||
|     if (m_context->bitmap) | ||||
|         m_context->bitmap->set_volatile(); | ||||
| } | ||||
| 
 | ||||
| bool PNGImageDecoderPlugin::set_nonvolatile() | ||||
| { | ||||
|     if (!m_context->bitmap) | ||||
|         return false; | ||||
|     return m_context->bitmap->set_nonvolatile(); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling