From: Vincent Vanwaelscappel Date: Wed, 5 Apr 2023 17:59:11 +0000 (+0200) Subject: try #5568 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ce5021c4f11ec4d7c1f415bf15bec3bcb207ee75;p=fluidbook-html5.git try #5568 @1 --- diff --git a/js/libs/fluidbook/fluidbook.support.js b/js/libs/fluidbook/fluidbook.support.js index 24c93b55..5e323ef7 100644 --- a/js/libs/fluidbook/fluidbook.support.js +++ b/js/libs/fluidbook/fluidbook.support.js @@ -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; } }