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
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);
@ -64,7 +67,10 @@ gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual)
}
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");
@ -76,7 +82,10 @@ gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual,
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");
@ -91,8 +100,10 @@ gfxXlibSurface::gfxXlibSurface(Screen *screen, Drawable drawable, XRenderPictFor
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");
@ -105,9 +116,11 @@ gfxXlibSurface::gfxXlibSurface(cairo_surface_t *csurf)
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);
@ -527,6 +540,7 @@ gfxXlibSurface::XRenderFormat()
return cairo_xlib_surface_get_xrender_format(CairoSurface());
}
#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
GLXPixmap
gfxXlibSurface::GetGLXPixmap()
{
@ -535,7 +549,7 @@ gfxXlibSurface::GetGLXPixmap()
}
return mGLXPixmap;
}
#endif
gfxASurface::MemoryLocation
gfxXlibSurface::GetMemoryLocation() const

View File

@ -44,7 +44,9 @@
#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:
@ -106,7 +108,9 @@ public:
// 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
@ -119,7 +123,9 @@ protected:
gfxIntSize mSize;
#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
GLXPixmap mGLXPixmap;
#endif
};
#endif /* GFX_XLIBSURFACE_H */