[qt] Don't recreate the surface returned by nsWindow::ThebesSurface()
authorVladimir Vukicevic <vladimir@pobox.com>
Mon, 28 Apr 2008 18:16:45 -0700
changeset 16932 2542d268de514dc24678fab614041106bc433b36
parent 16931 f74614d3764c2eba178ece5b25cae4e558a43767
child 16933 3d7dd0ede4af2f4760b617a8a32703ee453e6a5a
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
[qt] Don't recreate the surface returned by nsWindow::ThebesSurface()
widget/src/qt/nsWindow.cpp
--- a/widget/src/qt/nsWindow.cpp
+++ b/widget/src/qt/nsWindow.cpp
@@ -2353,48 +2353,21 @@ nsWindow::createQWidget(QWidget *parent,
 
     return mDrawingArea;
 }
 
 // return the gfxASurface for rendering to this widget
 gfxASurface*
 nsWindow::GetThebesSurface()
 {
-    // XXXvlad always create a new thebes surface for now,
-    // because the old clip doesn't get cleared otherwise.
-    // we should fix this at some point, and just reset
-    // the clip.
-    mThebesSurface = nsnull;
-
-    if (!mThebesSurface) {
-#ifdef QT_XLIB_SURFACE
-        qint32 x_offset = 0, y_offset = 0;
-        qint32 width = mDrawingArea->width(), height = mDrawingArea->height();
-
-        // Owen Taylor says this is the right thing to do!
-        width = PR_MIN(32767, width);
-        height = PR_MIN(32767, height);
-
-        mThebesSurface = new gfxXlibSurface
-            (mDrawingArea->x11Info().display(),
-             (Drawable)mDrawingArea->handle(),
-             static_cast<Visual*>(mDrawingArea->x11Info().visual()),
-             gfxIntSize(width, height));
-        // if the surface creation is reporting an error, then
-        // we don't have a surface to give back
-        if (mThebesSurface && mThebesSurface->CairoStatus() != 0)
-            mThebesSurface = nsnull;
-
-        if (mThebesSurface) {
-            mThebesSurface->SetDeviceOffset(gfxPoint(-x_offset, -y_offset));
-        }
-#else
-        mThebesSurface = new gfxQPainterSurface(gfxIntSize(5,5), gfxASurface::CONTENT_COLOR_ALPHA);
-#endif
-    }
+    /* This is really a dummy surface; this is only used when doing reflow, because
+     * we need a RenderingContext to measure text against.
+     */
+    if (!mThebesSurface)
+        mThebesSurface = new gfxQPainterSurface(gfxIntSize(5,5), gfxASurface::CONTENT_COLOR);
 
     return mThebesSurface;
 }
 
 NS_IMETHODIMP
 nsWindow::BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical)
 {
     NS_ENSURE_ARG_POINTER(aEvent);