Bug 232522 - ImageDiff no longer needs a --tolerance argument, and fix sometimes-black diff images
Summary: ImageDiff no longer needs a --tolerance argument, and fix sometimes-black dif...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
: 232467 (view as bug list)
Depends on:
Blocks: 149828
  Show dependency treegraph
 
Reported: 2021-10-29 21:32 PDT by Simon Fraser (smfr)
Modified: 2021-11-01 09:25 PDT (History)
8 users (show)

See Also:


Attachments
Patch (15.12 KB, patch)
2021-10-29 21:36 PDT, Simon Fraser (smfr)
mrobinson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2021-10-29 21:32:35 PDT
ImageDiff no longer needs a --tolerance argument, and fix sometimes-black diff images
Comment 1 Simon Fraser (smfr) 2021-10-29 21:36:45 PDT
Created attachment 442897 [details]
Patch
Comment 2 Simon Fraser (smfr) 2021-10-29 22:59:28 PDT
*** Bug 232467 has been marked as a duplicate of this bug. ***
Comment 3 Martin Robinson 2021-11-01 07:22:03 PDT
Comment on attachment 442897 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=442897&action=review

Looks good. Just a few suggestions before landing.

> Tools/ImageDiff/ImageDiff.cpp:111
> +                "usage: ImageDiff [-h] [-v] [-d] [-e] [-t TOLERANCE] ([actualImage baselineImage] | <stdin>)\n" \

I think you should remove `[-t TOLERANCE]` from this line now as well.

> Tools/ImageDiff/ImageDiff.cpp:123
>                  "  -t, --tolerance TOLERANCE\n" \
>                  "                        compare the images with the given tolerance\n"

These two lines should be removed as well.

> Tools/ImageDiff/PlatformImage.cpp:101
> +            float pixel = static_cast<float>(diffPixel[p]);

Is it possible that this cast is unnecessary?

> Tools/ImageDiff/PlatformImage.cpp:105
> +            diffPixel[p] = static_cast<unsigned char>(pixel);

Ditto.
Comment 4 Martin Robinson 2021-11-01 07:24:32 PDT
Ah, there is also the style error which seems pretty simple to fix as well.
Comment 5 Simon Fraser (smfr) 2021-11-01 08:21:35 PDT
(In reply to Martin Robinson from comment #3)
> Comment on attachment 442897 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=442897&action=review
> 
> Looks good. Just a few suggestions before landing.
> 
> > Tools/ImageDiff/ImageDiff.cpp:111
> > +                "usage: ImageDiff [-h] [-v] [-d] [-e] [-t TOLERANCE] ([actualImage baselineImage] | <stdin>)\n" \
> 
> I think you should remove `[-t TOLERANCE]` from this line now as well.
> 
> > Tools/ImageDiff/ImageDiff.cpp:123
> >                  "  -t, --tolerance TOLERANCE\n" \
> >                  "                        compare the images with the given tolerance\n"
> 
> These two lines should be removed as well.

Thanks, I know I did that in some other incarnation of this patch!

> 
> > Tools/ImageDiff/PlatformImage.cpp:101
> > +            float pixel = static_cast<float>(diffPixel[p]);
> 
> Is it possible that this cast is unnecessary?
> 
> > Tools/ImageDiff/PlatformImage.cpp:105
> > +            diffPixel[p] = static_cast<unsigned char>(pixel);

Both casts are not necessary but I like having them because it makes them clear to the reader.
Comment 6 Simon Fraser (smfr) 2021-11-01 08:22:02 PDT
Style warning is unavoidable; we don't link ImageDiff with WTF so can only use std:: types.
Comment 7 Simon Fraser (smfr) 2021-11-01 09:24:06 PDT
https://trac.webkit.org/changeset/285109/webkit
Comment 8 Radar WebKit Bug Importer 2021-11-01 09:25:20 PDT
<rdar://problem/84884082>