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 @@ ...@@ -4,7 +4,7 @@
FileReader, DataView, URL, fx, loadImage */ FileReader, DataView, URL, fx, loadImage */
(function (rJS, RSVP, window, document, navigator, Cropper, Promise, JSON, jIO, (function (rJS, RSVP, window, document, navigator, Cropper, Promise, JSON, jIO,
promiseEventListener, domsugar, createImageBitmap, FormData, caman, promiseEventListener, domsugar, createImageBitmap, FormData, caman,
FileReader, DataView, URL, fx) { FileReader, DataView, URL, fx, loadImage) {
"use strict"; "use strict";
var CROPPER_DATA_JIO_KEY = 'cropperjs_data_', var CROPPER_DATA_JIO_KEY = 'cropperjs_data_',
...@@ -568,10 +568,13 @@ ...@@ -568,10 +568,13 @@
canvas = document.createElement('canvas'); canvas = document.createElement('canvas');
webgl_context = canvas.getContext('webgl'); webgl_context = canvas.getContext('webgl');
if (webgl_context !== null) {
// Browser fails sometimes to initialize the webgl context
expected_width = Math.min( expected_width = Math.min(
expected_width || webgl_context.getParameter(webgl_context.MAX_TEXTURE_SIZE), expected_width || webgl_context.getParameter(webgl_context.MAX_TEXTURE_SIZE),
webgl_context.getParameter(webgl_context.MAX_TEXTURE_SIZE) - 1 webgl_context.getParameter(webgl_context.MAX_TEXTURE_SIZE) - 1
); );
}
if ((!!expected_width) && (expected_width < higher_dimension_value)) { if ((!!expected_width) && (expected_width < higher_dimension_value)) {
load_image_options[higher_dimension_key] = expected_width; load_image_options[higher_dimension_key] = expected_width;
...@@ -1116,4 +1119,4 @@ ...@@ -1116,4 +1119,4 @@
}(rJS, RSVP, window, document, navigator, Cropper, Promise, JSON, jIO, }(rJS, RSVP, window, document, navigator, Cropper, Promise, JSON, jIO,
promiseEventListener, domsugar, createImageBitmap, FormData, Caman, promiseEventListener, domsugar, createImageBitmap, FormData, Caman,
FileReader, DataView, URL, fx)); FileReader, DataView, URL, fx, loadImage));
\ No newline at end of file \ No newline at end of file
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>986.32279.2119.1979</string> </value> <value> <string>994.64153.48955.40226</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1599642009.31</float> <float>1632406703.55</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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