Skip to content
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

Magnifier positioning in reftest analyzer #11686

Merged
merged 1 commit into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/resources/reftest-analyzer.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ <h1>Reftest analyzer</h1>
<input type="checkbox" id="differences"> Circle differences
</label>
</form>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="800px" height="1130px" viewbox="0 0 800 1130" id="svg">
<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">
<defs>
<!-- use sRGB to avoid loss of data -->
<filter id="showDifferences" x="0%" y="0%" width="100%" height="100%"
Expand Down
16 changes: 11 additions & 5 deletions test/resources/reftest-analyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,13 @@ window.onload = function() {
var img = new Image();
img.onload = function() {
var canvas = document.createElement("canvas");
canvas.width = 800;
canvas.height = 1000;
canvas.width = img.naturalWidth;
canvas.height = img.naturalHeight;

var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);

whenReady(ctx.getImageData(0, 0, 800, 1000));
whenReady(ctx.getImageData(0, 0, img.naturalWidth, img.naturalHeight));
};
img.src = gPath + src;
}
Expand Down Expand Up @@ -323,13 +323,19 @@ window.onload = function() {
}
cell.style.display = "";
getImageData(item.images[0], function(data) {
gImage1Data = data
gImage1Data = data;
syncSVGSize(gImage1Data);
});
getImageData(item.images[1], function(data) {
gImage2Data = data
});
}

function syncSVGSize(imageData) {
ID("svg").setAttribute("width", imageData.width);
ID("svg").setAttribute("height", imageData.height);
}

function showImage(i) {
if (i == 1) {
ID("image1").style.display = "";
Expand Down Expand Up @@ -397,7 +403,7 @@ window.onload = function() {
var py = y + j;
var p1 = gMagPixPaths[i + dx_hi][j + dy_hi][0];
var p2 = gMagPixPaths[i + dx_hi][j + dy_hi][1];
if (px < 0 || py < 0 || px >= 800 || py >= 1000) {
if (px < 0 || py < 0 || px >= gImage1Data.width || py >= gImage1Data.height) {
p1.setAttribute("fill", "#aaa");
p2.setAttribute("fill", "#888");
} else {
Expand Down