mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-29 18:37:20 +02:00
Merge pull request #21642 from Snuffleupagus/normalizeBlendMode-shorten
Reduce a tiny bit of duplication in the `normalizeBlendMode` helper
This commit is contained in:
commit
a03ec7e8c5
@ -140,52 +140,45 @@ function normalizeBlendMode(value, parsingArray = false) {
|
||||
return "source-over";
|
||||
}
|
||||
|
||||
if (!(value instanceof Name)) {
|
||||
if (parsingArray) {
|
||||
return null;
|
||||
if (value instanceof Name) {
|
||||
switch (value.name) {
|
||||
case "Normal":
|
||||
case "Compatible":
|
||||
return "source-over";
|
||||
case "Multiply":
|
||||
return "multiply";
|
||||
case "Screen":
|
||||
return "screen";
|
||||
case "Overlay":
|
||||
return "overlay";
|
||||
case "Darken":
|
||||
return "darken";
|
||||
case "Lighten":
|
||||
return "lighten";
|
||||
case "ColorDodge":
|
||||
return "color-dodge";
|
||||
case "ColorBurn":
|
||||
return "color-burn";
|
||||
case "HardLight":
|
||||
return "hard-light";
|
||||
case "SoftLight":
|
||||
return "soft-light";
|
||||
case "Difference":
|
||||
return "difference";
|
||||
case "Exclusion":
|
||||
return "exclusion";
|
||||
case "Hue":
|
||||
return "hue";
|
||||
case "Saturation":
|
||||
return "saturation";
|
||||
case "Color":
|
||||
return "color";
|
||||
case "Luminosity":
|
||||
return "luminosity";
|
||||
}
|
||||
return "source-over";
|
||||
warn(`Unsupported blend mode: ${value.name}`);
|
||||
}
|
||||
switch (value.name) {
|
||||
case "Normal":
|
||||
case "Compatible":
|
||||
return "source-over";
|
||||
case "Multiply":
|
||||
return "multiply";
|
||||
case "Screen":
|
||||
return "screen";
|
||||
case "Overlay":
|
||||
return "overlay";
|
||||
case "Darken":
|
||||
return "darken";
|
||||
case "Lighten":
|
||||
return "lighten";
|
||||
case "ColorDodge":
|
||||
return "color-dodge";
|
||||
case "ColorBurn":
|
||||
return "color-burn";
|
||||
case "HardLight":
|
||||
return "hard-light";
|
||||
case "SoftLight":
|
||||
return "soft-light";
|
||||
case "Difference":
|
||||
return "difference";
|
||||
case "Exclusion":
|
||||
return "exclusion";
|
||||
case "Hue":
|
||||
return "hue";
|
||||
case "Saturation":
|
||||
return "saturation";
|
||||
case "Color":
|
||||
return "color";
|
||||
case "Luminosity":
|
||||
return "luminosity";
|
||||
}
|
||||
if (parsingArray) {
|
||||
return null;
|
||||
}
|
||||
warn(`Unsupported blend mode: ${value.name}`);
|
||||
return "source-over";
|
||||
return parsingArray ? null : "source-over";
|
||||
}
|
||||
|
||||
function addCachedImageOps(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user