No Bug - Fix Maemo/Qt bustage by only referencing GLXPixmap on GTK2. r=roc
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 05 Aug 2011 15:10:47 +1200
changeset 73893 062549aab2685b354dc0d90c82e9a9979fd1d58b
parent 73892 699b68990d54e6e7b657e4e4aff83d74e0a7709a
child 73894 6bcb177d3402b3def96bb7c46ca99c07a071dba1
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersroc
milestone8.0a1
No Bug - Fix Maemo/Qt bustage by only referencing GLXPixmap on GTK2. r=roc
gfx/thebes/gfxXlibSurface.cpp
gfx/thebes/gfxXlibSurface.h
--- a/gfx/thebes/gfxXlibSurface.cpp
+++ b/gfx/thebes/gfxXlibSurface.cpp
@@ -51,68 +51,81 @@
 using namespace mozilla;
 
 // Although the dimension parameters in the xCreatePixmapReq wire protocol are
 // 16-bit unsigned integers, the server's CreatePixmap returns BadAlloc if
 // either dimension cannot be represented by a 16-bit *signed* integer.
 #define XLIB_IMAGE_SIDE_SIZE_LIMIT 0x7fff
 
 gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual)
-    : mPixmapTaken(PR_FALSE), mDisplay(dpy), mDrawable(drawable), mGLXPixmap(None)
+    : mPixmapTaken(PR_FALSE), mDisplay(dpy), mDrawable(drawable)
+#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
+    , mGLXPixmap(None)
+#endif
 {
     DoSizeQuery();
     cairo_surface_t *surf = cairo_xlib_surface_create(dpy, drawable, visual, mSize.width, mSize.height);
     Init(surf);
 }
 
 gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual, const gfxIntSize& size)
-    : mPixmapTaken(PR_FALSE), mDisplay(dpy), mDrawable(drawable), mSize(size), mGLXPixmap(None)
+    : mPixmapTaken(PR_FALSE), mDisplay(dpy), mDrawable(drawable), mSize(size)
+#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
+    , mGLXPixmap(None)
+#endif
 {
     NS_ASSERTION(CheckSurfaceSize(size, XLIB_IMAGE_SIDE_SIZE_LIMIT),
                  "Bad size");
 
     cairo_surface_t *surf = cairo_xlib_surface_create(dpy, drawable, visual, mSize.width, mSize.height);
     Init(surf);
 }
 
 gfxXlibSurface::gfxXlibSurface(Screen *screen, Drawable drawable, XRenderPictFormat *format,
                                const gfxIntSize& size)
     : mPixmapTaken(PR_FALSE), mDisplay(DisplayOfScreen(screen)),
-      mDrawable(drawable), mSize(size), mGLXPixmap(None)
+      mDrawable(drawable), mSize(size)
+#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
+      , mGLXPixmap(None)
+#endif
 {
     NS_ASSERTION(CheckSurfaceSize(size, XLIB_IMAGE_SIDE_SIZE_LIMIT),
                  "Bad Size");
 
     cairo_surface_t *surf =
         cairo_xlib_surface_create_with_xrender_format(mDisplay, drawable,
                                                       screen, format,
                                                       mSize.width, mSize.height);
     Init(surf);
 }
 
 gfxXlibSurface::gfxXlibSurface(cairo_surface_t *csurf)
     : mPixmapTaken(PR_FALSE),
       mSize(cairo_xlib_surface_get_width(csurf),
-            cairo_xlib_surface_get_height(csurf)),
-      mGLXPixmap(None)
+            cairo_xlib_surface_get_height(csurf))
+#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
+      , mGLXPixmap(None)
+#endif
 {
     NS_PRECONDITION(cairo_surface_status(csurf) == 0,
                     "Not expecting an error surface");
 
     mDrawable = cairo_xlib_surface_get_drawable(csurf);
     mDisplay = cairo_xlib_surface_get_display(csurf);
 
     Init(csurf, PR_TRUE);
 }
 
 gfxXlibSurface::~gfxXlibSurface()
 {
+#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
     if (mGLXPixmap) {
         gl::sGLXLibrary.DestroyPixmap(mGLXPixmap);
     }
+#endif
     // gfxASurface's destructor calls RecordMemoryFreed().
     if (mPixmapTaken) {
         XFreePixmap (mDisplay, mDrawable);
     }
 }
 
 static Drawable
 CreatePixmap(Screen *screen, const gfxIntSize& size, unsigned int depth,
@@ -522,23 +535,24 @@ gfxXlibSurface::XScreen()
 }
 
 XRenderPictFormat*
 gfxXlibSurface::XRenderFormat()
 {
     return cairo_xlib_surface_get_xrender_format(CairoSurface());
 }
 
+#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
 GLXPixmap
 gfxXlibSurface::GetGLXPixmap()
 {
     if (!mGLXPixmap) {
         mGLXPixmap = gl::sGLXLibrary.CreatePixmap(this);
     }
     return mGLXPixmap;
 }
-
+#endif
 
 gfxASurface::MemoryLocation
 gfxXlibSurface::GetMemoryLocation() const
 {
     return MEMORY_OUT_OF_PROCESS;
 }
--- a/gfx/thebes/gfxXlibSurface.h
+++ b/gfx/thebes/gfxXlibSurface.h
@@ -39,17 +39,19 @@
 #ifndef GFX_XLIBSURFACE_H
 #define GFX_XLIBSURFACE_H
 
 #include "gfxASurface.h"
 
 #include <X11/extensions/Xrender.h>
 #include <X11/Xlib.h>
 
+#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
 #include "GLXLibrary.h"
+#endif
 
 class THEBES_API gfxXlibSurface : public gfxASurface {
 public:
     // construct a wrapper around the specified drawable with dpy/visual.
     // Will use XGetGeometry to query the window/pixmap size.
     gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual);
 
     // construct a wrapper around the specified drawable with dpy/visual,
@@ -101,25 +103,29 @@ public:
 
     // Find a visual and colormap pair suitable for rendering to this surface.
     PRBool GetColormapAndVisual(Colormap* colormap, Visual **visual);
 
     // This surface is a wrapper around X pixmaps, which are stored in the X
     // server, not the main application.
     virtual gfxASurface::MemoryLocation GetMemoryLocation() const;
 
+#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
     GLXPixmap GetGLXPixmap();
+#endif
 
 protected:
     // if TakePixmap() has been called on this
     PRBool mPixmapTaken;
     
     Display *mDisplay;
     Drawable mDrawable;
 
     void DoSizeQuery();
 
     gfxIntSize mSize;
 
+#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
     GLXPixmap mGLXPixmap;
+#endif
 };
 
 #endif /* GFX_XLIBSURFACE_H */