1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/omx-plugin/include/ics/android/native_window.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,126 @@ 1.4 +/* 1.5 + * Copyright (C) 2010 The Android Open Source Project 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * Unless required by applicable law or agreed to in writing, software 1.14 + * distributed under the License is distributed on an "AS IS" BASIS, 1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.16 + * See the License for the specific language governing permissions and 1.17 + * limitations under the License. 1.18 + */ 1.19 + 1.20 +#ifndef ANDROID_NATIVE_WINDOW_H 1.21 +#define ANDROID_NATIVE_WINDOW_H 1.22 + 1.23 +#include <android/rect.h> 1.24 + 1.25 +#ifdef __cplusplus 1.26 +extern "C" { 1.27 +#endif 1.28 + 1.29 +/* 1.30 + * Pixel formats that a window can use. 1.31 + */ 1.32 +enum { 1.33 + WINDOW_FORMAT_RGBA_8888 = 1, 1.34 + WINDOW_FORMAT_RGBX_8888 = 2, 1.35 + WINDOW_FORMAT_RGB_565 = 4, 1.36 +}; 1.37 + 1.38 +struct ANativeWindow; 1.39 +typedef struct ANativeWindow ANativeWindow; 1.40 + 1.41 +typedef struct ANativeWindow_Buffer { 1.42 + // The number of pixels that are show horizontally. 1.43 + int32_t width; 1.44 + 1.45 + // The number of pixels that are shown vertically. 1.46 + int32_t height; 1.47 + 1.48 + // The number of *pixels* that a line in the buffer takes in 1.49 + // memory. This may be >= width. 1.50 + int32_t stride; 1.51 + 1.52 + // The format of the buffer. One of WINDOW_FORMAT_* 1.53 + int32_t format; 1.54 + 1.55 + // The actual bits. 1.56 + void* bits; 1.57 + 1.58 + // Do not touch. 1.59 + uint32_t reserved[6]; 1.60 +} ANativeWindow_Buffer; 1.61 + 1.62 +/** 1.63 + * Acquire a reference on the given ANativeWindow object. This prevents the object 1.64 + * from being deleted until the reference is removed. 1.65 + */ 1.66 +void ANativeWindow_acquire(ANativeWindow* window); 1.67 + 1.68 +/** 1.69 + * Remove a reference that was previously acquired with ANativeWindow_acquire(). 1.70 + */ 1.71 +void ANativeWindow_release(ANativeWindow* window); 1.72 + 1.73 +/* 1.74 + * Return the current width in pixels of the window surface. Returns a 1.75 + * negative value on error. 1.76 + */ 1.77 +int32_t ANativeWindow_getWidth(ANativeWindow* window); 1.78 + 1.79 +/* 1.80 + * Return the current height in pixels of the window surface. Returns a 1.81 + * negative value on error. 1.82 + */ 1.83 +int32_t ANativeWindow_getHeight(ANativeWindow* window); 1.84 + 1.85 +/* 1.86 + * Return the current pixel format of the window surface. Returns a 1.87 + * negative value on error. 1.88 + */ 1.89 +int32_t ANativeWindow_getFormat(ANativeWindow* window); 1.90 + 1.91 +/* 1.92 + * Change the format and size of the window buffers. 1.93 + * 1.94 + * The width and height control the number of pixels in the buffers, not the 1.95 + * dimensions of the window on screen. If these are different than the 1.96 + * window's physical size, then it buffer will be scaled to match that size 1.97 + * when compositing it to the screen. 1.98 + * 1.99 + * For all of these parameters, if 0 is supplied then the window's base 1.100 + * value will come back in force. 1.101 + * 1.102 + * width and height must be either both zero or both non-zero. 1.103 + * 1.104 + */ 1.105 +int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, 1.106 + int32_t width, int32_t height, int32_t format); 1.107 + 1.108 +/** 1.109 + * Lock the window's next drawing surface for writing. 1.110 + * inOutDirtyBounds is used as an in/out parameter, upon entering the 1.111 + * function, it contains the dirty region, that is, the region the caller 1.112 + * intends to redraw. When the function returns, inOutDirtyBounds is updated 1.113 + * with the actual area the caller needs to redraw -- this region is often 1.114 + * extended by ANativeWindow_lock. 1.115 + */ 1.116 +int32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffer, 1.117 + ARect* inOutDirtyBounds); 1.118 + 1.119 +/** 1.120 + * Unlock the window's drawing surface after previously locking it, 1.121 + * posting the new buffer to the display. 1.122 + */ 1.123 +int32_t ANativeWindow_unlockAndPost(ANativeWindow* window); 1.124 + 1.125 +#ifdef __cplusplus 1.126 +}; 1.127 +#endif 1.128 + 1.129 +#endif // ANDROID_NATIVE_WINDOW_H