Skip to content

Commit

Permalink
Implement setRenderingIntent and setFlatness for the SVG backend
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
timvandermeij committed Mar 23, 2019
1 parent 56e00f5 commit aecc9c1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/display/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?
},
setFlatness: function CanvasGraphics_setFlatness(flatness) {
// There's no way to control this with canvas, but we can safely ignore.
// TODO set flatness?
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: function CanvasGraphics_setGState(states) {
for (var i = 0, ii = states.length; i < ii; i++) {
Expand Down
20 changes: 20 additions & 0 deletions src/display/svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,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;
Expand Down Expand Up @@ -1195,6 +1201,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 state of states) {
const key = state[0];
Expand All @@ -1216,6 +1230,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;
Expand Down

0 comments on commit aecc9c1

Please sign in to comment.