mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	LibWeb: Don't draw only-translated stacking contexts via bitmap
If the 2D transform in effect is just a simple translation, we don't need to draw into a temporary bitmap and then transform it. We can just translate the painter. :^)
This commit is contained in:
		
							parent
							
								
									e8a5233b94
								
							
						
					
					
						commit
						b7f9387f69
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		|  | @ -292,7 +292,7 @@ void StackingContext::paint(PaintContext& context) const | |||
| 
 | ||||
|     auto affine_transform = affine_transform_matrix(); | ||||
| 
 | ||||
|     if (opacity < 1.0f || !affine_transform.is_identity()) { | ||||
|     if (opacity < 1.0f || !affine_transform.is_identity_or_translation()) { | ||||
|         auto transform_origin = this->transform_origin(); | ||||
|         auto source_rect = paintable().absolute_paint_rect().translated(-transform_origin); | ||||
|         auto transformed_destination_rect = affine_transform.map(source_rect).translated(transform_origin); | ||||
|  | @ -333,6 +333,8 @@ void StackingContext::paint(PaintContext& context) const | |||
|         else | ||||
|             context.painter().draw_scaled_bitmap(destination_rect, *bitmap, bitmap->rect(), opacity, Gfx::Painter::ScalingMode::BilinearBlend); | ||||
|     } else { | ||||
|         Gfx::PainterStateSaver saver(context.painter()); | ||||
|         context.painter().translate(affine_transform.translation().to_rounded<int>()); | ||||
|         paint_internal(context); | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling