mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-30 02:47:22 +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";
|
return "source-over";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(value instanceof Name)) {
|
if (value instanceof Name) {
|
||||||
if (parsingArray) {
|
switch (value.name) {
|
||||||
return null;
|
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) {
|
return parsingArray ? null : "source-over";
|
||||||
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";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addCachedImageOps(
|
function addCachedImageOps(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user