djvu get glyphs separately from paint

This commit is contained in:
Kulikova Svetlana
2021-07-30 18:27:49 +03:00
parent ef7281f362
commit 18a4775984
11 changed files with 323 additions and 218 deletions

View File

@ -377,6 +377,11 @@ window.onload = function()
return res;
};
this.getGlyphs = function(pageIndex, width, height)
{
this.file.getGlyphs(pageIndex, width, height);
};
this._paint = function()
{
if (!this.isRepaint)
@ -454,7 +459,10 @@ window.onload = function()
}
if (!page.Image)
{
page.Image = this.file.getPage(i, w, h);
this.getGlyphs(i, w, h);
}
let x = ((xCenter * this.retinaPixelRatio) >> 0) - (w >> 1);
let y = ((page.Y - yPos) * this.retinaPixelRatio) >> 0;

View File

@ -124,16 +124,18 @@
};
CFile.prototype.getPagePixmap = function(pageIndex, width, height)
{
var res = Module["_XPS_GetPixmap"](this.nativeFile, pageIndex, width, height);
var glyphs = Module["_DJVU_GetGlyphs"](this.nativeFile, pageIndex);
return Module["_XPS_GetPixmap"](this.nativeFile, pageIndex, width, height);
};
CFile.prototype.getGlyphs = function(pageIndex, width, height)
{
var glyphs = Module["_DJVU_GetGlyphs"](this.nativeFile, pageIndex, width, height);
if (glyphs == null)
return res;
return;
var lenArray = new Int32Array(Module["HEAP8"].buffer, glyphs, 4);
var len = lenArray[0];
len -= 4;
if (len <= 0)
return res;
return;
this.pages[pageIndex].Lines = [];
var buffer = new Uint8Array(Module["HEAP8"].buffer, glyphs + 4, len);
@ -174,8 +176,7 @@
this.pages[pageIndex].Lines[Line].Glyphs[0].Y = _Y + _H;
this.pages[pageIndex].Lines[Line].Glyphs[0].fontSize = _H;
}
return res;
Module["_XPS_Delete"](glyphs);
};
CFile.prototype.structure = function()
{