From e6db4887bc5998a2c19ebf116a66fee0058fcf8a Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Wed, 29 May 2019 14:46:29 +0000 Subject: [PATCH] eliminate some temporary buffers Signed-off-by: Ivailo Monev --- src/gui/kernel/qapplication_x11.cpp | 23 ++++++----------------- src/gui/kernel/qt_x11_p.h | 2 +- src/gui/painting/qpaintengine_x11.cpp | 2 +- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index c35778e74..b326517cf 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -53,7 +53,6 @@ #include "qdatetime.h" #include "qtextcodec.h" #include "qdatastream.h" -#include "qbuffer.h" #include "qsocketnotifier.h" #include "qsessionmanager.h" #include "qclipboard.h" @@ -886,8 +885,7 @@ static void qt_get_net_supported() qt_x11Data->net_supported_list = 0; if (e == Success && type == XA_ATOM && format == 32) { - QBuffer ts; - ts.open(QIODevice::WriteOnly); + QByteArray buffer; while (after > 0) { XGetWindowProperty(qt_x11Data->display, QX11Info::appRootWindow(), @@ -895,7 +893,7 @@ static void qt_get_net_supported() False, XA_ATOM, &type, &format, &nitems, &after, &data); if (type == XA_ATOM && format == 32) { - ts.write(reinterpret_cast(data), nitems * sizeof(long)); + buffer.setRawData(reinterpret_cast(data), nitems * sizeof(long)); offset += nitems; } else after = 0; @@ -904,7 +902,6 @@ static void qt_get_net_supported() } // compute nitems - QByteArray buffer(ts.buffer()); nitems = buffer.size() / sizeof(Atom); qt_x11Data->net_supported_list = new Atom[nitems + 1]; Atom *a = (Atom *) buffer.data(); @@ -957,8 +954,7 @@ static void qt_get_net_virtual_roots() XFree(data); if (e == Success && type == XA_ATOM && format == 32) { - QBuffer ts; - ts.open(QIODevice::WriteOnly); + QByteArray buffer; while (after > 0) { XGetWindowProperty(qt_x11Data->display, QX11Info::appRootWindow(), @@ -966,7 +962,7 @@ static void qt_get_net_virtual_roots() False, XA_ATOM, &type, &format, &nitems, &after, &data); if (type == XA_ATOM && format == 32) { - ts.write(reinterpret_cast(data), nitems * 4); + buffer.setRawData(reinterpret_cast(data), nitems * 4); offset += nitems; } else after = 0; @@ -975,7 +971,6 @@ static void qt_get_net_virtual_roots() } // compute nitems - QByteArray buffer(ts.buffer()); nitems = buffer.size() / sizeof(Window); qt_x11Data->net_virtual_root_list = new Window[nitems + 1]; Window *a = (Window *) buffer.data(); @@ -1139,7 +1134,7 @@ void qt_init(QApplicationPrivate *priv, int, // RENDER qt_x11Data->use_xrender = false; qt_x11Data->xrender_major = 0; - qt_x11Data->xrender_version = 0; + qt_x11Data->xrender_minor = 0; // XFIXES qt_x11Data->use_xfixes = false; @@ -1378,13 +1373,7 @@ void qt_init(QApplicationPrivate *priv, int, XRenderQueryVersion(qt_x11Data->display, &major, &minor); if (qgetenv("QT_X11_NO_XRENDER").isNull()) { qt_x11Data->use_xrender = (major >= 0 && minor >= 5); - qt_x11Data->xrender_version = major*100+minor; - // workaround for broken XServer on Ubuntu Breezy (6.8 compiled with 7.0 - // protocol headers) - if (qt_x11Data->xrender_version == 10 - && VendorRelease(qt_x11Data->display) < 60900000 - && QByteArray(ServerVendor(qt_x11Data->display)).contains("X.Org")) - qt_x11Data->xrender_version = 9; + qt_x11Data->xrender_minor = minor; } } #endif // QT_NO_XRENDER diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index 9c5f64070..5becef863 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -226,7 +226,7 @@ struct QX11Data // true if Qt is compiled w/ RENDER support and RENDER is supported on the connected Display bool use_xrender; int xrender_major; - int xrender_version; + int xrender_minor; // true if Qt is compiled w/ XFIXES support and XFIXES is supported on the connected Display bool use_xfixes; diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index b701b11ac..166aaf72d 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -407,7 +407,7 @@ static QPaintEngine::PaintEngineFeatures qt_decide_features() features |= QPaintEngine::PorterDuff; features |= QPaintEngine::MaskedBrush; #if 0 - if (qt_x11Data->xrender_version > 10) { + if (qt_x11Data->xrender_minor > 10) { features |= QPaintEngine::LinearGradientFill; // ### }