[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - 13 commits - include/vcl vcl/inc vcl/opengl vcl/quartz vcl/source vcl/unx vcl/win vcl/workben
Caolán McNamara
caolanm at redhat.com
Tue Nov 11 01:08:51 PST 2014
include/vcl/opengl/OpenGLHelper.hxx | 5 +++++
vcl/inc/unx/pixmap.hxx | 1 +
vcl/opengl/gdiimpl.cxx | 2 +-
vcl/opengl/salbmp.cxx | 7 ++++++-
vcl/quartz/salbmp.cxx | 4 ++++
vcl/source/opengl/OpenGLHelper.cxx | 17 +++++++++++++++--
vcl/unx/generic/gdi/gdiimpl.cxx | 4 ++--
vcl/unx/generic/gdi/gdiimpl.hxx | 2 +-
vcl/unx/generic/gdi/pixmap.cxx | 7 ++++++-
vcl/unx/generic/gdi/salbmp.cxx | 5 +----
vcl/unx/generic/gdi/salgdi.cxx | 6 +-----
vcl/unx/generic/gdi/salgdi3.cxx | 2 --
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 4 ++--
vcl/win/source/gdi/salgdi.cxx | 4 +---
vcl/workben/icontest.cxx | 1 -
vcl/workben/outdevgrind.cxx | 9 +++++----
16 files changed, 51 insertions(+), 29 deletions(-)
New commits:
commit 421577a1cc1bda93bb372d4449239f321eb4959f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Nov 10 20:32:49 2014 +0000
only call XFreePixmap on pixmaps created via XCreatePixmap
not on those belonging to gdk shoe-horned in via
mpPixmap = GDK_PIXMAP_XID( mpGdkPixmap );
in GdkX11Pixmap::GdkX11Pixmap
This stops file->new->presentation crashing on second invocation
Change-Id: Iec673497f900b0ddabd439369b9ffe554800d425
diff --git a/vcl/inc/unx/pixmap.hxx b/vcl/inc/unx/pixmap.hxx
index 40bc11f..b65170f 100644
--- a/vcl/inc/unx/pixmap.hxx
+++ b/vcl/inc/unx/pixmap.hxx
@@ -36,6 +36,7 @@ protected:
Display* mpDisplay;
SalX11Screen mnScreen;
Pixmap mpPixmap;
+ bool mbDeletePixmap;
int mnWidth;
int mnHeight;
int mnDepth;
diff --git a/vcl/unx/generic/gdi/pixmap.cxx b/vcl/unx/generic/gdi/pixmap.cxx
index c30b9af..0440c46 100644
--- a/vcl/unx/generic/gdi/pixmap.cxx
+++ b/vcl/unx/generic/gdi/pixmap.cxx
@@ -13,6 +13,7 @@ X11Pixmap::X11Pixmap()
: mpDisplay( NULL )
, mnScreen( 0 )
, mpPixmap( 0 )
+, mbDeletePixmap( false )
, mnWidth( -1 )
, mnHeight( -1 )
, mnDepth( 0 )
@@ -22,6 +23,7 @@ X11Pixmap::X11Pixmap()
X11Pixmap::X11Pixmap( Display* pDisplay, SalX11Screen nScreen, int nWidth, int nHeight, int nDepth )
: mpDisplay( pDisplay )
, mnScreen( nScreen )
+, mbDeletePixmap( true )
, mnWidth( nWidth )
, mnHeight( nHeight )
, mnDepth( nDepth )
@@ -33,17 +35,19 @@ X11Pixmap::X11Pixmap( Display* pDisplay, SalX11Screen nScreen, int nWidth, int n
X11Pixmap::X11Pixmap( X11Pixmap& rOther )
: mpDisplay( rOther.mpDisplay )
, mnScreen( rOther.mnScreen )
+, mbDeletePixmap( rOther.mbDeletePixmap )
, mnWidth( rOther.mnWidth )
, mnHeight( rOther.mnHeight )
, mnDepth( rOther.mnDepth )
{
mpPixmap = rOther.mpPixmap;
rOther.mpPixmap = 0;
+ rOther.mbDeletePixmap = false;
}
X11Pixmap::~X11Pixmap()
{
- if( mpPixmap )
+ if (mbDeletePixmap && mpPixmap)
XFreePixmap( mpDisplay, mpPixmap );
}
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index b8db643..0cf68fd 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -290,7 +290,7 @@ GdkX11Pixmap::GdkX11Pixmap( int nWidth, int nHeight, int nDepth )
}
GdkX11Pixmap::GdkX11Pixmap( X11Pixmap& rOther, GdkWindow *pWindow )
-: X11Pixmap( rOther )
+ : X11Pixmap(rOther)
{
GdkColormap* pColormap;
commit 400f31f4965d9d5fb5bb0b17310cc20a6b173888
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Mon Nov 10 16:02:31 2014 +0000
vcl: cleanup the opengl selection API.
Change-Id: Icebf3c7d2911b27e29d2259b780a04048b293b3c
diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx
index d49f579..ee5a9f8 100644
--- a/include/vcl/opengl/OpenGLHelper.hxx
+++ b/include/vcl/opengl/OpenGLHelper.hxx
@@ -58,6 +58,11 @@ public:
*/
static bool supportsVCLOpenGL();
+ /**
+ * Returns true if VCL has OpenGL rendering enabled
+ */
+ static bool isVCLOpenGLEnabled();
+
#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID
static bool GetVisualInfo(Display* pDisplay, int nScreen, XVisualInfo& rVI);
static GLXFBConfig GetPixmapFBConfig( Display* pDisplay, bool& bInverted );
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index 5823b80..d9f445d 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -18,6 +18,7 @@
#include <boost/scoped_array.hpp>
#include <vcl/pngwrite.hxx>
#include <vcl/graph.hxx>
+#include <officecfg/Office/Common.hxx>
#include <vector>
@@ -360,8 +361,20 @@ void OpenGLHelper::checkGLError(const char* pFile, size_t nLine)
bool OpenGLHelper::supportsVCLOpenGL()
{
- static bool bDisableGL = !getenv("SAL_DISABLEGL");
- return bDisableGL;
+ static bool bDisableGL = !!getenv("SAL_DISABLEGL");
+
+ if (bDisableGL)
+ return false;
+ else
+ return true;
+}
+
+bool OpenGLHelper::isVCLOpenGLEnabled()
+{
+ if (!supportsVCLOpenGL())
+ return false;
+ bool bEnable = officecfg::Office::Common::VCL::UseOpenGL::get();
+ return bEnable;
}
#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index 6b2042c..f36795a 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -45,7 +45,6 @@
#include <opengl/salbmp.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
-#include <officecfg/Office/Common.hxx>
#if defined HAVE_VALGRIND_HEADERS
#include <valgrind/memcheck.h>
@@ -57,9 +56,7 @@
SalBitmap* X11SalInstance::CreateSalBitmap()
{
- static bool bOpenGLPossible = OpenGLHelper::supportsVCLOpenGL();
- bool bUseOpenGL = bOpenGLPossible ? officecfg::Office::Common::VCL::UseOpenGL::get() : false;
- if (bUseOpenGL)
+ if (OpenGLHelper::isVCLOpenGLEnabled())
return new OpenGLSalBitmap();
else
return new X11SalBitmap();
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 47b20bc..9609ec8 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -62,8 +62,6 @@
#include "generic/printergfx.hxx"
#include "xrender_peer.hxx"
-#include <officecfg/Office/Common.hxx>
-
#include <vcl/opengl/OpenGLHelper.hxx>
X11SalGraphics::X11SalGraphics():
@@ -84,9 +82,7 @@ X11SalGraphics::X11SalGraphics():
bPrinter_(false),
bVirDev_(false)
{
- static bool bOpenGLPossible = OpenGLHelper::supportsVCLOpenGL();
- bool bUseOpenGL = bOpenGLPossible ? officecfg::Office::Common::VCL::UseOpenGL::get() : false;
- if (bUseOpenGL)
+ if (OpenGLHelper::isVCLOpenGLEnabled())
{
mpImpl.reset(new X11OpenGLSalGraphicsImpl(*this));
mpTextRenderImpl.reset((new OpenGLX11CairoTextRender(false, *this)));
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index 4e3b76f..549a02f 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -589,9 +589,7 @@ WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hW
mbFontKernInit(false),
mnPenWidth(GSL_PEN_WIDTH)
{
- static bool bOpenGLPossible = OpenGLHelper::supportsVCLOpenGL();
- bool bUseOpenGL = bOpenGLPossible && mbWindow ? officecfg::Office::Common::VCL::UseOpenGL::get() : false;
- if (bUseOpenGL)
+ if (OpenGLHelper::isVCLOpenGLEnabled())
mpImpl.reset(new WinOpenGLSalGraphicsImpl(*this));
else
mpImpl.reset(new WinSalGraphicsImpl(*this));
commit c026a2c7df6d9b174f66bfa42e4046a4bb0271af
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Nov 10 15:58:03 2014 +0000
mpPixmap uninitialized in one ctor
Change-Id: Iffa82b96610dd1fe5900ca796af413a116d2dd28
diff --git a/vcl/unx/generic/gdi/pixmap.cxx b/vcl/unx/generic/gdi/pixmap.cxx
index beb5589..c30b9af 100644
--- a/vcl/unx/generic/gdi/pixmap.cxx
+++ b/vcl/unx/generic/gdi/pixmap.cxx
@@ -12,6 +12,7 @@
X11Pixmap::X11Pixmap()
: mpDisplay( NULL )
, mnScreen( 0 )
+, mpPixmap( 0 )
, mnWidth( -1 )
, mnHeight( -1 )
, mnDepth( 0 )
commit 4e3b9dc9c06bfcf2a8dee1693f20763e5f78c3bd
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Nov 10 14:15:14 2014 +0100
vcl: the docs say gdk_window_get_screen was added in GTK+ 2.24
Change-Id: Ib9b108c034181c0f94cbf86634447ba2d4afbaa5
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 50cb193..b8db643 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -294,7 +294,7 @@ GdkX11Pixmap::GdkX11Pixmap( X11Pixmap& rOther, GdkWindow *pWindow )
{
GdkColormap* pColormap;
-#if GTK_CHECK_VERSION(2,10,0)
+#if GTK_CHECK_VERSION(2,24,0)
GdkScreen *pScreen = gdk_window_get_screen( pWindow );
mpGdkPixmap = gdk_pixmap_foreign_new_for_screen( pScreen, mpPixmap,
mnWidth, mnHeight,
commit 59ea52db3e1911ec1d7e18036c0f444609751834
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Nov 10 09:41:24 2014 +0100
loplugin:staticcall
Change-Id: I33927305351b6e84721c11e3a1814266b41db8da
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index 0f210b3..4adea62 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -178,7 +178,7 @@ X11Pixmap* X11SalGraphicsImpl::GetPixmapFromScreen( const Rectangle& rRect )
}
// Copy the background of the screen into a composite pixmap
- mrParent.CopyScreenArea( mrParent.GetXDisplay(),
+ X11SalGraphics::CopyScreenArea( mrParent.GetXDisplay(),
mrParent.GetDrawable(), mrParent.GetScreenNumber(),
mrParent.GetVisual().GetDepth(),
pPixmap->GetDrawable(), pPixmap->GetScreen(),
@@ -206,7 +206,7 @@ bool X11SalGraphicsImpl::RenderPixmapToScreen( X11Pixmap* pPixmap, int nX, int n
if( !pPixmap )
return false;
- mrParent.CopyScreenArea( mrParent.GetXDisplay(),
+ X11SalGraphics::CopyScreenArea( mrParent.GetXDisplay(),
pPixmap->GetDrawable(), pPixmap->GetScreen(),
pPixmap->GetDepth(),
mrParent.GetDrawable(), mrParent.m_nXScreen,
commit d5b048e3599289c1846ffc1a312ac8dc9cefff91
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Nov 10 09:39:46 2014 +0100
loplugin:unreffun
Change-Id: Ia35c1b529d51882b48779d8e13afbe17ae66e937
diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx
index 3f47712..1809923 100644
--- a/vcl/unx/generic/gdi/salgdi3.cxx
+++ b/vcl/unx/generic/gdi/salgdi3.cxx
@@ -90,8 +90,6 @@ X11SalGraphics::GetFontGC()
return pFontGC_;
}
-ImplFontOptions* GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize);
-
void X11SalGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout )
{
mpTextRenderImpl->DrawServerFontLayout(rLayout);
commit 101d8b90a0a0c2c35643c3e9979c4a0b2da6c1de
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Nov 10 09:38:39 2014 +0100
-Werror,-Wheader-guard
Change-Id: I692d2011902f46d2ca48b4d1d0a2516026e5cae3
diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx
index e6bfa86..5b0062c 100644
--- a/vcl/unx/generic/gdi/gdiimpl.hxx
+++ b/vcl/unx/generic/gdi/gdiimpl.hxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCULDED_VCL_GENERIC_GDI_GDIIMPL_HXX
+#ifndef INCLUDED_VCL_GENERIC_GDI_GDIIMPL_HXX
#define INCLUDED_VCL_GENERIC_GDI_GDIIMPL_HXX
#include <prex.h>
commit 6c6402835b59d48b169265e0fccb5e9ef768328e
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Nov 10 09:37:10 2014 +0100
loplugin:unreffun
Change-Id: I230479415a4a822dda22e1795af56572a93cb802
diff --git a/vcl/workben/icontest.cxx b/vcl/workben/icontest.cxx
index 5c73b92..5dfea6c 100644
--- a/vcl/workben/icontest.cxx
+++ b/vcl/workben/icontest.cxx
@@ -147,7 +147,6 @@ private:
int nRet;
void DoItWithVcl(const OUString& sImageFile);
- void DoItWithOpenGL(const OUString& sImageFile);
};
void IconTestApp::Init()
commit 50bedbbbe30bdad6e77bb3308ee135574c1a332e
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Nov 10 09:36:13 2014 +0100
loplugin:saloverride
Change-Id: Id7de67480c6f8a31c7b7d6e560e6724fd09d8957
diff --git a/vcl/workben/outdevgrind.cxx b/vcl/workben/outdevgrind.cxx
index f857afe..cbcd1c5 100644
--- a/vcl/workben/outdevgrind.cxx
+++ b/vcl/workben/outdevgrind.cxx
@@ -57,8 +57,8 @@ namespace
class GrindApp : public Application
{
public:
- virtual int Main();
- virtual sal_uInt16 Exception( sal_uInt16 nError );
+ virtual int Main() SAL_OVERRIDE;
+ virtual sal_uInt16 Exception( sal_uInt16 nError ) SAL_OVERRIDE;
};
class TestWindow : public Dialog
@@ -73,7 +73,7 @@ class TestWindow : public Dialog
}
virtual ~TestWindow() {}
- virtual void Paint( const Rectangle& rRect );
+ virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
};
typedef boost::function1<void, OutputDevice*> functor_type;
commit 54b54778e8f193ae49c827b4e21f53d5d1119793
Author: Tor Lillqvist <tml at collabora.com>
Date: Mon Nov 10 09:37:19 2014 +0200
WaE: unused variable 'aString'
Change-Id: Ie548ad26b7bb2a8ced4e821296b44586aad4026a
diff --git a/vcl/workben/outdevgrind.cxx b/vcl/workben/outdevgrind.cxx
index 66763e0..f857afe 100644
--- a/vcl/workben/outdevgrind.cxx
+++ b/vcl/workben/outdevgrind.cxx
@@ -107,10 +107,11 @@ void setupMethodStubs( functor_vector_type& res )
aPoly3.Rotate( aPoly3.GetBoundRect().Center(),
900 );
- const OUString aString("This is a test");
const LineInfo aLineInfo(LINE_SOLID,5);
#ifdef FIXME_VDEV
+ const OUString aString("This is a test");
+
// unfortunately, VDevs have inaccessible copy constructors
static VirtualDevice aVDev;
static VirtualDevice aVDevBW(1);
commit be442e7d8a41703a5365d68abdc06789a114213c
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Mon Nov 10 08:17:51 2014 +0100
put these classes into an anonymous namespace
Change-Id: I29a30fcc8adab34fbe05a927d438c4e34d5c517b
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index d840c33..5a93aaa 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -220,6 +220,8 @@ bool OpenGLSalBitmap::AllocateUserData()
return maUserBuffer.get() != 0;
}
+namespace {
+
class ImplPixelFormat
{
protected:
@@ -311,6 +313,8 @@ ImplPixelFormat* ImplPixelFormat::GetFormat( sal_uInt16 nBits, const BitmapPalet
return 0;
}
+}
+
Size OpenGLSalBitmap::GetSize() const
{
std::deque< OpenGLSalBitmapOp* >::const_iterator it = maPendingOps.begin();
diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx
index c4cf2b0..0e64aa7 100644
--- a/vcl/quartz/salbmp.cxx
+++ b/vcl/quartz/salbmp.cxx
@@ -330,6 +330,8 @@ bool QuartzSalBitmap::AllocateUserData()
return maUserBuffer.get() != 0;
}
+namespace {
+
class ImplPixelFormat
{
protected:
@@ -536,6 +538,8 @@ ImplPixelFormat* ImplPixelFormat::GetFormat( sal_uInt16 nBits, const BitmapPalet
return 0;
}
+}
+
void QuartzSalBitmap::ConvertBitmapData( sal_uInt32 nWidth, sal_uInt32 nHeight,
sal_uInt16 nDestBits, sal_uInt32 nDestBytesPerRow, const BitmapPalette& rDestPalette, sal_uInt8* pDestData,
sal_uInt16 nSrcBits, sal_uInt32 nSrcBytesPerRow, const BitmapPalette& rSrcPalette, sal_uInt8* pSrcData )
commit ef3a757055780becca460f391fd1c88db7d0848d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Nov 10 08:16:38 2014 +0100
WaE: [-Wsometimes-uninitialized]
Change-Id: Ie51a67474631ecfb0b223bd2f5a63ae8bf363e42
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 97dca8b..d840c33 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -324,7 +324,8 @@ Size OpenGLSalBitmap::GetSize() const
GLuint OpenGLSalBitmap::CreateTexture()
{
- GLenum nFormat, nType;
+ GLenum nFormat = GL_RGBA;
+ GLenum nType = GL_UNSIGNED_BYTE;
sal_uInt8* pData( NULL );
bool bAllocated( false );
commit 1a617345569cb367419fe27e66de0e12d86917d5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Nov 10 08:13:31 2014 +0100
WaE implicit conversion of NULL constant to 'bool' [-Wnull-conversion]
Change-Id: I8f208d6c87275aa4a169c7c6ed219200617c5669
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 8c06769..85252ef 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -804,7 +804,7 @@ bool OpenGLSalGraphicsImpl::drawPolyPolygonBezier(
const SalPoint* const* /*pPtAry*/,
const sal_uInt8* const* /*pFlgAry*/ )
{
- return NULL;
+ return false;
}
// CopyArea --> No RasterOp, but ClipRegion
More information about the Libreoffice-commits
mailing list