Commit fc73422d authored by Romain Courteaud's avatar Romain Courteaud

erp5_document_scanner: browser may fail to initialize the webgl context

parent ed2165f2
......@@ -4,7 +4,7 @@
FileReader, DataView, URL, fx, loadImage */
(function (rJS, RSVP, window, document, navigator, Cropper, Promise, JSON, jIO,
promiseEventListener, domsugar, createImageBitmap, FormData, caman,
FileReader, DataView, URL, fx) {
FileReader, DataView, URL, fx, loadImage) {
"use strict";
var CROPPER_DATA_JIO_KEY = 'cropperjs_data_',
......@@ -568,10 +568,13 @@
canvas = document.createElement('canvas');
webgl_context = canvas.getContext('webgl');
expected_width = Math.min(
expected_width || webgl_context.getParameter(webgl_context.MAX_TEXTURE_SIZE),
webgl_context.getParameter(webgl_context.MAX_TEXTURE_SIZE) - 1
);
if (webgl_context !== null) {
// Browser fails sometimes to initialize the webgl context
expected_width = Math.min(
expected_width || webgl_context.getParameter(webgl_context.MAX_TEXTURE_SIZE),
webgl_context.getParameter(webgl_context.MAX_TEXTURE_SIZE) - 1
);
}
if ((!!expected_width) && (expected_width < higher_dimension_value)) {
load_image_options[higher_dimension_key] = expected_width;
......@@ -1116,4 +1119,4 @@
}(rJS, RSVP, window, document, navigator, Cropper, Promise, JSON, jIO,
promiseEventListener, domsugar, createImageBitmap, FormData, Caman,
FileReader, DataView, URL, fx));
\ No newline at end of file
FileReader, DataView, URL, fx, loadImage));
\ No newline at end of file
......@@ -244,7 +244,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>986.32279.2119.1979</string> </value>
<value> <string>994.64153.48955.40226</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>1599642009.31</float>
<float>1632406703.55</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment