Fixed double buffering for QT widget
authorromashin
Sat, 19 Apr 2008 18:39:14 +0300
changeset 16815 434741bdff4484597625a694cf7182e0e99ec16c
parent 16814 4271f564b62012177ae654bd582369e2b691d529
child 16816 c3a396a7a0c2f370d3de1f8dd831a700bae8a0cf
push id1298
push userpavlov@mozilla.com
push dateSun, 17 Aug 2008 05:03:09 +0000
treeherderautoland@4a506fa751d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone2.0a1pre
Fixed double buffering for QT widget
widget/src/qt/nsWindow.cpp
--- a/widget/src/qt/nsWindow.cpp
+++ b/widget/src/qt/nsWindow.cpp
@@ -1101,28 +1101,23 @@ nsWindow::OnExposeEvent(QPaintEvent *aEv
     } else {
 #ifdef MOZ_ENABLE_GLITZ
         ctx->PushGroup(gfxASurface::CONTENT_COLOR);
 #else // MOZ_ENABLE_GLITZ
         // Instead of just doing PushGroup we're going to do a little dance
         // to ensure that GDK creates the pixmap, so it doesn't go all
         // XGetGeometry on us in gdk_pixmap_foreign_new_for_display when we
         // paint native themes
-        // GdkDrawable* d = Qt::Key_DRAWABLE(mDrawingarea->inner_window);
-        // qint32 depth = gdk_drawable_get_depth(d);
-        // bufferPixmap = new QPixmap(d, boundsRect.width, boundsRect.height);
-
+
+        bufferPixmap = new QPixmap(boundsRect.width, boundsRect.height);
         if (bufferPixmap) {
-#if 0
-            GdkVisual* visual = gdk_drawable_get_visual(Qt::Key_DRAWABLE(bufferPixmap));
-            Visual* XVisual = gdk_x11_visual_get_xvisual(visual);
-            Display* display = gdk_x11_drawable_get_xdisplay(Qt::Key_DRAWABLE(bufferPixmap));
-            Drawable drawable = gdk_x11_drawable_get_xid(Qt::Key_DRAWABLE(bufferPixmap));
             bufferPixmapSurface =
-                new gfxXlibSurface(display, drawable, XVisual,
+                new gfxXlibSurface(bufferPixmap->x11Info().display(),
+                                   bufferPixmap->handle(),
+                                   static_cast<Visual*>(bufferPixmap->x11Info().visual()),
                                    gfxIntSize(boundsRect.width, boundsRect.height));
             if (bufferPixmapSurface) {
                 bufferPixmapSurface->SetDeviceOffset(gfxPoint(-boundsRect.x, -boundsRect.y));
                 nsCOMPtr<nsIRenderingContext> newRC;
                 nsresult rv = GetDeviceContext()->
                     CreateRenderingContextInstance(*getter_AddRefs(newRC));
                 if (NS_FAILED(rv)) {
                     bufferPixmapSurface = nsnull;
@@ -1130,18 +1125,18 @@ nsWindow::OnExposeEvent(QPaintEvent *aEv
                     rv = newRC->Init(GetDeviceContext(), bufferPixmapSurface);
                     if (NS_FAILED(rv)) {
                         bufferPixmapSurface = nsnull;
                     } else {
                         rc = newRC;
                     }
                 }
             }
-#endif
         }
+
 #endif // MOZ_ENABLE_GLITZ
     }
 
 #if 0
     // NOTE: Paint flashing region would be wrong for cairo, since
     // cairo inflates the update region, etc.  So don't paint flash
     // for cairo.
 #ifdef DEBUG