No Bug - Fix Maemo/Qt bustage by only referencing GLXPixmap on GTK2. r=roc

This commit is contained in:
Matt Woodrow 2011-08-05 15:10:47 +12:00
parent 7090baef12
commit ca6f9b4c50
2 changed files with 26 additions and 6 deletions

View File

@ -56,7 +56,10 @@ using namespace mozilla;
#define XLIB_IMAGE_SIDE_SIZE_LIMIT 0x7fff #define XLIB_IMAGE_SIDE_SIZE_LIMIT 0x7fff
gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual) 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(); DoSizeQuery();
cairo_surface_t *surf = cairo_xlib_surface_create(dpy, drawable, visual, mSize.width, mSize.height); cairo_surface_t *surf = cairo_xlib_surface_create(dpy, drawable, visual, mSize.width, mSize.height);
@ -64,7 +67,10 @@ gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual)
} }
gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual, const gfxIntSize& size) 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), NS_ASSERTION(CheckSurfaceSize(size, XLIB_IMAGE_SIDE_SIZE_LIMIT),
"Bad size"); "Bad size");
@ -76,7 +82,10 @@ gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual,
gfxXlibSurface::gfxXlibSurface(Screen *screen, Drawable drawable, XRenderPictFormat *format, gfxXlibSurface::gfxXlibSurface(Screen *screen, Drawable drawable, XRenderPictFormat *format,
const gfxIntSize& size) const gfxIntSize& size)
: mPixmapTaken(PR_FALSE), mDisplay(DisplayOfScreen(screen)), : 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), NS_ASSERTION(CheckSurfaceSize(size, XLIB_IMAGE_SIDE_SIZE_LIMIT),
"Bad Size"); "Bad Size");
@ -91,8 +100,10 @@ gfxXlibSurface::gfxXlibSurface(Screen *screen, Drawable drawable, XRenderPictFor
gfxXlibSurface::gfxXlibSurface(cairo_surface_t *csurf) gfxXlibSurface::gfxXlibSurface(cairo_surface_t *csurf)
: mPixmapTaken(PR_FALSE), : mPixmapTaken(PR_FALSE),
mSize(cairo_xlib_surface_get_width(csurf), mSize(cairo_xlib_surface_get_width(csurf),
cairo_xlib_surface_get_height(csurf)), cairo_xlib_surface_get_height(csurf))
mGLXPixmap(None) #if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
, mGLXPixmap(None)
#endif
{ {
NS_PRECONDITION(cairo_surface_status(csurf) == 0, NS_PRECONDITION(cairo_surface_status(csurf) == 0,
"Not expecting an error surface"); "Not expecting an error surface");
@ -105,9 +116,11 @@ gfxXlibSurface::gfxXlibSurface(cairo_surface_t *csurf)
gfxXlibSurface::~gfxXlibSurface() gfxXlibSurface::~gfxXlibSurface()
{ {
#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
if (mGLXPixmap) { if (mGLXPixmap) {
gl::sGLXLibrary.DestroyPixmap(mGLXPixmap); gl::sGLXLibrary.DestroyPixmap(mGLXPixmap);
} }
#endif
// gfxASurface's destructor calls RecordMemoryFreed(). // gfxASurface's destructor calls RecordMemoryFreed().
if (mPixmapTaken) { if (mPixmapTaken) {
XFreePixmap (mDisplay, mDrawable); XFreePixmap (mDisplay, mDrawable);
@ -527,6 +540,7 @@ gfxXlibSurface::XRenderFormat()
return cairo_xlib_surface_get_xrender_format(CairoSurface()); return cairo_xlib_surface_get_xrender_format(CairoSurface());
} }
#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
GLXPixmap GLXPixmap
gfxXlibSurface::GetGLXPixmap() gfxXlibSurface::GetGLXPixmap()
{ {
@ -535,7 +549,7 @@ gfxXlibSurface::GetGLXPixmap()
} }
return mGLXPixmap; return mGLXPixmap;
} }
#endif
gfxASurface::MemoryLocation gfxASurface::MemoryLocation
gfxXlibSurface::GetMemoryLocation() const gfxXlibSurface::GetMemoryLocation() const

View File

@ -44,7 +44,9 @@
#include <X11/extensions/Xrender.h> #include <X11/extensions/Xrender.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
#include "GLXLibrary.h" #include "GLXLibrary.h"
#endif
class THEBES_API gfxXlibSurface : public gfxASurface { class THEBES_API gfxXlibSurface : public gfxASurface {
public: public:
@ -106,7 +108,9 @@ public:
// server, not the main application. // server, not the main application.
virtual gfxASurface::MemoryLocation GetMemoryLocation() const; virtual gfxASurface::MemoryLocation GetMemoryLocation() const;
#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
GLXPixmap GetGLXPixmap(); GLXPixmap GetGLXPixmap();
#endif
protected: protected:
// if TakePixmap() has been called on this // if TakePixmap() has been called on this
@ -119,7 +123,9 @@ protected:
gfxIntSize mSize; gfxIntSize mSize;
#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
GLXPixmap mGLXPixmap; GLXPixmap mGLXPixmap;
#endif
}; };
#endif /* GFX_XLIBSURFACE_H */ #endif /* GFX_XLIBSURFACE_H */