move getCairoContext from X11CairoTextRender to X11SalGraphics
and simplify a little bit Change-Id: I5a2faeb7e22ee5a0eaa4f05bc73fd92cbe2f5083
This commit is contained in:
@@ -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(
|
||||
|
@@ -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: */
|
||||
|
@@ -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: */
|
||||
|
Reference in New Issue
Block a user