Bug 924679. Part 2: Create static gfxXlibSurface::GetColormapAndVisual so it can be used without a gfxXlibSurface. r=karlt
authorRobert O'Callahan <robert@ocallahan.org>
Fri, 25 Oct 2013 23:25:40 +0200
changeset 152580 87b489625999c8107423a3c8d1bd48616e823847
parent 152579 f168034813bb589e9cdab93ea6750fd1c25c59f0
child 152581 28e1e608cfe3f3b440d13dc0513c6f6705c938fa
push id25552
push usercbook@mozilla.com
push dateTue, 29 Oct 2013 12:21:45 +0000
treeherdermozilla-central@cd94525c17a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs924679
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 924679. Part 2: Create static gfxXlibSurface::GetColormapAndVisual so it can be used without a gfxXlibSurface. r=karlt
gfx/thebes/gfxXlibSurface.cpp
gfx/thebes/gfxXlibSurface.h
--- a/gfx/thebes/gfxXlibSurface.cpp
+++ b/gfx/thebes/gfxXlibSurface.cpp
@@ -396,29 +396,37 @@ DisplayTable::DisplayClosing(Display *di
     sDisplayTable->mDisplays.RemoveElement(display, FindDisplay());
     if (sDisplayTable->mDisplays.Length() == 0) {
         delete sDisplayTable;
         sDisplayTable = nullptr;
     }
     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 */
 int
 gfxXlibSurface::DepthOfVisual(const Screen* screen, const Visual* visual)
 {
     for (int d = 0; d < screen->ndepths; d++) {
         const Depth& d_info = screen->depths[d];
--- a/gfx/thebes/gfxXlibSurface.h
+++ b/gfx/thebes/gfxXlibSurface.h
@@ -56,16 +56,17 @@ public:
     Display* XDisplay() { return mDisplay; }
     Screen* XScreen();
     Drawable XDrawable() { return mDrawable; }
     XRenderPictFormat* XRenderFormat();
 
     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.
     void TakePixmap();
 
     // Release ownership of this surface's Pixmap.  This is only valid
     // on gfxXlibSurfaces for which the user called TakePixmap(), or
     // on those created by a Create() factory method.