Merge pull request #3009 from brendandahl/backdrop
Use white backdrop when possible.
This commit is contained in:
commit
74b0a51cee
@ -384,11 +384,11 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
||||
var stats = this.stats;
|
||||
stats.time('Rendering');
|
||||
|
||||
gfx.beginDrawing(viewport);
|
||||
var operatorList = this.operatorList;
|
||||
gfx.beginDrawing(viewport, operatorList.transparency);
|
||||
|
||||
var startIdx = 0;
|
||||
var length = this.operatorList.fnArray.length;
|
||||
var operatorList = this.operatorList;
|
||||
var length = operatorList.fnArray.length;
|
||||
var stepper = null;
|
||||
if (PDFJS.pdfBug && 'StepperManager' in globalScope &&
|
||||
globalScope['StepperManager'].enabled) {
|
||||
|
@ -415,7 +415,24 @@ 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.mozOpaque = true;
|
||||
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);
|
||||
|
@ -361,8 +361,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
}, handler, xref, resources, image, inline);
|
||||
}
|
||||
|
||||
if (!queue)
|
||||
queue = {};
|
||||
if (!queue) {
|
||||
queue = {
|
||||
transparency: false
|
||||
};
|
||||
}
|
||||
|
||||
if (!queue.argsArray) {
|
||||
queue.argsArray = [];
|
||||
@ -532,7 +535,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
case 'FL':
|
||||
case 'CA':
|
||||
case 'ca':
|
||||
case 'BM':
|
||||
gsStateObj.push([key, value]);
|
||||
break;
|
||||
case 'Font':
|
||||
@ -542,6 +544,12 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
value[1]
|
||||
]);
|
||||
break;
|
||||
case 'BM':
|
||||
if (!isName(value) || value.name !== 'Normal') {
|
||||
queue.transparency = true;
|
||||
}
|
||||
gsStateObj.push([key, value]);
|
||||
break;
|
||||
case 'SMask':
|
||||
// We support the default so don't trigger the TODO.
|
||||
if (!isName(value) || value.name != 'None')
|
||||
|
@ -50,7 +50,6 @@ function load() {
|
||||
var delay = params.delay || 0;
|
||||
|
||||
canvas = document.createElement('canvas');
|
||||
canvas.mozOpaque = true;
|
||||
stdout = document.getElementById('stdout');
|
||||
|
||||
info('User Agent: ' + navigator.userAgent);
|
||||
@ -394,10 +393,7 @@ function info(message) {
|
||||
}
|
||||
|
||||
function clear(ctx) {
|
||||
ctx.save();
|
||||
ctx.fillStyle = 'rgb(255, 255, 255)';
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.restore();
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
|
||||
/* Auto-scroll if the scrollbar is near the bottom, otherwise do nothing. */
|
||||
|
@ -2228,7 +2228,6 @@ var PageView = function pageView(container, id, scale,
|
||||
}
|
||||
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
// TODO(mack): use data attributes to store these
|
||||
ctx._scaleX = outputScale.sx;
|
||||
ctx._scaleY = outputScale.sy;
|
||||
|
Loading…
Reference in New Issue
Block a user