mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:42:44 +00:00 
			
		
		
		
	LibGfx: Add Bitmap::visually_equals()
				
					
				
			This commit is contained in:
		
							parent
							
								
									8b370f988b
								
							
						
					
					
						commit
						dad829de50
					
				
					 2 changed files with 20 additions and 0 deletions
				
			
		|  | @ -582,4 +582,22 @@ Vector<ARGB32> Bitmap::palette_to_vector() const | ||||||
|         vector.unchecked_append(palette_color(i).value()); |         vector.unchecked_append(palette_color(i).value()); | ||||||
|     return vector; |     return vector; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | bool Bitmap::visually_equals(Bitmap const& other) const | ||||||
|  | { | ||||||
|  |     auto own_width = width(); | ||||||
|  |     auto own_height = height(); | ||||||
|  |     if (other.width() != own_width || other.height() != own_height) | ||||||
|  |         return false; | ||||||
|  | 
 | ||||||
|  |     for (auto y = 0; y < own_height; ++y) { | ||||||
|  |         for (auto x = 0; x < own_width; ++x) { | ||||||
|  |             if (get_pixel(x, y) != other.get_pixel(x, y)) | ||||||
|  |                 return false; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -236,6 +236,8 @@ public: | ||||||
|     [[nodiscard]] Core::AnonymousBuffer& anonymous_buffer() { return m_buffer; } |     [[nodiscard]] Core::AnonymousBuffer& anonymous_buffer() { return m_buffer; } | ||||||
|     [[nodiscard]] Core::AnonymousBuffer const& anonymous_buffer() const { return m_buffer; } |     [[nodiscard]] Core::AnonymousBuffer const& anonymous_buffer() const { return m_buffer; } | ||||||
| 
 | 
 | ||||||
|  |     [[nodiscard]] bool visually_equals(Bitmap const&) const; | ||||||
|  | 
 | ||||||
| private: | private: | ||||||
|     Bitmap(BitmapFormat, IntSize const&, int, BackingStore const&); |     Bitmap(BitmapFormat, IntSize const&, int, BackingStore const&); | ||||||
|     Bitmap(BitmapFormat, IntSize const&, int, size_t pitch, void*); |     Bitmap(BitmapFormat, IntSize const&, int, size_t pitch, void*); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jelle Raaijmakers
						Jelle Raaijmakers