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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /*
michael@0 2 * Copyright (C) 2010 The Android Open Source Project
michael@0 3 *
michael@0 4 * Licensed under the Apache License, Version 2.0 (the "License");
michael@0 5 * you may not use this file except in compliance with the License.
michael@0 6 * You may obtain a copy of the License at
michael@0 7 *
michael@0 8 * http://www.apache.org/licenses/LICENSE-2.0
michael@0 9 *
michael@0 10 * Unless required by applicable law or agreed to in writing, software
michael@0 11 * distributed under the License is distributed on an "AS IS" BASIS,
michael@0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
michael@0 13 * See the License for the specific language governing permissions and
michael@0 14 * limitations under the License.
michael@0 15 */
michael@0 16
michael@0 17 #ifndef ANDROID_NATIVE_WINDOW_H
michael@0 18 #define ANDROID_NATIVE_WINDOW_H
michael@0 19
michael@0 20 #include <android/rect.h>
michael@0 21
michael@0 22 #ifdef __cplusplus
michael@0 23 extern "C" {
michael@0 24 #endif
michael@0 25
michael@0 26 /*
michael@0 27 * Pixel formats that a window can use.
michael@0 28 */
michael@0 29 enum {
michael@0 30 WINDOW_FORMAT_RGBA_8888 = 1,
michael@0 31 WINDOW_FORMAT_RGBX_8888 = 2,
michael@0 32 WINDOW_FORMAT_RGB_565 = 4,
michael@0 33 };
michael@0 34
michael@0 35 struct ANativeWindow;
michael@0 36 typedef struct ANativeWindow ANativeWindow;
michael@0 37
michael@0 38 typedef struct ANativeWindow_Buffer {
michael@0 39 // The number of pixels that are show horizontally.
michael@0 40 int32_t width;
michael@0 41
michael@0 42 // The number of pixels that are shown vertically.
michael@0 43 int32_t height;
michael@0 44
michael@0 45 // The number of *pixels* that a line in the buffer takes in
michael@0 46 // memory. This may be >= width.
michael@0 47 int32_t stride;
michael@0 48
michael@0 49 // The format of the buffer. One of WINDOW_FORMAT_*
michael@0 50 int32_t format;
michael@0 51
michael@0 52 // The actual bits.
michael@0 53 void* bits;
michael@0 54
michael@0 55 // Do not touch.
michael@0 56 uint32_t reserved[6];
michael@0 57 } ANativeWindow_Buffer;
michael@0 58
michael@0 59 /**
michael@0 60 * Acquire a reference on the given ANativeWindow object. This prevents the object
michael@0 61 * from being deleted until the reference is removed.
michael@0 62 */
michael@0 63 void ANativeWindow_acquire(ANativeWindow* window);
michael@0 64
michael@0 65 /**
michael@0 66 * Remove a reference that was previously acquired with ANativeWindow_acquire().
michael@0 67 */
michael@0 68 void ANativeWindow_release(ANativeWindow* window);
michael@0 69
michael@0 70 /*
michael@0 71 * Return the current width in pixels of the window surface. Returns a
michael@0 72 * negative value on error.
michael@0 73 */
michael@0 74 int32_t ANativeWindow_getWidth(ANativeWindow* window);
michael@0 75
michael@0 76 /*
michael@0 77 * Return the current height in pixels of the window surface. Returns a
michael@0 78 * negative value on error.
michael@0 79 */
michael@0 80 int32_t ANativeWindow_getHeight(ANativeWindow* window);
michael@0 81
michael@0 82 /*
michael@0 83 * Return the current pixel format of the window surface. Returns a
michael@0 84 * negative value on error.
michael@0 85 */
michael@0 86 int32_t ANativeWindow_getFormat(ANativeWindow* window);
michael@0 87
michael@0 88 /*
michael@0 89 * Change the format and size of the window buffers.
michael@0 90 *
michael@0 91 * The width and height control the number of pixels in the buffers, not the
michael@0 92 * dimensions of the window on screen. If these are different than the
michael@0 93 * window's physical size, then it buffer will be scaled to match that size
michael@0 94 * when compositing it to the screen.
michael@0 95 *
michael@0 96 * For all of these parameters, if 0 is supplied then the window's base
michael@0 97 * value will come back in force.
michael@0 98 */
michael@0 99 int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width, int32_t height, int32_t format);
michael@0 100
michael@0 101 /**
michael@0 102 * Lock the window's next drawing surface for writing.
michael@0 103 */
michael@0 104 int32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffer,
michael@0 105 ARect* inOutDirtyBounds);
michael@0 106
michael@0 107 /**
michael@0 108 * Unlock the window's drawing surface after previously locking it,
michael@0 109 * posting the new buffer to the display.
michael@0 110 */
michael@0 111 int32_t ANativeWindow_unlockAndPost(ANativeWindow* window);
michael@0 112
michael@0 113 #ifdef __cplusplus
michael@0 114 };
michael@0 115 #endif
michael@0 116
michael@0 117 #endif // ANDROID_NATIVE_WINDOW_H

mercurial