vcl/inc/opengl/contextprovider.hxx | 28 ---------------------------- vcl/inc/opengl/salbmp.hxx | 2 +- vcl/inc/salgdi.hxx | 4 ++++ vcl/inc/unx/salgdi.h | 2 +- vcl/opengl/salbmp.cxx | 23 ++++++----------------- vcl/opengl/texture.cxx | 8 -------- vcl/source/gdi/salgdilayout.cxx | 13 ++++++++++++- vcl/unx/generic/gdi/salgdi.cxx | 9 --------- 8 files changed, 24 insertions(+), 65 deletions(-)
New commits: commit a33aaf1c3f43725594448c76b072c3100a7d8dbf Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 18 09:17:01 2014 +0100 Revert "vcl: Fix crash when requesting coordonnates for empty texture" Not necessary any more. This reverts commit 2195500d40055a182c573da074e61ddf0a2b4d5a. diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx index 5afb611..938de54 100644 --- a/vcl/opengl/texture.cxx +++ b/vcl/opengl/texture.cxx @@ -173,14 +173,6 @@ int OpenGLTexture::GetHeight() const void OpenGLTexture::GetCoord( GLfloat* pCoord, const SalTwoRect& rPosAry, bool bInverted ) const { SAL_INFO( "vcl.opengl", "Getting coord " << Id() << " [" << maRect.Left() << "," << maRect.Top() << "] " << GetWidth() << "x" << GetHeight() ); - - if( mpImpl == NULL ) - { - pCoord[0] = pCoord[1] = pCoord[2] = pCoord[3] = 0.0f; - pCoord[4] = pCoord[5] = pCoord[6] = pCoord[7] = 0.0f; - return; - } - pCoord[0] = pCoord[2] = (maRect.Left() + rPosAry.mnSrcX) / (double) mpImpl->mnWidth; pCoord[4] = pCoord[6] = (maRect.Left() + rPosAry.mnSrcX + rPosAry.mnSrcWidth) / (double) mpImpl->mnWidth; commit d09f827b1d33ca001ebfa55bdecca1b3437e53ec Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 18 09:07:31 2014 +0100 windows opengl: Provide the context to textures everywhere where we have it. Change-Id: Ib820326fdc752d0893840bad3eb7f1369469f796 diff --git a/vcl/inc/opengl/contextprovider.hxx b/vcl/inc/opengl/contextprovider.hxx deleted file mode 100644 index 47eb98c..0000000 --- a/vcl/inc/opengl/contextprovider.hxx +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef INCLUDED_VCL_INC_OPENGL_CONTEXTPROVIDER_HXX -#define INCLUDED_VCL_INC_OPENGL_CONTEXTPROVIDER_HXX - -#include "vclpluginapi.h" - -#include <vcl/opengl/OpenGLContext.hxx> - -class VCLPLUG_GEN_PUBLIC OpenGLContextProvider -{ -public: - virtual ~OpenGLContextProvider() {}; - - /* Get the OpenGL context provided by this instance */ - virtual OpenGLContext* GetOpenGLContext() const = 0; -}; - -#endif // INCLUDED_VCL_INC_OPENGL_CONTEXTPROVIDER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/salbmp.hxx b/vcl/inc/opengl/salbmp.hxx index 98fc2fe..c862672 100644 --- a/vcl/inc/opengl/salbmp.hxx +++ b/vcl/inc/opengl/salbmp.hxx @@ -52,7 +52,7 @@ private: int mnBufHeight; std::deque< OpenGLSalBitmapOp* > maPendingOps; - bool makeCurrent(); + void makeCurrent(); public: OpenGLSalBitmap(); diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 4a567f5..95920a0 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -44,6 +44,7 @@ class SalLayout; class ImplLayoutArgs; class Rectangle; class FontSubsetInfo; +class OpenGLContext; class OutputDevice; class ServerFontLayout; struct SystemGraphicsData; @@ -85,6 +86,9 @@ public: virtual SalGraphicsImpl* GetImpl() const = 0; + /// Check that our mpImpl is OpenGL and return the context, otherwise NULL. + virtual OpenGLContext* GetOpenGLContext() const; + void setAntiAliasB2DDraw(bool bNew) { m_bAntiAliasB2DDraw = bNew; } bool getAntiAliasB2DDraw() const { return m_bAntiAliasB2DDraw; } diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index 6b0e2be..6bf4c04 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -62,7 +62,7 @@ namespace basegfx { class B2DTrapezoid; } -class VCLPLUG_GEN_PUBLIC X11SalGraphics : public SalGraphics, public OpenGLContextProvider +class VCLPLUG_GEN_PUBLIC X11SalGraphics : public SalGraphics { friend class ServerFontLayout; friend class X11SalGraphicsImpl; diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx index 78bcf07..c664d7e 100644 --- a/vcl/opengl/salbmp.cxx +++ b/vcl/opengl/salbmp.cxx @@ -27,7 +27,6 @@ #include "svdata.hxx" #include "salgdi.hxx" -#include "opengl/contextprovider.hxx" #include "opengl/salbmp.hxx" static bool isValidBitCount( sal_uInt16 nBitCount ) @@ -407,8 +406,7 @@ GLuint OpenGLSalBitmap::CreateTexture() } } - if( !makeCurrent() ) - return 0; + makeCurrent(); maTexture = OpenGLTexture (mnBufWidth, mnBufHeight, nFormat, nType, pData ); SAL_INFO( "vcl.opengl", "Created texture " << maTexture.Id() ); @@ -470,21 +468,13 @@ sal_uInt16 OpenGLSalBitmap::GetBitCount() const return mnBits; } -bool OpenGLSalBitmap::makeCurrent() +void OpenGLSalBitmap::makeCurrent() { if (!mpContext || !mpContext->isInitialized()) - { - OpenGLContextProvider *pProvider; - pProvider = dynamic_cast< OpenGLContextProvider* >( ImplGetDefaultWindow()->GetGraphics() ); - if( pProvider == NULL ) - { - SAL_WARN( "vcl.opengl", "Couldn't get default OpenGL context provider" ); - return false; - } - mpContext = pProvider->GetOpenGLContext(); - } + mpContext = ImplGetDefaultWindow()->GetGraphics()->GetOpenGLContext(); + + assert(mpContext && "Couldn't get default OpenGL context provider"); mpContext->makeCurrent(); - return true; } BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( bool /*bReadOnly*/ ) @@ -499,8 +489,7 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( bool /*bReadOnly*/ ) if( !maPendingOps.empty() ) { - if (!makeCurrent()) - return NULL; + makeCurrent(); SAL_INFO( "vcl.opengl", "** Creating texture and reading it back immediatly" ); if( !CreateTexture() || !AllocateUserData() || !ReadTexture() ) diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 599500b..da02043 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -27,11 +27,13 @@ #include <vcl/metaact.hxx> #include <vcl/gdimtf.hxx> #include <vcl/print.hxx> +#include <vcl/opengl/OpenGLContext.hxx> #include <vcl/outdev.hxx> #include <vcl/unowrap.hxx> #include <vcl/settings.hxx> #include <window.h> +#include <openglgdiimpl.hxx> #include <outdev.h> #include <sallayout.hxx> #include <salgdi.hxx> @@ -43,7 +45,7 @@ #include <boost/scoped_array.hpp> #include <boost/scoped_ptr.hpp> -#include "basegfx/polygon/b2dpolygon.hxx" +#include <basegfx/polygon/b2dpolygon.hxx> // The only common SalFrame method @@ -75,6 +77,15 @@ SalGraphics::~SalGraphics() { } +OpenGLContext* SalGraphics::GetOpenGLContext() const +{ + OpenGLSalGraphicsImpl *pImpl = dynamic_cast<OpenGLSalGraphicsImpl*>(GetImpl()); + if (pImpl) + return &pImpl->GetOpenGLContext(); + + return NULL; +} + bool SalGraphics::drawTransformedBitmap( const basegfx::B2DPoint& /* rNull */, const basegfx::B2DPoint& /* rX */, diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index fc2ca50..34df86d 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -172,15 +172,6 @@ void X11SalGraphics::DeInit() SetDrawable( None, m_nXScreen ); } -OpenGLContext* X11SalGraphics::GetOpenGLContext() const -{ - OpenGLSalGraphicsImpl *pImpl; - pImpl = dynamic_cast<OpenGLSalGraphicsImpl*>(mpImpl.get()); - if( pImpl ) - return &pImpl->GetOpenGLContext(); - return NULL; -} - void X11SalGraphics::SetClipRegion( GC pGC, Region pXReg ) const { Display *pDisplay = GetXDisplay(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits