Bug 758635 - LayerRenderer doesn't need to implement GLSurfaceView.Renderer. r=Cwiiis
☠☠ backed out by a1a4961783ef ☠ ☠
authorKartikaya Gupta <kgupta@mozilla.com>
Sat, 26 May 2012 11:03:27 -0400
changeset 95026 d22c4f57daaf73720ae3a5e5ff17e19a74a0fdca
parent 95025 6c27b32ad788184acc0deafaa2741bafc94ba436
child 95027 88787676b14a19cf8f5124407fa5e2c8a27ef604
push id9923
push userkgupta@mozilla.com
push dateSat, 26 May 2012 15:03:57 +0000
treeherdermozilla-inbound@d22c4f57daaf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCwiiis
bugs758635
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 758635 - LayerRenderer doesn't need to implement GLSurfaceView.Renderer. r=Cwiiis
mobile/android/base/gfx/LayerRenderer.java
--- a/mobile/android/base/gfx/LayerRenderer.java
+++ b/mobile/android/base/gfx/LayerRenderer.java
@@ -37,17 +37,17 @@ import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.nio.FloatBuffer;
 import java.nio.IntBuffer;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 /**
  * The layer renderer implements the rendering logic for a layer view.
  */
-public class LayerRenderer implements GLSurfaceView.Renderer {
+public class LayerRenderer {
     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
      * frame.
      */
     private static final int MAX_FRAME_TIME = 16;   /* 1000 ms / 60 FPS */
@@ -191,17 +191,17 @@ public class LayerRenderer implements GL
                 mCoordByteBuffer = null;
                 mCoordBuffer = null;
             }
         } finally {
             super.finalize();
         }
     }
 
-    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+    void onSurfaceCreated(GL10 gl, EGLConfig config) {
         checkMonitoringEnabled();
         createDefaultProgram();
         activateDefaultProgram();
     }
 
     public void createDefaultProgram() {
         int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, DEFAULT_VERTEX_SHADER);
         int fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, DEFAULT_FRAGMENT_SHADER);
@@ -263,33 +263,16 @@ public class LayerRenderer implements GL
     }
 
     public void removeLayer(Layer layer) {
         synchronized (mExtraLayers) {
             mExtraLayers.remove(layer);
         }
     }
 
-    /**
-     * Called whenever a new frame is about to be drawn.
-     */
-    public void onDrawFrame(GL10 gl) {
-	/* This code is causing crashes when the surface changes. (bug 738188)
-	 * I'm not sure if it actually works, so I'm disabling it now to avoid the crash.
-        Frame frame = createFrame(mView.getController().getViewportMetrics());
-        synchronized (mView.getController()) {
-            frame.beginDrawing();
-            frame.drawBackground();
-            frame.drawRootLayer();
-            frame.drawForeground();
-            frame.endDrawing();
-        }
-	*/
-    }
-
     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() {
@@ -319,17 +302,17 @@ public class LayerRenderer implements GL
         return createContext(new RectF(viewport), pageRect, zoomFactor);
     }
 
     private RenderContext createContext(RectF viewport, RectF pageRect, float zoomFactor) {
         return new RenderContext(viewport, pageRect, zoomFactor, mPositionHandle, mTextureHandle,
                                  mCoordBuffer);
     }
 
-    public void onSurfaceChanged(GL10 gl, final int width, final int height) {
+    void onSurfaceChanged(GL10 gl, final int width, final int height) {
         GLES20.glViewport(0, 0, width, height);
 
         if (mFrameRateLayer != null) {
             moveFrameRateLayer(width, height);
         }
 
         /* TODO: Throw away tile images? */
     }