blob: 058479a2a6e4b897665755ef83b71711bb61d6f6 [file] [log] [blame]
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -07001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_EGL_NATIVE_WINDOW_SURFACE_H
18#define ANDROID_EGL_NATIVE_WINDOW_SURFACE_H
19
20#include <stdint.h>
21#include <sys/types.h>
22#include <ui/EGLNativeSurface.h>
23
24// ---------------------------------------------------------------------------
25namespace android {
26// ---------------------------------------------------------------------------
27
28class Surface;
29
30class EGLNativeWindowSurface : public EGLNativeSurface<EGLNativeWindowSurface>
31{
32public:
33 EGLNativeWindowSurface(const sp<Surface>& surface);
34 ~EGLNativeWindowSurface();
35
36private:
37 static void hook_incRef(NativeWindowType window);
38 static void hook_decRef(NativeWindowType window);
39 static uint32_t hook_swapBuffers(NativeWindowType window);
40 static uint32_t hook_nextBuffer(NativeWindowType window);
41 static void hook_setSwapRectangle(NativeWindowType window, int l, int t, int w, int h);
42 static void hook_connect(NativeWindowType window);
43 static void hook_disconnect(NativeWindowType window);
44
45 uint32_t swapBuffers();
46 uint32_t nextBuffer();
47 void setSwapRectangle(int l, int t, int w, int h);
48 void connect();
49 void disconnect();
50
51 sp<Surface> mSurface;
52 bool mConnected;
53};
54
55// ---------------------------------------------------------------------------
56}; // namespace android
57// ---------------------------------------------------------------------------
58
59#endif // ANDROID_EGL_NATIVE_WINDOW_SURFACE_H
60