Merge pull request #4286 from yurydelendik/webgl

WebGL and misc memory optimizations
This commit is contained in:
Brendan Dahl 2014-04-07 14:33:34 -07:00
commit ed1f8c33bd
14 changed files with 605 additions and 82 deletions

View file

@ -216,10 +216,20 @@ var PDFView = {
pageCountField: document.getElementById('pageCountField')
});
this.initialized = true;
container.addEventListener('scroll', function() {
self.lastScroll = Date.now();
}, false);
var initializedPromise = Promise.all([
Preferences.get('enableWebGL').then(function (value) {
PDFJS.disableWebGL = !value;
})
// TODO move more preferences and other async stuff here
]);
return initializedPromise.then(function () {
PDFView.initialized = true;
});
},
getPage: function pdfViewGetPage(n) {
@ -1660,8 +1670,10 @@ var DocumentOutlineView = function documentOutlineView(outline) {
//#endif
function webViewerLoad(evt) {
PDFView.initialize();
PDFView.initialize().then(webViewerInitialized);
}
function webViewerInitialized() {
//#if (GENERIC || B2G)
var params = PDFView.parseQueryString(document.location.search.substring(1));
var file = 'file' in params ? params.file : DEFAULT_URL;
@ -1719,6 +1731,10 @@ function webViewerLoad(evt) {
PDFJS.disableHistory = (hashParams['disableHistory'] === 'true');
}
if ('webgl' in hashParams) {
PDFJS.disableWebGL = (hashParams['webgl'] !== 'true');
}
if ('useOnlyCssZoom' in hashParams) {
USE_ONLY_CSS_ZOOM = (hashParams['useOnlyCssZoom'] === 'true');
}