2017-10-27 22:55:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2014-10-17 23:34:01 +00:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
|
|
|
|
2014-10-21 13:53:00 +00:00
|
|
|
#include "AndroidSurfaceTexture.h"
|
2014-10-17 23:34:01 +00:00
|
|
|
|
|
|
|
using namespace mozilla;
|
2014-10-21 13:53:00 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gl {
|
2014-10-17 23:34:01 +00:00
|
|
|
|
|
|
|
void
|
2017-09-29 21:06:35 +00:00
|
|
|
AndroidSurfaceTexture::GetTransformMatrix(java::sdk::SurfaceTexture::Param surfaceTexture,
|
|
|
|
gfx::Matrix4x4* outMatrix)
|
2014-10-17 23:34:01 +00:00
|
|
|
{
|
2015-08-13 04:53:39 +00:00
|
|
|
JNIEnv* const env = jni::GetEnvForThread();
|
2014-11-13 18:47:24 +00:00
|
|
|
|
2016-08-23 22:52:30 +00:00
|
|
|
auto jarray = jni::FloatArray::LocalRef::Adopt(env, env->NewFloatArray(16));
|
2017-09-29 21:06:35 +00:00
|
|
|
surfaceTexture->GetTransformMatrix(jarray);
|
2014-11-13 18:47:24 +00:00
|
|
|
|
2015-01-10 00:33:57 +00:00
|
|
|
jfloat* array = env->GetFloatArrayElements(jarray.Get(), nullptr);
|
2014-11-13 18:47:24 +00:00
|
|
|
|
2017-09-29 21:06:35 +00:00
|
|
|
memcpy(&(outMatrix->_11), array, sizeof(float)*16);
|
2014-11-13 18:47:24 +00:00
|
|
|
|
2015-01-10 00:33:57 +00:00
|
|
|
env->ReleaseFloatArrayElements(jarray.Get(), array, 0);
|
2014-10-17 23:34:01 +00:00
|
|
|
}
|
|
|
|
|
2014-10-21 13:53:00 +00:00
|
|
|
} // gl
|
|
|
|
} // mozilla
|
2014-10-17 23:34:01 +00:00
|
|
|
#endif // MOZ_WIDGET_ANDROID
|