diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index 5368066c7178..e3e975939d6b 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -1743,15 +1743,9 @@ abstract public class GeckoApp * run experience, perhaps? */ mLayerController = new LayerController(this); - View v = mLayerController.getView(); - mPlaceholderLayerClient = new PlaceholderLayerClient(mLayerController, mLastViewport); - if (!mPlaceholderLayerClient.loadScreenshot()) { - // Instead of flickering the checkerboard, show a white screen until Gecko paints - v.setBackgroundColor(Color.WHITE); - } - mGeckoLayout.addView(v, 0); + mGeckoLayout.addView(mLayerController.getView(), 0); } mPluginContainer = (AbsoluteLayout) findViewById(R.id.plugin_container); diff --git a/mobile/android/base/gfx/GeckoLayerClient.java b/mobile/android/base/gfx/GeckoLayerClient.java index 4bfdc636bf90..eed593ebf961 100644 --- a/mobile/android/base/gfx/GeckoLayerClient.java +++ b/mobile/android/base/gfx/GeckoLayerClient.java @@ -367,7 +367,6 @@ public class GeckoLayerClient implements GeckoEventResponder, // a full viewport update, which is fine because if browser.js has somehow moved to // be out of sync with this first-paint viewport, then we force them back in sync. mLayerController.abortPanZoomAnimation(); - mLayerController.getView().setPaintState(LayerView.PAINT_BEFORE_FIRST); } } diff --git a/mobile/android/base/gfx/LayerRenderer.java b/mobile/android/base/gfx/LayerRenderer.java index 76718b1bb399..3d6249d74e24 100644 --- a/mobile/android/base/gfx/LayerRenderer.java +++ b/mobile/android/base/gfx/LayerRenderer.java @@ -680,16 +680,6 @@ public class LayerRenderer implements GLSurfaceView.Renderer { pixelBuffer.notify(); } } - - // Remove white screen once we've painted - if (mView.getPaintState() == LayerView.PAINT_BEFORE_FIRST) { - GeckoAppShell.getMainHandler().postAtFrontOfQueue(new Runnable() { - public void run() { - mView.setBackgroundColor(android.graphics.Color.TRANSPARENT); - } - }); - mView.setPaintState(LayerView.PAINT_AFTER_FIRST); - } } } } diff --git a/mobile/android/base/gfx/LayerView.java b/mobile/android/base/gfx/LayerView.java index 0a3501fd2d57..17367598a096 100644 --- a/mobile/android/base/gfx/LayerView.java +++ b/mobile/android/base/gfx/LayerView.java @@ -38,7 +38,6 @@ package org.mozilla.gecko.gfx; -import org.mozilla.gecko.GeckoAppShell; import org.mozilla.gecko.GeckoInputConnection; import org.mozilla.gecko.gfx.FloatSize; import org.mozilla.gecko.gfx.InputConnectionHandler; @@ -78,14 +77,6 @@ public class LayerView extends FlexibleGLSurfaceView { private static String LOGTAG = "GeckoLayerView"; /* List of events to be processed if the page does not prevent them. Should only be touched on the main thread */ private LinkedList mEventQueue = new LinkedList(); - /* Must be a PAINT_xxx constant */ - private int mPaintState = PAINT_NONE; - - /* Flags used to determine when to show the painted surface. The integer - * order must correspond to the order in which these states occur. */ - public static final int PAINT_NONE = 0; - public static final int PAINT_BEFORE_FIRST = 1; - public static final int PAINT_AFTER_FIRST = 2; public LayerView(Context context, LayerController controller) { @@ -246,17 +237,5 @@ public class LayerView extends FlexibleGLSurfaceView { public LayerRenderer getLayerRenderer() { return mRenderer; } - - /* paintState must be a PAINT_xxx constant. The state will only be changed - * if paintState represents a state that occurs after the current state. */ - public void setPaintState(int paintState) { - if (paintState > mPaintState) { - mPaintState = paintState; - } - } - - public int getPaintState() { - return mPaintState; - } } diff --git a/mobile/android/base/gfx/PlaceholderLayerClient.java b/mobile/android/base/gfx/PlaceholderLayerClient.java index 286549de2b41..17290eb25d2d 100644 --- a/mobile/android/base/gfx/PlaceholderLayerClient.java +++ b/mobile/android/base/gfx/PlaceholderLayerClient.java @@ -79,6 +79,25 @@ public class PlaceholderLayerClient { } else { mViewport = new ViewportMetrics(); } + loadScreenshot(); + + + if (mViewportUnknown) + mViewport.setViewport(mLayerController.getViewport()); + mLayerController.setViewportMetrics(mViewport); + + BufferedCairoImage image = new BufferedCairoImage(mBuffer, mWidth, mHeight, mFormat); + SingleTileLayer tileLayer = new SingleTileLayer(image); + + tileLayer.beginTransaction(); // calling thread irrelevant; nobody else has a ref to tileLayer yet + try { + Point origin = PointUtils.round(mViewport.getOrigin()); + tileLayer.setPosition(new Rect(origin.x, origin.y, origin.x + mWidth, origin.y + mHeight)); + } finally { + tileLayer.endTransaction(); + } + + mLayerController.setRoot(tileLayer); } public void destroy() { @@ -88,7 +107,7 @@ public class PlaceholderLayerClient { } } - public boolean loadScreenshot() { + boolean loadScreenshot() { if (GeckoApp.mAppContext.mLastScreen == null) return false; @@ -112,18 +131,6 @@ public class PlaceholderLayerClient { mLayerController.setPageSize(mViewport.getPageSize()); } - BufferedCairoImage image = new BufferedCairoImage(mBuffer, mWidth, mHeight, mFormat); - SingleTileLayer tileLayer = new SingleTileLayer(image); - - tileLayer.beginTransaction(); // calling thread irrelevant; nobody else has a ref to tileLayer yet - try { - Point origin = PointUtils.round(mViewport.getOrigin()); - tileLayer.setPosition(new Rect(origin.x, origin.y, origin.x + mWidth, origin.y + mHeight)); - } finally { - tileLayer.endTransaction(); - } - - mLayerController.setRoot(tileLayer); return true; } }