mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
Developing disable gpu on adreno
This commit is contained in:
@ -65,7 +65,8 @@ var AscBrowser = {
|
|||||||
isAndroidNativeApp : false,
|
isAndroidNativeApp : false,
|
||||||
safariVersion : 17004001,
|
safariVersion : 17004001,
|
||||||
isTelegramWebView : false,
|
isTelegramWebView : false,
|
||||||
maxTouchPoints : 0
|
maxTouchPoints : 0,
|
||||||
|
willReadFrequently : false
|
||||||
};
|
};
|
||||||
|
|
||||||
// user agent lower case
|
// user agent lower case
|
||||||
@ -270,6 +271,40 @@ var UI = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (AscBrowser.isChrome)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
let canvas = document.createElement("canvas");
|
||||||
|
let ctxGL = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
|
||||||
|
|
||||||
|
if (ctxGL)
|
||||||
|
{
|
||||||
|
let debugInfo = ctxGL.getExtension('WEBGL_debug_renderer_info');
|
||||||
|
if (debugInfo)
|
||||||
|
{
|
||||||
|
let renderer = ctxGL.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
|
||||||
|
if (renderer)
|
||||||
|
{
|
||||||
|
renderer = renderer.toLowerCase();
|
||||||
|
if (-1 !== renderer.indexOf("qualcomm") && -1 !== renderer.indexOf("adreno"))
|
||||||
|
AscBrowser.willReadFrequently = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AscBrowser.getContext2D = function(canvas)
|
||||||
|
{
|
||||||
|
if (AscBrowser.willReadFrequently)
|
||||||
|
return canvas.getContext('2d', { willReadFrequently: true });
|
||||||
|
return canvas.getContext('2d');
|
||||||
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------export----------------------------------------------------
|
//--------------------------------------------------------export----------------------------------------------------
|
||||||
window['AscCommon'] = window['AscCommon'] || {};
|
window['AscCommon'] = window['AscCommon'] || {};
|
||||||
window['AscCommon'].AscBrowser = AscBrowser;
|
window['AscCommon'].AscBrowser = AscBrowser;
|
||||||
|
|||||||
@ -274,7 +274,7 @@
|
|||||||
this.TempImage = document.createElement("canvas");
|
this.TempImage = document.createElement("canvas");
|
||||||
this.TempImage.width = w;
|
this.TempImage.width = w;
|
||||||
this.TempImage.height = h;
|
this.TempImage.height = h;
|
||||||
var ctxD = this.TempImage.getContext("2d");
|
var ctxD = AscCommon.AscBrowser.getContext2D(this.TempImage);
|
||||||
var pixDst = null;
|
var pixDst = null;
|
||||||
|
|
||||||
if (this.m_oCanvas != null)
|
if (this.m_oCanvas != null)
|
||||||
@ -375,7 +375,7 @@
|
|||||||
this.m_oCanvas.width = (width == 0) ? 1 : width;
|
this.m_oCanvas.width = (width == 0) ? 1 : width;
|
||||||
this.m_oCanvas.height = (height == 0) ? 1 : height;
|
this.m_oCanvas.height = (height == 0) ? 1 : height;
|
||||||
|
|
||||||
this.m_oContext = this.m_oCanvas.getContext('2d');
|
this.m_oContext = AscCommon.AscBrowser.getContext2D(this.m_oCanvas);
|
||||||
this.m_oContext.globalCompositeOperation = "source-in";
|
this.m_oContext.globalCompositeOperation = "source-in";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6679,7 +6679,7 @@ function CSlideDrawer()
|
|||||||
this.CachedCanvas.width = _need_pix_width + 100;
|
this.CachedCanvas.width = _need_pix_width + 100;
|
||||||
this.CachedCanvas.height = _need_pix_height + 100;
|
this.CachedCanvas.height = _need_pix_height + 100;
|
||||||
|
|
||||||
this.CachedCanvasCtx = this.CachedCanvas.getContext('2d');
|
this.CachedCanvasCtx = AscCommon.AscBrowser.getContext2D(this.CachedCanvas);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2497,9 +2497,7 @@
|
|||||||
if (null == canvas)
|
if (null == canvas)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var context = AscCommon.AscBrowser.getContext2D(canvas);
|
||||||
|
|
||||||
var context = canvas.getContext("2d");
|
|
||||||
var _width = canvas.width;
|
var _width = canvas.width;
|
||||||
var _height = canvas.height;
|
var _height = canvas.height;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user