1 /* 2 * Copyright (C) 2011 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 #ifndef NATIVE_SUB_WINDOW_H 17 #define NATIVE_SUB_WINDOW_H 18 19 #include "render_api_platform_types.h" 20 21 #include <EGL/egl.h> 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 typedef void (*SubWindowRepaintCallback)(void*); 28 29 // Create a new sub-window that will be used to display the content of the 30 // emulated GPU on top of the regular UI window. 31 // |p_window| is the platform-specific handle to the main UI window. 32 // |x|, |y| is the position sub-window relative to the top-left corner of the 33 // main window. 34 // |width| and |height| are the dimensions of the sub-window, as well as of 35 // the emulated framebuffer. 36 // |repaint_callback| may be invoked every time the window has to be repainted 37 // (such as receiving a WM_PAINT event on Windows). If the provided argument is 38 // NULL, nothing will be invoked. 39 // |repaint_callback_param| an additional parameter that will be passed to the 40 // repaint callback when/if it's invoked. 41 // On success, return a new platform-specific window handle, cast as an 42 // EGLNativeWindowType. Or 0/NULL in case of failure. 43 EGLNativeWindowType createSubWindow(FBNativeWindowType p_window, 44 int x, 45 int y, 46 int width, 47 int height, 48 SubWindowRepaintCallback repaint_callback, 49 void* repaint_callback_param, 50 int hideWindow); 51 52 // Destroy a sub-window previously created through createSubWindow() above. 53 void destroySubWindow(EGLNativeWindowType win); 54 55 // Moves a sub-window previously created through createSubWindow() above. 56 // |p_parent_window| is the platform-specific handle to the main UI window. 57 // |p_sub_window| is the platform-specific handle to the EGL subwindow. 58 // |x|,|y|,|width|,|height| are the new location and dimensions of the 59 // subwindow. 60 int moveSubWindow(FBNativeWindowType p_parent_window, 61 EGLNativeWindowType p_sub_window, 62 int x, 63 int y, 64 int width, 65 int height); 66 67 #ifdef __cplusplus 68 } 69 #endif 70 71 #endif 72