mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibGfx: Replace Bitmap::visually_equals() with ::diff()
This produces more granural information on the actual pixel errors present between two bitmaps. It now also asserts that both bitmaps are the same size, since we should never compare two differently sized bitmaps anyway.
This commit is contained in:
parent
b7b504cf2d
commit
0f642ecb5c
Notes:
github-actions[bot]
2025-07-17 12:00:38 +00:00
Author: https://github.com/gmta
Commit: 0f642ecb5c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5470
Reviewed-by: https://github.com/tcl3 ✅
3 changed files with 55 additions and 8 deletions
|
@ -137,7 +137,28 @@ public:
|
|||
[[nodiscard]] Core::AnonymousBuffer& anonymous_buffer() { return m_buffer; }
|
||||
[[nodiscard]] Core::AnonymousBuffer const& anonymous_buffer() const { return m_buffer; }
|
||||
|
||||
[[nodiscard]] bool visually_equals(Bitmap const&) const;
|
||||
struct DiffResult {
|
||||
bool identical { false };
|
||||
|
||||
// Cumulative channel differences.
|
||||
u64 total_red_error { 0 };
|
||||
u64 total_green_error { 0 };
|
||||
u64 total_blue_error { 0 };
|
||||
u64 total_alpha_error { 0 };
|
||||
u64 total_error { 0 };
|
||||
|
||||
// Maximum channel differences.
|
||||
u8 maximum_red_error { 0 };
|
||||
u8 maximum_green_error { 0 };
|
||||
u8 maximum_blue_error { 0 };
|
||||
u8 maximum_alpha_error { 0 };
|
||||
u8 maximum_error { 0 };
|
||||
|
||||
// Number of pixels with errors.
|
||||
u64 pixel_error_count { 0 };
|
||||
};
|
||||
|
||||
[[nodiscard]] DiffResult diff(Bitmap const&) const;
|
||||
|
||||
[[nodiscard]] AlphaType alpha_type() const { return m_alpha_type; }
|
||||
void set_alpha_type_destructive(AlphaType);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue