mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:42:44 +00:00 
			
		
		
		
	LibWeb: Snap transformed stacking contexts to pixel grid
Make sure that we're painting them at an integer pixel position, to avoid smearing.
This commit is contained in:
		
							parent
							
								
									e095b9c6f9
								
							
						
					
					
						commit
						a6e1b9eed2
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		|  | @ -295,6 +295,11 @@ void StackingContext::paint(PaintContext& context) const | ||||||
| 
 | 
 | ||||||
|         auto transformed_destination_rect = affine_transform.map(source_rect).translated(transform_origin); |         auto transformed_destination_rect = affine_transform.map(source_rect).translated(transform_origin); | ||||||
|         source_rect.translate_by(transform_origin); |         source_rect.translate_by(transform_origin); | ||||||
|  | 
 | ||||||
|  |         // NOTE: If the destination and source rects are the same size, we round the source rect to ensure that it's pixel-aligned.
 | ||||||
|  |         if (transformed_destination_rect.size() == source_rect.size()) | ||||||
|  |             context.painter().draw_scaled_bitmap(transformed_destination_rect.to_rounded<int>(), *bitmap, source_rect.to_rounded<int>(), opacity); | ||||||
|  |         else | ||||||
|             context.painter().draw_scaled_bitmap(transformed_destination_rect.to_rounded<int>(), *bitmap, source_rect, opacity, Gfx::Painter::ScalingMode::BilinearBlend); |             context.painter().draw_scaled_bitmap(transformed_destination_rect.to_rounded<int>(), *bitmap, source_rect, opacity, Gfx::Painter::ScalingMode::BilinearBlend); | ||||||
|     } else { |     } else { | ||||||
|         paint_internal(context); |         paint_internal(context); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling