Replace css color rgb(...) by #...

* it's faster to generate the color code in using a table for components
* it's very likely a way faster to parse (when setting the color in the canvas)
This commit is contained in:
Calixte Denizet 2020-10-30 14:51:50 +01:00
parent bf870bd2ac
commit 9d11b51a3e
6 changed files with 15 additions and 18 deletions

View file

@ -1049,7 +1049,7 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
}
setStrokeRGBColor(r, g, b) {
this.current.strokeColor = Util.makeCssRgb(r, g, b);
this.current.strokeColor = Util.makeHexColor(r, g, b);
}
setFillAlpha(fillAlpha) {
@ -1057,7 +1057,7 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
}
setFillRGBColor(r, g, b) {
this.current.fillColor = Util.makeCssRgb(r, g, b);
this.current.fillColor = Util.makeHexColor(r, g, b);
this.current.tspan = this.svgFactory.createElement("svg:tspan");
this.current.xcoords = [];
this.current.ycoords = [];
@ -1143,7 +1143,7 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
this.svg = bbox;
this.transformMatrix = matrix;
if (paintType === 2) {
const cssColor = Util.makeCssRgb(...color);
const cssColor = Util.makeHexColor(...color);
this.current.fillColor = cssColor;
this.current.strokeColor = cssColor;
}