| OLD | NEW |
| 1 window.ignoreCyan = false; | 1 window.ignoreCyan = false; |
| 2 | 2 |
| 3 function testImageColors(source, cyanInTargetGamut) { | 3 function testImageColors(source, cyanInTargetGamut) { |
| 4 window.ignoreCyan = !cyanInTargetGamut; | 4 window.ignoreCyan = !cyanInTargetGamut; |
| 5 | 5 |
| 6 var image = document.querySelector('img'); | 6 var image = document.querySelector('img'); |
| 7 image.onload = function() { | 7 image.onload = function() { |
| 8 runAfterLayoutAndPaint(window.testRunner ? changeColorProfile : profileChang
ed); | 8 runAfterLayoutAndPaint(function () { setTimeout(drawImageToCanvas, 0) }); |
| 9 }; | 9 }; |
| 10 | 10 |
| 11 image.src = source; | 11 image.src = source; |
| 12 } | 12 } |
| 13 | 13 |
| 14 function changeColorProfile() { | |
| 15 /* The test image contains the Munsell colors in a known color space. Convert | |
| 16 * the colors to sRGB color space and test the transformed color accuracy. | |
| 17 */ | |
| 18 window.testRunner.setColorProfile('sRGB', profileChanged); | |
| 19 } | |
| 20 | |
| 21 function profileChanged() { | |
| 22 setTimeout(drawImageToCanvas, 0); | |
| 23 } | |
| 24 | |
| 25 function drawImageToCanvas() { | 14 function drawImageToCanvas() { |
| 26 var image = document.querySelector('img'); | 15 var image = document.querySelector('img'); |
| 27 | 16 |
| 28 var canvas = document.querySelector('canvas'); | 17 var canvas = document.querySelector('canvas'); |
| 29 canvas.width = image.width; | 18 canvas.width = image.width; |
| 30 canvas.height = image.height; | 19 canvas.height = image.height; |
| 31 | 20 |
| 32 canvas.getContext('2d').drawImage(image, 0, 0, canvas.width, canvas.height); | 21 canvas.getContext('2d').drawImage(image, 0, 0, canvas.width, canvas.height); |
| 33 chartColorTransform(canvas); | 22 chartColorTransform(canvas); |
| 34 } | 23 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 * Report the total RMS color error: lower is better, and should be << 2, whic
h is the | 144 * Report the total RMS color error: lower is better, and should be << 2, whic
h is the |
| 156 * JND (Just Noticable Difference) perception threshold. Above a JND, the col
or error | 145 * JND (Just Noticable Difference) perception threshold. Above a JND, the col
or error |
| 157 * is noticable to the human eye. | 146 * is noticable to the human eye. |
| 158 */ | 147 */ |
| 159 drawRule(); | 148 drawRule(); |
| 160 log('\nResult: total RMS color error: ' + Math.sqrt(totalSquaredError / 30.0).
toFixed(2)); | 149 log('\nResult: total RMS color error: ' + Math.sqrt(totalSquaredError / 30.0).
toFixed(2)); |
| 161 | 150 |
| 162 if (window.testRunner) | 151 if (window.testRunner) |
| 163 window.testRunner.notifyDone(); | 152 window.testRunner.notifyDone(); |
| 164 } | 153 } |
| OLD | NEW |