Kaydet (Commit) 5a8ec16b authored tarafından Caolán McNamara's avatar Caolán McNamara

move getCairoContext from X11CairoTextRender to X11SalGraphics

and simplify a little bit

Change-Id: I5a2faeb7e22ee5a0eaa4f05bc73fd92cbe2f5083
üst 1a1ee2f6
...@@ -283,6 +283,10 @@ public: ...@@ -283,6 +283,10 @@ public:
*/ */
void YieldGraphicsExpose(); void YieldGraphicsExpose();
cairo_t* getCairoContext();
void releaseCairoContext(cairo_t* cr);
// do XCopyArea or XGet/PutImage depending on screen numbers // do XCopyArea or XGet/PutImage depending on screen numbers
// signature is like XCopyArea with screen numbers added // signature is like XCopyArea with screen numbers added
static void CopyScreenArea( static void CopyScreenArea(
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#include "xrender_peer.hxx" #include "xrender_peer.hxx"
#include "cairo_cairo.hxx" #include "cairo_cairo.hxx"
#include "cairo_xlib_cairo.hxx" #include "cairo_xlib_cairo.hxx"
#include <cairo-xlib.h>
#include <vcl/opengl/OpenGLHelper.hxx> #include <vcl/opengl/OpenGLHelper.hxx>
...@@ -564,4 +565,20 @@ SalGeometryProvider *X11SalGraphics::GetGeometryProvider() const ...@@ -564,4 +565,20 @@ SalGeometryProvider *X11SalGraphics::GetGeometryProvider() const
return static_cast< SalGeometryProvider * >(m_pVDev); 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -25,10 +25,6 @@ ...@@ -25,10 +25,6 @@
#include "gcach_xpeer.hxx" #include "gcach_xpeer.hxx"
#include <cairo.h> #include <cairo.h>
#include <cairo-ft.h>
#include <cairo-xlib.h>
#include <cairo-xlib-xrender.h>
struct BOX struct BOX
{ {
...@@ -58,30 +54,7 @@ GlyphCache& X11CairoTextRender::getPlatformGlyphCache() ...@@ -58,30 +54,7 @@ GlyphCache& X11CairoTextRender::getPlatformGlyphCache()
cairo_t* X11CairoTextRender::getCairoContext() cairo_t* X11CairoTextRender::getCairoContext()
{ {
// find a XRenderPictFormat compatible with the Drawable cairo_t *cr = mrParent.getCairoContext();
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);
//rhbz#1283420 bodge to draw and undraw something which has the side effect //rhbz#1283420 bodge to draw and undraw something which has the side effect
//of making the mysterious xrender related problem go away //of making the mysterious xrender related problem go away
...@@ -148,7 +121,7 @@ size_t X11CairoTextRender::GetHeight() const ...@@ -148,7 +121,7 @@ size_t X11CairoTextRender::GetHeight() const
void X11CairoTextRender::releaseCairoContext(cairo_t* cr) void X11CairoTextRender::releaseCairoContext(cairo_t* cr)
{ {
cairo_destroy(cr); mrParent.releaseCairoContext(cr);
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment