diff options
author | Anders Bakken <anders.bakken@nokia.com> | 2009-08-26 19:50:28 (GMT) |
---|---|---|
committer | Anders Bakken <anders.bakken@nokia.com> | 2009-08-26 19:50:28 (GMT) |
commit | e201ff0ff3a8223b14a72954c898674e606f147e (patch) | |
tree | eb893e730f8c20bb7930d05b2391e6cb6f174532 | |
parent | 900c3368404f418c444a9781ed52f7b681ab7076 (diff) | |
download | Qt-e201ff0ff3a8223b14a72954c898674e606f147e.zip Qt-e201ff0ff3a8223b14a72954c898674e606f147e.tar.gz Qt-e201ff0ff3a8223b14a72954c898674e606f147e.tar.bz2 |
Optimize permanentState/setPermanentState
No need to use a QDataStream here.
Reviewed-by: Donald Carr <donald.carr@nokia.com>
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 60211a6..9de1ca5 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -243,22 +243,19 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect) QByteArray QDirectFBWindowSurface::permanentState() const { - QByteArray state; #ifdef QT_DIRECTFB_WM - QDataStream ds(&state, QIODevice::WriteOnly); - ds << reinterpret_cast<quintptr>(this); -#endif + QByteArray state(sizeof(this), 0); + *reinterpret_cast<const QDirectFBWindowSurface**>(state.data()) = this; return state; +#endif + return QByteArray(); } void QDirectFBWindowSurface::setPermanentState(const QByteArray &state) { #ifdef QT_DIRECTFB_WM - if (state.size() == sizeof(quintptr)) { - QDataStream ds(state); - quintptr ptr; - ds >> ptr; - sibling = reinterpret_cast<QDirectFBWindowSurface*>(ptr); + if (state.size() == sizeof(this)) { + sibling = *reinterpret_cast<QDirectFBWindowSurface *const*>(state.constData()); } #else Q_UNUSED(state); |