[Libreoffice-commits] core.git: Branch 'private/moggi/opengl-preparation' - 2 commits - vcl/opengl

Markus Mohrhard markus.mohrhard at googlemail.com
Thu Jun 4 19:42:15 PDT 2015


 vcl/opengl/win/WinDeviceInfo.cxx    |   26 ++++++++++++++++++++++++++
 vcl/opengl/win/blocklist_parser.cxx |   10 ++++++++--
 vcl/opengl/win/blocklist_parser.hxx |    1 +
 3 files changed, 35 insertions(+), 2 deletions(-)

New commits:
commit 756d7898166ebf40720d2f483ee17669e5841d63
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jun 5 04:40:21 2015 +0200

    finally enable the blacklist parser
    
    Change-Id: I8346872a3e5bc7443524e5039f66eea0d3d381cd

diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx
index 0479358..670d3c2 100644
--- a/vcl/opengl/win/WinDeviceInfo.cxx
+++ b/vcl/opengl/win/WinDeviceInfo.cxx
@@ -9,6 +9,8 @@
 
 #include "opengl/win/WinDeviceInfo.hxx"
 
+#include "blocklist_parser.hxx"
+
 #include <windows.h>
 #include <setupapi.h>
 #include <algorithm>
@@ -884,8 +886,32 @@ OUString WinOpenGLDeviceInfo::GetDeviceVendor(wgl::DeviceVendor id)
     return *mpDeviceVendors[id];
 }
 
+namespace {
+
+
+OUString getBlacklistFile()
+{
+    OUString url("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/user/config/opengl_blacklist_windows.xml");
+    rtl::Bootstrap::expandMacros(url);
+
+    return url;
+}
+
+
+}
+
 void WinOpenGLDeviceInfo::FillBlacklist()
 {
+    OUString aURL = getBlacklistFile();
+    WinBlocklistParser aParser(aURL, maDriverInfo);
+    try {
+        aParser.parse();
+    }
+    catch (...)
+    {
+        SAL_WARN("vcl.opengl.win", "error parsing blacklist");
+        maDriverInfo.clear();
+    }
 }
 
 
diff --git a/vcl/opengl/win/blocklist_parser.hxx b/vcl/opengl/win/blocklist_parser.hxx
index c34af0a..6f0142b 100644
--- a/vcl/opengl/win/blocklist_parser.hxx
+++ b/vcl/opengl/win/blocklist_parser.hxx
@@ -19,6 +19,7 @@ class InvalidFileException
 
 class WinBlocklistParser
 {
+public:
     WinBlocklistParser(const OUString& rURL, std::vector<wgl::DriverInfo>& rDriverList);
     void parse();
 
commit d82eaaec2e1cd4c2def22301b134ece27e93b283
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jun 5 04:39:29 2015 +0200

    fix a few bugs in blacklist parser
    
    Change-Id: Iaeaa568c24d6814bb696d040bef02470bd46e8e1

diff --git a/vcl/opengl/win/blocklist_parser.cxx b/vcl/opengl/win/blocklist_parser.cxx
index 83bf490..ef4771a 100644
--- a/vcl/opengl/win/blocklist_parser.cxx
+++ b/vcl/opengl/win/blocklist_parser.cxx
@@ -122,6 +122,10 @@ void WinBlocklistParser::handleDevice(wgl::DriverInfo& rDriver, xmlreader::XmlRe
     {
         rDriver.mbWhitelisted = true;
     }
+    else if (meBlockType == BlockType::BLACKLIST)
+    {
+        rDriver.mbWhitelisted = false;
+    }
     else if (meBlockType == BlockType::UNKNOWN)
     {
         throw InvalidFileException();
@@ -173,7 +177,8 @@ void WinBlocklistParser::handleDevice(wgl::DriverInfo& rDriver, xmlreader::XmlRe
         }
         else
         {
-            SAL_WARN("vcl.opengl.win", "unsupported attribute");
+            OString aAttrName(name.begin, name.length);
+            SAL_WARN("vcl.opengl.win", "unsupported attribute: " << aAttrName);
         }
     }
 
@@ -185,7 +190,7 @@ void WinBlocklistParser::handleDevice(wgl::DriverInfo& rDriver, xmlreader::XmlRe
         int nsId;
 
         xmlreader::XmlReader::Result res = rReader.nextItem(
-                xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
+                xmlreader::XmlReader::TEXT_NORMALIZED, &name, &nsId);
 
         if (res == xmlreader::XmlReader::RESULT_BEGIN)
         {
@@ -203,6 +208,7 @@ void WinBlocklistParser::handleDevice(wgl::DriverInfo& rDriver, xmlreader::XmlRe
                 if (!bSuccess || !name.equals("id"))
                     throw InvalidFileException();
 
+                name = rReader.getAttributeValue(false);
                 OString aDeviceId(name.begin, name.length);
                 rDriver.maDevices.push_back(OStringToOUString(aDeviceId, RTL_TEXTENCODING_UTF8));
             }


More information about the Libreoffice-commits mailing list