2017-10-28 01:55:37 +03: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-18 03:34:01 +04:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
|
|
|
|
2014-10-21 17:53:00 +04:00
|
|
|
#include "AndroidSurfaceTexture.h"
|
2014-10-18 03:34:01 +04:00
|
|
|
|
|
|
|
using namespace mozilla;
|
2014-10-21 17:53:00 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gl {
|
2014-10-18 03:34:01 +04:00
|
|
|
|
|
|
|
void
|
2017-09-30 00:06:35 +03:00
|
|
|
AndroidSurfaceTexture::GetTransformMatrix(java::sdk::SurfaceTexture::Param surfaceTexture,
|
|
|
|
gfx::Matrix4x4* outMatrix)
|
2014-10-18 03:34:01 +04:00
|
|
|
{
|
2015-08-13 07:53:39 +03:00
|
|
|
JNIEnv* const env = jni::GetEnvForThread();
|
2014-11-13 21:47:24 +03:00
|
|
|
|
2016-08-24 01:52:30 +03:00
|
|
|
auto jarray = jni::FloatArray::LocalRef::Adopt(env, env->NewFloatArray(16));
|
2017-09-30 00:06:35 +03:00
|
|
|
surfaceTexture->GetTransformMatrix(jarray);
|
2014-11-13 21:47:24 +03:00
|
|
|
|
2015-01-10 03:33:57 +03:00
|
|
|
jfloat* array = env->GetFloatArrayElements(jarray.Get(), nullptr);
|
2014-11-13 21:47:24 +03:00
|
|
|
|
2017-09-30 00:06:35 +03:00
|
|
|
memcpy(&(outMatrix->_11), array, sizeof(float)*16);
|
2014-11-13 21:47:24 +03:00
|
|
|
|
2015-01-10 03:33:57 +03:00
|
|
|
env->ReleaseFloatArrayElements(jarray.Get(), array, 0);
|
2014-10-18 03:34:01 +04:00
|
|
|
}
|
|
|
|
|
2014-10-21 17:53:00 +04:00
|
|
|
} // gl
|
|
|
|
} // mozilla
|
2014-10-18 03:34:01 +04:00
|
|
|
#endif // MOZ_WIDGET_ANDROID
|