[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdegraphics/kolourpaint/pixmapfx
From:       Clarence Dang <dang () kde ! org>
Date:       2007-10-05 10:29:02
Message-ID: 1191580142.288203.22759.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 721481 by dang:

Ban bogus code path -- kpPixmapFX::draw() on QBitmap's.

No one was doing it (except an interim version of kpPixmapFX::flip()
that was fixed before it was committed).  And even if they were,
the way this method was being used did not support an "RGB" channel 
with only 2 colors (draw_ToQColor() would not work).



 M  +8 -0      kpPixmapFX.h  
 M  +5 -5      kpPixmapFX_AbstractDraw.cpp  


--- trunk/KDE/kdegraphics/kolourpaint/pixmapfx/kpPixmapFX.h #721480:721481
@@ -309,6 +309,14 @@
     // WARNING: The current implementation does not permit <drawFunc> to access
     //          <image> (as it clears <image>'s mask before drawFunc() (but
     //          does restore the mask later)).
+    //
+    // ASSUMPTIONS:
+    //
+    // 1. <image> already satisifes the no-alpha-channel invariant
+    //    (any newly-constructed QPixmap will, even though the RGB channel
+    //     contains randomness).
+    // 2. <image> is not of depth 1.
+    //
     static void draw (QPixmap *image,
         void (*drawFunc) (QPainter * /*p*/,
             bool /*drawingOnRGBLayer*/,
--- trunk/KDE/kdegraphics/kolourpaint/pixmapfx/kpPixmapFX_AbstractDraw.cpp #721480:721481
@@ -135,13 +135,13 @@
 
     KP_PFX_CHECK_NO_ALPHA_CHANNEL (*image);
 
+    // Interesting note (in case we support depth 1 later):
+    // QBitmap's do not have masks but QBitmap::mask() returns itself.
+    Q_ASSERT (image->depth () > 1);
 
-    // Get mask.  Work around the fact that QBitmap's do not have masks.
-    // but QBitmap::mask() returns itself.
-    QBitmap mask = image->depth () > 1 ?
-        image->mask () :
-        QBitmap ();
 
+    QBitmap mask = image->mask ();
+
 #if DEBUG_KP_PIXMAP_FX
     kDebug () << "\tDraw(): hasMask=" << !mask.isNull ();
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic