aboutsummaryrefslogtreecommitdiff
path: root/src/library_browser.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/library_browser.js')
-rw-r--r--src/library_browser.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/library_browser.js b/src/library_browser.js
index 6b1e956d..5b19a360 100644
--- a/src/library_browser.js
+++ b/src/library_browser.js
@@ -68,6 +68,7 @@ mergeInto(LibraryManager.library, {
function getMimetype(name) {
return {
'jpg': 'image/jpeg',
+ 'jpeg': 'image/jpeg',
'png': 'image/png',
'bmp': 'image/bmp',
'ogg': 'audio/ogg',
@@ -81,7 +82,7 @@ mergeInto(LibraryManager.library, {
var imagePlugin = {};
imagePlugin['canHandle'] = function(name) {
- return !Module.noImageDecoding && name.substr(-4) in { '.jpg': 1, '.png': 1, '.bmp': 1 };
+ return !Module.noImageDecoding && /\.(jpg|jpeg|png|bmp)$/.exec(name);
};
imagePlugin['handle'] = function(byteArray, name, onload, onerror) {
var b = null;
@@ -200,8 +201,18 @@ mergeInto(LibraryManager.library, {
return null;
}
#endif
+ var ctx;
try {
- var ctx = canvas.getContext(useWebGL ? 'experimental-webgl' : '2d');
+ if (useWebGL) {
+ ctx = canvas.getContext('experimental-webgl', {
+ alpha: false,
+#if GL_TESTING
+ preserveDrawingBuffer: true
+#endif
+ });
+ } else {
+ ctx = canvas.getContext('2d');
+ }
if (!ctx) throw ':(';
} catch (e) {
Module.print('Could not create canvas - ' + e);
@@ -262,7 +273,7 @@ mergeInto(LibraryManager.library, {
}
return ctx;
},
-
+ destroyContext: function(canvas, useWebGL, setInModule) {},
requestFullScreen: function() {
var canvas = Module['canvas'];
function fullScreenChange() {