Romain Guy | 8f0095c | 2011-05-02 17:24:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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 | #include "jni.h" |
| 18 | #include <nativehelper/JNIHelp.h> |
| 19 | #include <android_runtime/AndroidRuntime.h> |
| 20 | |
| 21 | #include <gui/SurfaceTexture.h> |
| 22 | |
| 23 | namespace android { |
| 24 | |
| 25 | // ---------------------------------------------------------------------------- |
| 26 | // Native layer |
| 27 | // ---------------------------------------------------------------------------- |
| 28 | |
| 29 | static void android_view_TextureView_setDefaultBufferSize(JNIEnv* env, jobject, |
| 30 | jint surfaceTexture, jint width, jint height) { |
| 31 | |
| 32 | sp<SurfaceTexture> surface = reinterpret_cast<SurfaceTexture*>(surfaceTexture); |
| 33 | surface->setDefaultBufferSize(width, height); |
| 34 | } |
| 35 | |
| 36 | // ---------------------------------------------------------------------------- |
| 37 | // JNI Glue |
| 38 | // ---------------------------------------------------------------------------- |
| 39 | |
| 40 | const char* const kClassPathName = "android/view/TextureView"; |
| 41 | |
| 42 | static JNINativeMethod gMethods[] = { |
| 43 | { "nSetDefaultBufferSize", "(III)V", (void*) android_view_TextureView_setDefaultBufferSize } |
| 44 | }; |
| 45 | |
| 46 | int register_android_view_TextureView(JNIEnv* env) { |
| 47 | return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods)); |
| 48 | } |
| 49 | |
| 50 | }; |