The Android Open Source Project | 7c1b96a | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | /* |
| 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 Project | a6938ba | 2009-02-10 15:44:00 -0800 | [diff] [blame] | 23 | #include <EGL/egl.h> |
The Android Open Source Project | 7c1b96a | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 24 | |
| 25 | // --------------------------------------------------------------------------- |
| 26 | namespace android { |
| 27 | // --------------------------------------------------------------------------- |
| 28 | |
| 29 | class Surface; |
| 30 | |
| 31 | class EGLNativeWindowSurface : public EGLNativeSurface<EGLNativeWindowSurface> |
| 32 | { |
| 33 | public: |
| 34 | EGLNativeWindowSurface(const sp<Surface>& surface); |
| 35 | ~EGLNativeWindowSurface(); |
| 36 | |
The Android Open Source Project | a6938ba | 2009-02-10 15:44:00 -0800 | [diff] [blame] | 37 | void setSwapRectangle(int l, int t, int w, int h); |
| 38 | |
The Android Open Source Project | 7c1b96a | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 39 | private: |
| 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 Project | 7c1b96a | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 43 | static void hook_connect(NativeWindowType window); |
| 44 | static void hook_disconnect(NativeWindowType window); |
| 45 | |
| 46 | uint32_t swapBuffers(); |
The Android Open Source Project | 7c1b96a | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 47 | 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 | |