Bug 924679. Part 2: Create static gfxXlibSurface::GetColormapAndVisual so it can be used without a gfxXlibSurface. r=karlt

--HG--
extra : rebase_source : 10599d49077114cd214ceafd811bfea3135bb9ff
This commit is contained in:
Robert O'Callahan 2013-10-25 23:25:40 +02:00
parent 6ce0733df8
commit a04236ab2b
2 changed files with 16 additions and 7 deletions

View File

@ -401,19 +401,27 @@ DisplayTable::DisplayClosing(Display *display, XExtCodes* codes)
return 0;
}
/* static */
bool
gfxXlibSurface::GetColormapAndVisual(cairo_surface_t* aXlibSurface,
Colormap* aColormap, Visual** aVisual)
{
XRenderPictFormat* format =
cairo_xlib_surface_get_xrender_format(aXlibSurface);
Screen* screen = cairo_xlib_surface_get_screen(aXlibSurface);
Visual* visual = cairo_xlib_surface_get_visual(aXlibSurface);
return DisplayTable::GetColormapAndVisual(screen, format, visual,
aColormap, aVisual);
}
bool
gfxXlibSurface::GetColormapAndVisual(Colormap* aColormap, Visual** aVisual)
{
if (!mSurfaceValid)
return false;
XRenderPictFormat* format =
cairo_xlib_surface_get_xrender_format(CairoSurface());
Screen* screen = cairo_xlib_surface_get_screen(CairoSurface());
Visual* visual = cairo_xlib_surface_get_visual(CairoSurface());
return DisplayTable::GetColormapAndVisual(screen, format, visual,
aColormap, aVisual);
return GetColormapAndVisual(CairoSurface(), aColormap, aVisual);
}
/* static */

View File

@ -61,6 +61,7 @@ public:
static int DepthOfVisual(const Screen* screen, const Visual* visual);
static Visual* FindVisual(Screen* screen, gfxImageFormat format);
static XRenderPictFormat *FindRenderFormat(Display *dpy, gfxImageFormat format);
static bool GetColormapAndVisual(cairo_surface_t* aXlibSurface, Colormap* colormap, Visual **visual);
// take ownership of a passed-in Pixmap, calling XFreePixmap on it
// when the gfxXlibSurface is destroyed.