Bumping manifests a=b2g-bump
[gecko.git] / gfx / gl / AndroidNativeWindow.h
blobd7aa8b192564584b4d7de606564f15d447c205f9
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
11 #include <jni.h>
12 #include "GLDefs.h"
14 #include "nsISupports.h"
15 #include "mozilla/TypedEnum.h"
16 #include "mozilla/gfx/2D.h"
19 namespace mozilla {
20 namespace gl {
22 MOZ_BEGIN_ENUM_CLASS(AndroidWindowFormat)
23 Unknown = -1,
24 RGBA_8888 = 1,
25 RGBX_8888 = 1 << 1,
26 RGB_565 = 1 << 2
27 MOZ_END_ENUM_CLASS(AndroidWindowFormat)
29 /**
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)
37 public:
39 static AndroidNativeWindow* CreateFromSurface(JNIEnv* aEnv, jobject aSurface);
41 gfx::IntSize Size();
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);
47 bool UnlockAndPost();
49 void* Handle() { return mWindow; }
51 protected:
52 AndroidNativeWindow(void* aWindow)
53 : mWindow(aWindow)
58 virtual ~AndroidNativeWindow();
60 void* mWindow;
67 #endif
68 #endif