OSDN Git Service

remove unused composition modes
authorIvailo Monev <xakepa10@gmail.com>
Tue, 14 Dec 2021 22:28:46 +0000 (00:28 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Tue, 14 Dec 2021 22:28:46 +0000 (00:28 +0200)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/painting/qdrawhelper.cpp
src/gui/painting/qpaintengine.cpp
src/gui/painting/qpaintengine.h
src/gui/painting/qpaintengine_x11.cpp
src/gui/painting/qpainter.cpp
src/gui/painting/qpainter.h

index 6a86f31..fb031ed 100644 (file)
@@ -2506,211 +2506,6 @@ static void QT_FASTCALL comp_func_Exclusion(uint *dest, const uint *src, const i
     }
 }
 
-static void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest,
-                                                    int length,
-                                                    uint color,
-                                                    const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    while (length--)
-        *dest++ |= color;
-}
-
-static void QT_FASTCALL rasterop_SourceOrDestination(uint *dest,
-                                              const uint *src,
-                                              int length,
-                                              const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    while (length--)
-        *dest++ |= *src++;
-}
-
-static void QT_FASTCALL rasterop_solid_SourceAndDestination(uint *dest,
-                                                     int length,
-                                                     uint color,
-                                                     const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    color |= 0xff000000;
-    while (length--)
-        *dest++ &= color;
-}
-
-static void QT_FASTCALL rasterop_SourceAndDestination(uint *dest,
-                                               const uint *src,
-                                               int length,
-                                               const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    while (length--) {
-        *dest = (*src & *dest) | 0xff000000;
-        ++dest; ++src;
-    }
-}
-
-static void QT_FASTCALL rasterop_solid_SourceXorDestination(uint *dest,
-                                                     int length,
-                                                     uint color,
-                                                     const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    color &= 0x00ffffff;
-    while (length--)
-        *dest++ ^= color;
-}
-
-static void QT_FASTCALL rasterop_SourceXorDestination(uint *dest,
-                                               const uint *src,
-                                               int length,
-                                               const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    while (length--) {
-        *dest = (*src ^ *dest) | 0xff000000;
-        ++dest; ++src;
-    }
-}
-
-static void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest,
-                                                           int length,
-                                                           uint color,
-                                                           const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    color = ~color;
-    while (length--) {
-        *dest = (color & ~(*dest)) | 0xff000000;
-        ++dest;
-    }
-}
-
-static void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *dest,
-                                                     const uint *src,
-                                                     int length,
-                                                     const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    while (length--) {
-        *dest = (~(*src) & ~(*dest)) | 0xff000000;
-        ++dest; ++src;
-    }
-}
-
-static void QT_FASTCALL rasterop_solid_NotSourceOrNotDestination(uint *dest,
-                                                          int length,
-                                                          uint color,
-                                                          const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    color = ~color | 0xff000000;
-    while (length--) {
-        *dest = color | ~(*dest);
-        ++dest;
-    }
-}
-
-static void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *dest,
-                                                    const uint *src,
-                                                    int length,
-                                                    const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    while (length--) {
-        *dest = ~(*src) | ~(*dest) | 0xff000000;
-        ++dest; ++src;
-    }
-}
-
-static void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest,
-                                                        int length,
-                                                        uint color,
-                                                        const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    color = ~color & 0x00ffffff;
-    while (length--) {
-        *dest = color ^ (*dest);
-        ++dest;
-    }
-}
-
-static void QT_FASTCALL rasterop_NotSourceXorDestination(uint *dest,
-                                                  const uint *src,
-                                                  int length,
-                                                  const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    while (length--) {
-        *dest = ((~(*src)) ^ (*dest)) | 0xff000000;
-        ++dest; ++src;
-    }
-}
-
-static void QT_FASTCALL rasterop_solid_NotSource(uint *dest, const int length,
-                                          uint color, const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    qt_memfill(dest, ~color | 0xff000000, length);
-}
-
-static void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src,
-                                    int length, const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    while (length--)
-        *dest++ = ~(*src++) | 0xff000000;
-}
-
-static void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest,
-                                                        int length,
-                                                        uint color,
-                                                        const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    color = ~color | 0xff000000;
-    while (length--) {
-        *dest = color & *dest;
-        ++dest;
-    }
-}
-
-static void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest,
-                                                  const uint *src,
-                                                  int length,
-                                                  const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    while (length--) {
-        *dest = (~(*src) & *dest) | 0xff000000;
-        ++dest; ++src;
-    }
-}
-
-static void QT_FASTCALL rasterop_solid_SourceAndNotDestination(uint *dest,
-                                                        int length,
-                                                        uint color,
-                                                        uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    while (length--) {
-        *dest = (color & ~(*dest)) | 0xff000000;
-        ++dest;
-    }
-}
-
-static void QT_FASTCALL rasterop_SourceAndNotDestination(uint *dest,
-                                                  const uint *src,
-                                                  int length,
-                                                  const uint const_alpha)
-{
-    Q_UNUSED(const_alpha);
-    while (length--) {
-        *dest = (*src & ~(*dest)) | 0xff000000;
-        ++dest; ++src;
-    }
-}
-
 static const CompositionFunctionSolid functionForModeSolid[] = {
         comp_func_solid_SourceOver,
         comp_func_solid_DestinationOver,
@@ -2735,16 +2530,7 @@ static const CompositionFunctionSolid functionForModeSolid[] = {
         comp_func_solid_HardLight,
         comp_func_solid_SoftLight,
         comp_func_solid_Difference,
-        comp_func_solid_Exclusion,
-        rasterop_solid_SourceOrDestination,
-        rasterop_solid_SourceAndDestination,
-        rasterop_solid_SourceXorDestination,
-        rasterop_solid_NotSourceAndNotDestination,
-        rasterop_solid_NotSourceOrNotDestination,
-        rasterop_solid_NotSourceXorDestination,
-        rasterop_solid_NotSource,
-        rasterop_solid_NotSourceAndDestination,
-        rasterop_solid_SourceAndNotDestination
+        comp_func_solid_Exclusion
 };
 
 static const CompositionFunction functionForMode[] = {
@@ -2771,16 +2557,7 @@ static const CompositionFunction functionForMode[] = {
         comp_func_HardLight,
         comp_func_SoftLight,
         comp_func_Difference,
-        comp_func_Exclusion,
-        rasterop_SourceOrDestination,
-        rasterop_SourceAndDestination,
-        rasterop_SourceXorDestination,
-        rasterop_NotSourceAndNotDestination,
-        rasterop_NotSourceOrNotDestination,
-        rasterop_NotSourceXorDestination,
-        rasterop_NotSource,
-        rasterop_NotSourceAndDestination,
-        rasterop_SourceAndNotDestination
+        comp_func_Exclusion
 };
 
 static inline TextureBlendType getBlendType(const QSpanData *data)
index 700e733..03de907 100644 (file)
@@ -178,7 +178,6 @@ QFont QTextItem::font() const
   \value PixmapTransform    The engine can transform pixmaps, including
                             rotation and shearing.
   \value PorterDuff         The engine supports Porter-Duff operations
-  \value RasterOpModes      The engine supports bitwise raster operations.
   \value AllFeatures        All of the above features. This enum value is usually
                             used as a bit mask.
 */
index 0b629d7..031f214 100644 (file)
@@ -74,8 +74,7 @@ public:
         ConstantOpacity             = 0x00000040, // Can render at constant opacity
         PerspectiveTransform        = 0x00000080, // Can do perspective transformations
         BlendModes                  = 0x00000100, // Can do extended Porter&Duff composition
-        RasterOpModes               = 0x00000200, // Can do logical raster operations
-        PaintOutsidePaintEvent      = 0x00000400, // Engine is capable of painting outside paint events
+        PaintOutsidePaintEvent      = 0x00000200, // Engine is capable of painting outside paint events
 
         AllFeatures                 = 0xffffffff  // For convenience
     };
index bdfd45f..65a51a4 100644 (file)
@@ -343,8 +343,7 @@ static QPaintEngine::PaintEngineFeatures qt_decide_features()
 {
     QPaintEngine::PaintEngineFeatures features =
         QPaintEngine::AlphaBlend
-        | QPaintEngine::PainterPaths
-        | QPaintEngine::RasterOpModes;
+        | QPaintEngine::PainterPaths;
 
     if (qt_x11Data->use_xrender) {
         features |= QPaintEngine::Antialiasing;
@@ -1046,33 +1045,6 @@ void QX11PaintEngine::updateState(const QPaintEngineState &state)
                 d->composition_mode = PictOpXor;
                 break;
 #endif
-            case QPainter::RasterOp_SourceOrDestination:
-                function = GXor;
-                break;
-            case QPainter::RasterOp_SourceAndDestination:
-                function = GXand;
-                break;
-            case QPainter::RasterOp_SourceXorDestination:
-                function = GXxor;
-                break;
-            case QPainter::RasterOp_NotSourceAndNotDestination:
-                function = GXnor;
-                break;
-            case QPainter::RasterOp_NotSourceOrNotDestination:
-                function = GXnand;
-                break;
-            case QPainter::RasterOp_NotSourceXorDestination:
-                function = GXequiv;
-                break;
-            case QPainter::RasterOp_NotSource:
-                function = GXcopyInverted;
-                break;
-            case QPainter::RasterOp_SourceAndNotDestination:
-                function = GXandReverse;
-                break;
-            case QPainter::RasterOp_NotSourceAndDestination:
-                function = GXandInverted;
-                break;
             default:
                 break;
         }
index e666a88..968ccaa 100644 (file)
@@ -1764,15 +1764,6 @@ void QPainter::setBrushOrigin(const QPointF &p)
     the source, are merged with the pixel in another image, the
     destination.
 
-    Please note that the bitwise raster operation modes, denoted with
-    a RasterOp prefix, are only natively supported in the X11 and
-    raster paint engines. This means that the only way to utilize
-    these modes on the Mac is via a QImage. The RasterOp denoted blend
-    modes are \e not supported for pens and brushes with alpha
-    components. Also, turning on the QPainter::Antialiasing render
-    hint will effectively disable the RasterOp modes.
-
-
      \image qpainter-compositionmode1.png
      \image qpainter-compositionmode2.png
 
@@ -1888,38 +1879,6 @@ void QPainter::setBrushOrigin(const QPointF &p)
     with white inverts the destination color, whereas painting with
     black leaves the destination color unchanged.
 
-    \value RasterOp_SourceOrDestination Does a bitwise OR operation on
-    the source and destination pixels (src OR dst).
-
-    \value RasterOp_SourceAndDestination Does a bitwise AND operation
-    on the source and destination pixels (src AND dst).
-
-    \value RasterOp_SourceXorDestination Does a bitwise XOR operation
-    on the source and destination pixels (src XOR dst).
-
-    \value RasterOp_NotSourceAndNotDestination Does a bitwise NOR
-    operation on the source and destination pixels ((NOT src) AND (NOT
-    dst)).
-
-    \value RasterOp_NotSourceOrNotDestination Does a bitwise NAND
-    operation on the source and destination pixels ((NOT src) OR (NOT
-    dst)).
-
-    \value RasterOp_NotSourceXorDestination Does a bitwise operation
-    where the source pixels are inverted and then XOR'ed with the
-    destination ((NOT src) XOR dst).
-
-    \value RasterOp_NotSource Does a bitwise operation where the
-    source pixels are inverted (NOT src).
-
-    \value RasterOp_NotSourceAndDestination Does a bitwise operation
-    where the source is inverted and then AND'ed with the destination
-    ((NOT src) AND dst).
-
-    \value RasterOp_SourceAndNotDestination Does a bitwise operation
-    where the source is AND'ed with the inverted destination pixels
-    (src AND (NOT dst)).
-
     \sa compositionMode(), setCompositionMode(), {QPainter#Composition
     Modes}{Composition Modes}, {Image Composition Example}
 */
@@ -1928,8 +1887,7 @@ void QPainter::setBrushOrigin(const QPointF &p)
     Sets the composition mode to the given \a mode.
 
     \warning Only a QPainter operating on a QImage fully supports all
-    composition modes. The RasterOp modes are supported for X11 as
-    described in compositionMode().
+    composition modes.
 
     \sa compositionMode()
 */
@@ -1948,13 +1906,7 @@ void QPainter::setCompositionMode(CompositionMode mode)
         return;
     }
 
-    if (mode >= QPainter::RasterOp_SourceOrDestination) {
-        if (Q_UNLIKELY(!d->engine->hasFeature(QPaintEngine::RasterOpModes))) {
-            qWarning("QPainter::setCompositionMode: "
-                     "Raster operation modes not supported on device");
-            return;
-        }
-    } else if (mode >= QPainter::CompositionMode_Plus) {
+    if (mode >= QPainter::CompositionMode_Plus) {
         if (Q_UNLIKELY(!d->engine->hasFeature(QPaintEngine::BlendModes))) {
             qWarning("QPainter::setCompositionMode: "
                      "Blend modes not supported on device");
index a2eb40a..dde8555 100644 (file)
@@ -102,18 +102,7 @@ public:
         CompositionMode_HardLight,
         CompositionMode_SoftLight,
         CompositionMode_Difference,
-        CompositionMode_Exclusion,
-
-        // ROPs
-        RasterOp_SourceOrDestination,
-        RasterOp_SourceAndDestination,
-        RasterOp_SourceXorDestination,
-        RasterOp_NotSourceAndNotDestination,
-        RasterOp_NotSourceOrNotDestination,
-        RasterOp_NotSourceXorDestination,
-        RasterOp_NotSource,
-        RasterOp_NotSourceAndDestination,
-        RasterOp_SourceAndNotDestination
+        CompositionMode_Exclusion
     };
     void setCompositionMode(CompositionMode mode);
     CompositionMode compositionMode() const;