Reduce the usage of QAbstractVideoBufferPrivate.

Move the handle type to the base class (since it's always needed) and
don't allocate the private class in the default paths.

Change-Id: I870a315310ce740f07b1d43cedecfce21feae505
Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
This commit is contained in:
Michael Goddard
2012-06-12 14:54:22 +10:00
committed by Qt by Nokia
parent f5e3fdc4a7
commit d1b0862ad4
3 changed files with 6 additions and 13 deletions

View File

@@ -122,11 +122,9 @@ namespace
Constructs an abstract video buffer of the given \a type. Constructs an abstract video buffer of the given \a type.
*/ */
QAbstractVideoBuffer::QAbstractVideoBuffer(HandleType type) QAbstractVideoBuffer::QAbstractVideoBuffer(HandleType type)
: d_ptr(new QAbstractVideoBufferPrivate) : d_ptr(0)
, m_type(type)
{ {
Q_D(QAbstractVideoBuffer);
d->handleType = type;
} }
/*! /*!
@@ -134,10 +132,8 @@ QAbstractVideoBuffer::QAbstractVideoBuffer(HandleType type)
*/ */
QAbstractVideoBuffer::QAbstractVideoBuffer(QAbstractVideoBufferPrivate &dd, HandleType type) QAbstractVideoBuffer::QAbstractVideoBuffer(QAbstractVideoBufferPrivate &dd, HandleType type)
: d_ptr(&dd) : d_ptr(&dd)
, m_type(type)
{ {
Q_D(QAbstractVideoBuffer);
d->handleType = type;
} }
/*! /*!
@@ -168,7 +164,7 @@ void QAbstractVideoBuffer::release()
*/ */
QAbstractVideoBuffer::HandleType QAbstractVideoBuffer::handleType() const QAbstractVideoBuffer::HandleType QAbstractVideoBuffer::handleType() const
{ {
return d_func()->handleType; return m_type;
} }
/*! /*!

View File

@@ -96,7 +96,8 @@ public:
protected: protected:
QAbstractVideoBuffer(QAbstractVideoBufferPrivate &dd, HandleType type); QAbstractVideoBuffer(QAbstractVideoBufferPrivate &dd, HandleType type);
QAbstractVideoBufferPrivate *d_ptr; QAbstractVideoBufferPrivate *d_ptr; // For expansion, not used currently
HandleType m_type;
private: private:
Q_DECLARE_PRIVATE(QAbstractVideoBuffer) Q_DECLARE_PRIVATE(QAbstractVideoBuffer)

View File

@@ -66,18 +66,14 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Multimedia) QT_MODULE(Multimedia)
class QAbstractVideoBufferPrivate class QAbstractVideoBufferPrivate
{ {
public: public:
QAbstractVideoBufferPrivate() QAbstractVideoBufferPrivate()
: handleType(QAbstractVideoBuffer::NoHandle)
{} {}
virtual ~QAbstractVideoBufferPrivate() virtual ~QAbstractVideoBufferPrivate()
{} {}
QAbstractVideoBuffer::HandleType handleType;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE