vcl/inc/unx/salgdi.h | 4 +++ vcl/unx/generic/gdi/salgdi.cxx | 17 +++++++++++++++ vcl/unx/generic/gdi/x11cairotextrender.cxx | 31 +---------------------------- 3 files changed, 23 insertions(+), 29 deletions(-)
New commits: commit 5a8ec16bf5b51af826ed98644021cd2290747f6f Author: Caolán McNamara <caol...@redhat.com> Date: Mon Feb 1 12:38:52 2016 +0000 move getCairoContext from X11CairoTextRender to X11SalGraphics and simplify a little bit Change-Id: I5a2faeb7e22ee5a0eaa4f05bc73fd92cbe2f5083 diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index d2cee20..697a7ca 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -283,6 +283,10 @@ public: */ void YieldGraphicsExpose(); + cairo_t* getCairoContext(); + void releaseCairoContext(cairo_t* cr); + + // do XCopyArea or XGet/PutImage depending on screen numbers // signature is like XCopyArea with screen numbers added static void CopyScreenArea( diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index fc8554b..7bc1719 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -64,6 +64,7 @@ #include "xrender_peer.hxx" #include "cairo_cairo.hxx" #include "cairo_xlib_cairo.hxx" +#include <cairo-xlib.h> #include <vcl/opengl/OpenGLHelper.hxx> @@ -564,4 +565,20 @@ SalGeometryProvider *X11SalGraphics::GetGeometryProvider() const return static_cast< SalGeometryProvider * >(m_pVDev); } +cairo_t* X11SalGraphics::getCairoContext() +{ + cairo_surface_t* surface = cairo_xlib_surface_create(GetXDisplay(), hDrawable_, + GetVisual().visual, SAL_MAX_INT16, SAL_MAX_INT16); + + cairo_t *cr = cairo_create(surface); + cairo_surface_destroy(surface); + + return cr; +} + +void X11SalGraphics::releaseCairoContext(cairo_t* cr) +{ + cairo_destroy(cr); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/x11cairotextrender.cxx b/vcl/unx/generic/gdi/x11cairotextrender.cxx index 5a2b095..a3973c8 100644 --- a/vcl/unx/generic/gdi/x11cairotextrender.cxx +++ b/vcl/unx/generic/gdi/x11cairotextrender.cxx @@ -25,10 +25,6 @@ #include "gcach_xpeer.hxx" #include <cairo.h> -#include <cairo-ft.h> - -#include <cairo-xlib.h> -#include <cairo-xlib-xrender.h> struct BOX { @@ -58,30 +54,7 @@ GlyphCache& X11CairoTextRender::getPlatformGlyphCache() cairo_t* X11CairoTextRender::getCairoContext() { - // find a XRenderPictFormat compatible with the Drawable - XRenderPictFormat* pVisualFormat = mrParent.GetXRenderFormat(); - - Display* pDisplay = mrParent.GetXDisplay(); - - cairo_surface_t* surface = nullptr; - if (pVisualFormat) - { - surface = cairo_xlib_surface_create_with_xrender_format ( - pDisplay, mrParent.hDrawable_, - ScreenOfDisplay(pDisplay, mrParent.m_nXScreen.getXScreen()), - pVisualFormat, SAL_MAX_INT16, SAL_MAX_INT16); - } - else - { - surface = cairo_xlib_surface_create(pDisplay, mrParent.hDrawable_, - mrParent.GetVisual().visual, SAL_MAX_INT16, SAL_MAX_INT16); - } - - if (!surface) - return nullptr; - - cairo_t *cr = cairo_create(surface); - cairo_surface_destroy(surface); + cairo_t *cr = mrParent.getCairoContext(); //rhbz#1283420 bodge to draw and undraw something which has the side effect //of making the mysterious xrender related problem go away @@ -148,7 +121,7 @@ size_t X11CairoTextRender::GetHeight() const void X11CairoTextRender::releaseCairoContext(cairo_t* cr) { - cairo_destroy(cr); + mrParent.releaseCairoContext(cr); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits