⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 287345 in webkit


Ignore:
Timestamp:
Dec 21, 2021, 9:15:33 PM (5 years ago)
Author:
Simon Fraser
Message:

Fuzzy pixel data need to be computed in terms of CSS pixels
​https://bugs.webkit.org/show_bug.cgi?id=232525

Reviewed by Tim Horton.

Tools:

Pixel tolerance is computed in CSS pixels, so have ImageDiff divide the total number of
differing pixels by the square of the scale factor (a single different pixel at 1x becomes 4
different pixels at 2x).

  • ImageDiff/ImageDiff.cpp:

(processImages):

  • ImageDiff/PlatformImage.cpp:

(ImageDiff::PlatformImage::isCompatible const):
(ImageDiff::PlatformImage::difference):

LayoutTests:

Add a hidpi pixel tolerance test.

  • fast/harness/image-diff/hidpi-pixel-tolerance-expected.html: Added.
  • fast/harness/image-diff/hidpi-pixel-tolerance.html: Added.
  • platform/ios-wk2/TestExpectations: Remove fast/harness/image-diff/fuzz-2-25.html.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r287329 r287345  
     12021-12-21  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Fuzzy pixel data need to be computed in terms of CSS pixels
     4        https://bugs.webkit.org/show_bug.cgi?id=232525
     5
     6        Reviewed by Tim Horton.
     7
     8        Add a hidpi pixel tolerance test.
     9
     10        * fast/harness/image-diff/hidpi-pixel-tolerance-expected.html: Added.
     11        * fast/harness/image-diff/hidpi-pixel-tolerance.html: Added.
     12        * platform/ios-wk2/TestExpectations: Remove fast/harness/image-diff/fuzz-2-25.html.
     13
    1142021-12-21  Alan Bujtas  <zalan@apple.com>
    215
  • trunk/LayoutTests/platform/ios-wk2/TestExpectations

    r287323 r287345  
    11121112
    11131113webkit.org/b/157589 fast/text-autosizing/ios/text-autosizing-after-back.html [ Pass Timeout ]
    1114 
    1115 webkit.org/b/232525 fast/harness/image-diff/fuzz-2-25.html [ ImageOnlyFailure ]
    11161114
    11171115# started to fail after new snapshotting in r202532
  • trunk/Tools/ChangeLog

    r287343 r287345  
     12021-12-21  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Fuzzy pixel data need to be computed in terms of CSS pixels
     4        https://bugs.webkit.org/show_bug.cgi?id=232525
     5
     6        Reviewed by Tim Horton.
     7
     8        Pixel tolerance is computed in CSS pixels, so have ImageDiff divide the total number of
     9        differing pixels by the square of the scale factor (a single different pixel at 1x becomes 4
     10        different pixels at 2x).
     11
     12        * ImageDiff/ImageDiff.cpp:
     13        (processImages):
     14        * ImageDiff/PlatformImage.cpp:
     15        (ImageDiff::PlatformImage::isCompatible const):
     16        (ImageDiff::PlatformImage::difference):
     17
    1182021-12-21  Alex Christensen  <achristensen@webkit.org>
    219
  • trunk/Tools/ImageDiff/ImageDiff.cpp

    r286285 r287345  
    5959            fprintf(stderr, "Error: test and reference images differ in alpha. Test image %s alpha, reference image %s alpha.\n",
    6060                actualImage->hasAlpha() ? "has" : "does not have", baselineImage->hasAlpha() ? "has" : "does not have");
     61        } else if (actualImage->scaleFactor() != baselineImage->scaleFactor()) {
     62            fprintf(stderr, "Error: test and reference images differ in scale factor. Test image scale factor %.1f, reference image scale factor %.1f.\n",
     63                actualImage->scaleFactor(), baselineImage->scaleFactor());
    6164        }
    6265
  • trunk/Tools/ImageDiff/PlatformImage.cpp

    r285109 r287345  
    3737    return width() == other.width()
    3838        && height() == other.height()
     39        && scaleFactor() == other.scaleFactor()
    3940        && rowBytes() == other.rowBytes()
    4041        && hasAlpha() == other.hasAlpha();
    … …  
    106107        }
    107108
     109        // totalPixels is "CSS pixels" or "points".
     110        difference.totalPixels /= (scaleFactor() * scaleFactor());
     111
    108112        return PlatformImage::createFromDiffData(diffBuffer, width, height);
    109113    }
Note: See TracChangeset for help on using the changeset viewer.