skip cached objects and has consistent font ids

This commit is contained in:
Yury Delendik 2012-04-16 18:44:51 -05:00
parent b6edbb38c1
commit cff6c8db08
3 changed files with 10 additions and 5 deletions

View File

@ -489,6 +489,8 @@ var WorkerTransport = (function WorkerTransportClosure() {
messageHandler.on('obj', function transportObj(data) {
var id = data[0];
var type = data[1];
if (this.objs.hasData(id))
return;
switch (type) {
case 'JpegStream':

View File

@ -153,13 +153,14 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
font = xref.fetchIfRef(font) || fontRes.get(fontName);
assertWellFormed(isDict(font));
++self.objIdCounter;
if (!font.translated) {
font.translated = self.translateFont(font, xref, resources,
dependency);
if (font.translated) {
// keep track of each font we translated so the caller can
// load them asynchronously before calling display on a page
loadedName = 'font_' + uniquePrefix + (++self.objIdCounter);
loadedName = 'font_' + uniquePrefix + self.objIdCounter;
font.translated.properties.loadedName = loadedName;
font.loadedName = loadedName;

View File

@ -194,13 +194,15 @@ function nextPage(task, loadError) {
textLayer: textLayerBuilder,
viewport: viewport
};
page.render(renderContext).then(function() {
var completeRender = (function(error) {
page.destroy();
snapshotCurrentPage(task, false);
snapshotCurrentPage(task, error);
});
page.render(renderContext).then(function() {
completeRender(false);
},
function(error) {
page.destroy();
snapshotCurrentPage(task, 'render : ' + error);
completeRender('render : ' + error);
});
},
function(error) {