mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
Use white backdrop when possible.
This commit is contained in:
parent
04f6e17e11
commit
ec311f303b
5 changed files with 32 additions and 12 deletions
|
@ -415,7 +415,23 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
'shadingFill': true
|
||||
},
|
||||
|
||||
beginDrawing: function CanvasGraphics_beginDrawing(viewport) {
|
||||
beginDrawing: function CanvasGraphics_beginDrawing(viewport, transparency) {
|
||||
// For pdfs that use blend modes we have to clear the canvas else certain
|
||||
// blend modes can look wrong since we'd be blending with a white
|
||||
// backdrop. The problem with a transparent backdrop though is we then
|
||||
// don't get sub pixel anti aliasing on text, so we fill with white if
|
||||
// we can.
|
||||
var width = this.ctx.canvas.width;
|
||||
var height = this.ctx.canvas.height;
|
||||
if (transparency) {
|
||||
this.ctx.clearRect(0, 0, width, height);
|
||||
} else {
|
||||
this.ctx.save();
|
||||
this.ctx.fillStyle = 'rgb(255, 255, 255)';
|
||||
this.ctx.fillRect(0, 0, width, height);
|
||||
this.ctx.restore();
|
||||
}
|
||||
|
||||
var transform = viewport.transform;
|
||||
this.ctx.save();
|
||||
this.ctx.transform.apply(this.ctx, transform);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue