summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis-Francis Ratté-Boulianne <lfrb@collabora.com>2014-11-13 21:30:05 -0500
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-11-15 12:17:42 +0100
commitaa9dfcee5039246874809f1235835415b8eaa1a9 (patch)
tree5fdbe1eeaf493d849b3fabf4beafe18a005dad4c
parent9d2afa44fd783820c64d424632f4d96278382253 (diff)
vcl: Implement copyBits in the OpenGL backend
Change-Id: I101afd11394d3d024d38519afd61d700114702ac
-rw-r--r--vcl/inc/generic/genpspgraphics.h1
-rw-r--r--vcl/inc/headless/svpgdi.hxx1
-rw-r--r--vcl/inc/salgdi.hxx3
-rw-r--r--vcl/inc/unx/salgdi.h1
-rw-r--r--vcl/inc/win/salgdi.h1
-rw-r--r--vcl/opengl/gdiimpl.cxx19
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx5
-rw-r--r--vcl/win/source/gdi/salgdi.cxx5
8 files changed, 32 insertions, 4 deletions
diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h
index 882e475c1cd5..382a69300e41 100644
--- a/vcl/inc/generic/genpspgraphics.h
+++ b/vcl/inc/generic/genpspgraphics.h
@@ -71,6 +71,7 @@ public:
const psp::FastPrintFontInfo& );
// overload all pure virtual methods
+ virtual SalGraphicsImpl*GetImpl() const SAL_OVERRIDE { return NULL; };
virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) SAL_OVERRIDE;
virtual sal_uInt16 GetBitCount() const SAL_OVERRIDE;
virtual long GetGraphicsWidth() const SAL_OVERRIDE;
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 9f2604f073c5..4da3ffa1a59b 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -137,6 +137,7 @@ public:
SvpSalGraphics();
virtual ~SvpSalGraphics();
+ virtual SalGraphicsImpl* GetImpl() const SAL_OVERRIDE { return NULL; };
virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) SAL_OVERRIDE;
virtual sal_uInt16 GetBitCount() const SAL_OVERRIDE;
virtual long GetGraphicsWidth() const SAL_OVERRIDE;
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 24534508b6c1..4a567f5b7f57 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -29,6 +29,7 @@
#include <vcl/salnativewidgets.hxx>
#include <vcl/metric.hxx>
+#include "salgdiimpl.hxx"
#include "salglyphid.hxx"
#include "sallayout.hxx"
@@ -82,6 +83,8 @@ public:
SalGraphics();
virtual ~SalGraphics();
+ virtual SalGraphicsImpl* GetImpl() const = 0;
+
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 f14eab60f8ed..a09e026c6d2e 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -128,6 +128,7 @@ public:
void Init( class ImplSalPrinterData *pPrinter );
void DeInit();
+ SalGraphicsImpl* GetImpl() const SAL_OVERRIDE;
inline const SalDisplay* GetDisplay() const;
inline Display* GetXDisplay() const;
inline const SalVisual& GetVisual() const;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 82cfb387d734..74e8fe00e61d 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -203,6 +203,7 @@ public:
explicit WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hWnd);
virtual ~WinSalGraphics();
+ SalGraphicsImpl* GetImpl() const SAL_OVERRIDE;
bool isPrinter() const;
bool isVirtualDevice() const;
bool isWindow() const;
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 027d9ac61174..801130ffbb29 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -30,6 +30,7 @@
#include <basegfx/polygon/b2dtrapezoid.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
+#include "salgdi.hxx"
#include "opengl/salbmp.hxx"
#include <vector>
@@ -1082,13 +1083,13 @@ void OpenGLSalGraphicsImpl::copyArea(
// CopyBits and DrawBitmap --> RasterOp and ClipRegion
// CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
-void OpenGLSalGraphicsImpl::copyBits( const SalTwoRect& rPosAry, SalGraphics* /*pSrcGraphics*/ )
+void OpenGLSalGraphicsImpl::copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics )
{
- // TODO Check if SalGraphicsImpl is the same
- const bool bSameGraphics( false );
+ OpenGLSalGraphicsImpl *pImpl = pSrcGraphics ? dynamic_cast< OpenGLSalGraphicsImpl* >(pSrcGraphics->GetImpl()) : NULL;
SAL_INFO( "vcl.opengl", "::copyBits" );
- if( bSameGraphics &&
+
+ if( pImpl == this &&
(rPosAry.mnSrcWidth == rPosAry.mnDestWidth) &&
(rPosAry.mnSrcHeight == rPosAry.mnDestHeight))
{
@@ -1102,6 +1103,16 @@ void OpenGLSalGraphicsImpl::copyBits( const SalTwoRect& rPosAry, SalGraphics* /*
return;
}
+ if( pImpl->mbOffscreen )
+ {
+ Size aSize( pImpl->GetWidth(), pImpl->GetHeight() );
+ PreDraw();
+ DrawTexture( pImpl->maOffscreenTex, rPosAry );
+ PostDraw();
+ return;
+ }
+
+ SAL_WARN( "vcl.opengl", "*** NOT IMPLEMENTED *** copyBits" );
// TODO Copy from one FBO to the other (glBlitFramebuffer)
}
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 50ffdc6ade7f..fc2ca5080e6f 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -121,6 +121,11 @@ void X11SalGraphics::freeResources()
bFontGC_ = false;
}
+SalGraphicsImpl* X11SalGraphics::GetImpl() const
+{
+ return mpImpl.get();
+}
+
void X11SalGraphics::SetDrawable( Drawable aDrawable, SalX11Screen nXScreen )
{
// shortcut if nothing changed
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index 195d14cdd06b..c5f848c677de 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -615,6 +615,11 @@ WinSalGraphics::~WinSalGraphics()
delete [] mpFontKernPairs;
}
+SalGraphicsImpl* WinSalGraphics::GetImpl() const
+{
+ return mpImpl.get();
+}
+
bool WinSalGraphics::isPrinter() const
{
return mbPrinter;