diff options
-rw-r--r-- | core/java/android/view/GLES20Canvas.java | 23 | ||||
-rw-r--r-- | core/jni/android_view_GLES20Canvas.cpp | 12 | ||||
-rw-r--r-- | graphics/java/android/graphics/Canvas.java | 45 | ||||
-rw-r--r-- | libs/hwui/DisplayListRenderer.cpp | 26 | ||||
-rw-r--r-- | libs/hwui/DisplayListRenderer.h | 6 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 8 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.h | 2 |
7 files changed, 2 insertions, 120 deletions
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java index dac3135..9a6a274 100644 --- a/core/java/android/view/GLES20Canvas.java +++ b/core/java/android/view/GLES20Canvas.java @@ -56,8 +56,6 @@ class GLES20Canvas extends HardwareCanvas { private DrawFilter mFilter; - private boolean mContextLocked; - /////////////////////////////////////////////////////////////////////////// // JNI /////////////////////////////////////////////////////////////////////////// @@ -224,33 +222,12 @@ class GLES20Canvas extends HardwareCanvas { private static native void nFinish(int renderer); @Override - public boolean acquireContext() { - if (!mContextLocked) { - nAcquireContext(mRenderer); - mContextLocked = true; - } - return mContextLocked; - } - - private static native void nAcquireContext(int renderer); - - @Override public boolean callDrawGLFunction(int drawGLFunction) { return nCallDrawGLFunction(mRenderer, drawGLFunction); } private static native boolean nCallDrawGLFunction(int renderer, int drawGLFunction); - @Override - public void releaseContext() { - if (mContextLocked) { - nReleaseContext(mRenderer); - mContextLocked = false; - } - } - - private static native void nReleaseContext(int renderer); - /////////////////////////////////////////////////////////////////////////// // Display list /////////////////////////////////////////////////////////////////////////// diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp index 9de270d..7a609a5 100644 --- a/core/jni/android_view_GLES20Canvas.cpp +++ b/core/jni/android_view_GLES20Canvas.cpp @@ -137,21 +137,11 @@ static void android_view_GLES20Canvas_finish(JNIEnv* env, jobject clazz, renderer->finish(); } -static void android_view_GLES20Canvas_acquireContext(JNIEnv* env, jobject clazz, - OpenGLRenderer* renderer) { - renderer->acquireContext(); -} - static bool android_view_GLES20Canvas_callDrawGLFunction(JNIEnv* env, jobject clazz, OpenGLRenderer* renderer, Functor *functor) { return renderer->callDrawGLFunction(functor); } -static void android_view_GLES20Canvas_releaseContext(JNIEnv* env, jobject clazz, - OpenGLRenderer* renderer) { - renderer->releaseContext(); -} - // ---------------------------------------------------------------------------- // State // ---------------------------------------------------------------------------- @@ -609,8 +599,6 @@ static JNINativeMethod gMethods[] = { { "nPrepare", "(IZ)V", (void*) android_view_GLES20Canvas_prepare }, { "nPrepareDirty", "(IIIIIZ)V", (void*) android_view_GLES20Canvas_prepareDirty }, { "nFinish", "(I)V", (void*) android_view_GLES20Canvas_finish }, - { "nAcquireContext", "(I)V", (void*) android_view_GLES20Canvas_acquireContext }, - { "nReleaseContext", "(I)V", (void*) android_view_GLES20Canvas_releaseContext }, { "nCallDrawGLFunction", "(II)Z", (void*) android_view_GLES20Canvas_callDrawGLFunction }, diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java index 00b06e0..c1deed3 100644 --- a/graphics/java/android/graphics/Canvas.java +++ b/graphics/java/android/graphics/Canvas.java @@ -1596,51 +1596,6 @@ public class Canvas { } /** - * <p>Acquires the Canvas context. After invoking this method, the Canvas - * context can be modified by the caller. For instance, if you acquire - * the context of an OpenGL Canvas you can reset the GL viewport, scissor, - * etc.</p> - * - * <p>A call to {@link #acquireContext()} should aways be followed by - * a call to {@link #releaseContext()}, preferrably using a try block:</p> - * - * <pre> - * try { - * if (canvas.acquireContext()) { - * // Use the canvas and/or its context - * } - * } finally { - * canvas.releaseContext(); - * } - * </pre> - * - * <p>Acquiring the context can be an expensive operation and should not - * be done unless absolutely necessary.</p> - * - * <p>Applications should never invoke this method directly.</p> - * - * @return True if the context could be acquired successfully, false - * otherwise (if the context is already acquired for instance.) - * - * @see #releaseContext() - * - * @hide - */ - public boolean acquireContext() { - return false; - } - - /** - * <p>Release the context acquired with {@link #acquireContext()}.</p> - * - * @see #acquireContext() - * - * @hide - */ - public void releaseContext() { - } - - /** * Free up as much memory as possible from private caches (e.g. fonts, images) * * @hide diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index c2106d4..cfc853c 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -82,8 +82,6 @@ void PathHeap::flatten(SkFlattenableWriteBuffer& buffer) const { /////////////////////////////////////////////////////////////////////////////// const char* DisplayList::OP_NAMES[] = { - "AcquireContext", - "ReleaseContext", "Save", "Restore", "RestoreToCount", @@ -239,16 +237,6 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t level) { needsInvalidate |= renderer.callDrawGLFunction(functor); } break; - case AcquireContext: { - DISPLAY_LIST_LOGD("%s%s", (char*) indent, OP_NAMES[op]); - renderer.acquireContext(); - } - break; - case ReleaseContext: { - DISPLAY_LIST_LOGD("%s%s", (char*) indent, OP_NAMES[op]); - renderer.releaseContext(); - } - break; case Save: { int rendererNum = getInt(); DISPLAY_LIST_LOGD("%s%s %d", (char*) indent, OP_NAMES[op], rendererNum); @@ -644,15 +632,9 @@ void DisplayListRenderer::finish() { } void DisplayListRenderer::interrupt() { - } -void DisplayListRenderer::resume() { -} -void DisplayListRenderer::acquireContext() { - // TODO: probably noop instead of calling super - addOp(DisplayList::AcquireContext); - OpenGLRenderer::acquireContext(); +void DisplayListRenderer::resume() { } bool DisplayListRenderer::callDrawGLFunction(Functor *functor) { @@ -661,12 +643,6 @@ bool DisplayListRenderer::callDrawGLFunction(Functor *functor) { return false; // No invalidate needed at record-time } -void DisplayListRenderer::releaseContext() { - // TODO: probably noop instead of calling super - addOp(DisplayList::ReleaseContext); - OpenGLRenderer::releaseContext(); -} - int DisplayListRenderer::save(int flags) { addOp(DisplayList::Save); addInt(flags); diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index bab5149..a6d2bfe 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -89,9 +89,7 @@ public: // IMPORTANT: Update the intialization of OP_NAMES in the .cpp file // when modifying this file enum Op { - AcquireContext = 0, - ReleaseContext, - Save, + Save = 0, Restore, RestoreToCount, SaveLayer, @@ -245,8 +243,6 @@ public: void finish(); bool callDrawGLFunction(Functor *functor); - void acquireContext(); - void releaseContext(); void interrupt(); void resume(); diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index c378f46..81c3407 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -191,10 +191,6 @@ void OpenGLRenderer::interrupt() { mCaches.unbindMeshBuffer(); } -void OpenGLRenderer::acquireContext() { - interrupt(); -} - void OpenGLRenderer::resume() { glViewport(0, 0, mSnapshot->viewport.getWidth(), mSnapshot->viewport.getHeight()); @@ -212,10 +208,6 @@ void OpenGLRenderer::resume() { glBlendEquation(GL_FUNC_ADD); } -void OpenGLRenderer::releaseContext() { - resume(); -} - bool OpenGLRenderer::callDrawGLFunction(Functor *functor) { interrupt(); if (mDirtyClip) { diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index 77de1d2..64def03 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -71,8 +71,6 @@ public: virtual void resume(); virtual bool callDrawGLFunction(Functor *functor); - virtual void acquireContext(); - virtual void releaseContext(); int getSaveCount() const; virtual int save(int flags); |