1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 // vim:set ts=2 sts=2 sw=2 et cin:
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef AndroidNativeWindow_h__
8 #define AndroidNativeWindow_h__
9 #ifdef MOZ_WIDGET_ANDROID
14 #include "nsISupports.h"
15 #include "mozilla/TypedEnum.h"
16 #include "mozilla/gfx/2D.h"
22 MOZ_BEGIN_ENUM_CLASS(AndroidWindowFormat
)
27 MOZ_END_ENUM_CLASS(AndroidWindowFormat
)
30 * This class is a wrapper around Android's SurfaceTexture class.
31 * Usage is pretty much exactly like the Java class, so see
32 * the Android documentation for details.
34 class AndroidNativeWindow
{
35 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AndroidNativeWindow
)
39 static AndroidNativeWindow
* CreateFromSurface(JNIEnv
* aEnv
, jobject aSurface
);
42 AndroidWindowFormat
Format();
44 bool SetBuffersGeometry(int32_t aWidth
, int32_t aHeight
, AndroidWindowFormat aFormat
);
46 bool Lock(void** out_bits
, int32_t* out_width
, int32_t* out_height
, int32_t* out_stride
, AndroidWindowFormat
* out_format
);
49 void* Handle() { return mWindow
; }
52 AndroidNativeWindow(void* aWindow
)
58 virtual ~AndroidNativeWindow();