ThreadedRenderer.java revision 04fc583c3dd3144bc6b718fcac4b3e1afdfdb067
1cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck/* 2cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * Copyright (C) 2013 The Android Open Source Project 3cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * 4cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * Licensed under the Apache License, Version 2.0 (the "License"); 5cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * you may not use this file except in compliance with the License. 6cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * You may obtain a copy of the License at 7cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * 8cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * http://www.apache.org/licenses/LICENSE-2.0 9cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * 10cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * Unless required by applicable law or agreed to in writing, software 11cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * distributed under the License is distributed on an "AS IS" BASIS, 12cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * See the License for the specific language governing permissions and 14cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * limitations under the License. 15cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck */ 16cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 17cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reckpackage android.view; 18cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 1904fc583c3dd3144bc6b718fcac4b3e1afdfdb067John Reckimport android.graphics.Bitmap; 20cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reckimport android.graphics.Rect; 21cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reckimport android.graphics.SurfaceTexture; 22cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reckimport android.os.SystemClock; 23cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reckimport android.os.Trace; 24cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reckimport android.view.Surface.OutOfResourcesException; 25cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reckimport android.view.View.AttachInfo; 26cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 27cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reckimport java.io.PrintWriter; 28cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 29cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck/** 30cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * Hardware renderer that proxies the rendering to a render thread. Most calls 314f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck * are currently synchronous. 324f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck * TODO: Make draw() async. 334f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck * TODO: Figure out how to share the DisplayList between two threads (global lock?) 34cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * 35cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * The UI thread can block on the RenderThread, but RenderThread must never 36cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * block on the UI thread. 37cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * 384f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck * ThreadedRenderer creates an instance of RenderProxy. RenderProxy in turn creates 394f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck * and manages a CanvasContext on the RenderThread. The CanvasContext is fully managed 404f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck * by the lifecycle of the RenderProxy. 414f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck * 42cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * Note that although currently the EGL context & surfaces are created & managed 43cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * by the render thread, the goal is to move that into a shared structure that can 44cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * be managed by both threads. EGLSurface creation & deletion should ideally be 45cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * done on the UI thread and not the RenderThread to avoid stalling the 46cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * RenderThread with surface buffer allocation. 47cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * 48cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * @hide 49cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck */ 50cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reckpublic class ThreadedRenderer extends HardwareRenderer { 51cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck private static final String LOGTAG = "ThreadedRenderer"; 52cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 534f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck private static final Rect NULL_RECT = new Rect(-1, -1, -1, -1); 54cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 55cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck private int mWidth, mHeight; 564f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck private long mNativeProxy; 57cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 583dfe19f72cbd95b201e89376ae1810c5c9229b00John Reck ThreadedRenderer(boolean translucent) { 594f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck mNativeProxy = nCreateProxy(translucent); 604f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck setEnabled(mNativeProxy != 0); 61cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 62cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 63cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 64cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck void destroy(boolean full) { 654f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck nDestroyCanvas(mNativeProxy); 66cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 67cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 68cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 69cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck boolean initialize(Surface surface) throws OutOfResourcesException { 704f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck return nInitialize(mNativeProxy, surface); 71cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 72cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 73cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 74cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck void updateSurface(Surface surface) throws OutOfResourcesException { 754f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck nUpdateSurface(mNativeProxy, surface); 76cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 77cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 78cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 79cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck void destroyLayers(View view) { 80cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck throw new NoSuchMethodError(); 81cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 82cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 83cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 84cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck void destroyHardwareResources(View view) { 854f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck // TODO: canvas.clearLayerUpdates() 864f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck destroyResources(view); 874f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck // TODO: GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS); 884f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck } 894f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck 904f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck private static void destroyResources(View view) { 914f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck view.destroyHardwareResources(); 924f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck 934f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck if (view instanceof ViewGroup) { 944f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck ViewGroup group = (ViewGroup) view; 954f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck 964f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck int count = group.getChildCount(); 974f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck for (int i = 0; i < count; i++) { 984f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck destroyResources(group.getChildAt(i)); 994f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck } 1004f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck } 101cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 102cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 103cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 104cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck void invalidate(Surface surface) { 1054f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck updateSurface(surface); 106cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 107cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 108cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 109cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck boolean validate() { 110cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck // TODO Remove users of this API 111cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck return false; 112cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 113cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 114cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 115cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck boolean safelyRun(Runnable action) { 1164f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck // TODO: 1174f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck return false; 118cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 119cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 120cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 121cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck void setup(int width, int height) { 122cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck mWidth = width; 123cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck mHeight = height; 1244f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck nSetup(mNativeProxy, width, height); 125cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 126cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 127cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 128cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck int getWidth() { 129cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck return mWidth; 130cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 131cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 132cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 133cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck int getHeight() { 134cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck return mHeight; 135cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 136cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 137cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 138cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck void dumpGfxInfo(PrintWriter pw) { 139cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck // TODO Auto-generated method stub 140cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 141cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 142cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 143cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck long getFrameCount() { 144cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck // TODO Auto-generated method stub 145cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck return 0; 146cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 147cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 148cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 149cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck boolean loadSystemProperties() { 1504f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck return false; 151cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 152cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 153cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 154cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck void pushLayerUpdate(HardwareLayer layer) { 155cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck throw new NoSuchMethodError(); 156cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 157cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 158cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 15904fc583c3dd3144bc6b718fcac4b3e1afdfdb067John Reck void onLayerCreated(HardwareLayer layer) { 16004fc583c3dd3144bc6b718fcac4b3e1afdfdb067John Reck throw new NoSuchMethodError(); 16104fc583c3dd3144bc6b718fcac4b3e1afdfdb067John Reck } 16204fc583c3dd3144bc6b718fcac4b3e1afdfdb067John Reck 16304fc583c3dd3144bc6b718fcac4b3e1afdfdb067John Reck @Override 16404fc583c3dd3144bc6b718fcac4b3e1afdfdb067John Reck void onLayerDestroyed(HardwareLayer layer) { 165cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck throw new NoSuchMethodError(); 166cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 167cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 168cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 169cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck void flushLayerUpdates() { 170cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck throw new NoSuchMethodError(); 171cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 172cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 173cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck /** 174cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * TODO: Remove 175cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * Temporary hack to allow RenderThreadTest prototype app to trigger 176cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * replaying a DisplayList after modifying the displaylist properties 177cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * 178cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck * @hide */ 179cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck public void repeatLastDraw() { 180cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 181cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 182cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 183cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck void draw(View view, AttachInfo attachInfo, HardwareDrawCallbacks callbacks, Rect dirty) { 184cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck attachInfo.mIgnoreDirtyState = true; 185cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck attachInfo.mDrawingTime = SystemClock.uptimeMillis(); 186cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck view.mPrivateFlags |= View.PFLAG_DRAWN; 187cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 188cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck view.mRecreateDisplayList = (view.mPrivateFlags & View.PFLAG_INVALIDATED) 189cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck == View.PFLAG_INVALIDATED; 190cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck view.mPrivateFlags &= ~View.PFLAG_INVALIDATED; 191cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 192cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck Trace.traceBegin(Trace.TRACE_TAG_VIEW, "getDisplayList"); 193cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck DisplayList displayList = view.getDisplayList(); 194cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck Trace.traceEnd(Trace.TRACE_TAG_VIEW); 195cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 196cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck view.mRecreateDisplayList = false; 197cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 1984f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck if (dirty == null) { 1994f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck dirty = NULL_RECT; 2004f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck } 2014f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck nDrawDisplayList(mNativeProxy, displayList.getNativeDisplayList(), 2024f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck dirty.left, dirty.top, dirty.right, dirty.bottom); 203cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 204cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 205cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 20604fc583c3dd3144bc6b718fcac4b3e1afdfdb067John Reck HardwareLayer createTextureLayer() { 207cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck throw new NoSuchMethodError(); 208cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 209cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 210cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 21104fc583c3dd3144bc6b718fcac4b3e1afdfdb067John Reck HardwareLayer createDisplayListLayer(int width, int height) { 212cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck throw new NoSuchMethodError(); 213cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 214cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 215cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 216cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck SurfaceTexture createSurfaceTexture(HardwareLayer layer) { 217cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck throw new NoSuchMethodError(); 218cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 219cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 220cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 22104fc583c3dd3144bc6b718fcac4b3e1afdfdb067John Reck boolean copyLayerInto(HardwareLayer layer, Bitmap bitmap) { 222cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck throw new NoSuchMethodError(); 223cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 224cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 225cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 22636bef0bf30d6bae48cf3837df351075ca4fce654Ashok Bhat void detachFunctor(long functor) { 2274f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck nDetachFunctor(mNativeProxy, functor); 228cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 229cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 230cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 23136bef0bf30d6bae48cf3837df351075ca4fce654Ashok Bhat void attachFunctor(AttachInfo attachInfo, long functor) { 2324f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck nAttachFunctor(mNativeProxy, functor); 233cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 234cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 235cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck @Override 236cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck void setName(String name) { 237cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 238cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 2394f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck @Override 2404f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck protected void finalize() throws Throwable { 2414f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck try { 2424f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck nDeleteProxy(mNativeProxy); 2434f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck } finally { 2444f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck super.finalize(); 245cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 246cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck } 247cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 2484f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck /** @hide */ 2494f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck public static native void postToRenderThread(Runnable runnable); 250cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 2514f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck private static native long nCreateProxy(boolean translucent); 2524f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck private static native void nDeleteProxy(long nativeProxy); 253cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 2544f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck private static native boolean nInitialize(long nativeProxy, Surface window); 2554f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck private static native void nUpdateSurface(long nativeProxy, Surface window); 2564f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck private static native void nSetup(long nativeProxy, int width, int height); 2574f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck private static native void nDrawDisplayList(long nativeProxy, long displayList, 2584f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck int dirtyLeft, int dirtyTop, int dirtyRight, int dirtyBottom); 2594f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck private static native void nDestroyCanvas(long nativeProxy); 260cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck 2614f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck private static native void nAttachFunctor(long nativeProxy, long functor); 2624f02bf4eef6af47f35c70c4dda5b7b9523d89ca0John Reck private static native void nDetachFunctor(long nativeProxy, long functor); 263cec24ae16e9a0a7c3075f1a8d9149bb7fb3813fcJohn Reck} 264