Merge pull request #11281 from Snuffleupagus/issue-11279

Support Blend Modes which are specified in an Array of Names (issue 11279)
This commit is contained in:
Tim van der Meij 2019-10-27 19:09:54 +01:00 committed by GitHub
commit 31737565d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 2 deletions

View File

@ -125,8 +125,23 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
};
// Convert PDF blend mode names to HTML5 blend mode names.
function normalizeBlendMode(value) {
function normalizeBlendMode(value, parsingArray = false) {
if (Array.isArray(value)) {
// Use the first *supported* BM value in the Array (fixes issue11279.pdf).
for (let i = 0, ii = value.length; i < ii; i++) {
const maybeBM = normalizeBlendMode(value[i], /* parsingArray = */ true);
if (maybeBM) {
return maybeBM;
}
}
warn(`Unsupported blend mode Array: ${value}`);
return 'source-over';
}
if (!isName(value)) {
if (parsingArray) {
return null;
}
return 'source-over';
}
switch (value.name) {
@ -164,7 +179,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
case 'Luminosity':
return 'luminosity';
}
warn('Unsupported blend mode: ' + value.name);
if (parsingArray) {
return null;
}
warn(`Unsupported blend mode: ${value.name}`);
return 'source-over';
}

View File

@ -85,6 +85,7 @@
!issue11045.pdf
!issue11150_reduced.pdf
!issue11242_reduced.pdf
!issue11279.pdf
!bad-PageLabels.pdf
!decodeACSuccessive.pdf
!filled-background.pdf

BIN
test/pdfs/issue11279.pdf Normal file

Binary file not shown.

View File

@ -1512,6 +1512,13 @@
"link": false,
"type": "eq"
},
{ "id": "issue11279",
"file": "pdfs/issue11279.pdf",
"md5": "03361d24f3ed63b93f77abf731f8fc73",
"rounds": 1,
"link": false,
"type": "eq"
},
{ "id": "issue8480",
"file": "pdfs/issue8480.pdf",
"md5": "769bc07bf8041d95667f2d32aaf75665",