Add ability to fast track natively supported jpegs.

This commit is contained in:
Brendan Dahl 2011-12-08 21:18:04 -08:00
parent d1c823efce
commit 7d1cddf371
5 changed files with 59 additions and 23 deletions

View file

@ -1036,6 +1036,23 @@ var CanvasGraphics = (function canvasGraphics() {
this.restore();
},
paintJpegXObject: function canvasGraphicsPaintJpegXObject(objId, w, h) {
var domImage = this.objs.get(objId);
if (!domImage) {
error('Dependent image isn\'t ready yet');
}
this.save();
var ctx = this.ctx;
// scale the image to the unit square
ctx.scale(1 / w, -1 / h);
ctx.drawImage(domImage, 0, 0, domImage.width, domImage.height,
0, -h, w, h);
this.restore();
},
paintImageMaskXObject: function canvasGraphicsPaintImageMaskXObject(
imgArray, inverseDecode, width, height) {
function applyStencilMask(buffer, inverseDecode) {