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

List:       kde-commits
Subject:    KDE/kdegames/kpat/libkcardgame
From:       Parker Coates <parker.coates () kdemail ! net>
Date:       2011-01-08 20:31:24
Message-ID: 20110108203124.2F0ABAC8B2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1212966 by coates:

Make cards check that their size is correct before painting.

If a card is asked to paint() but it's current pixmap differs in size
from the current deck card size, it now explicitly requests a new a new
pixmap from the deck.

This will hopefully fix all the recent issues with cards having the
wrong size or not appearing at all. Technically, they were always
appearing, but sometimes they were appearing at a size of 0 by 0 pixels.
:)

BUG:255933

 M  +6 -0      kabstractcarddeck.cpp  
 M  +2 -0      kabstractcarddeck.h  
 M  +9 -0      kcard.cpp  


--- trunk/KDE/kdegames/kpat/libkcardgame/kabstractcarddeck.cpp #1212965:1212966
@@ -487,5 +487,11 @@
 }
 
 
+QPixmap KAbstractCardDeck::cardPixmap( quint32 id, bool faceUp )
+{
+    return d->requestPixmap( id, faceUp );
+}
+
+
 #include "kabstractcarddeck.moc"
 #include "kabstractcarddeck_p.moc"
--- trunk/KDE/kdegames/kpat/libkcardgame/kabstractcarddeck.h #1212965:1212966
@@ -55,6 +55,8 @@
 
     bool hasAnimatedCards() const;
 
+    QPixmap cardPixmap( quint32 id, bool faceUp );
+
 Q_SIGNALS:
     void cardAnimationDone();
 
--- trunk/KDE/kdegames/kpat/libkcardgame/kcard.cpp #1212965:1212966
@@ -314,6 +314,15 @@
     Q_UNUSED( option );
     Q_UNUSED( widget );
 
+    if ( pixmap().size() != d->deck->cardSize() )
+    {
+        QPixmap newPix = d->deck->cardPixmap( d->id, d->faceUp );
+        if ( d->faceUp )
+            setFrontPixmap( newPix );
+        else
+            setBackPixmap( newPix );
+    }
+
     // Enable smooth pixmap transformation only if the card is rotated. We
     // don't really need it otherwise and it slows down our flip animations.
     painter->setRenderHint( QPainter::SmoothPixmapTransform, int(rotation()) % 90 );
[prev in list] [next in list] [prev in thread] [next in thread] 

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