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

List:       kde-commits
Subject:    kdenonbeta/style-workshop/largeimagelib
From:       Maks Orlovich <maksim () kde ! org>
Date:       2004-07-02 1:17:12
Message-ID: 20040702011712.4A2089992 () office ! kde ! org
[Download RAW message or body]

CVS commit by orlovich: 

Fix alpha support in core. 


  M +14 -3     frame.cpp   1.17
  M +5 -0      imageformat.h   1.4
  M +1 -0      imagetile.cpp   1.4


--- kdenonbeta/style-workshop/largeimagelib/frame.cpp  #1.16:1.17
@@ -122,5 +122,4 @@ void Frame::paint(unsigned int dx, unsig
                                  
         usePainter = new QPainter(doubleBuffer);
-        usePainter->fillRect(0, 0, sWidth, sHeight, Qt::black); //### CHECKME..
         useDX = 0;
         useDY = 0;
@@ -173,5 +172,17 @@ void Frame::paint(unsigned int dx, unsig
             
             if (!pmap.isNull())
+            {
+                //We have to be extra careful if we have an alpha channel and we're \
double-buffering +                if (format.hasAlpha() && usePainter != p)
+                {
+                    usePainter->end();
+                    copyBlt(doubleBuffer, paintX, paintY, &pmap, startX, startY, \
paintWidth, paintHeight); +                    usePainter->begin(doubleBuffer);
+                }
+                else
                 usePainter->drawPixmap(paintX, paintY, pmap, startX, startY, \
paintWidth, paintHeight); +            }
+            else
+                usePainter->fillRect(paintX, paintY, paintWidth, paintHeight, \
Qt::black);  
             paintX += paintWidth;

--- kdenonbeta/style-workshop/largeimagelib/imageformat.h  #1.3:1.4
@@ -50,4 +50,9 @@ struct ImageFormat
     }
     
+    bool hasAlpha() const
+    {
+        return  (type == Image_RGBA_32);
+    }
+    
     QValueVector<QRgb> palette;
 

--- kdenonbeta/style-workshop/largeimagelib/imagetile.cpp  #1.3:1.4
@@ -40,4 +40,5 @@ ImageTile* ImageTile::create(bool recons
     //Give the proper geometry, set palette if needed be
     tile->image = QImage(w, h, format.depth()*8);
+    tile->image.setAlphaBuffer(format.hasAlpha());
     
     if (format.type == ImageFormat::Image_Palette_8)


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

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