Remove TryCatch in canvas fill
As verified by @Rob--W, the evenodd fill rule works correctly in all supported browsers. This now allows optimization by JS engines. This fixes #5458
This commit is contained in:
parent
9f5abd70d7
commit
063ca95f5f
@ -1096,12 +1096,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||||||
ctx.fill();
|
ctx.fill();
|
||||||
ctx.mozFillRule = 'nonzero';
|
ctx.mozFillRule = 'nonzero';
|
||||||
} else {
|
} else {
|
||||||
try {
|
ctx.fill('evenodd');
|
||||||
ctx.fill('evenodd');
|
|
||||||
} catch (ex) {
|
|
||||||
// shouldn't really happen, but browsers might think differently
|
|
||||||
ctx.fill();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.pendingEOFill = false;
|
this.pendingEOFill = false;
|
||||||
} else {
|
} else {
|
||||||
@ -2110,12 +2105,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||||||
ctx.clip();
|
ctx.clip();
|
||||||
ctx.mozFillRule = 'nonzero';
|
ctx.mozFillRule = 'nonzero';
|
||||||
} else {
|
} else {
|
||||||
try {
|
ctx.clip('evenodd');
|
||||||
ctx.clip('evenodd');
|
|
||||||
} catch (ex) {
|
|
||||||
// shouldn't really happen, but browsers might think differently
|
|
||||||
ctx.clip();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ctx.clip();
|
ctx.clip();
|
||||||
|
@ -522,9 +522,9 @@ if (typeof PDFJS === 'undefined') {
|
|||||||
|
|
||||||
if (polyfill) {
|
if (polyfill) {
|
||||||
var contextPrototype = window.CanvasRenderingContext2D.prototype;
|
var contextPrototype = window.CanvasRenderingContext2D.prototype;
|
||||||
contextPrototype._createImageData = contextPrototype.createImageData;
|
var createImageData = contextPrototype.createImageData;
|
||||||
contextPrototype.createImageData = function(w, h) {
|
contextPrototype.createImageData = function(w, h) {
|
||||||
var imageData = this._createImageData(w, h);
|
var imageData = createImageData.call(this, w, h);
|
||||||
imageData.data.set = function(arr) {
|
imageData.data.set = function(arr) {
|
||||||
for (var i = 0, ii = this.length; i < ii; i++) {
|
for (var i = 0, ii = this.length; i < ii; i++) {
|
||||||
this[i] = arr[i];
|
this[i] = arr[i];
|
||||||
@ -532,6 +532,8 @@ if (typeof PDFJS === 'undefined') {
|
|||||||
};
|
};
|
||||||
return imageData;
|
return imageData;
|
||||||
};
|
};
|
||||||
|
// this closure will be kept referenced, so clear its vars
|
||||||
|
contextPrototype = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user