summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorJanne Koskinen <janne.p.koskinen@digia.com>2009-06-15 15:08:43 (GMT)
committerJanne Koskinen <janne.p.koskinen@digia.com>2009-06-15 15:08:43 (GMT)
commit7a42405649aeea3e709231464d450b5da521e5cb (patch)
treec8a0bc351478ee24a29e2a436fe498213598a5ae /src/opengl
parentba1491c5942239f9e0f3f283114f9ed91f43f02b (diff)
parent08ae7ee1fb930e7d4b4039e2294cba69f9380964 (diff)
downloadQt-7a42405649aeea3e709231464d450b5da521e5cb.zip
Qt-7a42405649aeea3e709231464d450b5da521e5cb.tar.gz
Qt-7a42405649aeea3e709231464d450b5da521e5cb.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt-s60-public
Conflicts: src/corelib/tools/qringbuffer_p.h
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp3
-rw-r--r--src/opengl/qgl.cpp55
-rw-r--r--src/opengl/qgl.h3
-rw-r--r--src/opengl/qgl_win.cpp16
-rw-r--r--src/opengl/qgl_wince.cpp3
-rw-r--r--src/opengl/qgl_x11.cpp30
-rw-r--r--src/opengl/qglframebufferobject.cpp1
-rw-r--r--src/opengl/qglframebufferobject.h2
-rw-r--r--src/opengl/qglpaintdevice_qws.cpp2
-rw-r--r--src/opengl/qglpaintdevice_qws_p.h3
-rw-r--r--src/opengl/qglpixelbuffer.cpp1
-rw-r--r--src/opengl/qglpixelbuffer.h2
-rw-r--r--src/opengl/qpaintengine_opengl.cpp2
13 files changed, 64 insertions, 59 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index a74f044..beb4da6 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -926,6 +926,9 @@ void QGL2PaintEngineEx::drawCachedGlyphs(const QPointF &p, const QTextItemInt &t
const QImage &image = cache->image();
int margin = cache->glyphMargin();
+ if (image.isNull())
+ return;
+
glActiveTexture(QT_BRUSH_TEXTURE_UNIT);
d->ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, true);
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 04bc611..cd7a7f0 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1484,8 +1484,8 @@ Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg()
*/
QGLContext::QGLContext(const QGLFormat &format, QPaintDevice *device)
+ : d_ptr(new QGLContextPrivate(this))
{
- d_ptr = new QGLContextPrivate(this);
Q_D(QGLContext);
d->init(device, format);
}
@@ -1507,8 +1507,8 @@ QGLContext::QGLContext(const QGLFormat &format, QPaintDevice *device)
\sa format(), isValid()
*/
QGLContext::QGLContext(const QGLFormat &format)
+ : d_ptr(new QGLContextPrivate(this))
{
- d_ptr = new QGLContextPrivate(this);
Q_D(QGLContext);
d->init(0, format);
}
@@ -1539,7 +1539,6 @@ QGLContext::~QGLContext()
QGLSignalProxy::instance()->emitAboutToDestroyContext(this);
reset();
- delete d;
}
void QGLContextPrivate::cleanup()
@@ -2504,6 +2503,42 @@ const QGLContext* QGLContext::currentContext()
visual. On other platforms it may work differently.
*/
+/*! \fn int QGLContext::choosePixelFormat(void* dummyPfd, HDC pdc)
+
+ \bold{Win32 only:} This virtual function chooses a pixel format
+ that matches the OpenGL \link setFormat() format\endlink.
+ Reimplement this function in a subclass if you need a custom
+ context.
+
+ \warning The \a dummyPfd pointer and \a pdc are used as a \c
+ PIXELFORMATDESCRIPTOR*. We use \c void to avoid using
+ Windows-specific types in our header files.
+
+ \sa chooseContext()
+*/
+
+/*! \fn void *QGLContext::chooseVisual()
+
+ \bold{X11 only:} This virtual function tries to find a visual that
+ matches the format, reducing the demands if the original request
+ cannot be met.
+
+ The algorithm for reducing the demands of the format is quite
+ simple-minded, so override this method in your subclass if your
+ application has spcific requirements on visual selection.
+
+ \sa chooseContext()
+*/
+
+/*! \fn void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth)
+ \internal
+
+ \bold{X11 only:} This virtual function chooses a visual that matches
+ the OpenGL \link format() format\endlink. Reimplement this function
+ in a subclass if you need a custom visual.
+
+ \sa chooseContext()
+*/
/*!
\fn void QGLContext::reset()
@@ -2588,7 +2623,7 @@ const QGLContext* QGLContext::currentContext()
\i paintGL() - Renders the OpenGL scene. Gets called whenever the widget
needs to be updated.
\i resizeGL() - Sets up the OpenGL viewport, projection, etc. Gets
- called whenever the the widget has been resized (and also when it
+ called whenever the widget has been resized (and also when it
is shown for the first time because all newly created widgets get a
resize event automatically).
\i initializeGL() - Sets up the OpenGL rendering context, defines display
@@ -3020,11 +3055,10 @@ void QGLWidget::setFormat(const QGLFormat &format)
*/
/*
- \obsolete
-
\fn void QGLWidget::setContext(QGLContext *context,
- const QGLContext* shareContext,
- bool deleteOldContext)
+ const QGLContext* shareContext,
+ bool deleteOldContext)
+ \obsolete
Sets a new context for this widget. The QGLContext \a context must
be created using \e new. QGLWidget will delete \a context when
@@ -3174,9 +3208,10 @@ void QGLWidget::resizeOverlayGL(int, int)
{
}
-
+/*! \fn bool QGLWidget::event(QEvent *e)
+ \reimp
+*/
#if !defined(Q_OS_WINCE) && !defined(Q_WS_QWS)
-/*! \reimp */
bool QGLWidget::event(QEvent *e)
{
Q_D(QGLWidget);
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index 01b1d6f..b7b2f36 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -45,6 +45,7 @@
#include <QtGui/qwidget.h>
#include <QtOpenGL/qglcolormap.h>
#include <QtCore/qmap.h>
+#include <QtCore/qscopedpointer.h>
QT_BEGIN_HEADER
@@ -348,7 +349,7 @@ protected:
static QGLContext* currentCtx;
private:
- QGLContextPrivate* d_ptr;
+ QScopedPointer<QGLContextPrivate> d_ptr;
friend class QGLPixelBuffer;
friend class QGLPixelBufferPrivate;
diff --git a/src/opengl/qgl_win.cpp b/src/opengl/qgl_win.cpp
index bd8569a..217b0fc 100644
--- a/src/opengl/qgl_win.cpp
+++ b/src/opengl/qgl_win.cpp
@@ -884,19 +884,9 @@ static bool qLogEq(bool a, bool b)
return (((!a) && (!b)) || (a && b));
}
-/*!
- \bold{Win32 only:} This virtual function chooses a pixel
- format that matches the OpenGL \link setFormat() format\endlink.
- Reimplement this function in a subclass if you need a custom
- context.
-
- \warning The \a dummyPfd pointer and \a pdc are used as a \c
- PIXELFORMATDESCRIPTOR*. We use \c void to avoid using
- Windows-specific types in our header files.
-
- \sa chooseContext()
-*/
-
+/*
+ See qgl.cpp for qdoc comment.
+ */
int QGLContext::choosePixelFormat(void* dummyPfd, HDC pdc)
{
Q_D(QGLContext);
diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp
index cb51598..7429071 100644
--- a/src/opengl/qgl_wince.cpp
+++ b/src/opengl/qgl_wince.cpp
@@ -552,9 +552,6 @@ void QGLWidgetPrivate::updateColormap()
ReleaseDC(q->winId(), hdc);
}
-/*!
- \reimp
-\*/
bool QGLWidget::event(QEvent *e)
{
Q_D(QGLWidget);
diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp
index 28c34de..7ed7a23 100644
--- a/src/opengl/qgl_x11.cpp
+++ b/src/opengl/qgl_x11.cpp
@@ -443,19 +443,9 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
return true;
}
-
-/*!
- \bold{X11 only:} This virtual function tries to find a
- visual that matches the format, reducing the demands if the original
- request cannot be met.
-
- The algorithm for reducing the demands of the format is quite
- simple-minded, so override this method in your subclass if your
- application has spcific requirements on visual selection.
-
- \sa chooseContext()
-*/
-
+/*
+ See qgl.cpp for qdoc comment.
+ */
void *QGLContext::chooseVisual()
{
Q_D(QGLContext);
@@ -519,17 +509,9 @@ void *QGLContext::chooseVisual()
return vis;
}
-
-/*!
- \internal
-
- \bold{X11 only:} This virtual function chooses a visual
- that matches the OpenGL \link format() format\endlink. Reimplement this
- function in a subclass if you need a custom visual.
-
- \sa chooseContext()
-*/
-
+/*
+ See qgl.cpp for qdoc comment.
+ */
void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth)
{
Q_D(QGLContext);
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index c362b7e..6e908e2 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -448,7 +448,6 @@ QGLFramebufferObject::~QGLFramebufferObject()
glDeleteRenderbuffersEXT(1, &d->depth_stencil_buffer);
glDeleteFramebuffersEXT(1, &d->fbo);
}
- delete d_ptr;
}
/*!
diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h
index a9e1b2f..fea8920 100644
--- a/src/opengl/qglframebufferobject.h
+++ b/src/opengl/qglframebufferobject.h
@@ -116,7 +116,7 @@ protected:
private:
Q_DISABLE_COPY(QGLFramebufferObject)
- QGLFramebufferObjectPrivate *d_ptr;
+ QScopedPointer<QGLFramebufferObjectPrivate> d_ptr;
friend class QGLDrawable;
};
diff --git a/src/opengl/qglpaintdevice_qws.cpp b/src/opengl/qglpaintdevice_qws.cpp
index 18905ab..60a1238 100644
--- a/src/opengl/qglpaintdevice_qws.cpp
+++ b/src/opengl/qglpaintdevice_qws.cpp
@@ -68,8 +68,6 @@ QWSGLPaintDevice::QWSGLPaintDevice(QWidget *widget) :
QWSGLPaintDevice::~QWSGLPaintDevice()
{
- Q_D(QWSGLPaintDevice);
- delete d;
}
QPaintEngine* QWSGLPaintDevice::paintEngine() const
diff --git a/src/opengl/qglpaintdevice_qws_p.h b/src/opengl/qglpaintdevice_qws_p.h
index 369de7f..a471b1b 100644
--- a/src/opengl/qglpaintdevice_qws_p.h
+++ b/src/opengl/qglpaintdevice_qws_p.h
@@ -53,6 +53,7 @@
// We mean it.
//
+#include <QtCore/qscopedpointer.h>
#include <QPaintDevice>
QT_BEGIN_NAMESPACE
@@ -76,7 +77,7 @@ public:
private:
friend class QWSGLWindowSurface;
- QWSGLPaintDevicePrivate *d_ptr;
+ QScopedPointer<QWSGLPaintDevicePrivate> d_ptr;
};
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index 5f74f26..8ff2e1d 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -186,7 +186,6 @@ QGLPixelBuffer::~QGLPixelBuffer()
delete d->qctx;
if (current && current != d->qctx)
current->makeCurrent();
- delete d_ptr;
}
/*! \fn bool QGLPixelBuffer::makeCurrent()
diff --git a/src/opengl/qglpixelbuffer.h b/src/opengl/qglpixelbuffer.h
index 0131570..8264c22 100644
--- a/src/opengl/qglpixelbuffer.h
+++ b/src/opengl/qglpixelbuffer.h
@@ -107,7 +107,7 @@ protected:
private:
Q_DISABLE_COPY(QGLPixelBuffer)
- QGLPixelBufferPrivate *d_ptr;
+ QScopedPointer<QGLPixelBufferPrivate> d_ptr;
friend class QGLDrawable;
friend class QGLWindowSurface;
};
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 5a212f5..c9fbc7e 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -5625,7 +5625,7 @@ void QOpenGLPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
QPainter *p = painter();
QBrush oldBrush = p->brush();
p->setBrush(brush);
- qt_draw_helper(p->d_ptr, painterPathFromVectorPath(path), QPainterPrivate::FillDraw);
+ qt_draw_helper(p->d_ptr.data(), painterPathFromVectorPath(path), QPainterPrivate::FillDraw);
p->setBrush(oldBrush);
return;
}