blob: 3494234636042202a212f2c87b61e912a920cedf [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>
The Android Open Source Projecta6938ba2009-02-10 15:44:00 -080023#include <EGL/egl.h>
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070024
25// ---------------------------------------------------------------------------
26namespace android {
27// ---------------------------------------------------------------------------
28
29class Surface;
30
31class EGLNativeWindowSurface : public EGLNativeSurface<EGLNativeWindowSurface>
32{
33public:
34 EGLNativeWindowSurface(const sp<Surface>& surface);
35 ~EGLNativeWindowSurface();
36
The Android Open Source Projecta6938ba2009-02-10 15:44:00 -080037 void setSwapRectangle(int l, int t, int w, int h);
38
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070039private:
40 static void hook_incRef(NativeWindowType window);
41 static void hook_decRef(NativeWindowType window);
42 static uint32_t hook_swapBuffers(NativeWindowType window);
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070043 static void hook_connect(NativeWindowType window);
44 static void hook_disconnect(NativeWindowType window);
45
46 uint32_t swapBuffers();
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070047 void connect();
48 void disconnect();
49
50 sp<Surface> mSurface;
51 bool mConnected;
52};
53
54// ---------------------------------------------------------------------------
55}; // namespace android
56// ---------------------------------------------------------------------------
57
58#endif // ANDROID_EGL_NATIVE_WINDOW_SURFACE_H
59