mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-28 23:28:16 +02:00
Simplify the ColorSpaceUtils.singletons
handling (PR 19564 follow-up)
With the changes in PR 19564 the actual `ColorSpace`-classes where separated from the various static "helper" methods. Hence it seems that we can now simplify/shorten this old code to instead cache the "standard" ColorSpaces directly on the `ColorSpaceUtils`-class.
This commit is contained in:
parent
fedfdf9d10
commit
d8d7235876
5 changed files with 56 additions and 91 deletions
|
@ -73,28 +73,13 @@ class DefaultAppearanceEvaluator extends EvaluatorPreprocessor {
|
|||
}
|
||||
break;
|
||||
case OPS.setFillRGBColor:
|
||||
ColorSpaceUtils.singletons.rgb.getRgbItem(
|
||||
args,
|
||||
0,
|
||||
result.fontColor,
|
||||
0
|
||||
);
|
||||
ColorSpaceUtils.rgb.getRgbItem(args, 0, result.fontColor, 0);
|
||||
break;
|
||||
case OPS.setFillGray:
|
||||
ColorSpaceUtils.singletons.gray.getRgbItem(
|
||||
args,
|
||||
0,
|
||||
result.fontColor,
|
||||
0
|
||||
);
|
||||
ColorSpaceUtils.gray.getRgbItem(args, 0, result.fontColor, 0);
|
||||
break;
|
||||
case OPS.setFillCMYKColor:
|
||||
ColorSpaceUtils.singletons.cmyk.getRgbItem(
|
||||
args,
|
||||
0,
|
||||
result.fontColor,
|
||||
0
|
||||
);
|
||||
ColorSpaceUtils.cmyk.getRgbItem(args, 0, result.fontColor, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +117,7 @@ class AppearanceStreamEvaluator extends EvaluatorPreprocessor {
|
|||
fontSize: 0,
|
||||
fontName: "",
|
||||
fontColor: /* black = */ new Uint8ClampedArray(3),
|
||||
fillColorSpace: ColorSpaceUtils.singletons.gray,
|
||||
fillColorSpace: ColorSpaceUtils.gray,
|
||||
};
|
||||
let breakLoop = false;
|
||||
const stack = [];
|
||||
|
@ -186,28 +171,13 @@ class AppearanceStreamEvaluator extends EvaluatorPreprocessor {
|
|||
cs.getRgbItem(args, 0, result.fontColor, 0);
|
||||
break;
|
||||
case OPS.setFillRGBColor:
|
||||
ColorSpaceUtils.singletons.rgb.getRgbItem(
|
||||
args,
|
||||
0,
|
||||
result.fontColor,
|
||||
0
|
||||
);
|
||||
ColorSpaceUtils.rgb.getRgbItem(args, 0, result.fontColor, 0);
|
||||
break;
|
||||
case OPS.setFillGray:
|
||||
ColorSpaceUtils.singletons.gray.getRgbItem(
|
||||
args,
|
||||
0,
|
||||
result.fontColor,
|
||||
0
|
||||
);
|
||||
ColorSpaceUtils.gray.getRgbItem(args, 0, result.fontColor, 0);
|
||||
break;
|
||||
case OPS.setFillCMYKColor:
|
||||
ColorSpaceUtils.singletons.cmyk.getRgbItem(
|
||||
args,
|
||||
0,
|
||||
result.fontColor,
|
||||
0
|
||||
);
|
||||
ColorSpaceUtils.cmyk.getRgbItem(args, 0, result.fontColor, 0);
|
||||
break;
|
||||
case OPS.showText:
|
||||
case OPS.showSpacedText:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue