OLD | NEW |
| (Empty) |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package org.chromium.ui.gfx; | |
6 | |
7 import android.graphics.SurfaceTexture; | |
8 import android.os.Build; | |
9 | |
10 import org.chromium.base.CalledByNative; | |
11 import org.chromium.base.JNINamespace; | |
12 | |
13 /** | |
14 * Wrapper class for the underlying platform's SurfaceTexture in order to | |
15 * provide a stable JNI API. | |
16 */ | |
17 @JNINamespace("gfx") | |
18 class SurfaceTexturePlatformWrapper { | |
19 @CalledByNative | |
20 private static SurfaceTexture create(int textureId) { | |
21 return new SurfaceTexture(textureId); | |
22 } | |
23 | |
24 @CalledByNative | |
25 private static void destroy(SurfaceTexture surfaceTexture) { | |
26 surfaceTexture.setOnFrameAvailableListener(null); | |
27 surfaceTexture.release(); | |
28 } | |
29 | |
30 @CalledByNative | |
31 private static void setFrameAvailableCallback(SurfaceTexture surfaceTexture, | |
32 int nativeSurfaceTextureListener) { | |
33 surfaceTexture.setOnFrameAvailableListener( | |
34 new SurfaceTextureListener(nativeSurfaceTextureListener)); | |
35 } | |
36 | |
37 @CalledByNative | |
38 private static void updateTexImage(SurfaceTexture surfaceTexture) { | |
39 surfaceTexture.updateTexImage(); | |
40 } | |
41 | |
42 @CalledByNative | |
43 private static void setDefaultBufferSize(SurfaceTexture surfaceTexture, int
width, | |
44 int height) { | |
45 surfaceTexture.setDefaultBufferSize(width, height); | |
46 } | |
47 | |
48 @CalledByNative | |
49 private static void getTransformMatrix(SurfaceTexture surfaceTexture, float[
] matrix) { | |
50 surfaceTexture.getTransformMatrix(matrix); | |
51 } | |
52 | |
53 @CalledByNative | |
54 private static void attachToGLContext(SurfaceTexture surfaceTexture, int tex
Name) { | |
55 assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN; | |
56 surfaceTexture.attachToGLContext(texName); | |
57 } | |
58 | |
59 @CalledByNative | |
60 private static void detachFromGLContext(SurfaceTexture surfaceTexture) { | |
61 assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN; | |
62 surfaceTexture.detachFromGLContext(); | |
63 } | |
64 } | |
OLD | NEW |