summaryrefslogtreecommitdiff
path: root/vcl/opengl/win
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-11-10 04:05:32 +0100
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-11-10 07:59:56 +0100
commitce8e2735dd2a3eb925209ba4cdfc3eba8a62cf9f (patch)
treed4113a193cffe81132b82dd51d8848264de14064 /vcl/opengl/win
parenta46b3da152f0de02486d01eefd744e4d4f376ea9 (diff)
add code for getting device width and height on window devices
Change-Id: Ib1b84745cd1211a5194da78d83646ade4b01e72a
Diffstat (limited to 'vcl/opengl/win')
-rw-r--r--vcl/opengl/win/gdiimpl.cxx39
1 files changed, 38 insertions, 1 deletions
diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx
index 17868c8594a4..e829ca445f42 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;
}