[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl2' - 4 commits - solenv/gbuild vcl/inc vcl/source vcl/win

Jan Holesovsky kendy at collabora.com
Mon Nov 17 14:25:24 PST 2014


 solenv/gbuild/ExternalProject.mk    |    1 
 vcl/inc/win/saldata.hxx             |    2 
 vcl/source/opengl/OpenGLContext.cxx |   21 +++++++---
 vcl/source/opengl/OpenGLHelper.cxx  |    2 
 vcl/win/source/gdi/winlayout.cxx    |    8 +--
 vcl/win/source/window/salframe.cxx  |   73 ++++++++----------------------------
 6 files changed, 40 insertions(+), 67 deletions(-)

New commits:
commit 9368d7474263460e33d2047ffa9f6cc97f3b997d
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Nov 17 16:37:50 2014 +0100

    windows opengl: Use the updated DrawMask to get nice text with OpenGL.
    
    Change-Id: Ie4f08575848e76159af86d44e10f24fa383930fb

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 7f6fdc9..1d461e6 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -243,13 +243,11 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
             aRects.mnDestWidth = width;
             aRects.mnDestHeight = height;
 
-            pImpl->PreDraw();
             COLORREF color = GetTextColor(hDC);
             SalColor salColor = MAKE_SALCOLOR(GetRValue(color), GetGValue(color), GetBValue(color));
-            // TODO when we have it:
-            // pImpl->DrawSolidColorWithMask(salColor, aTexture, aRects);
-            // and kill the following interim thing:
-            pImpl->DrawTexture(aTexture, aRects);
+
+            pImpl->PreDraw();
+            pImpl->DrawMask(aTexture, salColor, aRects);
             pImpl->PostDraw();
         }
 
commit bb92f43374d09206151c9640811bc28dfb2d94e4
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Nov 17 12:29:56 2014 +0100

    windows: Improve logging.
    
    Change-Id: I15e6d240b3c94af07e9b39cc16efb581869729f2

diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx
index e1ae8cc..2c0731e 100644
--- a/vcl/inc/win/saldata.hxx
+++ b/vcl/inc/win/saldata.hxx
@@ -183,7 +183,7 @@ LRESULT CALLBACK SalFrameWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l
 void EmitTimerCallback();
 
 void SalTestMouseLeave();
-bool ImplWriteLastError( DWORD lastError, const char *szApiCall );
+void ImplWriteLastError(DWORD lastError, const char *szApiCall);
 
 long ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
 long ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam );
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index b803fd6..cc1264b 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -23,6 +23,10 @@
 #include <postmac.h>
 #endif
 
+#if defined( WNT )
+#include <win/saldata.hxx>
+#endif
+
 using namespace com::sun::star;
 
 #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
@@ -200,8 +204,6 @@ bool WGLisExtensionSupported(const char *extension)
         if ((p==supported || p[-1]==' ') && (p[extlen]=='\0' || p[extlen]==' '))
             return 1; // Match
     }
