mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 04:02:44 +00:00 
			
		
		
		
	 1c0669f010
			
		
	
	
		1c0669f010
		
	
	
	
	
		
			
			Instead of LibGUI and WindowServer building their own copies of the drawing and graphics code, let's it in a separate LibDraw library. This avoids building the code twice, and will encourage better separation of concerns. :^)
		
			
				
	
	
		
			28 lines
		
	
	
	
		
			608 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
	
		
			608 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <AK/Vector.h>
 | |
| #include <LibDraw/Rect.h>
 | |
| 
 | |
| class DisjointRectSet {
 | |
| public:
 | |
|     DisjointRectSet() {}
 | |
|     ~DisjointRectSet() {}
 | |
|     DisjointRectSet(DisjointRectSet&& other)
 | |
|         : m_rects(move(other.m_rects))
 | |
|     {
 | |
|     }
 | |
| 
 | |
|     void add(const Rect&);
 | |
| 
 | |
|     bool is_empty() const { return m_rects.is_empty(); }
 | |
|     int size() const { return m_rects.size(); }
 | |
| 
 | |
|     void clear() { m_rects.clear(); }
 | |
|     void clear_with_capacity() { m_rects.clear_with_capacity(); }
 | |
|     const Vector<Rect, 32>& rects() const { return m_rects; }
 | |
| 
 | |
| private:
 | |
|     void shatter();
 | |
| 
 | |
|     Vector<Rect, 32> m_rects;
 | |
| };
 |