mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 17:55:50 +00:00
5de9b3dc5f
This allows us to allocate an Android SurfaceTexture in the compositor process as well as an accompanying Surface. We can then transfer the Surface back to the content process via binder, where it can be used for things like WebGL and video decoding. Each SurfaceTexture/Surface pair has a unique handle. We use this handle in layer transactions to locate the SurfaceTexture for a given Surface and composite it appropriately. MozReview-Commit-ID: 68VSbXdfsMH
47 lines
1.0 KiB
C++
47 lines
1.0 KiB
C++
#ifdef MOZ_WIDGET_ANDROID
|
|
|
|
#include "AndroidSurfaceTexture.h"
|
|
|
|
using namespace mozilla;
|
|
|
|
namespace mozilla {
|
|
namespace gl {
|
|
|
|
void
|
|
AndroidSurfaceTexture::GetTransformMatrix(java::sdk::SurfaceTexture::LocalRef aSurfaceTexture,
|
|
gfx::Matrix4x4& aMatrix)
|
|
{
|
|
JNIEnv* const env = jni::GetEnvForThread();
|
|
|
|
auto jarray = jni::FloatArray::LocalRef::Adopt(env, env->NewFloatArray(16));
|
|
aSurfaceTexture->GetTransformMatrix(jarray);
|
|
|
|
jfloat* array = env->GetFloatArrayElements(jarray.Get(), nullptr);
|
|
|
|
aMatrix._11 = array[0];
|
|
aMatrix._12 = array[1];
|
|
aMatrix._13 = array[2];
|
|
aMatrix._14 = array[3];
|
|
|
|
aMatrix._21 = array[4];
|
|
aMatrix._22 = array[5];
|
|
aMatrix._23 = array[6];
|
|
aMatrix._24 = array[7];
|
|
|
|
aMatrix._31 = array[8];
|
|
aMatrix._32 = array[9];
|
|
aMatrix._33 = array[10];
|
|
aMatrix._34 = array[11];
|
|
|
|
aMatrix._41 = array[12];
|
|
aMatrix._42 = array[13];
|
|
aMatrix._43 = array[14];
|
|
aMatrix._44 = array[15];
|
|
|
|
env->ReleaseFloatArrayElements(jarray.Get(), array, 0);
|
|
}
|
|
|
|
} // gl
|
|
} // mozilla
|
|
#endif // MOZ_WIDGET_ANDROID
|