media/omx-plugin/include/ics/android/native_window.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:eb2ea4e87a07
1 /*
2 * Copyright (C) 2010 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_NATIVE_WINDOW_H
18 #define ANDROID_NATIVE_WINDOW_H
19
20 #include <android/rect.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /*
27 * Pixel formats that a window can use.
28 */
29 enum {
30 WINDOW_FORMAT_RGBA_8888 = 1,
31 WINDOW_FORMAT_RGBX_8888 = 2,
32 WINDOW_FORMAT_RGB_565 = 4,
33 };
34
35 struct ANativeWindow;
36 typedef struct ANativeWindow ANativeWindow;
37
38 typedef struct ANativeWindow_Buffer {
39 // The number of pixels that are show horizontally.
40 int32_t width;
41
42 // The number of pixels that are shown vertically.
43 int32_t height;
44
45 // The number of *pixels* that a line in the buffer takes in
46 // memory. This may be >= width.
47 int32_t stride;
48
49 // The format of the buffer. One of WINDOW_FORMAT_*
50 int32_t format;
51
52 // The actual bits.
53 void* bits;
54
55 // Do not touch.
56 uint32_t reserved[6];
57 } ANativeWindow_Buffer;
58
59 /**
60 * Acquire a reference on the given ANativeWindow object. This prevents the object
61 * from being deleted until the reference is removed.
62 */
63 void ANativeWindow_acquire(ANativeWindow* window);
64
65 /**
66 * Remove a reference that was previously acquired with ANativeWindow_acquire().
67 */
68 void ANativeWindow_release(ANativeWindow* window);
69
70 /*
71 * Return the current width in pixels of the window surface. Returns a
72 * negative value on error.
73 */
74 int32_t ANativeWindow_getWidth(ANativeWindow* window);
75
76 /*
77 * Return the current height in pixels of the window surface. Returns a
78 * negative value on error.
79 */
80 int32_t ANativeWindow_getHeight(ANativeWindow* window);
81
82 /*
83 * Return the current pixel format of the window surface. Returns a
84 * negative value on error.
85 */
86 int32_t ANativeWindow_getFormat(ANativeWindow* window);
87
88 /*
89 * Change the format and size of the window buffers.
90 *
91 * The width and height control the number of pixels in the buffers, not the
92 * dimensions of the window on screen. If these are different than the
93 * window's physical size, then it buffer will be scaled to match that size
94 * when compositing it to the screen.
95 *
96 * For all of these parameters, if 0 is supplied then the window's base
97 * value will come back in force.
98 *
99 * width and height must be either both zero or both non-zero.
100 *
101 */
102 int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window,
103 int32_t width, int32_t height, int32_t format);
104
105 /**
106 * Lock the window's next drawing surface for writing.
107 * inOutDirtyBounds is used as an in/out parameter, upon entering the
108 * function, it contains the dirty region, that is, the region the caller
109 * intends to redraw. When the function returns, inOutDirtyBounds is updated
110 * with the actual area the caller needs to redraw -- this region is often
111 * extended by ANativeWindow_lock.
112 */
113 int32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffer,
114 ARect* inOutDirtyBounds);
115
116 /**
117 * Unlock the window's drawing surface after previously locking it,
118 * posting the new buffer to the display.
119 */
120 int32_t ANativeWindow_unlockAndPost(ANativeWindow* window);
121
122 #ifdef __cplusplus
123 };
124 #endif
125
126 #endif // ANDROID_NATIVE_WINDOW_H

mercurial