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