]> _ Git - fluidbook-html5.git/commitdiff
try #5568 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 5 Apr 2023 17:59:11 +0000 (19:59 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 5 Apr 2023 17:59:11 +0000 (19:59 +0200)
js/libs/fluidbook/fluidbook.support.js

index 24c93b55e2a1de080d9f01a59d6478748cfb943d..5e323ef7676cba30eee614c065fae4740d743a84 100644 (file)
@@ -14,7 +14,8 @@ function FluidbookSupport(fluidbook) {
     this.iOS = Modernizr.ios;
     this.edge = Modernizr.edge;
     this.chromeBased = Modernizr.chrome || this.edge;
-    this.svgtocanvas = this.fluidbook.settings.svgToCanvas && this.IE === 0 && !(this.safari && this.macOs);
+    this.gpuInfos = this.getGPUInfos();
+    this.svgtocanvas = this.fluidbook.settings.svgToCanvas && this.IE === 0 && !(this.safari && this.macOs) && this.getGPUInfos().vendor.indexOf('intel') === -1 && this.getGPUInfos().vendor.indexOf('renderer') === -1;
     this.svgtocanvg = false;// && this.svgtocanvas;
 
     // If in node-webkit or if the index.html fluidbook is locally open in a browser
@@ -168,14 +169,18 @@ FluidbookSupport.prototype = {
                 return transitions[t];
             }
         }
-    }, checkOrientation: function () {
+    },
+
+    checkOrientation: function () {
         var o = this.getOrientation();
         if (o != this._orientation) {
             this._orientation = o;
             $(this.fluidbook).trigger('fluidbook.orientationchange');
             resize();
         }
-    }, getOrientation: function () {
+    },
+
+    getOrientation: function () {
         try {
             if ((this.fluidbook.pad && this.fluidbook.pad.enabled) || this.fluidbook.mobilefirst.enabled) {
                 return 0;
@@ -194,5 +199,27 @@ FluidbookSupport.prototype = {
 
         }
         return $("#op").is(':visible') ? 0 : 90;
+    },
+
+    getGPUInfos: function () {
+        var canvas = document.createElement('canvas');
+        var gl;
+        var debugInfo;
+        var vendor;
+        var renderer;
+
+        try {
+            gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
+        } catch (e) {
+        }
+
+        if (gl) {
+            debugInfo = gl.getExtension('WEBGL_debug_renderer_info');
+            vendor = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
+            renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
+            return {vendor: vendor.toLowerCase(), renderer: renderer.toLowerCase()};
+        }
+
+        return false;
     }
 }