[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - 2 commits - vcl/inc vcl/opengl vcl/win

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Nov 9 19:12:01 PST 2014


 vcl/inc/opengl/win/gdiimpl.hxx |    4 +++-
 vcl/opengl/win/gdiimpl.cxx     |   39 ++++++++++++++++++++++++++++++++++++++-
 vcl/win/source/gdi/salgdi.cxx  |    4 ++--
 3 files changed, 43 insertions(+), 4 deletions(-)

New commits:
commit ea6622bb5e1e300856e7bd7bb6d0a307252d4cf8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Nov 10 04:06:25 2014 +0100

    only use OpenGL for window devices for now
    
    That fixes the build problems that I have seen.
    
    Change-Id: Ida89aa153d73ce4e07e3f0e0499df567e4df5009

diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index d9d333d..4e3b76f 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -590,7 +590,7 @@ WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hW
     mnPenWidth(GSL_PEN_WIDTH)
 {
     static bool bOpenGLPossible = OpenGLHelper::supportsVCLOpenGL();
-    bool bUseOpenGL = bOpenGLPossible && !mbPrinter ? officecfg::Office::Common::VCL::UseOpenGL::get() : false;
+    bool bUseOpenGL = bOpenGLPossible && mbWindow ? officecfg::Office::Common::VCL::UseOpenGL::get() : false;
     if (bUseOpenGL)
         mpImpl.reset(new WinOpenGLSalGraphicsImpl(*this));
     else
commit 381ed248e18bbcbb078908d93ef33b6101bc8439
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Nov 10 04:05:32 2014 +0100

    add code for getting device width and height on window devices
    
    Change-Id: Ib1b84745cd1211a5194da78d83646ade4b01e72a

diff --git a/vcl/inc/opengl/win/gdiimpl.hxx b/vcl/inc/opengl/win/gdiimpl.hxx
index 0af7089..aa29dd9 100644
--- a/vcl/inc/opengl/win/gdiimpl.hxx
+++ b/vcl/inc/opengl/win/gdiimpl.hxx
@@ -13,13 +13,15 @@
 #include <vcl/dllapi.h>
 
 #include "openglgdiimpl.hxx"
+#include "win/salgdi.h"
 
 class WinOpenGLSalGraphicsImpl : public OpenGLSalGraphicsImpl
 {
 private:
+    WinSalGraphics& mrParent;
 
 public:
-    WinOpenGLSalGraphicsImpl();
+    WinOpenGLSalGraphicsImpl(WinSalGraphics& rGraphics);
 
 protected:
     virtual GLfloat GetWidth() const SAL_OVERRIDE;
diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx
index 17868c8..e829ca4 100644
--- a/vcl/opengl/win/gdiimpl.cxx
+++ b/vcl/opengl/win/gdiimpl.cxx
@@ -9,18 +9,55 @@
 
 #include "opengl/win/gdiimpl.hxx"
 
-WinOpenGLSalGraphicsImpl::WinOpenGLSalGraphicsImpl()
+#include <win/wincomp.hxx>
+#include <win/saldata.hxx>
+#include <win/salframe.h>
+
+WinOpenGLSalGraphicsImpl::WinOpenGLSalGraphicsImpl(WinSalGraphics& rGraphics):
+    mrParent(rGraphics)
 {
 }
 
 GLfloat WinOpenGLSalGraphicsImpl::GetWidth() const
 {
+    if( mrParent.gethWnd() && IsWindow( mrParent.gethWnd() ) )
+    {
+        WinSalFrame* pFrame = GetWindowPtr( mrParent.gethWnd() );
+        if( pFrame )
+        {
+            if( pFrame->maGeometry.nWidth )
+                return pFrame->maGeometry.nWidth;
+            else
+            {
+                // TODO: perhaps not needed, maGeometry should always be up-to-date
+                RECT aRect;
+                GetClientRect( mrParent.gethWnd(), &aRect );
+                return aRect.right;
+            }
+        }
+    }
 
     return 1;
 }
 
 GLfloat WinOpenGLSalGraphicsImpl::GetHeight() const
 {
+    if( mrParent.gethWnd() && IsWindow( mrParent.gethWnd() ) )
+    {
+        WinSalFrame* pFrame = GetWindowPtr( mrParent.gethWnd() );
+        if( pFrame )
+        {
+            if( pFrame->maGeometry.nHeight )
+                return pFrame->maGeometry.nHeight;
+            else
+            {
+                // TODO: perhaps not needed, maGeometry should always be up-to-date
+                RECT aRect;
+                GetClientRect( mrParent.gethWnd(), &aRect );
+                return aRect.bottom;
+            }
+        }
+    }
 
     return 1;
 }
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index 28394b5..d9d333d 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -592,7 +592,7 @@ WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hW
     static bool bOpenGLPossible = OpenGLHelper::supportsVCLOpenGL();
     bool bUseOpenGL = bOpenGLPossible && !mbPrinter ? officecfg::Office::Common::VCL::UseOpenGL::get() : false;
     if (bUseOpenGL)
-        mpImpl.reset(new WinOpenGLSalGraphicsImpl());
+        mpImpl.reset(new WinOpenGLSalGraphicsImpl(*this));
     else
         mpImpl.reset(new WinSalGraphicsImpl(*this));
 


More information about the Libreoffice-commits mailing list