Bug 435739 Poor performance of Firefox 3 with no X RENDER extension
authorGinn Chen <ginn.chen@sun.com>
Wed, 11 Jun 2008 18:29:21 +0800
changeset 15314 694a9a4d6dcf
parent 15313 85d738b45221
child 15315 1dbb84c9bf30
push id125
push userginn.chen@sun.com
push date2008-06-11 10:32 +0000
treeherdermozilla-central@694a9a4d6dcf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs435739
milestone1.9.1a1pre
Bug 435739 Poor performance of Firefox 3 with no X RENDER extension r=vladimir
gfx/thebes/src/gfxPlatformGtk.cpp
--- a/gfx/thebes/src/gfxPlatformGtk.cpp
+++ b/gfx/thebes/src/gfxPlatformGtk.cpp
@@ -140,64 +140,46 @@ gfxPlatformGtk::CreateOffscreenSurface(c
     if (!display)
         return nsnull;
 
     if (!UseGlitz()) {
         GdkPixmap* pixmap = nsnull;
         XRenderPictFormat* xrenderFormat =
             XRenderFindStandardFormat(display, xrenderFormatID);
 
-        if (!xrenderFormat) {
-            // We don't have Render; see if we can just create a pixmap
-            // of the requested depth.
-            GdkVisual* vis;
-
-            if (imageFormat == gfxASurface::ImageFormatRGB24) {
-                vis = gdk_rgb_get_visual();
-                if (vis->type == GDK_VISUAL_TRUE_COLOR)
-                    pixmap = gdk_pixmap_new(nsnull, size.width, size.height, vis->depth);
-            }
-
-            if (pixmap) {
-                gdk_drawable_set_colormap(GDK_DRAWABLE(pixmap), nsnull);
-                newSurface = new gfxXlibSurface(display,
-                                                GDK_PIXMAP_XID(GDK_DRAWABLE(pixmap)),
-                                                GDK_VISUAL_XVISUAL(vis),
-                                                size);
-            }
-        } else {
+        if (xrenderFormat) {
             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
-            newSurface->SetData(&cairo_gdk_pixmap_key,
-                                pixmap,
-                                do_gdk_pixmap_unref);
-        } else {
-            // something went wrong with the surface creation.  Ignore and let's fall back
-            // to image surfaces.
-            if (pixmap)
-                gdk_pixmap_unref(pixmap);
-            newSurface = nsnull;
+            if (newSurface && newSurface->CairoStatus() == 0) {
+                // set up the surface to auto-unref the gdk pixmap when
+                // the surface is released
+                newSurface->SetData(&cairo_gdk_pixmap_key,
+                                    pixmap,
+                                    do_gdk_pixmap_unref);
+            } else {
+                // something went wrong with the surface creation.
+                // Ignore and let's fall back to image surfaces.
+                if (pixmap)
+                    gdk_pixmap_unref(pixmap);
+                newSurface = nsnull;
+            }
         }
 
         if (!newSurface) {
-            // we couldn't create an xlib surface for whatever reason; fall back to
-            // image surface for the data.
+            // We don't have Render or we couldn't create an xlib surface for
+            // whatever reason; fall back to image surface for the data.
             newSurface = new gfxImageSurface(gfxIntSize(size.width, size.height), imageFormat);
         }
 
     } else {
 #ifdef MOZ_ENABLE_GLITZ
         glitz_drawable_format_t *gdformat = glitz_glx_find_pbuffer_format
             (display,
              gdk_x11_get_default_screen(),