diff options
| -rw-r--r-- | core/java/android/view/GLES20Canvas.java | 12 | ||||
| -rw-r--r-- | core/java/android/view/GLRenderer.java | 70 | ||||
| -rw-r--r-- | core/java/android/view/HardwareRenderer.java | 8 | ||||
| -rw-r--r-- | core/jni/android_view_GLES20Canvas.cpp | 14 |
4 files changed, 0 insertions, 104 deletions
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java index 3384359..dc68e51 100644 --- a/core/java/android/view/GLES20Canvas.java +++ b/core/java/android/view/GLES20Canvas.java @@ -284,18 +284,6 @@ class GLES20Canvas extends HardwareCanvas { private static native int nGetStencilSize(); - void setCountOverdrawEnabled(boolean enabled) { - nSetCountOverdrawEnabled(mRenderer, enabled); - } - - static native void nSetCountOverdrawEnabled(long renderer, boolean enabled); - - float getOverdraw() { - return nGetOverdraw(mRenderer); - } - - static native float nGetOverdraw(long renderer); - /////////////////////////////////////////////////////////////////////////// // Functor /////////////////////////////////////////////////////////////////////////// diff --git a/core/java/android/view/GLRenderer.java b/core/java/android/view/GLRenderer.java index 449bad6..5002fe5 100644 --- a/core/java/android/view/GLRenderer.java +++ b/core/java/android/view/GLRenderer.java @@ -109,9 +109,7 @@ public class GLRenderer extends HardwareRenderer { private static final String[] OVERDRAW = { OVERDRAW_PROPERTY_SHOW, - OVERDRAW_PROPERTY_COUNT }; - private static final int OVERDRAW_TYPE_COUNT = 1; private static final int GL_VERSION = 2; static EGL10 sEgl; @@ -160,8 +158,6 @@ public class GLRenderer extends HardwareRenderer { boolean mDebugDirtyRegions; int mDebugOverdraw = -1; - HardwareLayer mDebugOverdrawLayer; - Paint mDebugOverdrawPaint; final boolean mTranslucent; @@ -495,14 +491,6 @@ public class GLRenderer extends HardwareRenderer { return new GLES20RenderLayer(width, height, isOpaque); } - void countOverdraw(HardwareCanvas canvas) { - ((GLES20Canvas) canvas).setCountOverdrawEnabled(true); - } - - float getOverdraw(HardwareCanvas canvas) { - return ((GLES20Canvas) canvas).getOverdraw(); - } - @Override public SurfaceTexture createSurfaceTexture(HardwareLayer layer) { return ((GLES20TextureLayer) layer).getSurfaceTexture(); @@ -706,14 +694,6 @@ public class GLRenderer extends HardwareRenderer { if (debugOverdraw != mDebugOverdraw) { changed = true; mDebugOverdraw = debugOverdraw; - - if (mDebugOverdraw != OVERDRAW_TYPE_COUNT) { - if (mDebugOverdrawLayer != null) { - mDebugOverdrawLayer.destroy(); - mDebugOverdrawLayer = null; - mDebugOverdrawPaint = null; - } - } } if (loadProperties()) { @@ -1182,7 +1162,6 @@ public class GLRenderer extends HardwareRenderer { if (mDrawDelta > 0) { mFrameCount++; - debugOverdraw(attachInfo, dirty, canvas, displayList); debugDirtyRegions(dirty, canvas); drawProfileData(attachInfo); } @@ -1201,55 +1180,6 @@ public class GLRenderer extends HardwareRenderer { } } - private void debugOverdraw(View.AttachInfo attachInfo, Rect dirty, - HardwareCanvas canvas, DisplayList displayList) { - - if (mDebugOverdraw == OVERDRAW_TYPE_COUNT) { - if (mDebugOverdrawLayer == null) { - mDebugOverdrawLayer = createHardwareLayer(mWidth, mHeight, true); - } else if (mDebugOverdrawLayer.getWidth() != mWidth || - mDebugOverdrawLayer.getHeight() != mHeight) { - mDebugOverdrawLayer.resize(mWidth, mHeight); - } - - if (!mDebugOverdrawLayer.isValid()) { - mDebugOverdraw = -1; - return; - } - - HardwareCanvas layerCanvas = mDebugOverdrawLayer.start(canvas, dirty); - countOverdraw(layerCanvas); - final int restoreCount = layerCanvas.save(); - layerCanvas.drawDisplayList(displayList, null, DisplayList.FLAG_CLIP_CHILDREN); - layerCanvas.restoreToCount(restoreCount); - mDebugOverdrawLayer.end(canvas); - - float overdraw = getOverdraw(layerCanvas); - DisplayMetrics metrics = attachInfo.mRootView.getResources().getDisplayMetrics(); - - drawOverdrawCounter(canvas, overdraw, metrics.density); - } - } - - private void drawOverdrawCounter(HardwareCanvas canvas, float overdraw, float density) { - final String text = String.format("%.2fx", overdraw); - final Paint paint = setupPaint(density); - // HSBtoColor will clamp the values in the 0..1 range - paint.setColor(Color.HSBtoColor(0.28f - 0.28f * overdraw / 3.5f, 0.8f, 1.0f)); - - canvas.drawText(text, density * 4.0f, mHeight - paint.getFontMetrics().bottom, paint); - } - - private Paint setupPaint(float density) { - if (mDebugOverdrawPaint == null) { - mDebugOverdrawPaint = new Paint(); - mDebugOverdrawPaint.setAntiAlias(true); - mDebugOverdrawPaint.setShadowLayer(density * 3.0f, 0.0f, 0.0f, 0xff000000); - mDebugOverdrawPaint.setTextSize(density * 20.0f); - } - return mDebugOverdrawPaint; - } - private DisplayList buildDisplayList(View view, HardwareCanvas canvas) { if (mDrawDelta <= 0) { return view.mDisplayList; diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index 2013494..352ab83 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -153,14 +153,6 @@ public abstract class HardwareRenderer { public static final String OVERDRAW_PROPERTY_SHOW = "show"; /** - * Value for {@link #DEBUG_OVERDRAW_PROPERTY}. When the property is set to this - * value, an overdraw counter will be shown on screen. - * - * @hide - */ - public static final String OVERDRAW_PROPERTY_COUNT = "count"; - - /** * Turn on to debug non-rectangular clip operations. * * Possible values: diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp index 6cc94e3..1dc3630 100644 --- a/core/jni/android_view_GLES20Canvas.cpp +++ b/core/jni/android_view_GLES20Canvas.cpp @@ -197,18 +197,6 @@ static void android_view_GLES20Canvas_setProperty(JNIEnv* env, env->ReleaseStringUTFChars(name, valueCharArray); } -static void android_view_GLES20Canvas_setCountOverdrawEnabled(JNIEnv* env, jobject clazz, - jlong rendererPtr, jboolean enabled) { - OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr); - renderer->setCountOverdrawEnabled(enabled); -} - -static jfloat android_view_GLES20Canvas_getOverdraw(JNIEnv* env, jobject clazz, - jlong rendererPtr) { - OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr); - return renderer->getOverdraw(); -} - // ---------------------------------------------------------------------------- // Functor // ---------------------------------------------------------------------------- @@ -1176,8 +1164,6 @@ static JNINativeMethod gMethods[] = { { "nSetProperty", "(Ljava/lang/String;Ljava/lang/String;)V", (void*) android_view_GLES20Canvas_setProperty }, - { "nSetCountOverdrawEnabled", "(JZ)V", (void*) android_view_GLES20Canvas_setCountOverdrawEnabled }, - { "nGetOverdraw", "(J)F", (void*) android_view_GLES20Canvas_getOverdraw }, { "nGetStencilSize", "()I", (void*) android_view_GLES20Canvas_getStencilSize }, |
