diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-07-22 16:18:32 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-08-03 22:42:17 +0200 |
commit | 29fbaec862373d353dbad19ee108ddf5b4de1a0f (patch) | |
tree | 344274839c66ddd95f76b615ed0363a519c8c31b | |
parent | LOAndroid3: change MockTileProvider to accept filename (diff) | |
download | core-29fbaec862373d353dbad19ee108ddf5b4de1a0f.tar.gz core-29fbaec862373d353dbad19ee108ddf5b4de1a0f.zip |
LOAndroid3: clean-up code
Change-Id: I18aa63baff99e29ed343ce9092cc5ea73cc097d7
4 files changed, 24 insertions, 19 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GLController.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GLController.java index e8f201228666..9f38bfecd179 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GLController.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GLController.java @@ -37,9 +37,8 @@ package org.mozilla.gecko.gfx; -import android.util.Log; import android.view.SurfaceHolder; -import android.view.SurfaceView; + import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGL11; import javax.microedition.khronos.egl.EGLConfig; diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java index 43cf88dbe85a..a8276fa57ba2 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoSoftwareLayerClient.java @@ -76,10 +76,9 @@ public class GeckoSoftwareLayerClient extends GeckoLayerClient { Log.i(LOGTAG, "Creating MultiTileLayer"); if(mTileLayer == null) { mTileLayer = new MultiTileLayer(TILE_SIZE); + mLayerController.setRoot(mTileLayer); } - mLayerController.setRoot(mTileLayer); - // Force a resize event to be sent because the results of this // are different depending on what tile system we're using sendResizeEventIfNecessary(true); diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/Layer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/Layer.java index b70c88e12768..cc689ed623c0 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/Layer.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/Layer.java @@ -69,8 +69,7 @@ public abstract class Layer { */ public final boolean update(RenderContext context) { if (mTransactionLock.isHeldByCurrentThread()) { - throw new RuntimeException("draw() called while transaction lock held by this " + - "thread?!"); + throw new RuntimeException("draw() called while transaction lock held by this thread?!"); } if (mTransactionLock.tryLock()) { diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java index 8fb391a81f8e..ba7608f3cbb4 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java @@ -525,7 +525,9 @@ public class LayerRenderer implements GLSurfaceView.Renderer { mLastPageContext = mPageContext; /* Update layers. */ - if (rootLayer != null) mUpdated &= rootLayer.update(mPageContext); + if (rootLayer != null) { + mUpdated &= rootLayer.update(mPageContext); + } mUpdated &= mBackgroundLayer.update(mScreenContext); mUpdated &= mShadowLayer.update(mPageContext); updateCheckerboardLayer(mScreenContext); @@ -533,14 +535,16 @@ public class LayerRenderer implements GLSurfaceView.Renderer { mUpdated &= mVertScrollLayer.update(mPageContext); mUpdated &= mHorizScrollLayer.update(mPageContext); - for (Layer layer : mExtraLayers) + for (Layer layer : mExtraLayers) { mUpdated &= layer.update(mPageContext); + } GLES20.glDisable(GLES20.GL_SCISSOR_TEST); // If a layer update requires further work, schedule another redraw - if (!mUpdated) + if (!mUpdated) { mView.requestRender(); + } PanningPerfAPI.recordFrameTime(); @@ -565,8 +569,9 @@ public class LayerRenderer implements GLSurfaceView.Renderer { Rect pageRect = getPageRect(); RectF untransformedPageRect = new RectF(0.0f, 0.0f, pageRect.width(), pageRect.height()); - if (!untransformedPageRect.contains(mView.getController().getViewport())) + if (!untransformedPageRect.contains(mView.getController().getViewport())) { mShadowLayer.draw(mPageContext); + } /* Draw the checkerboard. */ setScissorRect(); @@ -591,22 +596,24 @@ public class LayerRenderer implements GLSurfaceView.Renderer { LayerController controller = mView.getController(); /* Draw any extra layers that were added (likely plugins) */ - for (Layer layer : mExtraLayers) + for (Layer layer : mExtraLayers) { layer.draw(mPageContext); + } /* Draw the vertical scrollbar. */ IntSize screenSize = new IntSize(controller.getViewportSize()); - if (pageRect.height() > screenSize.height) + if (pageRect.height() > screenSize.height) { mVertScrollLayer.draw(mPageContext); + } /* Draw the horizontal scrollbar. */ - if (pageRect.width() > screenSize.width) + if (pageRect.width() > screenSize.width) { mHorizScrollLayer.draw(mPageContext); + } /* Measure how much of the screen is checkerboarding */ Layer rootLayer = controller.getRoot(); - if ((rootLayer != null) && - (mProfileRender || PanningPerfAPI.isRecordingCheckerboard())) { + if (rootLayer != null && (mProfileRender || PanningPerfAPI.isRecordingCheckerboard())) { // Find out how much of the viewport area is valid Rect viewport = RectUtils.round(mPageContext.viewport); Region validRegion = rootLayer.getValidRegion(mPageContext); @@ -622,10 +629,10 @@ public class LayerRenderer implements GLSurfaceView.Renderer { // source, but is not mentioned in the Android documentation, // and so is liable to change. // If it does change, this code will need to be reevaluated. - Rect r = new Rect(); + Rect rect = new Rect(); int checkerboardArea = 0; - for (RegionIterator i = new RegionIterator(validRegion); i.next(r);) { - checkerboardArea += r.width() * r.height(); + for (RegionIterator i = new RegionIterator(validRegion); i.next(rect);) { + checkerboardArea += rect.width() * rect.height(); } checkerboard = checkerboardArea / (float)screenArea; @@ -658,8 +665,9 @@ public class LayerRenderer implements GLSurfaceView.Renderer { public void endDrawing() { // If a layer update requires further work, schedule another redraw - if (!mUpdated) + if (!mUpdated) { mView.requestRender(); + } PanningPerfAPI.recordFrameTime(); |