src/gui/painting/qbrush.cpp
changeset 30 5dc02b23752f
parent 22 79de32ba3296
child 33 3e2da88830cd
--- a/src/gui/painting/qbrush.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/gui/painting/qbrush.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -911,7 +911,7 @@
     otherwise returns false.
 
     Two brushes are different if they have different styles, colors or
-    pixmaps.
+    transforms or different pixmaps or gradients depending on the style.
 
     \sa operator==()
 */
@@ -923,7 +923,7 @@
     otherwise returns false.
 
     Two brushes are equal if they have equal styles, colors and
-    pixmaps.
+    transforms and equal pixmaps or gradients depending on the style.
 
     \sa operator!=()
 */
@@ -932,26 +932,26 @@
 {
     if (b.d == d)
         return true;
-    if (b.d->style == d->style && b.d->color == d->color) {
-        switch (d->style) {
-        case Qt::TexturePattern: {
-            QPixmap &us = (static_cast<QTexturedBrushData *>(d.data()))->pixmap();
-            QPixmap &them = (static_cast<QTexturedBrushData *>(b.d.data()))->pixmap();
+    if (b.d->style != d->style || b.d->color != d->color || b.d->transform != d->transform)
+        return false;
+    switch (d->style) {
+    case Qt::TexturePattern:
+        {
+            const QPixmap &us = (static_cast<QTexturedBrushData *>(d.data()))->pixmap();
+            const QPixmap &them = (static_cast<QTexturedBrushData *>(b.d.data()))->pixmap();
             return ((us.isNull() && them.isNull()) || us.cacheKey() == them.cacheKey());
         }
-        case Qt::LinearGradientPattern:
-        case Qt::RadialGradientPattern:
-        case Qt::ConicalGradientPattern:
-            {
-                QGradientBrushData *d1 = static_cast<QGradientBrushData *>(d.data());
-                QGradientBrushData *d2 = static_cast<QGradientBrushData *>(b.d.data());
-                return d1->gradient == d2->gradient;
-            }
-        default:
-            return true;
+    case Qt::LinearGradientPattern:
+    case Qt::RadialGradientPattern:
+    case Qt::ConicalGradientPattern:
+        {
+            const QGradientBrushData *d1 = static_cast<QGradientBrushData *>(d.data());
+            const QGradientBrushData *d2 = static_cast<QGradientBrushData *>(b.d.data());
+            return d1->gradient == d2->gradient;
         }
+    default:
+        return true;
     }
-    return false;
 }
 
 /*!