From 07942adb77f60738a6043665673d51fc7991233b Mon Sep 17 00:00:00 2001 From: Louai Al-Khanji Date: Fri, 6 Jan 2017 15:15:54 -0800 Subject: xcb: Add experimental legacy support for native X11 painting This commit revives the old native QPixmap and QPaintEngine implementations that were present in Qt4. The backing store supports regular raster windows in this commit. Support for render-to-texture widgets and OpenGL compositing will be added in a follow-up commit. Change-Id: I80a9c4f0c42a6f68f571dfee930d95000d5dd950 Reviewed-by: Lars Knoll --- src/gui/configure.json | 22 +++++++++++++++++++++- src/gui/image/qplatformpixmap.h | 5 +++-- src/gui/painting/qbrush.cpp | 2 +- src/gui/painting/qpaintengine.cpp | 4 ++-- 4 files changed, 27 insertions(+), 6 deletions(-) (limited to 'src/gui') diff --git a/src/gui/configure.json b/src/gui/configure.json index 854b187eb6..1e873d3709 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -40,6 +40,7 @@ "tslib": "boolean", "vulkan": "boolean", "xcb": { "type": "enum", "values": [ "no", "yes", "qt", "system" ] }, + "xcb-native-painting": "boolean", "xcb-xlib": "boolean", "xinput2": "boolean", "xkb": "boolean", @@ -305,6 +306,13 @@ "sources": [ { "type": "pkgConfig", "args": "xkbcommon xkbcommon-x11 >= 0.4.1" } ] + }, + "xrender": { + "label": "XRender for native painting", + "test": "x11/xrender", + "sources": [ + "-lXrender" + ] } }, @@ -755,6 +763,18 @@ "condition": "libs.xcb_glx", "output": [ "privateFeature" ] }, + "xcb-native-painting": { + "label": "Native painting (experimental)", + "emitIf": "features.xcb", + "condition": "features.xcb-xlib && libs.xrender", + "output": [ "privateFeature" ] + }, + "xrender": { + "label": "XRender for native painting", + "emitIf": "features.xcb && features.xcb-native-painting", + "condition": "features.xcb-native-painting", + "output": [ "privateFeature" ] + }, "xcb-render": { "label": "XCB render", "emitIf": "features.xcb", @@ -1145,7 +1165,7 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla "section": "X11", "condition": "features.xcb", "entries": [ - "system-xcb", "egl_x11", "xinput2", "xkb", "xlib", "xcb-render", "xcb-glx", "xcb-xlib", "xkbcommon-system" + "system-xcb", "egl_x11", "xinput2", "xkb", "xlib", "xcb-render", "xcb-glx", "xcb-xlib", "xkbcommon-system", "xcb-native-painting" ] }, { diff --git a/src/gui/image/qplatformpixmap.h b/src/gui/image/qplatformpixmap.h index 1857856b07..7635ac2949 100644 --- a/src/gui/image/qplatformpixmap.h +++ b/src/gui/image/qplatformpixmap.h @@ -69,7 +69,7 @@ public: enum ClassId { RasterClass, DirectFBClass, BlitterClass, Direct2DClass, - CustomClass = 1024 }; + X11Class, CustomClass = 1024 }; QPlatformPixmap(PixelType pixelType, int classId); virtual ~QPlatformPixmap(); @@ -147,6 +147,7 @@ protected: private: friend class QPixmap; + friend class QX11PlatformPixmap; friend class QImagePixmapCleanupHooks; // Needs to set is_cached friend class QOpenGLTextureCache; //Needs to check the reference count friend class QExplicitlySharedDataPointer; @@ -162,7 +163,7 @@ private: # define QT_XFORM_TYPE_MSBFIRST 0 # define QT_XFORM_TYPE_LSBFIRST 1 -extern bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int); +Q_GUI_EXPORT bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int); QT_END_NAMESPACE diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index cc3ee76f0d..5c13308d94 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -100,7 +100,7 @@ const uchar *qt_patternForBrush(int brushStyle, bool invert) return pat_tbl[brushStyle - Qt::Dense1Pattern][invert]; } -QPixmap qt_pixmapForBrush(int brushStyle, bool invert) +Q_GUI_EXPORT QPixmap qt_pixmapForBrush(int brushStyle, bool invert) { QPixmap pm; diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index 5fc5d5364e..f42fd4ff87 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -547,8 +547,8 @@ void qt_fill_tile(QPixmap *tile, const QPixmap &pixmap) } } -void qt_draw_tile(QPaintEngine *gc, qreal x, qreal y, qreal w, qreal h, - const QPixmap &pixmap, qreal xOffset, qreal yOffset) +Q_GUI_EXPORT void qt_draw_tile(QPaintEngine *gc, qreal x, qreal y, qreal w, qreal h, + const QPixmap &pixmap, qreal xOffset, qreal yOffset) { qreal yPos, xPos, drawH, drawW, yOff, xOff; yPos = y; -- cgit v1.2.3