cefsharp解決閃爍


CefSharp禁用GPU的命令行參數

其中,Major和Minor分別指代系統的主版本(大版本)、次版本(小版本)版本號。其中指定了Windows7系統會禁用 GPU。,突發奇想,是否windows8.1也是因為這個問題?然后開始驗證。

所以,經查閱,各系統的對應版本如下:

系統的主版本、次版本

 

1 Windows 10 -- 10.0* 2 Windows Server 2016 Technical Preview -- 10.0* 3 Windows 8.1 -- 6.3* 4 Windows Server 2012 R2 -- 6.3* 5 Windows 8 -- 6.2 6 Windows Server 2012 --6.2 7 Windows 7 -- 6.1 8 Windows Server 2008 R2 -- 6.1 9 Windows Server 2008 -- 610 Windows Vista -- 611 Windows Server 2003 R2 -- 5.212 Windows Server 2003 -- 5.213 Windows XP 64-Bit Edition -- 5.214 Windows XP -- 5.115 Windows 2000 -- 5

系統的主版本、次版本

如上圖得知,若判斷是否為Windows8.1系統,判斷osVersion.Version.Major == 6 && osVersion.Version.Minor == 3 即可,

但是不知源碼中 為何要判斷windows7的禁用GPU,在windows7下取消禁用GPU的測試,發現頁面並未閃爍。

但是為了安全起見,並且身邊沒有window8和其他的系統,所以決定,應用CefSharp的時候,配置CefCommandLineArgs進行了只判斷osVersion.Version.Major == 6的處理,即windows8.1、windows8、windows7等都禁用了GPU。

 

  var osVersion = Environment.OSVersion;
//Disable GPU for Windows 7          
  if (osVersion.Version.Major == 6 && osVersion.Version.Minor == 1)
{
// Disable GPU in WPF and Offscreen examples until #1634 has been resolved6                 
settings.CefCommandLineArgs.Add("disable-gpu", "1");
}       

 

 

var setting = new CefSharp.CefSettings();
setting.CefCommandLineArgs.Add("disable-gpu", "1"); // 禁用gpu

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM