OSDN Git Service

remove redundant QXImageWrapper
authorIvailo Monev <xakepa10@gmail.com>
Sat, 26 Dec 2020 05:40:05 +0000 (05:40 +0000)
committerIvailo Monev <xakepa10@gmail.com>
Sat, 26 Dec 2020 05:40:05 +0000 (05:40 +0000)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/CMakeLists.txt
src/gui/image/qpixmap_x11.cpp
src/gui/image/qpixmap_x11_p.h

index 1f27109..34e3ecd 100644 (file)
@@ -1013,8 +1013,10 @@ katie_unity_exclude(
     ${CMAKE_CURRENT_SOURCE_DIR}/graphicsview/qgraphicsitem.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/graphicsview/qgraphicsscene.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/graphicsview/qgraphicsview.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/image/qbitmap.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmap.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmap_x11.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmapfilter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/itemviews/qitemeditorfactory.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/kernel/qapplication.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/kernel/qapplication_x11.cpp
@@ -1024,11 +1026,17 @@ katie_unity_exclude(
     ${CMAKE_CURRENT_SOURCE_DIR}/kernel/qdnd_x11.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/kernel/qeventdispatcher_x11.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/kernel/qkeymapper_x11.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/kernel/qwidget.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/kernel/qwidget_x11.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/kernel/qx11embed_x11.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/kernel/qx11info_x11.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/painting/qbackingstore.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/painting/qcolor.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/painting/qcolormap_x11.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/painting/qgraphicssystem.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/painting/qgraphicssystem_raster.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/painting/qgraphicssystemfactory.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/painting/qgraphicssystemplugin.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/painting/qpaintengine_x11.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/painting/qregion_x11.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/painting/qwindowsurface_raster.cpp
index 781eb22..97e4179 100644 (file)
@@ -1322,15 +1322,8 @@ int QX11PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
     return 0;
 }
 
-struct QXImageWrapper
+bool QX11PixmapData::canTakeQImageFromXImage(const XImage *xi) const
 {
-    XImage *xi;
-};
-
-bool QX11PixmapData::canTakeQImageFromXImage(const QXImageWrapper &xiWrapper) const
-{
-    XImage *xi = xiWrapper.xi;
-
     // ARGB32_Premultiplied
     if (picture && depth() == 32)
         return true;
@@ -1350,10 +1343,8 @@ bool QX11PixmapData::canTakeQImageFromXImage(const QXImageWrapper &xiWrapper) co
     return false;
 }
 
-QImage QX11PixmapData::takeQImageFromXImage(const QXImageWrapper &xiWrapper) const
+QImage QX11PixmapData::takeQImageFromXImage(XImage *xi) const
 {
-    XImage *xi = xiWrapper.xi;
-
     QImage::Format format = QImage::Format_ARGB32_Premultiplied;
     if (depth() == 24)
         format = QImage::Format_RGB32;
@@ -1405,19 +1396,18 @@ QImage QX11PixmapData::takeQImageFromXImage(const QXImageWrapper &xiWrapper) con
 
 QImage QX11PixmapData::toImage(const QRect &rect) const
 {
-    QXImageWrapper xiWrapper;
-    xiWrapper.xi = XGetImage(qt_x11Data->display, hd, rect.x(), rect.y(), rect.width(), rect.height(),
-                             AllPlanes, (depth() == 1) ? XYPixmap : ZPixmap);
+    XImage *xi = XGetImage(qt_x11Data->display, hd, rect.x(), rect.y(), rect.width(), rect.height(),
+                           AllPlanes, (depth() == 1) ? XYPixmap : ZPixmap);
 
-    Q_CHECK_PTR(xiWrapper.xi);
-    if (!xiWrapper.xi)
+    Q_CHECK_PTR(xi);
+    if (!xi)
         return QImage();
 
-    if (!x11_mask && canTakeQImageFromXImage(xiWrapper))
-        return takeQImageFromXImage(xiWrapper);
+    if (!x11_mask && canTakeQImageFromXImage(xi))
+        return takeQImageFromXImage(xi);
 
-    QImage image = toImage(xiWrapper, rect);
-    qSafeXDestroyImage(xiWrapper.xi);
+    QImage image = toImage(xi, rect);
+    qSafeXDestroyImage(xi);
     return image;
 }
 
@@ -1441,10 +1431,8 @@ QImage QX11PixmapData::toImage() const
     return toImage(QRect(0, 0, w, h));
 }
 
-QImage QX11PixmapData::toImage(const QXImageWrapper &xiWrapper, const QRect &rect) const
+QImage QX11PixmapData::toImage(const XImage *xi, const QRect &rect) const
 {
-    XImage *xi = xiWrapper.xi;
-
     int d = depth();
     Visual *visual = (Visual *)xinfo.visual();
     bool trucol = (visual->c_class >= TrueColor) && d > 1;
index 113d0bd..987fab8 100644 (file)
 
 #include "qpixmapdata_p.h"
 #include "qx11info_x11.h"
+#include "qt_x11_p.h"
 
 QT_BEGIN_NAMESPACE
 
 class QX11PaintEngine;
 
-struct QXImageWrapper;
-
 class Q_GUI_EXPORT QX11PixmapData : public QPixmapData
 {
 public:
@@ -103,14 +102,14 @@ private:
 
     void release();
 
-    QImage toImage(const QXImageWrapper &xi, const QRect &rect) const;
+    QImage toImage(const XImage *xi, const QRect &rect) const;
 
     QBitmap mask_to_bitmap(int screen) const;
     static Qt::HANDLE bitmap_to_mask(const QBitmap &, int screen);
     void bitmapFromImage(const QImage &image);
 
-    bool canTakeQImageFromXImage(const QXImageWrapper &xi) const;
-    QImage takeQImageFromXImage(const QXImageWrapper &xi) const;
+    bool canTakeQImageFromXImage(const XImage *xi) const;
+    QImage takeQImageFromXImage(XImage *xi) const;
 
     Qt::HANDLE hd;