42 #define GL_GLEXT_PROTOTYPES 44 #include <QtOpenVG/private/qpaintengine_vg_p.h> 46 #include "private/qt_x11_p.h" 56 #include <vg/openvg.h> 83 #
if defined(QVG_USE_FBO)
101 #if defined(QVG_USE_FBO) 105 #if defined(Q_WS_X11) 120 vgDestroyContextSH();
130 #if defined(Q_WS_X11) 142 #if defined(QVG_USE_FBO) 157 #if defined(Q_WS_X11) 158 glXMakeCurrent(
X11->display, 0, 0);
164 #if defined(QVG_USE_FBO) 166 glDeleteTextures(1, &texture);
167 glDeleteFramebuffersEXT(1, &fbo);
174 #if defined(Q_WS_X11) 176 if (win != drawable) {
178 glXDestroyContext(
X11->display, context);
185 spec[i++] = GLX_DOUBLEBUFFER;
186 spec[i++] = GLX_DEPTH_SIZE;
188 spec[i++] = GLX_STENCIL_SIZE;
190 spec[i++] = GLX_RGBA;
191 spec[i++] = GLX_RED_SIZE;
193 spec[i++] = GLX_GREEN_SIZE;
195 spec[i++] = GLX_BLUE_SIZE;
202 XVisualInfo *visual = glXChooseVisual
204 context = glXCreateContext(
X11->display, visual, 0, True);
206 qWarning(
"glXCreateContext: could not create GL context for VG rendering");
211 #if defined(QVG_USE_FBO) 212 if (needsResize && fbo) {
213 #if defined(Q_WS_X11) 214 glXMakeCurrent(
X11->display, drawable, context);
216 glDeleteTextures(1, &texture);
217 glDeleteFramebuffersEXT(1, &fbo);
218 #if defined(Q_WS_X11) 219 glXMakeCurrent(
X11->display, 0, 0);
225 #if defined(Q_WS_X11) 226 glXMakeCurrent(
X11->display, drawable, context);
228 glGenFramebuffersEXT(1, &fbo);
231 glGenTextures(1, &texture);
233 glTexImage2D(
GL_TEXTURE_2D, 0, GL_RGBA8, size.width(), size.height(), 0,
239 glFramebufferTexture2DEXT
244 #if defined(Q_WS_X11) 245 glXMakeCurrent(
X11->display, 0, 0);
260 shivaContext()->doneCurrent();
263 #if defined(Q_WS_X11) 273 shivaContext()->makeCurrent(
d_ptr);
288 #if defined(QVG_USE_FBO) 291 static GLfloat
const vertices[][2] = {
292 {-1, -1}, {1, -1}, {1, 1}, {-1, 1}
294 static GLfloat
const texCoords[][2] = {
295 {0, 0}, {1, 0}, {1, 1}, {0, 1}
297 glMatrixMode(GL_PROJECTION);
299 glMatrixMode(GL_MODELVIEW);
301 glVertexPointer(2,
GL_FLOAT, 0, vertices);
302 glTexCoordPointer(2,
GL_FLOAT, 0, texCoords);
305 glEnableClientState(GL_VERTEX_ARRAY);
306 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
308 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
309 glDisableClientState(GL_VERTEX_ARRAY);
314 #if defined(Q_WS_X11) virtual ~ShivaVGWindowSurface()
Q_GLOBAL_STATIC(QShivaContext, shivaContext)
#define GL_TEXTURE_MIN_FILTER
QPaintEngine * paintEngine() const
void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
#define QT_END_NAMESPACE
This macro expands to.
QPointer< QWidget > widget
QRect rect(const QWidget *widget) const
Returns the rectangle for widget in the coordinates of this window surface.
~ShivaVGWindowSurfacePrivate()
#define GL_STENCIL_BUFFER_BIT
virtual void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
virtual QPoint offset(const QWidget *widget) const
Returns the offset of widget in the coordinates of this window surface.
#define GL_TEXTURE_WRAP_S
#define GL_FRAMEBUFFER_EXT
void endPaint(const QRegion ®ion)
This function is called after painting onto the surface has ended, with the region in which the paint...
void beginPaint(const QRegion ®ion)
This function is called before painting onto the surface begins, with the region in which the paintin...
QPaintDevice * paintDevice()
Implement this function to return the appropriate paint device.
bool makeCurrent(ShivaVGWindowSurfacePrivate *surface)
#define GL_COLOR_ATTACHMENT0_EXT
#define GLX_SAMPLE_BUFFERS_ARB
int width() const
Returns the width.
QX11Info * qt_x11Info(const QPaintDevice *pd)
const Q_GUI_EXPORT QX11Info * qt_x11Info(const QPaintDevice *pd)
Returns the QX11Info structure for the pd paint device.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset)
Flushes the given region from the specified widget onto the screen.
friend Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, PaintDeviceMetric metric)
ShivaVGWindowSurfacePrivate * currentSurface
QSize size() const
Returns the size of the rectangle.
Q_CORE_EXPORT void qWarning(const char *,...)
The QRegion class specifies a clip region for a painter.
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
int metric(PaintDeviceMetric metric) const
The QWindowSurface class provides the drawing area for top-level windows.
#define GL_DEPTH_BUFFER_BIT
#define GL_TEXTURE_WRAP_T
The QX11Info class provides information about the X display configuration.
ShivaVGWindowSurface(QWidget *window)
The QPoint class defines a point in the plane using integer precision.
int height() const
Returns the height.
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
bool scroll(const QRegion &area, int dx, int dy)
Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative...
ShivaVGWindowSurfacePrivate()
The QSize class defines the size of a two-dimensional object using integer point precision.
#define GL_TEXTURE_MAG_FILTER
void ensureContext(QWidget *widget)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
virtual bool scroll(const QRegion &area, int dx, int dy)
Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative...
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.
static Display * display()
Returns the default display for the application.
int screen() const
Returns the number of the screen currently in use.
ShivaVGWindowSurfacePrivate * d_ptr
static int area(const QSize &s)