Bug 1028825 - Get rid of the Thebes backed gfxContext in Android's nsWindow.cpp. r=Cwiiis
authorJonathan Watt <jwatt@jwatt.org>
Mon, 23 Jun 2014 16:33:23 +0100
changeset 190158 31bf8c4b3e19d65153fd4ee22ab2a18865b82f94
parent 190157 1566b80f6c2bfe87c71d596e138afbe2b0fa55f4
child 190159 c70a41a3fc2b7a2bc6a71a320354cea4e92fbb37
push id7411
push userkwierso@gmail.com
push dateTue, 24 Jun 2014 02:07:45 +0000
treeherderfx-team@cc4602e0c1d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCwiiis
bugs1028825
milestone33.0a1
Bug 1028825 - Get rid of the Thebes backed gfxContext in Android's nsWindow.cpp. r=Cwiiis
widget/android/nsWindow.cpp
widget/android/nsWindow.h
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -923,109 +923,16 @@ nsWindow::OnGlobalAndroidEvent(AndroidGe
             // a draw event now.
             if (!sCompositorPaused) {
                 win->RedrawAll();
             }
             break;
     }
 }
 
-bool
-nsWindow::DrawTo(gfxASurface *targetSurface)
-{
-    nsIntRect boundsRect(0, 0, mBounds.width, mBounds.height);
-    return DrawTo(targetSurface, boundsRect);
-}
-
-bool
-nsWindow::DrawTo(gfxASurface *targetSurface, const nsIntRect &invalidRect)
-{
-    mozilla::layers::RenderTraceScope trace("DrawTo", "717171");
-    if (!mIsVisible || !mWidgetListener || !GetLayerManager(nullptr))
-        return false;
-
-    nsRefPtr<nsWindow> kungFuDeathGrip(this);
-    nsIntRect boundsRect(0, 0, mBounds.width, mBounds.height);
-
-    // Figure out if any of our children cover this widget completely
-    int32_t coveringChildIndex = -1;
-    for (uint32_t i = 0; i < mChildren.Length(); ++i) {
-        if (mChildren[i]->mBounds.IsEmpty())
-            continue;
-
-        if (mChildren[i]->mBounds.Contains(boundsRect)) {
-            coveringChildIndex = int32_t(i);
-        }
-    }
-
-    // If we have no covering child, then we need to render this.
-    if (coveringChildIndex == -1) {
-        nsIntRegion region = invalidRect;
-
-        mWidgetListener->WillPaintWindow(this);
-
-        switch (GetLayerManager(nullptr)->GetBackendType()) {
-            case mozilla::layers::LayersBackend::LAYERS_BASIC: {
-
-                nsRefPtr<gfxContext> ctx = new gfxContext(targetSurface);
-
-                {
-                    mozilla::layers::RenderTraceScope trace2("Basic DrawTo", "727272");
-                    AutoLayerManagerSetup
-                      setupLayerManager(this, ctx, mozilla::layers::BufferMode::BUFFER_NONE);
-
-                    mWidgetListener->PaintWindow(this, region);
-                }
-                break;
-            }
-
-            case mozilla::layers::LayersBackend::LAYERS_CLIENT: {
-                mWidgetListener->PaintWindow(this, region);
-                break;
-            }
-
-            default:
-                NS_ERROR("Invalid layer manager");
-        }
-
-        mWidgetListener->DidPaintWindow();
-
-        // We had no covering child, so make sure we draw all the children,
-        // starting from index 0.
-        coveringChildIndex = 0;
-    }
-
-    gfxPoint offset;
-
-    if (targetSurface)
-        offset = targetSurface->GetDeviceOffset();
-
-    for (uint32_t i = coveringChildIndex; i < mChildren.Length(); ++i) {
-        if (mChildren[i]->mBounds.IsEmpty() ||
-            !mChildren[i]->mBounds.Intersects(boundsRect)) {
-            continue;
-        }
-
-        if (targetSurface)
-            targetSurface->SetDeviceOffset(offset + gfxPoint(mChildren[i]->mBounds.x,
-                                                             mChildren[i]->mBounds.y));
-
-        bool ok = mChildren[i]->DrawTo(targetSurface, invalidRect);
-
-        if (!ok) {
-            ALOG("nsWindow[%p]::DrawTo child %d[%p] returned FALSE!", (void*) this, i, (void*)mChildren[i]);
-        }
-    }
-
-    if (targetSurface)
-        targetSurface->SetDeviceOffset(offset);
-
-    return true;
-}
-
 void
 nsWindow::OnSizeChanged(const gfxIntSize& aSize)
 {
     ALOG("nsWindow: %p OnSizeChanged [%d %d]", (void*)this, aSize.width, aSize.height);
 
     mBounds.width = aSize.width;
     mBounds.height = aSize.height;
 
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -11,18 +11,16 @@
 #include "nsIIdleServiceInternal.h"
 #include "nsTArray.h"
 #include "AndroidJavaWrappers.h"
 #include "GeneratedJNIWrappers.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/TextRange.h"
 
-class gfxASurface;
-
 struct ANPEvent;
 
 namespace mozilla {
     class AndroidGeckoEvent;
 
     namespace layers {
         class CompositorParent;
         class CompositorChild;
@@ -163,18 +161,16 @@ public:
     /* RootLayerTreeId() can only be called when GetAPZCTreeManager() returns non-null */
     static uint64_t RootLayerTreeId();
 
     virtual bool WidgetPaintsBackground();
 
 protected:
     void BringToFront();
     nsWindow *FindTopLevel();
-    bool DrawTo(gfxASurface *targetSurface);
-    bool DrawTo(gfxASurface *targetSurface, const nsIntRect &aRect);
     bool IsTopLevel();
     void RemoveIMEComposition();
     void PostFlushIMEChanges();
     void FlushIMEChanges();
 
     // Call this function when the users activity is the direct cause of an
     // event (like a keypress or mouse click).
     void UserActivity();