-
-    CHECK_GL_ERROR();
 }
 
 bool InitMultisample(PIXELFORMATDESCRIPTOR pfd, int& rPixelFormat,
@@ -767,7 +769,8 @@ bool OpenGLContext::init(HDC hDC, HWND hWnd)
 bool OpenGLContext::ImplInit()
 {
     SAL_INFO("vcl.opengl", "OpenGLContext::ImplInit----start");
-    PIXELFORMATDESCRIPTOR PixelFormatFront = // PixelFormat Tells Windows How We Want Things To Be
+    // PixelFormat tells Windows how we want things to be
+    PIXELFORMATDESCRIPTOR PixelFormatFront =
     {
         sizeof(PIXELFORMATDESCRIPTOR),
         1,                              // Version Number
@@ -815,17 +818,25 @@ bool OpenGLContext::ImplInit()
         return false;
     }
 
-    SetPixelFormat(m_aGLWin.hDC, WindowPix, &PixelFormatFront);
+    if (!SetPixelFormat(m_aGLWin.hDC, WindowPix, &PixelFormatFront))
+    {
+        ImplWriteLastError(GetLastError(), "SetPixelFormat in OpenGLContext::ImplInit");
+        SAL_WARN("vcl.opengl", "SetPixelFormat failed");
+        return false;
+    }
+
     m_aGLWin.hRC = wglCreateContext(m_aGLWin.hDC);
     if (m_aGLWin.hRC == NULL)
     {
+        ImplWriteLastError(GetLastError(), "wglCreateContext in OpenGLContext::ImplInit");
         SAL_WARN("vcl.opengl", "wglCreateContext failed");
         return false;
     }
 
     if (!wglMakeCurrent(m_aGLWin.hDC, m_aGLWin.hRC))
     {
-        SAL_WARN("vcl.opengl", "wglMakeCurrent failed: " << GetLastError());
+        ImplWriteLastError(GetLastError(), "wglMakeCurrent in OpenGLContext::ImplInit");
+        SAL_WARN("vcl.opengl", "wglMakeCurrent failed");
         return false;
     }
 
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index d42b0f5..d2fef8f 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -5974,64 +5974,27 @@ bool ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LR
     return bResult;
 }
 
-bool ImplWriteLastError( DWORD lastError, const char *szApiCall )
+void ImplWriteLastError(DWORD lastError, const char *szApiCall)
 {
-    static int first=1;
-    // if VCL_LOGFILE_ENABLED is set, Win32 API error messages can be written
-    // to %TMP%/vcl.log or %TEMP%/vcl.log
-    static char *logEnabled = getenv("VCL_LOGFILE_ENABLED");
-    if( logEnabled )
-    {
-        bool bSuccess = FALSE;
-        static char *szTmp = getenv("TMP");
-        if( !szTmp || !*szTmp )
-            szTmp = getenv("TEMP");
-        if( szTmp && *szTmp )
-        {
-            char fname[5000];
-            strcpy( fname, szTmp );
-            if( fname[strlen(fname) - 1] != '\\' )
-                strcat( fname, "\\");
-            strcat( fname, "vcl.log" );
-            FILE *fp = fopen( fname, "a" ); // always append
-            if( fp )
-            {
-                if( first )
-                {
-                    first = 0;
-                    fprintf( fp, "Process ID: %ld (0x%lx)\n", GetCurrentProcessId(), GetCurrentProcessId() );
-                }
-                time_t aclock;
-                time( &aclock );                           // Get time in seconds
-                struct tm *newtime = localtime( &aclock ); // Convert time to struct tm form
-                fprintf( fp, asctime( newtime ) );         // print time stamp
-
-                fprintf( fp, "%s returned %lu (0x%lx)\n", szApiCall, lastError, lastError );
-                bSuccess = TRUE;    // may be FormatMessage fails but we wrote at least the error code
-
-                LPVOID lpMsgBuf;
-                if (FormatMessageA(
-                    FORMAT_MESSAGE_ALLOCATE_BUFFER |
-                    FORMAT_MESSAGE_FROM_SYSTEM |
-                    FORMAT_MESSAGE_IGNORE_INSERTS,
-                    NULL,
-                    lastError,
-                    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
-                    (LPSTR) &lpMsgBuf,
-                    0,
-                    NULL ))
-                {
-                    fprintf( fp, " %s\n", (LPSTR)lpMsgBuf );
-                    LocalFree( lpMsgBuf );
-                }
-
-                fclose( fp );
-            }
-        }
-        return bSuccess;
+#if OSL_DEBUG_LEVEL > 0
+    LPVOID lpMsgBuf;
+    if (FormatMessageA(
+                FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                FORMAT_MESSAGE_FROM_SYSTEM |
+                FORMAT_MESSAGE_IGNORE_INSERTS,
+                NULL,
+                lastError & 0xffff,
+                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+                (LPTSTR) &lpMsgBuf,
+                0,
+                NULL ))
+    {
+        SAL_WARN("vcl", "API call: " << szApiCall << " returned " << lastError << " (0x" << std::hex << lastError << "): " << (LPTSTR) lpMsgBuf);
+        LocalFree(lpMsgBuf);
     }
     else
-        return TRUE;
+        SAL_WARN("vcl", "API call: " << szApiCall << " returned " << lastError << " (0x" << std::hex << lastError << ")");
+#endif
 }
 
 #ifdef _WIN32
commit 4c85f9a370e4dfc1ffde4f1b6a54c98a0d7ece79
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Nov 17 00:28:29 2014 +0100

    opengl: Do not check for OpenGL errors in a loop.
    
    Can lead to an infinite loop.
    
    Change-Id: I09863959719115aec23534ac72a9a9690af3aeb9

diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index fda89c3..6e2fe2c 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -353,7 +353,7 @@ float OpenGLHelper::getGLVersion()
 void OpenGLHelper::checkGLError(const char* pFile, size_t nLine)
 {
     GLenum glErr = glGetError();
-    while (glErr != GL_NO_ERROR)
+    if (glErr != GL_NO_ERROR)
     {
         const char* sError = OpenGLHelper::GLErrorString(glErr);
 
commit af85db1aa3468ccf17de72a661d10631df0736ee
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Sun Nov 16 00:11:38 2014 +0100

    windows: msbuild gets completely confused when the 'Platform' envvar is set.
    
    Change-Id: Iea04859c6afa203bd6b527b99c680ff4176cf9e1

diff --git a/solenv/gbuild/ExternalProject.mk b/solenv/gbuild/ExternalProject.mk
index aeb5379..59fc678 100644
--- a/solenv/gbuild/ExternalProject.mk
+++ b/solenv/gbuild/ExternalProject.mk
@@ -212,6 +212,7 @@ define gb_ExternalProject_run
 $(if $(findstring YES,$(UNPACKED_IS_BIN_TARBALL)),\
 	touch $@,
 $(call gb_Helper_print_on_error,cd $(EXTERNAL_WORKDIR)/$(3) && \
+	unset Platform && \
 	$(if $(WRAPPERS),export $(WRAPPERS) &&) \
 	$(if $(NMAKE),INCLUDE="$(gb_ExternalProject_INCLUDE)" LIB="$(ILIB)" MAKEFLAGS=) \
 	$(2) && touch $@,$(EXTERNAL_WORKDIR)/$(if $(3),$(3)/,)$(if $(4),$(4),$(1).log))


More information about the Libreoffice-commits mailing list