summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-11-17 15:19:21 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-11-17 15:19:23 +0000
commitb3ec64e1005c82d41b6d1a1d86b6933fd25d87d2 (patch)
treea2bf0ea168d7508773bf61f5d63b93b062c04ef7 /core/jni
parent99cc4d2ed14442aa142463ebb26762d8808daa68 (diff)
parentb35c9602cf5c628c621e4fe102a461505f302bfe (diff)
downloadframeworks_base-b3ec64e1005c82d41b6d1a1d86b6933fd25d87d2.zip
frameworks_base-b3ec64e1005c82d41b6d1a1d86b6933fd25d87d2.tar.gz
frameworks_base-b3ec64e1005c82d41b6d1a1d86b6933fd25d87d2.tar.bz2
Merge "Wire up surface width/height to lockHardwareCanvas" into lmp-mr1-dev
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android_view_Surface.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index a0b2ca8..a39ff8e 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -357,6 +357,22 @@ static void nativeWriteToParcel(JNIEnv* env, jclass clazz,
parcel->writeStrongBinder( self != 0 ? self->getIGraphicBufferProducer()->asBinder() : NULL);
}
+static jint nativeGetWidth(JNIEnv* env, jclass clazz, jlong nativeObject) {
+ Surface* surface = reinterpret_cast<Surface*>(nativeObject);
+ ANativeWindow* anw = static_cast<ANativeWindow*>(surface);
+ int value = 0;
+ anw->query(anw, NATIVE_WINDOW_WIDTH, &value);
+ return value;
+}
+
+static jint nativeGetHeight(JNIEnv* env, jclass clazz, jlong nativeObject) {
+ Surface* surface = reinterpret_cast<Surface*>(nativeObject);
+ ANativeWindow* anw = static_cast<ANativeWindow*>(surface);
+ int value = 0;
+ anw->query(anw, NATIVE_WINDOW_HEIGHT, &value);
+ return value;
+}
+
namespace uirenderer {
using namespace android::uirenderer::renderthread;
@@ -426,6 +442,8 @@ static JNINativeMethod gSurfaceMethods[] = {
(void*)nativeReadFromParcel },
{"nativeWriteToParcel", "(JLandroid/os/Parcel;)V",
(void*)nativeWriteToParcel },
+ {"nativeGetWidth", "(J)I", (void*)nativeGetWidth },
+ {"nativeGetHeight", "(J)I", (void*)nativeGetHeight },
// HWUI context
{"nHwuiCreate", "(JJ)J", (void*) hwui::create },