0
|
1 |
/****************************************************************************
|
|
2 |
**
|
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
** All rights reserved.
|
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
6 |
**
|
|
7 |
** This file is part of the plugins of the Qt Toolkit.
|
|
8 |
**
|
|
9 |
** $QT_BEGIN_LICENSE:LGPL$
|
|
10 |
** No Commercial Usage
|
|
11 |
** This file contains pre-release code and may not be distributed.
|
|
12 |
** You may use this file in accordance with the terms and conditions
|
|
13 |
** contained in the Technology Preview License Agreement accompanying
|
|
14 |
** this package.
|
|
15 |
**
|
|
16 |
** GNU Lesser General Public License Usage
|
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
18 |
** General Public License version 2.1 as published by the Free Software
|
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
20 |
** packaging of this file. Please review the following information to
|
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
23 |
**
|
|
24 |
** In addition, as a special exception, Nokia gives you certain additional
|
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
27 |
**
|
|
28 |
** If you have questions regarding the use of this file, please contact
|
|
29 |
** Nokia at qt-info@nokia.com.
|
|
30 |
**
|
|
31 |
**
|
|
32 |
**
|
|
33 |
**
|
|
34 |
**
|
|
35 |
**
|
|
36 |
**
|
|
37 |
**
|
|
38 |
** $QT_END_LICENSE$
|
|
39 |
**
|
|
40 |
****************************************************************************/
|
|
41 |
|
|
42 |
#ifndef PVRQWSDRAWABLE_H
|
|
43 |
#define PVRQWSDRAWABLE_H
|
|
44 |
|
|
45 |
#ifdef __cplusplus
|
|
46 |
extern "C" {
|
|
47 |
#endif
|
|
48 |
|
|
49 |
typedef struct {
|
|
50 |
int x, y, width, height;
|
|
51 |
} PvrQwsRect;
|
|
52 |
|
|
53 |
typedef enum
|
|
54 |
{
|
|
55 |
PvrQwsScreen,
|
|
56 |
PvrQwsWindow,
|
|
57 |
PvrQwsPixmap
|
|
58 |
|
|
59 |
} PvrQwsDrawableType;
|
|
60 |
|
|
61 |
typedef enum
|
|
62 |
{
|
|
63 |
PvrQws_1BPP = 0,
|
|
64 |
PvrQws_RGB565,
|
|
65 |
PvrQws_ARGB4444,
|
|
66 |
PvrQws_RGB888,
|
|
67 |
PvrQws_ARGB8888,
|
|
68 |
PvrQws_VGAEMU
|
|
69 |
|
|
70 |
} PvrQwsPixelFormat;
|
|
71 |
|
|
72 |
typedef struct _PvrQwsDrawable PvrQwsDrawable;
|
|
73 |
|
|
74 |
typedef void (*PvrQwsSwapFunction)
|
|
75 |
(PvrQwsDrawable *drawable, void *userData, int repaintOnly);
|
|
76 |
|
|
77 |
/* Open the display and prepare for window operations. The display
|
|
78 |
can be opened multiple times and each time is reference counted.
|
|
79 |
The display will be finally closed when the same number of
|
|
80 |
calls to pvrQwsDisplayClose() have been encountered */
|
|
81 |
int pvrQwsDisplayOpen(void);
|
|
82 |
|
|
83 |
/* Close the display */
|
|
84 |
void pvrQwsDisplayClose(void);
|
|
85 |
|
|
86 |
/* Determine if the display is already open */
|
|
87 |
int pvrQwsDisplayIsOpen(void);
|
|
88 |
|
|
89 |
/* Create a window that represents a particular framebuffer screen.
|
|
90 |
Initially the visible region will be the whole screen. If the screen
|
|
91 |
window has already been created, then will return the same value */
|
|
92 |
PvrQwsDrawable *pvrQwsScreenWindow(int screen);
|
|
93 |
|
|
94 |
/* Create a top-level window on a particular framebuffer screen.
|
|
95 |
Initially the window will not have a visible region */
|
|
96 |
PvrQwsDrawable *pvrQwsCreateWindow(int screen, long winId, const PvrQwsRect *rect);
|
|
97 |
|
|
98 |
/* Fetch an existing window for a window id and increase its refcount */
|
|
99 |
PvrQwsDrawable *pvrQwsFetchWindow(long winId);
|
|
100 |
|
|
101 |
/* Release the refcount on a window. Returns 1 if refcount is zero */
|
|
102 |
int pvrQwsReleaseWindow(PvrQwsDrawable *drawable);
|
|
103 |
|
|
104 |
/* Create an off-screen pixmap */
|
|
105 |
PvrQwsDrawable *pvrQwsCreatePixmap(int width, int height, int screen);
|
|
106 |
|
|
107 |
/* Destroy a previously-created drawable. Will not destroy screens. */
|
|
108 |
void pvrQwsDestroyDrawable(PvrQwsDrawable *drawable);
|
|
109 |
|
|
110 |
/* Get a drawable's type */
|
|
111 |
PvrQwsDrawableType pvrQwsGetDrawableType(PvrQwsDrawable *drawable);
|
|
112 |
|
|
113 |
/* Sets the visible region for a window or screen drawable. Pixels within
|
|
114 |
the specified rectangles will be copied to the framebuffer when the window
|
|
115 |
or screen is swapped. The rectangles should be in global co-ordinates */
|
|
116 |
void pvrQwsSetVisibleRegion
|
|
117 |
(PvrQwsDrawable *drawable, const PvrQwsRect *rects, int numRects);
|
|
118 |
|
|
119 |
/* Clear the visible region for a window or screen drawable,
|
|
120 |
effectively removing it from the screen */
|
|
121 |
void pvrQwsClearVisibleRegion(PvrQwsDrawable *drawable);
|
|
122 |
|
|
123 |
/* Set the geometry for a drawable. This can only be used on windows */
|
|
124 |
void pvrQwsSetGeometry(PvrQwsDrawable *drawable, const PvrQwsRect *rect);
|
|
125 |
|
|
126 |
/* Get the current geometry for a drawable */
|
|
127 |
void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect);
|
|
128 |
|
|
129 |
/* Set the rotation angle in degrees */
|
|
130 |
void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle);
|
|
131 |
|
|
132 |
/* Get the line stride for a drawable. Returns zero if the buffers
|
|
133 |
are not allocated or have been invalidated */
|
|
134 |
int pvrQwsGetStride(PvrQwsDrawable *drawable);
|
|
135 |
|
|
136 |
/* Get the pixel format for a drawable */
|
|
137 |
PvrQwsPixelFormat pvrQwsGetPixelFormat(PvrQwsDrawable *drawable);
|
|
138 |
|
|
139 |
/* Get a pointer to the beginning of a drawable's current render buffer.
|
|
140 |
Returns null if the buffers are not allocated or have been invalidated */
|
|
141 |
void *pvrQwsGetRenderBuffer(PvrQwsDrawable *drawable);
|
|
142 |
|
|
143 |
/* Allocate the buffers associated with a drawable. We allocate one buffer
|
|
144 |
for pixmaps, and several for windows and screens */
|
|
145 |
int pvrQwsAllocBuffers(PvrQwsDrawable *drawable);
|
|
146 |
|
|
147 |
/* Free the buffers associated with a drawable */
|
|
148 |
void pvrQwsFreeBuffers(PvrQwsDrawable *drawable);
|
|
149 |
|
|
150 |
/* Invalidate the buffers associated with a drawable. The buffers will
|
|
151 |
still be allocated but the next attempt to swap the buffers will fail */
|
|
152 |
void pvrQwsInvalidateBuffers(PvrQwsDrawable *drawable);
|
|
153 |
|
|
154 |
/* Swap the back buffers for a window or screen and copy to the framebuffer */
|
|
155 |
int pvrQwsSwapBuffers(PvrQwsDrawable *drawable, int repaintOnly);
|
|
156 |
|
|
157 |
/* Set the swap function for a drawable. When pvrQwsSwapBuffers()
|
|
158 |
is called on the drawable, the supplied function will be called
|
|
159 |
instead of copying the drawable contents to the screen. This allows
|
|
160 |
higher-level compositors to know when a drawable has changed.
|
|
161 |
The swap function can be set to null to return to normal processing */
|
|
162 |
void pvrQwsSetSwapFunction
|
|
163 |
(PvrQwsDrawable *drawable, PvrQwsSwapFunction func, void *userData);
|
|
164 |
|
|
165 |
#ifdef __cplusplus
|
|
166 |
};
|
|
167 |
#endif
|
|
168 |
|
|
169 |
#endif
|