From e201ff0ff3a8223b14a72954c898674e606f147e Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 26 Aug 2009 12:50:28 -0700 Subject: Optimize permanentState/setPermanentState No need to use a QDataStream here. Reviewed-by: Donald Carr --- .../gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 15 ++++++--------- 1 file 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(this); -#endif + QByteArray state(sizeof(this), 0); + *reinterpret_cast(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(ptr); + if (state.size() == sizeof(this)) { + sibling = *reinterpret_cast(state.constData()); } #else Q_UNUSED(state); -- cgit v0.12