diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-02-15 13:47:29 +0900 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-23 10:10:20 +0100 |
commit | 23c4f26e2bccd4a1b41b7e9edcd155f674e1735d (patch) | |
tree | 2d971a7723675e8d799f3f14445efd4359f8ef92 /android | |
parent | 415fb7914c93a4f551e93490bcc4359296c38d96 (diff) |
android: cleanup LayerRenderer
Change-Id: I26f1819c801bb1930975b0be3f036748f843e4a4
Diffstat (limited to 'android')
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java | 102 | ||||
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java | 5 |
2 files changed, 0 insertions, 107 deletions
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 d6110ac02558..e924bcf7f3dc 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 @@ -36,7 +36,6 @@ import javax.microedition.khronos.opengles.GL10; */ public class LayerRenderer implements GLSurfaceView.Renderer { private static final String LOGTAG = "GeckoLayerRenderer"; - private static final String PROFTAG = "GeckoLayerRendererProf"; /* * The amount of time a frame is allowed to take to render before we declare it a dropped @@ -44,9 +43,6 @@ public class LayerRenderer implements GLSurfaceView.Renderer { */ private static final int MAX_FRAME_TIME = 16; /* 1000 ms / 60 FPS */ - private static final int FRAME_RATE_METER_WIDTH = 128; - private static final int FRAME_RATE_METER_HEIGHT = 32; - private final LayerView mView; private final SingleTileLayer mBackgroundLayer; private final NinePatchTileLayer mShadowLayer; @@ -61,16 +57,6 @@ public class LayerRenderer implements GLSurfaceView.Renderer { private CopyOnWriteArrayList<Layer> mExtraLayers = new CopyOnWriteArrayList<Layer>(); - // Dropped frames display - private int[] mFrameTimings; - private int mCurrentFrame, mFrameTimingsSum, mDroppedFrames; - - // Render profiling output - private int mFramesRendered; - private float mCompleteFramesRendered; - private boolean mProfileRender; - private long mProfileOutputTime; - /* Used by robocop for testing purposes */ private IntBuffer mPixelBuffer; @@ -137,9 +123,6 @@ public class LayerRenderer implements GLSurfaceView.Renderer { mVertScrollLayer = ScrollbarLayer.create(this, true); mFadeRunnable = new FadeRunnable(); - mFrameTimings = new int[60]; - mCurrentFrame = mFrameTimingsSum = mDroppedFrames = 0; - // Initialize the FloatBuffer that will be used to store all vertices and texture // coordinates in draw() commands. mCoordByteBuffer = DirectBufferAllocator.allocate(COORD_BUFFER_SIZE * 4); @@ -253,27 +236,6 @@ public class LayerRenderer implements GLSurfaceView.Renderer { } } - private void printCheckerboardStats() { - Log.d(PROFTAG, "Frames rendered over last 1000ms: " + mCompleteFramesRendered + "/" + mFramesRendered); - mFramesRendered = 0; - mCompleteFramesRendered = 0; - } - - /** Used by robocop for testing purposes. Not for production use! */ - IntBuffer getPixels() { - IntBuffer pixelBuffer = IntBuffer.allocate(mView.getWidth() * mView.getHeight()); - synchronized (pixelBuffer) { - mPixelBuffer = pixelBuffer; - mView.requestRender(); - try { - pixelBuffer.wait(); - } catch (InterruptedException ie) { - } - mPixelBuffer = null; - } - return pixelBuffer; - } - private RenderContext createScreenContext(ImmutableViewportMetrics metrics) { RectF viewport = new RectF(0.0f, 0.0f, metrics.getWidth(), metrics.getHeight()); RectF pageRect = new RectF(metrics.getPageRect()); @@ -296,19 +258,6 @@ public class LayerRenderer implements GLSurfaceView.Renderer { GLES20.glViewport(0, 0, width, height); } - private void updateDroppedFrames(long frameStartTime) { - int frameElapsedTime = (int)(SystemClock.uptimeMillis() - frameStartTime); - - /* Update the running statistics. */ - mFrameTimingsSum -= mFrameTimings[mCurrentFrame]; - mFrameTimingsSum += frameElapsedTime; - mDroppedFrames -= (mFrameTimings[mCurrentFrame] + 1) / MAX_FRAME_TIME; - mDroppedFrames += (frameElapsedTime + 1) / MAX_FRAME_TIME; - - mFrameTimings[mCurrentFrame] = frameElapsedTime; - mCurrentFrame = (mCurrentFrame + 1) % mFrameTimings.length; - } - /* * create a vertex shader type (GLES20.GL_VERTEX_SHADER) * or a fragment shader type (GLES20.GL_FRAGMENT_SHADER) @@ -552,55 +501,6 @@ public class LayerRenderer implements GLSurfaceView.Renderer { /* Draw the horizontal scrollbar. */ if (mPageRect.width() > mFrameMetrics.getWidth()) mHorizScrollLayer.draw(mPageContext); - - /* Measure how much of the screen is checkerboarding */ - Layer rootLayer = mView.getLayerClient().getRoot(); - 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); - - /* restrict the viewport to page bounds so we don't - * count overscroll as checkerboard */ - if (!viewport.intersect(mPageRect)) { - /* if the rectangles don't intersect - intersect() doesn't change viewport - so we set it to empty by hand */ - viewport.setEmpty(); - } - validRegion.op(viewport, Region.Op.INTERSECT); - - float checkerboard = 0.0f; - - int screenArea = viewport.width() * viewport.height(); - if (screenArea > 0 && !(validRegion.isRect() && validRegion.getBounds().equals(viewport))) { - validRegion.op(viewport, Region.Op.REVERSE_DIFFERENCE); - - // XXX The assumption here is that a Region never has overlapping - // rects. This is true, as evidenced by reading the SkRegion - // 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(); - int checkerboardArea = 0; - for (RegionIterator i = new RegionIterator(validRegion); i.next(r);) { - checkerboardArea += r.width() * r.height(); - } - - checkerboard = checkerboardArea / (float)screenArea; - } - - PanningPerfAPI.recordCheckerboard(checkerboard); - - mCompleteFramesRendered += 1.0f - checkerboard; - mFramesRendered ++; - - if (mFrameStartTime - mProfileOutputTime > 1000) { - mProfileOutputTime = mFrameStartTime; - printCheckerboardStats(); - } - } } /** This function is invoked via JNI; be careful when modifying signature. */ @@ -609,8 +509,6 @@ public class LayerRenderer implements GLSurfaceView.Renderer { if (!mUpdated) mView.requestRender(); - PanningPerfAPI.recordFrameTime(); - /* Used by robocop for testing purposes */ IntBuffer pixelBuffer = mPixelBuffer; if (mUpdated && pixelBuffer != null) { diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java index 124aeff16e59..1b94fc4e3f50 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java @@ -266,11 +266,6 @@ public class LayerView extends FrameLayout { return mRenderer.getMaxTextureSize(); } - /** Used by robocop for testing purposes. Not for production use! This is called via reflection by robocop. */ - public IntBuffer getPixels() { - return mRenderer.getPixels(); - } - public void setLayerRenderer(LayerRenderer renderer) { mRenderer = renderer; } |