-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alternative diff views #16
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of the actual code, this seems like a reasonable improvement. I am slightly concerned about the potential performance costs, especially for larger-scale cases (incidentally, this is actually a fantastic use case for the planned virtual scrolling in Xilem)
However, these concerns needn't block this pr - there isn't another reasonable way to implement the report functionality into the browser with this feature (short of computing the diffs in wasm or other nastiness).
It just provides greater motivation for the future work I want to do of a Rust frontend to this.
@@ -15,7 +15,8 @@ pub enum ImageDifference { | |||
Content { | |||
n_different_pixels: u64, | |||
distance_sum: u64, | |||
diff_image: Image, | |||
rg_diff_image: Image, | |||
overlay_diff_image: Image, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This work always being done twice concerns me slightly for performance reasons. I think the pattern I'd like to see is:
- only the absolute/scalar difference is calculated.
- producing the diff images is a separate step, either with a function for each or a "mode" enum.
@@ -41,6 +42,48 @@ impl Debug for ImageDifference { | |||
} | |||
} | |||
|
|||
fn compute_rg_diff_image(left: &Image, right: &Image) -> (Image, u64) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is, these should probably be publicly exposed, somehow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea
html! { | ||
img class="zoom" src=(embed_png_url(&data)) width=[w] height=[h] onclick="openImageDialog(this)"; | ||
img id=(format!("img-diff1-{}", id)) class="zoom" src=(embed_png_url(&rg_data)) width=[w] height=[h] onclick="openImageDialog(this)"; | ||
img id=(format!("img-diff2-{}", id)) style="display: none" class="zoom" src=(embed_png_url(&overlay_data)) width=[w] height=[h] onclick="openImageDialog(this)"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is partly why I want a Xilem or similar app for Kompari; so that these diffs could be computed on-the-fly. This change effectively doubles the cost of creating a report, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it doubles the cost of creation, but I would not be worried about it much. I just have made an artificial error in Nelsie and this new version took about ~2s to generate report for 540 images. Moreover it can be easily parallelized by Rayon. btw: Scrolling in the browser is still smooth for all (3+1)x540 images.
Report allows to switch between diff views (implemented as "tabs" under the diff view)
Original red green:
Overlay view: