John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.view; |
| 18 | |
John Reck | 04fc583 | 2014-02-05 16:38:25 -0800 | [diff] [blame] | 19 | import android.graphics.Bitmap; |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 20 | import android.graphics.Rect; |
| 21 | import android.graphics.SurfaceTexture; |
John Reck | 66f0be6 | 2014-05-13 13:39:31 -0700 | [diff] [blame] | 22 | import android.os.IBinder; |
| 23 | import android.os.RemoteException; |
| 24 | import android.os.ServiceManager; |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 25 | import android.os.Trace; |
John Reck | 66f0be6 | 2014-05-13 13:39:31 -0700 | [diff] [blame] | 26 | import android.util.Log; |
John Reck | 315c329 | 2014-05-09 19:21:04 -0700 | [diff] [blame] | 27 | import android.util.TimeUtils; |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 28 | import android.view.Surface.OutOfResourcesException; |
| 29 | import android.view.View.AttachInfo; |
| 30 | |
| 31 | import java.io.PrintWriter; |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * Hardware renderer that proxies the rendering to a render thread. Most calls |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 35 | * are currently synchronous. |
| 36 | * TODO: Make draw() async. |
| 37 | * TODO: Figure out how to share the DisplayList between two threads (global lock?) |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 38 | * |
| 39 | * The UI thread can block on the RenderThread, but RenderThread must never |
| 40 | * block on the UI thread. |
| 41 | * |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 42 | * ThreadedRenderer creates an instance of RenderProxy. RenderProxy in turn creates |
| 43 | * and manages a CanvasContext on the RenderThread. The CanvasContext is fully managed |
| 44 | * by the lifecycle of the RenderProxy. |
| 45 | * |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 46 | * Note that although currently the EGL context & surfaces are created & managed |
| 47 | * by the render thread, the goal is to move that into a shared structure that can |
| 48 | * be managed by both threads. EGLSurface creation & deletion should ideally be |
| 49 | * done on the UI thread and not the RenderThread to avoid stalling the |
| 50 | * RenderThread with surface buffer allocation. |
| 51 | * |
| 52 | * @hide |
| 53 | */ |
| 54 | public class ThreadedRenderer extends HardwareRenderer { |
| 55 | private static final String LOGTAG = "ThreadedRenderer"; |
| 56 | |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 57 | private static final Rect NULL_RECT = new Rect(); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 58 | |
John Reck | f9be779 | 2014-05-02 18:21:16 -0700 | [diff] [blame] | 59 | // Keep in sync with DrawFrameTask.h SYNC_* flags |
| 60 | // Nothing interesting to report |
| 61 | private static final int SYNC_OK = 0x0; |
| 62 | // Needs a ViewRoot invalidate |
| 63 | private static final int SYNC_INVALIDATE_REQUIRED = 0x1; |
| 64 | |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 65 | private int mWidth, mHeight; |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 66 | private long mNativeProxy; |
John Reck | f7d9c1d | 2014-04-09 10:01:03 -0700 | [diff] [blame] | 67 | private boolean mInitialized = false; |
John Reck | bc0cc02 | 2014-04-11 16:08:14 -0700 | [diff] [blame] | 68 | private RenderNode mRootNode; |
John Reck | 18f16e6 | 2014-05-02 16:46:41 -0700 | [diff] [blame] | 69 | private Choreographer mChoreographer; |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 70 | |
John Reck | 3dfe19f | 2013-12-13 14:25:19 -0800 | [diff] [blame] | 71 | ThreadedRenderer(boolean translucent) { |
John Reck | 66f0be6 | 2014-05-13 13:39:31 -0700 | [diff] [blame] | 72 | AtlasInitializer.sInstance.init(); |
| 73 | |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 74 | long rootNodePtr = nCreateRootRenderNode(); |
| 75 | mRootNode = RenderNode.adopt(rootNodePtr); |
John Reck | bc0cc02 | 2014-04-11 16:08:14 -0700 | [diff] [blame] | 76 | mRootNode.setClipToBounds(false); |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 77 | mNativeProxy = nCreateProxy(translucent, rootNodePtr); |
John Reck | 18f16e6 | 2014-05-02 16:46:41 -0700 | [diff] [blame] | 78 | |
| 79 | // Setup timing |
| 80 | mChoreographer = Choreographer.getInstance(); |
| 81 | nSetFrameInterval(mNativeProxy, mChoreographer.getFrameIntervalNanos()); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | @Override |
| 85 | void destroy(boolean full) { |
John Reck | f7d9c1d | 2014-04-09 10:01:03 -0700 | [diff] [blame] | 86 | mInitialized = false; |
| 87 | updateEnabledState(null); |
John Reck | fae904d | 2014-04-14 11:01:57 -0700 | [diff] [blame] | 88 | nDestroyCanvasAndSurface(mNativeProxy); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 89 | } |
| 90 | |
John Reck | f7d9c1d | 2014-04-09 10:01:03 -0700 | [diff] [blame] | 91 | private void updateEnabledState(Surface surface) { |
| 92 | if (surface == null || !surface.isValid()) { |
| 93 | setEnabled(false); |
| 94 | } else { |
| 95 | setEnabled(mInitialized); |
| 96 | } |
| 97 | } |
| 98 | |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 99 | @Override |
| 100 | boolean initialize(Surface surface) throws OutOfResourcesException { |
John Reck | f7d9c1d | 2014-04-09 10:01:03 -0700 | [diff] [blame] | 101 | mInitialized = true; |
| 102 | updateEnabledState(surface); |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 103 | return nInitialize(mNativeProxy, surface); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | @Override |
| 107 | void updateSurface(Surface surface) throws OutOfResourcesException { |
John Reck | f7d9c1d | 2014-04-09 10:01:03 -0700 | [diff] [blame] | 108 | updateEnabledState(surface); |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 109 | nUpdateSurface(mNativeProxy, surface); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | @Override |
John Reck | f7d9c1d | 2014-04-09 10:01:03 -0700 | [diff] [blame] | 113 | void pauseSurface(Surface surface) { |
| 114 | nPauseSurface(mNativeProxy, surface); |
| 115 | } |
| 116 | |
| 117 | @Override |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 118 | void destroyHardwareResources(View view) { |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 119 | destroyResources(view); |
| 120 | // TODO: GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS); |
| 121 | } |
| 122 | |
| 123 | private static void destroyResources(View view) { |
| 124 | view.destroyHardwareResources(); |
| 125 | |
| 126 | if (view instanceof ViewGroup) { |
| 127 | ViewGroup group = (ViewGroup) view; |
| 128 | |
| 129 | int count = group.getChildCount(); |
| 130 | for (int i = 0; i < count; i++) { |
| 131 | destroyResources(group.getChildAt(i)); |
| 132 | } |
| 133 | } |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | @Override |
| 137 | void invalidate(Surface surface) { |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 138 | updateSurface(surface); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | @Override |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 142 | boolean safelyRun(Runnable action) { |
John Reck | fc53ef27 | 2014-02-11 10:40:25 -0800 | [diff] [blame] | 143 | nRunWithGlContext(mNativeProxy, action); |
| 144 | return true; |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | @Override |
Chris Craik | 797b95b | 2014-05-20 18:10:25 -0700 | [diff] [blame^] | 148 | void setup(int width, int height, float lightX, float lightY, float lightZ, float lightRadius) { |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 149 | mWidth = width; |
| 150 | mHeight = height; |
John Reck | bc0cc02 | 2014-04-11 16:08:14 -0700 | [diff] [blame] | 151 | mRootNode.setLeftTopRightBottom(0, 0, mWidth, mHeight); |
Chris Craik | 797b95b | 2014-05-20 18:10:25 -0700 | [diff] [blame^] | 152 | nSetup(mNativeProxy, width, height, lightX, lightY, lightZ, lightRadius); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | @Override |
John Reck | 63a0667 | 2014-05-07 13:45:54 -0700 | [diff] [blame] | 156 | void setOpaque(boolean opaque) { |
| 157 | nSetOpaque(mNativeProxy, opaque); |
| 158 | } |
| 159 | |
| 160 | @Override |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 161 | int getWidth() { |
| 162 | return mWidth; |
| 163 | } |
| 164 | |
| 165 | @Override |
| 166 | int getHeight() { |
| 167 | return mHeight; |
| 168 | } |
| 169 | |
| 170 | @Override |
| 171 | void dumpGfxInfo(PrintWriter pw) { |
| 172 | // TODO Auto-generated method stub |
| 173 | } |
| 174 | |
| 175 | @Override |
| 176 | long getFrameCount() { |
| 177 | // TODO Auto-generated method stub |
| 178 | return 0; |
| 179 | } |
| 180 | |
| 181 | @Override |
| 182 | boolean loadSystemProperties() { |
John Reck | e4280ba | 2014-05-05 16:39:37 -0700 | [diff] [blame] | 183 | return nLoadSystemProperties(mNativeProxy); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 184 | } |
| 185 | |
John Reck | bc0cc02 | 2014-04-11 16:08:14 -0700 | [diff] [blame] | 186 | private void updateRootDisplayList(View view, HardwareDrawCallbacks callbacks) { |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 187 | view.mPrivateFlags |= View.PFLAG_DRAWN; |
| 188 | |
| 189 | view.mRecreateDisplayList = (view.mPrivateFlags & View.PFLAG_INVALIDATED) |
| 190 | == View.PFLAG_INVALIDATED; |
| 191 | view.mPrivateFlags &= ~View.PFLAG_INVALIDATED; |
| 192 | |
| 193 | Trace.traceBegin(Trace.TRACE_TAG_VIEW, "getDisplayList"); |
John Reck | bc0cc02 | 2014-04-11 16:08:14 -0700 | [diff] [blame] | 194 | HardwareCanvas canvas = mRootNode.start(mWidth, mHeight); |
John Reck | 05e8584 | 2014-04-23 14:48:28 -0700 | [diff] [blame] | 195 | try { |
John Reck | 86faf9e | 2014-05-19 13:19:07 -0700 | [diff] [blame] | 196 | canvas.save(); |
Alan Viverette | d5b2ec4 | 2014-05-17 16:34:09 -0700 | [diff] [blame] | 197 | callbacks.onHardwarePreDraw(canvas); |
John Reck | 05e8584 | 2014-04-23 14:48:28 -0700 | [diff] [blame] | 198 | canvas.drawDisplayList(view.getDisplayList()); |
| 199 | callbacks.onHardwarePostDraw(canvas); |
John Reck | 86faf9e | 2014-05-19 13:19:07 -0700 | [diff] [blame] | 200 | canvas.restore(); |
John Reck | 05e8584 | 2014-04-23 14:48:28 -0700 | [diff] [blame] | 201 | } finally { |
| 202 | mRootNode.end(canvas); |
| 203 | Trace.traceEnd(Trace.TRACE_TAG_VIEW); |
| 204 | } |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 205 | |
| 206 | view.mRecreateDisplayList = false; |
John Reck | bc0cc02 | 2014-04-11 16:08:14 -0700 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | @Override |
| 210 | void draw(View view, AttachInfo attachInfo, HardwareDrawCallbacks callbacks, Rect dirty) { |
| 211 | attachInfo.mIgnoreDirtyState = true; |
John Reck | 18f16e6 | 2014-05-02 16:46:41 -0700 | [diff] [blame] | 212 | long frameTimeNanos = mChoreographer.getFrameTimeNanos(); |
John Reck | 315c329 | 2014-05-09 19:21:04 -0700 | [diff] [blame] | 213 | attachInfo.mDrawingTime = frameTimeNanos / TimeUtils.NANOS_PER_MS; |
John Reck | bc0cc02 | 2014-04-11 16:08:14 -0700 | [diff] [blame] | 214 | |
| 215 | updateRootDisplayList(view, callbacks); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 216 | |
John Reck | 6313b92 | 2014-04-16 18:59:21 -0700 | [diff] [blame] | 217 | attachInfo.mIgnoreDirtyState = false; |
| 218 | |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 219 | if (dirty == null) { |
| 220 | dirty = NULL_RECT; |
| 221 | } |
John Reck | f9be779 | 2014-05-02 18:21:16 -0700 | [diff] [blame] | 222 | int syncResult = nSyncAndDrawFrame(mNativeProxy, frameTimeNanos, |
John Reck | 18f16e6 | 2014-05-02 16:46:41 -0700 | [diff] [blame] | 223 | dirty.left, dirty.top, dirty.right, dirty.bottom); |
John Reck | f9be779 | 2014-05-02 18:21:16 -0700 | [diff] [blame] | 224 | if ((syncResult & SYNC_INVALIDATE_REQUIRED) != 0) { |
| 225 | attachInfo.mViewRootImpl.invalidate(); |
| 226 | } |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | @Override |
Bo Liu | ae738a7 | 2014-04-27 16:22:04 -0700 | [diff] [blame] | 230 | void invokeFunctor(long functor, boolean waitForCompletion) { |
John Reck | 0d1f634 | 2014-03-28 20:30:27 -0700 | [diff] [blame] | 231 | nInvokeFunctor(mNativeProxy, functor, waitForCompletion); |
| 232 | } |
| 233 | |
| 234 | @Override |
John Reck | 19b6bcf | 2014-02-14 20:03:38 -0800 | [diff] [blame] | 235 | HardwareLayer createDisplayListLayer(int width, int height) { |
| 236 | long layer = nCreateDisplayListLayer(mNativeProxy, width, height); |
| 237 | return HardwareLayer.adoptDisplayListLayer(this, layer); |
| 238 | } |
| 239 | |
| 240 | @Override |
| 241 | HardwareLayer createTextureLayer() { |
| 242 | long layer = nCreateTextureLayer(mNativeProxy); |
| 243 | return HardwareLayer.adoptTextureLayer(this, layer); |
| 244 | } |
| 245 | |
| 246 | @Override |
| 247 | SurfaceTexture createSurfaceTexture(final HardwareLayer layer) { |
| 248 | final SurfaceTexture[] ret = new SurfaceTexture[1]; |
| 249 | nRunWithGlContext(mNativeProxy, new Runnable() { |
| 250 | @Override |
| 251 | public void run() { |
| 252 | ret[0] = layer.createSurfaceTexture(); |
| 253 | } |
| 254 | }); |
| 255 | return ret[0]; |
| 256 | } |
| 257 | |
| 258 | @Override |
| 259 | boolean copyLayerInto(final HardwareLayer layer, final Bitmap bitmap) { |
| 260 | return nCopyLayerInto(mNativeProxy, |
| 261 | layer.getDeferredLayerUpdater(), bitmap.mNativeBitmap); |
| 262 | } |
| 263 | |
| 264 | @Override |
| 265 | void pushLayerUpdate(HardwareLayer layer) { |
| 266 | // TODO: Remove this, it's not needed outside of GLRenderer |
| 267 | } |
| 268 | |
| 269 | @Override |
| 270 | void onLayerCreated(HardwareLayer layer) { |
| 271 | // TODO: Is this actually useful? |
| 272 | } |
| 273 | |
| 274 | @Override |
| 275 | void flushLayerUpdates() { |
| 276 | // TODO: Figure out what this should do or remove it |
| 277 | } |
| 278 | |
| 279 | @Override |
| 280 | void onLayerDestroyed(HardwareLayer layer) { |
| 281 | nDestroyLayer(mNativeProxy, layer.getDeferredLayerUpdater()); |
| 282 | } |
| 283 | |
| 284 | @Override |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 285 | void setName(String name) { |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 286 | } |
| 287 | |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 288 | @Override |
John Reck | 28ad7b5 | 2014-04-07 16:59:25 -0700 | [diff] [blame] | 289 | void fence() { |
| 290 | nFence(mNativeProxy); |
| 291 | } |
| 292 | |
| 293 | @Override |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 294 | protected void finalize() throws Throwable { |
| 295 | try { |
| 296 | nDeleteProxy(mNativeProxy); |
John Reck | 0ed751d | 2014-04-08 14:10:17 -0700 | [diff] [blame] | 297 | mNativeProxy = 0; |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 298 | } finally { |
| 299 | super.finalize(); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 300 | } |
| 301 | } |
| 302 | |
John Reck | 66f0be6 | 2014-05-13 13:39:31 -0700 | [diff] [blame] | 303 | private static class AtlasInitializer { |
| 304 | static AtlasInitializer sInstance = new AtlasInitializer(); |
| 305 | |
| 306 | private boolean mInitialized = false; |
| 307 | |
| 308 | private AtlasInitializer() {} |
| 309 | |
| 310 | synchronized void init() { |
| 311 | if (mInitialized) return; |
| 312 | IBinder binder = ServiceManager.getService("assetatlas"); |
| 313 | if (binder == null) return; |
| 314 | |
| 315 | IAssetAtlas atlas = IAssetAtlas.Stub.asInterface(binder); |
| 316 | try { |
| 317 | if (atlas.isCompatible(android.os.Process.myPpid())) { |
| 318 | GraphicBuffer buffer = atlas.getBuffer(); |
| 319 | if (buffer != null) { |
| 320 | long[] map = atlas.getMap(); |
| 321 | if (map != null) { |
| 322 | nSetAtlas(buffer, map); |
| 323 | mInitialized = true; |
| 324 | } |
| 325 | // If IAssetAtlas is not the same class as the IBinder |
| 326 | // we are using a remote service and we can safely |
| 327 | // destroy the graphic buffer |
| 328 | if (atlas.getClass() != binder.getClass()) { |
| 329 | buffer.destroy(); |
| 330 | } |
| 331 | } |
| 332 | } |
| 333 | } catch (RemoteException e) { |
| 334 | Log.w(LOG_TAG, "Could not acquire atlas", e); |
| 335 | } |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | private static native void nSetAtlas(GraphicBuffer buffer, long[] map); |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 340 | |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 341 | private static native long nCreateRootRenderNode(); |
| 342 | private static native long nCreateProxy(boolean translucent, long rootRenderNode); |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 343 | private static native void nDeleteProxy(long nativeProxy); |
| 344 | |
John Reck | 18f16e6 | 2014-05-02 16:46:41 -0700 | [diff] [blame] | 345 | private static native void nSetFrameInterval(long nativeProxy, long frameIntervalNanos); |
John Reck | e4280ba | 2014-05-05 16:39:37 -0700 | [diff] [blame] | 346 | private static native boolean nLoadSystemProperties(long nativeProxy); |
John Reck | 18f16e6 | 2014-05-02 16:46:41 -0700 | [diff] [blame] | 347 | |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 348 | private static native boolean nInitialize(long nativeProxy, Surface window); |
| 349 | private static native void nUpdateSurface(long nativeProxy, Surface window); |
John Reck | f7d9c1d | 2014-04-09 10:01:03 -0700 | [diff] [blame] | 350 | private static native void nPauseSurface(long nativeProxy, Surface window); |
Chris Craik | 797b95b | 2014-05-20 18:10:25 -0700 | [diff] [blame^] | 351 | private static native void nSetup(long nativeProxy, int width, int height, |
| 352 | float lightX, float lightY, float lightZ, float lightRadius); |
John Reck | 63a0667 | 2014-05-07 13:45:54 -0700 | [diff] [blame] | 353 | private static native void nSetOpaque(long nativeProxy, boolean opaque); |
John Reck | f9be779 | 2014-05-02 18:21:16 -0700 | [diff] [blame] | 354 | private static native int nSyncAndDrawFrame(long nativeProxy, long frameTimeNanos, |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 355 | int dirtyLeft, int dirtyTop, int dirtyRight, int dirtyBottom); |
John Reck | fc53ef27 | 2014-02-11 10:40:25 -0800 | [diff] [blame] | 356 | private static native void nRunWithGlContext(long nativeProxy, Runnable runnable); |
John Reck | fae904d | 2014-04-14 11:01:57 -0700 | [diff] [blame] | 357 | private static native void nDestroyCanvasAndSurface(long nativeProxy); |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 358 | |
John Reck | 0d1f634 | 2014-03-28 20:30:27 -0700 | [diff] [blame] | 359 | private static native void nInvokeFunctor(long nativeProxy, long functor, boolean waitForCompletion); |
John Reck | 19b6bcf | 2014-02-14 20:03:38 -0800 | [diff] [blame] | 360 | |
| 361 | private static native long nCreateDisplayListLayer(long nativeProxy, int width, int height); |
| 362 | private static native long nCreateTextureLayer(long nativeProxy); |
| 363 | private static native boolean nCopyLayerInto(long nativeProxy, long layer, long bitmap); |
| 364 | private static native void nDestroyLayer(long nativeProxy, long layer); |
John Reck | 28ad7b5 | 2014-04-07 16:59:25 -0700 | [diff] [blame] | 365 | |
| 366 | private static native void nFence(long nativeProxy); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 367 | } |