From 2b18e5a355e1a5aaefd7224881aab17b19260633 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sat, 23 Mar 2019 23:05:12 +0100 Subject: [PATCH] Implement `setRenderingIntent` and `setFlatness` for the SVG backend This mirrors the canvas implementation where we ignore these operators. This avoids console spam regarding unimplemented operators we're not interested in. For the Tracemonkey paper, we're now down to one warning about tiling patterns which is in fact a valid one. --- src/display/canvas.js | 11 ++++------- src/display/svg.js | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/display/canvas.js b/src/display/canvas.js index f78630801..1531e0534 100644 --- a/src/display/canvas.js +++ b/src/display/canvas.js @@ -888,14 +888,11 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { ctx.lineDashOffset = dashPhase; } }, - setRenderingIntent: function CanvasGraphics_setRenderingIntent(intent) { - // Maybe if we one day fully support color spaces this will be important - // for now we can ignore. - // TODO set rendering intent? + setRenderingIntent(intent) { + // This operation is ignored since we haven't found a use case for it yet. }, - setFlatness: function CanvasGraphics_setFlatness(flatness) { - // There's no way to control this with canvas, but we can safely ignore. - // TODO set flatness? + setFlatness(flatness) { + // This operation is ignored since we haven't found a use case for it yet. }, setGState: function CanvasGraphics_setGState(states) { for (var i = 0, ii = states.length; i < ii; i++) { diff --git a/src/display/svg.js b/src/display/svg.js index c22c9137c..fe5e98550 100644 --- a/src/display/svg.js +++ b/src/display/svg.js @@ -595,6 +595,12 @@ SVGGraphics = class SVGGraphics { case OPS.setDash: this.setDash(args[0], args[1]); break; + case OPS.setRenderingIntent: + this.setRenderingIntent(args[0]); + break; + case OPS.setFlatness: + this.setFlatness(args[0]); + break; case OPS.setGState: this.setGState(args[0]); break; @@ -1188,6 +1194,14 @@ SVGGraphics = class SVGGraphics { this.current.textHScale = scale / 100; } + setRenderingIntent(intent) { + // This operation is ignored since we haven't found a use case for it yet. + } + + setFlatness(flatness) { + // This operation is ignored since we haven't found a use case for it yet. + } + setGState(states) { for (const [key, value] of states) { switch (key) { @@ -1206,6 +1220,12 @@ SVGGraphics = class SVGGraphics { case 'D': this.setDash(value[0], value[1]); break; + case 'RI': + this.setRenderingIntent(value); + break; + case 'FL': + this.setFlatness(value); + break; case 'Font': this.setFont(value); break;