diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-11-10 00:09:01 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-11-10 07:59:54 +0100 |
commit | eff8d971c97557691fd11540d1a5a366d225fb21 (patch) | |
tree | 7003119f09b07548f871e43b80296966216c04fe | |
parent | 9f8effdc74b4d74ce04d7c8971c91752d4a9a4cb (diff) |
implementation for OpenGL text rendering in the unx backend
Change-Id: Ib1246f361d5efd13a7e36d568641c6360495604d
-rw-r--r-- | vcl/Library_vclplug_gen.mk | 1 | ||||
-rw-r--r-- | vcl/inc/cairotextrender.hxx | 1 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/cairotextrender.cxx | 1 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salgdi.cxx | 8 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/x11cairotextrender.cxx | 33 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/x11cairotextrender.hxx | 13 |
6 files changed, 55 insertions, 2 deletions
diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk index bec6f4cdadf5..73e5d010e597 100644 --- a/vcl/Library_vclplug_gen.mk +++ b/vcl/Library_vclplug_gen.mk @@ -95,6 +95,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gen,\ vcl/unx/generic/gdi/gcach_xpeer \ vcl/unx/generic/gdi/gdiimpl \ vcl/unx/generic/gdi/pixmap \ + vcl/unx/generic/gdi/openglx11cairotextrender \ vcl/unx/generic/gdi/salbmp \ vcl/unx/generic/gdi/salgdi2 \ vcl/unx/generic/gdi/salgdi3 \ diff --git a/vcl/inc/cairotextrender.hxx b/vcl/inc/cairotextrender.hxx index 7bc0b2f7a36e..e5db2ab7e612 100644 --- a/vcl/inc/cairotextrender.hxx +++ b/vcl/inc/cairotextrender.hxx @@ -77,6 +77,7 @@ class CairoTextRender : public TextRenderImpl protected: virtual GlyphCache& getPlatformGlyphCache() = 0; virtual cairo_surface_t* getCairoSurface() = 0; + virtual void drawSurface(cairo_t* cr) = 0; bool setFont( const FontSelectPattern *pEntry, int nFallbackLevel ); diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index 5adbd87186da..5b31b92fd42a 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -341,6 +341,7 @@ void CairoTextRender::DrawServerFontLayout( const ServerFontLayout& rLayout ) aI = aNext; } + drawSurface(cr); cairo_destroy(cr); } diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index b4df486b78f4..47b20bc84d82 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -57,6 +57,7 @@ #include "gdiimpl.hxx" #include "opengl/x11/gdiimpl.hxx" #include "x11cairotextrender.hxx" +#include "openglx11cairotextrender.hxx" #include "generic/printergfx.hxx" #include "xrender_peer.hxx" @@ -66,7 +67,6 @@ #include <vcl/opengl/OpenGLHelper.hxx> X11SalGraphics::X11SalGraphics(): - mpTextRenderImpl(new X11CairoTextRender(false, *this)), m_pFrame(NULL), m_pVDev(NULL), m_pColormap(NULL), @@ -87,9 +87,15 @@ X11SalGraphics::X11SalGraphics(): static bool bOpenGLPossible = OpenGLHelper::supportsVCLOpenGL(); bool bUseOpenGL = bOpenGLPossible ? officecfg::Office::Common::VCL::UseOpenGL::get() : false; if (bUseOpenGL) + { mpImpl.reset(new X11OpenGLSalGraphicsImpl(*this)); + mpTextRenderImpl.reset((new OpenGLX11CairoTextRender(false, *this))); + } else + { + mpTextRenderImpl.reset((new X11CairoTextRender(false, *this))); mpImpl.reset(new X11SalGraphicsImpl(*this)); + } } diff --git a/vcl/unx/generic/gdi/x11cairotextrender.cxx b/vcl/unx/generic/gdi/x11cairotextrender.cxx index 3a21c390a357..2533107908c2 100644 --- a/vcl/unx/generic/gdi/x11cairotextrender.cxx +++ b/vcl/unx/generic/gdi/x11cairotextrender.cxx @@ -20,6 +20,7 @@ #include "x11cairotextrender.hxx" #include "unx/saldata.hxx" #include "unx/saldisp.hxx" +#include "unx/salvd.h" #include "gcach_xpeer.hxx" @@ -93,4 +94,36 @@ void X11CairoTextRender::clipRegion(cairo_t* cr) } } +size_t X11CairoTextRender::GetWidth() const +{ + if( mrParent.m_pFrame ) + return mrParent.m_pFrame->maGeometry.nWidth; + else if( mrParent.m_pVDev ) + { + long nWidth = 0; + long nHeight = 0; + mrParent.m_pVDev->GetSize( nWidth, nHeight ); + return nWidth; + } + return 1; +} + +size_t X11CairoTextRender::GetHeight() const +{ + if( mrParent.m_pFrame ) + return mrParent.m_pFrame->maGeometry.nHeight; + else if( mrParent.m_pVDev ) + { + long nWidth = 0; + long nHeight = 0; + mrParent.m_pVDev->GetSize( nWidth, nHeight ); + return nHeight; + } + return 1; +} + +void X11CairoTextRender::drawSurface(cairo_t* /*cr*/) +{ +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/x11cairotextrender.hxx b/vcl/unx/generic/gdi/x11cairotextrender.hxx index 99688d125f74..fb0c130ab292 100644 --- a/vcl/unx/generic/gdi/x11cairotextrender.hxx +++ b/vcl/unx/generic/gdi/x11cairotextrender.hxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#ifndef INCLUDED_VCL_UNX_GENERIC_GDI_X11CAIROTEXTRENDER_HXX +#define INCLUDED_VCL_UNX_GENERIC_GDI_X11CAIROTEXTRENDER_HXX value + #include "cairotextrender.hxx" #include "unx/saldata.hxx" @@ -26,14 +29,22 @@ class X11CairoTextRender : public CairoTextRender { -private: +protected: X11SalGraphics& mrParent; + +protected: + size_t GetWidth() const; + size_t GetHeight() const; + public: X11CairoTextRender(bool bPrinter, X11SalGraphics& rParent); virtual GlyphCache& getPlatformGlyphCache() SAL_OVERRIDE; virtual cairo_surface_t* getCairoSurface() SAL_OVERRIDE; virtual void clipRegion(cairo_t* cr) SAL_OVERRIDE; + virtual void drawSurface(cairo_t* cr) SAL_OVERRIDE; }; +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |