Autogenerated with:
cp dom/.clang-format gfx/ && mach format gfx/**.{cpp,h,mm}
Manual changes:
* OSVRSession headers are not system headers and they are not
standalone / rely on stdint, so tweaked to preserve previous
ordering.
* Missing include in GLDefs.h
* Missing include in gfxOTSUtils.
* Need to keep the windows header order in DCLayerTree.
* missing hb_font include in MockScaledFont.h
Differential Revision: https://phabricator.services.mozilla.com/D311695
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
/* 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/. */
|
|
|
|
#ifndef AndroidNativeWindow_h_
|
|
#define AndroidNativeWindow_h_
|
|
|
|
#include <android/native_window.h>
|
|
#include <android/native_window_jni.h>
|
|
#include <jni.h>
|
|
|
|
#include "SurfaceTexture.h"
|
|
#include "mozilla/java/GeckoSurfaceWrappers.h"
|
|
|
|
namespace mozilla {
|
|
namespace gl {
|
|
|
|
class AndroidNativeWindow final {
|
|
public:
|
|
AndroidNativeWindow() : mNativeWindow(nullptr) {}
|
|
|
|
explicit AndroidNativeWindow(java::sdk::Surface::Param aSurface) {
|
|
mNativeWindow =
|
|
ANativeWindow_fromSurface(jni::GetEnvForThread(), aSurface.Get());
|
|
}
|
|
|
|
explicit AndroidNativeWindow(java::GeckoSurface::Param aSurface) {
|
|
java::sdk::Surface::LocalRef surf = aSurface->GetSurface();
|
|
mNativeWindow =
|
|
ANativeWindow_fromSurface(jni::GetEnvForThread(), surf.Get());
|
|
}
|
|
|
|
~AndroidNativeWindow() {
|
|
if (mNativeWindow) {
|
|
ANativeWindow_release(mNativeWindow);
|
|
mNativeWindow = nullptr;
|
|
}
|
|
}
|
|
|
|
ANativeWindow* NativeWindow() const { return mNativeWindow; }
|
|
|
|
private:
|
|
ANativeWindow* mNativeWindow;
|
|
};
|
|
|
|
} // namespace gl
|
|
} // namespace mozilla
|
|
|
|
#endif // AndroidNativeWindow_h_
|