1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Address Julian's comments.

This commit is contained in:
Brendan Dahl 2011-12-12 15:09:05 -08:00
parent fcd612e486
commit 94a48cab82
4 changed files with 18 additions and 9 deletions

View file

@ -84,17 +84,17 @@ var PDFImage = (function PDFImageClosure() {
*/
PDFImage.buildImage = function buildImage(callback, handler, xref, res,
image, inline) {
var promise = new Promise();
var imageDataPromise = new Promise();
var smaskPromise = new Promise();
var promises = [promise, smaskPromise];
// The image data and smask data may not be ready yet, wait till both are
// resolved.
Promise.all(promises).then(function(results) {
var image = new PDFImage(xref, res, results[0], inline, results[1]);
Promise.all([imageDataPromise, smaskPromise]).then(function(results) {
var imageData = results[0], smaskData = results[1];
var image = new PDFImage(xref, res, imageData, inline, smaskData);
callback(image);
});
handleImageData(handler, xref, res, image, promise);
handleImageData(handler, xref, res, image, imageDataPromise);
var smask = xref.fetchIfRef(image.dict.get('SMask'));
if (smask)