reftest-analyzer.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <!DOCTYPE html>
  2. <!--
  3. Copyright 2012 Mozilla Foundation
  4. Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5. The contents of this file are subject to the Mozilla Public License Version
  6. 1.1 (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.mozilla.org/MPL
  9. Software distributed under the License is distributed on an "AS IS" basis,
  10. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. for the specific language governing rights and limitations under the
  12. License.
  13. Alternatively, the contents of this file may be used under the terms of
  14. either the GNU General Public License Version 2 or later (the "GPL"), or
  15. the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  16. in which case the provisions of the GPL or the LGPL are applicable instead
  17. of those above. If you wish to allow use of your version of this file only
  18. under the terms of either the GPL or the LGPL, and not to allow others to
  19. use your version of this file under the terms of the MPL, indicate your
  20. decision by deleting the provisions above and replace them with the notice
  21. and other provisions required by the LGPL or the GPL. If you do not delete
  22. the provisions above, a recipient may use your version of this file under
  23. the terms of any one of the MPL, the GPL or the LGPL.
  24. Original author: L. David Baron <dbaron@dbaron.org>
  25. -->
  26. <html>
  27. <head>
  28. <title>Reftest analyzer</title>
  29. <meta charset="utf-8">
  30. <link rel="stylesheet" href="reftest-analyzer.css">
  31. <script src="reftest-analyzer.js"></script>
  32. </head>
  33. <body>
  34. <div id="entry">
  35. <h1>Reftest analyzer</h1>
  36. <p>
  37. Paste your log into this textarea:<br>
  38. <textarea cols="80" rows="10" id="logEntry"></textarea><br>
  39. <input type="button" value="Process pasted log" id="logPasted">
  40. </p>
  41. <p>
  42. <br>...or load it from a file:<br>
  43. <input type="file" id="fileEntry">
  44. </p>
  45. </div>
  46. <div id="loading">Loading log...</div>
  47. <div id="viewer">
  48. <div id="pixelarea">
  49. <div id="pixelinfo">
  50. <table>
  51. <tbody>
  52. <tr>
  53. <th>Pixel at:</th>
  54. <td colspan="2" id="coords"></td>
  55. </tr>
  56. <tr>
  57. <th>Test:</th>
  58. <td id="pix1rgb"></td>
  59. <td id="pix1hex"></td>
  60. </tr>
  61. <tr>
  62. <th>Reference:</th>
  63. <td id="pix2rgb"></td>
  64. <td id="pix2hex"></td>
  65. </tr>
  66. </tbody>
  67. </table>
  68. <div>
  69. <div id="pixelhint">?
  70. <div>
  71. <p>Move the mouse over the reftest image on the right to show
  72. magnified pixels on the left. The color information above is for
  73. the pixel centered in the magnified view.</p>
  74. <p>The test is shown in the upper triangle of each pixel and
  75. the reference is shown in the lower triangle.</p>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <div id="magnification">
  81. <svg xmlns="http://www.w3.org/2000/svg" width="84" height="84" shape-rendering="optimizeSpeed">
  82. <g id="mag" />
  83. </svg>
  84. </div>
  85. </div>
  86. <div id="itemlist">
  87. <table id="itemtable"></table>
  88. </div>
  89. <div id="imagepane">
  90. <form id="imgcontrols">
  91. <label>
  92. <input type="radio" name="which" id="testImage" value="0" checked="checked"> Test
  93. </label>
  94. <label>
  95. <input type="radio" name="which" id="referenceImage" value="1"> Reference
  96. </label>
  97. <label>
  98. <input type="checkbox" id="differences"> Circle differences
  99. </label>
  100. <span id="shortcuts">Shortcuts: n=next p=previous t=toggle d=differences</span>
  101. </form>
  102. <div id="images">
  103. <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="800" height="1000" id="svg">
  104. <defs>
  105. <!-- use sRGB to avoid loss of data -->
  106. <filter id="showDifferences" x="0%" y="0%" width="100%" height="100%"
  107. style="color-interpolation-filters: sRGB">
  108. <feImage id="feimage1" result="img1" xlink:href="#image1" />
  109. <feImage id="feimage2" result="img2" xlink:href="#image2" />
  110. <!-- inv1 and inv2 are the images with RGB inverted -->
  111. <feComponentTransfer result="inv1" in="img1">
  112. <feFuncR type="linear" slope="-1" intercept="1" />
  113. <feFuncG type="linear" slope="-1" intercept="1" />
  114. <feFuncB type="linear" slope="-1" intercept="1" />
  115. </feComponentTransfer>
  116. <feComponentTransfer result="inv2" in="img2">
  117. <feFuncR type="linear" slope="-1" intercept="1" />
  118. <feFuncG type="linear" slope="-1" intercept="1" />
  119. <feFuncB type="linear" slope="-1" intercept="1" />
  120. </feComponentTransfer>
  121. <!-- w1 will have non-white pixels anywhere that img2
  122. is brighter than img1, and w2 for the reverse.
  123. It would be nice not to have to go through these
  124. intermediate states, but feComposite
  125. type="arithmetic" can't transform the RGB channels
  126. and leave the alpha channel untouched. -->
  127. <feComposite result="w1" in="img1" in2="inv2" operator="arithmetic" k2="1" k3="1" />
  128. <feComposite result="w2" in="img2" in2="inv1" operator="arithmetic" k2="1" k3="1" />
  129. <!-- c1 will have non-black pixels anywhere that img2
  130. is brighter than img1, and c2 for the reverse -->
  131. <feComponentTransfer result="c1" in="w1">
  132. <feFuncR type="linear" slope="-1" intercept="1" />
  133. <feFuncG type="linear" slope="-1" intercept="1" />
  134. <feFuncB type="linear" slope="-1" intercept="1" />
  135. </feComponentTransfer>
  136. <feComponentTransfer result="c2" in="w2">
  137. <feFuncR type="linear" slope="-1" intercept="1" />
  138. <feFuncG type="linear" slope="-1" intercept="1" />
  139. <feFuncB type="linear" slope="-1" intercept="1" />
  140. </feComponentTransfer>
  141. <!-- c will be nonblack (and fully on) for every pixel+component where there are differences -->
  142. <feComposite result="c" in="c1" in2="c2" operator="arithmetic" k2="255" k3="255" />
  143. <!-- a will be opaque for every pixel with differences and transparent for all others -->
  144. <feColorMatrix result="a" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0" />
  145. <!-- a, dilated by 4 pixels -->
  146. <feMorphology result="dila4" in="a" operator="dilate" radius="4" />
  147. <!-- a, dilated by 1 pixel -->
  148. <feMorphology result="dila1" in="a" operator="dilate" radius="1" />
  149. <!-- all the pixels in the 3-pixel dilation of a but not in the 1-pixel dilation of a, to highlight the diffs -->
  150. <feComposite result="highlight" in="dila4" in2="dila1" operator="out" />
  151. <feFlood result="red" flood-color="red" />
  152. <feComposite result="redhighlight" in="red" in2="highlight" operator="in" />
  153. <feFlood result="black" flood-color="black" flood-opacity="0.5" />
  154. <feMerge>
  155. <feMergeNode in="black" />
  156. <feMergeNode in="redhighlight" />
  157. </feMerge>
  158. </filter>
  159. </defs>
  160. <g id="magnify">
  161. <image x="0" y="0" id="image1" />
  162. <image x="0" y="0" id="image2" />
  163. </g>
  164. <rect id="diffrect" filter="url(#showDifferences)" pointer-events="none" x="0" y="0" width="100%" height="100%" />
  165. </svg>
  166. </div>
  167. </div>
  168. </body>
  169. </html>