am 9aba2324: Merge "Add getTransformMatrix to the SurfaceTexture API." into honeycomb
* commit '9aba2324ac8d7216732b42346bfcaf0be71eb22e': Add getTransformMatrix to the SurfaceTexture API.
This commit is contained in:
@@ -86209,6 +86209,19 @@
|
|||||||
<parameter name="texName" type="int">
|
<parameter name="texName" type="int">
|
||||||
</parameter>
|
</parameter>
|
||||||
</constructor>
|
</constructor>
|
||||||
|
<method name="getTransformMatrix"
|
||||||
|
return="void"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="mtx" type="float[]">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
<method name="setOnFrameAvailableListener"
|
<method name="setOnFrameAvailableListener"
|
||||||
return="void"
|
return="void"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
|
|||||||
@@ -82,6 +82,15 @@ static void SurfaceTexture_updateTexImage(JNIEnv* env, jobject clazz)
|
|||||||
surfaceTexture->updateTexImage();
|
surfaceTexture->updateTexImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SurfaceTexture_getTransformMatrix(JNIEnv* env, jobject clazz,
|
||||||
|
jfloatArray jmtx)
|
||||||
|
{
|
||||||
|
sp<SurfaceTexture> surfaceTexture(getSurfaceTexture(env, clazz));
|
||||||
|
float* mtx = env->GetFloatArrayElements(jmtx, NULL);
|
||||||
|
surfaceTexture->getTransformMatrix(mtx);
|
||||||
|
env->ReleaseFloatArrayElements(jmtx, mtx, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
const char* const kSurfaceTextureClassPathName = "android/graphics/SurfaceTexture";
|
const char* const kSurfaceTextureClassPathName = "android/graphics/SurfaceTexture";
|
||||||
@@ -91,6 +100,7 @@ static JNINativeMethod gSurfaceTextureMethods[] = {
|
|||||||
{"nativeClassInit", "()V", (void*)nativeClassInit },
|
{"nativeClassInit", "()V", (void*)nativeClassInit },
|
||||||
{"init", "(I)V", (void*)SurfaceTexture_init },
|
{"init", "(I)V", (void*)SurfaceTexture_init },
|
||||||
{"updateTexImage", "()V", (void*)SurfaceTexture_updateTexImage },
|
{"updateTexImage", "()V", (void*)SurfaceTexture_updateTexImage },
|
||||||
|
{"getTransformMatrixImpl", "([F)V", (void*)SurfaceTexture_getTransformMatrix },
|
||||||
};
|
};
|
||||||
|
|
||||||
static void nativeClassInit(JNIEnv* env, jclass clazz)
|
static void nativeClassInit(JNIEnv* env, jclass clazz)
|
||||||
|
|||||||
@@ -79,6 +79,31 @@ public class SurfaceTexture {
|
|||||||
*/
|
*/
|
||||||
public native void updateTexImage();
|
public native void updateTexImage();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the 4x4 texture coordinate transform matrix associated with the texture image set by
|
||||||
|
* the most recent call to updateTexImage.
|
||||||
|
*
|
||||||
|
* This transform matrix maps 2D homogeneous texture coordinates of the form (s, t, 0, 1) with s
|
||||||
|
* and t in the inclusive range [0, 1] to the texture coordinate that should be used to sample
|
||||||
|
* that location from the texture. Sampling the texture outside of the range of this transform
|
||||||
|
* is undefined.
|
||||||
|
*
|
||||||
|
* The matrix is stored in column-major order so that it may be passed directly to OpenGL ES via
|
||||||
|
* the glLoadMatrixf or glUniformMatrix4fv functions.
|
||||||
|
*
|
||||||
|
* @param mtx the array into which the 4x4 matrix will be stored. The array must have exactly
|
||||||
|
* 16 elements.
|
||||||
|
*/
|
||||||
|
public void getTransformMatrix(float[] mtx) {
|
||||||
|
if (mtx.length != 16) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
getTransformMatrixImpl(mtx);
|
||||||
|
}
|
||||||
|
|
||||||
|
private native void getTransformMatrixImpl(float[] mtx);
|
||||||
|
|
||||||
private native void init(int texName);
|
private native void init(int texName);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user