1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00

Merge pull request #17875 from calixteman/jbig2_issue

Update the current stride before composing when decoding a text region
This commit is contained in:
calixteman 2024-04-03 20:41:24 +02:00 committed by GitHub
commit 25f6a0c139
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 31 additions and 3 deletions

View file

@ -865,6 +865,20 @@ function decodeTextRegion(
decodingContext
);
}
let increment = 0;
if (!transposed) {
if (referenceCorner > 1) {
currentS += symbolWidth - 1;
} else {
increment = symbolWidth - 1;
}
} else if (!(referenceCorner & 1)) {
currentS += symbolHeight - 1;
} else {
increment = symbolHeight - 1;
}
const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
let s2, t2, symbolRow;
@ -896,7 +910,6 @@ function decodeTextRegion(
);
}
}
currentS += symbolHeight - 1;
} else {
for (t2 = 0; t2 < symbolHeight; t2++) {
row = bitmap[offsetT + t2];
@ -921,7 +934,6 @@ function decodeTextRegion(
);
}
}
currentS += symbolWidth - 1;
}
i++;
const deltaS = huffman
@ -930,7 +942,7 @@ function decodeTextRegion(
if (deltaS === null) {
break; // OOB
}
currentS += deltaS + dsOffset;
currentS += increment + deltaS + dsOffset;
} while (true);
}
return bitmap;

View file

@ -637,3 +637,5 @@
!issue17730.pdf
!bug1883609.pdf
!issue17808.pdf
!issue17871_bottom_right.pdf
!issue17871_top_right.pdf

Binary file not shown.

Binary file not shown.

View file

@ -9801,5 +9801,19 @@
"md5": "dd66194bdaa0f62bc96c760384f2e098",
"rounds": 1,
"type": "eq"
},
{
"id": "issue17871_bottom_right",
"file": "pdfs/issue17871_bottom_right.pdf",
"md5": "664807166c5279224abfbf259f701958",
"rounds": 1,
"type": "eq"
},
{
"id": "issue17871_top_right",
"file": "pdfs/issue17871_top_right.pdf",
"md5": "07d95eabf18aee0cf38f09eb7b1390ec",
"rounds": 1,
"type": "eq"
}
]