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 #include "NativeSubWindow.h"
17 #include <android/native_window.h>
18 
19 #include <stdio.h>
20 
createSubWindow(FBNativeWindowType p_window,int x,int y,int width,int height,float dpr,SubWindowRepaintCallback repaint_callback,void * repaint_callback_param,int hideWindow)21 EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
22                                     int x,
23                                     int y,
24                                     int width,
25                                     int height,
26                                     float dpr,
27                                     SubWindowRepaintCallback repaint_callback,
28                                     void* repaint_callback_param,
29                                     int hideWindow) {
30     ANativeWindow_acquire(p_window);
31     ANativeWindow_setBuffersGeometry(p_window, width, height, AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM);
32     return p_window;
33 }
34 
destroySubWindow(EGLNativeWindowType win)35 void destroySubWindow(EGLNativeWindowType win) {
36     ANativeWindow_release(win);
37 }
38 
moveSubWindow(FBNativeWindowType p_parent_window,EGLNativeWindowType p_sub_window,int x,int y,int width,int height,float dpr)39 int moveSubWindow(FBNativeWindowType p_parent_window,
40                   EGLNativeWindowType p_sub_window,
41                   int x,
42                   int y,
43                   int width,
44                   int height,
45                   float dpr) {
46     // moving windows not supported in Android; we can't create an actual sub window
47     return true;
48 }
49