b=573319 no longer use GdkPixmaps in offscreen-surfaces as they were unusable without a GdkColormap r=jrmuizel

This commit is contained in:
Karl Tomlinson 2010-06-27 20:05:00 +12:00
Родитель b07884e197
Коммит c07e3281ea
2 изменённых файлов: 8 добавлений и 29 удалений

Просмотреть файл

@ -164,12 +164,6 @@ gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
gfxASurface::gfxImageFormat imageFormat)
{
nsRefPtr<gfxASurface> newSurface = nsnull;
PRBool sizeOk = PR_TRUE;
if (size.width >= GDK_PIXMAP_SIZE_MAX ||
size.height >= GDK_PIXMAP_SIZE_MAX)
sizeOk = PR_FALSE;
#ifdef MOZ_X11
// XXX we really need a different interface here, something that passes
// in more context, including the display and/or target surface type that
@ -178,7 +172,6 @@ gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
if (!display)
return nsnull;
GdkPixmap* pixmap = nsnull;
// try to optimize it for 16bpp default screen
if (gfxASurface::ImageFormatRGB24 == imageFormat
&& 16 == gdk_visual_get_system()->depth)
@ -187,37 +180,20 @@ gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
XRenderPictFormat* xrenderFormat =
gfxXlibSurface::FindRenderFormat(display, imageFormat);
if (xrenderFormat && sizeOk) {
pixmap = gdk_pixmap_new(nsnull, size.width, size.height,
xrenderFormat->depth);
if (pixmap) {
gdk_drawable_set_colormap(GDK_DRAWABLE(pixmap), nsnull);
newSurface = new gfxXlibSurface(display,
GDK_PIXMAP_XID(GDK_DRAWABLE(pixmap)),
xrenderFormat,
size);
}
if (newSurface && newSurface->CairoStatus() == 0) {
// set up the surface to auto-unref the gdk pixmap when
// the surface is released
SetGdkDrawable(newSurface, GDK_DRAWABLE(pixmap));
} else {
if (xrenderFormat) {
newSurface = new gfxXlibSurface(display, xrenderFormat, size);
if (newSurface && newSurface->CairoStatus() != 0) {
// something went wrong with the surface creation.
// Ignore and let's fall back to image surfaces.
newSurface = nsnull;
}
// always unref; SetGdkDrawable takes its own ref
if (pixmap)
g_object_unref(pixmap);
}
#endif
#ifdef MOZ_DFB
if (sizeOk)
if (size.width < GDK_PIXMAP_SIZE_MAX && size.height < GDK_PIXMAP_SIZE_MAX) {
newSurface = new gfxDirectFBSurface(size, imageFormat);
}
#endif

Просмотреть файл

@ -99,6 +99,9 @@ gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, XRenderPictForma
gfxXlibSurface::gfxXlibSurface(Display *dpy, XRenderPictFormat *format, const gfxIntSize& size)
: mPixmapTaken(PR_FALSE), mDisplay(dpy), mSize(size)
{
if (!CheckSurfaceSize(size, XLIB_IMAGE_SIDE_SIZE_LIMIT))
return;
mDrawable = (Drawable)XCreatePixmap(dpy,
RootWindow(dpy, DefaultScreen(dpy)),
mSize.width, mSize.height,