mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:32:45 +00:00 
			
		
		
		
	LibDraw: Rename Painter::blit_tiled() => draw_tiled_bitmap()
Also change the API to take a destination rect instead of a source rect since internally it was basically creating a destination rect from the source rect anyway. It was a little confusing.
This commit is contained in:
		
							parent
							
								
									762f20944c
								
							
						
					
					
						commit
						96f10c8de2
					
				
					 3 changed files with 6 additions and 6 deletions
				
			
		|  | @ -305,9 +305,9 @@ void Painter::blit_dimmed(const Point& position, const GraphicsBitmap& source, c | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void Painter::blit_tiled(const Point& position, const GraphicsBitmap& source, const Rect& src_rect) | ||||
| void Painter::draw_tiled_bitmap(const Rect& a_dst_rect, const GraphicsBitmap& source) | ||||
| { | ||||
|     auto dst_rect = Rect(position, src_rect.size()).translated(translation()); | ||||
|     auto dst_rect = a_dst_rect.translated(translation()); | ||||
|     auto clipped_rect = dst_rect.intersected(clip_rect()); | ||||
|     if (clipped_rect.is_empty()) | ||||
|         return; | ||||
|  | @ -318,9 +318,9 @@ void Painter::blit_tiled(const Point& position, const GraphicsBitmap& source, co | |||
|     const size_t dst_skip = m_target->pitch() / sizeof(RGBA32); | ||||
| 
 | ||||
|     if (source.format() == GraphicsBitmap::Format::RGB32 || source.format() == GraphicsBitmap::Format::RGBA32) { | ||||
|         int x_start = first_column + src_rect.left(); | ||||
|         int x_start = first_column + a_dst_rect.left(); | ||||
|         for (int row = first_row; row <= last_row; ++row) { | ||||
|             const RGBA32* sl = source.scanline((row + src_rect.top()) | ||||
|             const RGBA32* sl = source.scanline((row + a_dst_rect.top()) | ||||
|                 % source.size().height()); | ||||
|             for (int x = x_start; x < clipped_rect.width() + x_start; ++x) { | ||||
|                 dst[x - x_start] = sl[x % source.size().width()]; | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ public: | |||
|     void draw_scaled_bitmap(const Rect& dst_rect, const GraphicsBitmap&, const Rect& src_rect); | ||||
|     void blit(const Point&, const GraphicsBitmap&, const Rect& src_rect, float opacity = 1.0f); | ||||
|     void blit_dimmed(const Point&, const GraphicsBitmap&, const Rect& src_rect); | ||||
|     void blit_tiled(const Point&, const GraphicsBitmap&, const Rect& src_rect); | ||||
|     void draw_tiled_bitmap(const Rect& dst_rect, const GraphicsBitmap&); | ||||
|     void blit_offset(const Point&, const GraphicsBitmap&, const Rect& src_rect, const Point&); | ||||
|     void blit_scaled(const Rect&, const GraphicsBitmap&, const Rect&, float, float); | ||||
|     void draw_text(const Rect&, const StringView&, const Font&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None); | ||||
|  |  | |||
|  | @ -120,7 +120,7 @@ void WSCompositor::compose() | |||
|                 m_back_painter->blit_offset(dirty_rect.location(), *m_wallpaper, | ||||
|                     dirty_rect, offset); | ||||
|             } else if (m_wallpaper_mode == WallpaperMode::Tile) { | ||||
|                 m_back_painter->blit_tiled(dirty_rect.location(), *m_wallpaper, dirty_rect); | ||||
|                 m_back_painter->draw_tiled_bitmap(dirty_rect, *m_wallpaper); | ||||
|             } else { | ||||
|                 float hscale = (float)m_wallpaper->size().width() / (float)ws.size().width(); | ||||
|                 float vscale = (float)m_wallpaper->size().height() / (float)ws.size().height(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling