diff options
author | Ritt Konstantin <ritt.ks@gmail.com> | 2011-06-06 11:52:06 (GMT) |
---|---|---|
committer | Harald Fernengel <harald.fernengel@nokia.com> | 2011-06-06 11:52:06 (GMT) |
commit | 336167a1ab637bfa8b2a14eac80dc36ceda1a7e8 (patch) | |
tree | 2319b2e92bc3577c0a58dd1ca07b100f733c6260 /src/gui/painting | |
parent | 597e690c92243b47ac2191c8de8b12cd689bf2a6 (diff) | |
download | Qt-336167a1ab637bfa8b2a14eac80dc36ceda1a7e8.zip Qt-336167a1ab637bfa8b2a14eac80dc36ceda1a7e8.tar.gz Qt-336167a1ab637bfa8b2a14eac80dc36ceda1a7e8.tar.bz2 |
nano optimization
allocate uninitialized QByteArray as it will be initialized few lines later
Merge-request: 2627
Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qwindowsurface_qws.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp index 5bd56d3..88d7d27 100644 --- a/src/gui/painting/qwindowsurface_qws.cpp +++ b/src/gui/painting/qwindowsurface_qws.cpp @@ -982,9 +982,7 @@ void QWSLocalMemSurface::setGeometry(const QRect &rect) QByteArray QWSLocalMemSurface::permanentState() const { - QByteArray array; - array.resize(sizeof(uchar*) + 3 * sizeof(int) + - sizeof(SurfaceFlags)); + QByteArray array(sizeof(uchar*) + 3 * sizeof(int) + sizeof(SurfaceFlags), Qt::Uninitialized); char *ptr = array.data(); @@ -1165,8 +1163,7 @@ void QWSSharedMemSurface::setGeometry(const QRect &rect) QByteArray QWSSharedMemSurface::permanentState() const { - QByteArray array; - array.resize(6 * sizeof(int)); + QByteArray array(6 * sizeof(int), Qt::Uninitialized); int *ptr = reinterpret_cast<int*>(array.data()); @@ -1240,8 +1237,8 @@ bool QWSOnScreenSurface::isValid() const QByteArray QWSOnScreenSurface::permanentState() const { - QByteArray array; - array.resize(sizeof(int)); + QByteArray array(sizeof(int), Qt::Uninitialized); + int *ptr = reinterpret_cast<int*>(array.data()); ptr[0] = QApplication::desktop()->screenNumber(window()); return array; @@ -1281,8 +1278,7 @@ QWSYellowSurface::~QWSYellowSurface() QByteArray QWSYellowSurface::permanentState() const { - QByteArray array; - array.resize(2 * sizeof(int)); + QByteArray array(2 * sizeof(int), Qt::Uninitialized); int *ptr = reinterpret_cast<int*>(array.data()); ptr[0] = surfaceSize.width(); |