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

List:       kde-commits
Subject:    kdegraphics/kuickshow/src
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2005-01-14 14:31:22
Message-ID: 20050114143122.317901BA76 () office ! kde ! org
[Download RAW message or body]

CVS commit by lunakl: 

http://lists.kde.org/?l=kde-core-devel&m=110545229628391&w=2
Fix printing to do the scaling on the printer in order not to loose
image quality.
Hmm, is that shrinkToFit condition written intentionally that way
or does it have wrong precedence?
CCMAIL: pfeiffer@kde.org


  M +7 -6      printing.cpp   1.18


--- kdegraphics/kuickshow/src/printing.cpp  #1.17:1.18
@@ -107,6 +107,7 @@ bool Printing::printImageWithQt( const Q
     //
     bool shrinkToFit = (printer.option( "app-kuickshow-shrinkToFit" ) != f);
+    QSize imagesize = image.size();
     if ( shrinkToFit && image.width() > w || image.height() > h ) {
-        image = image.smoothScale( w, h, QImage::ScaleMin );
+        imagesize.scale( w, h, QSize::ScaleMin );
     }
 
@@ -126,22 +127,22 @@ bool Printing::printImageWithQt( const Q
     // x - alignment
     if ( alignment & Qt::AlignHCenter )
-        x = (w - image.width())/2;
+        x = (w - imagesize.width())/2;
     else if ( alignment & Qt::AlignLeft )
         x = 0;
     else if ( alignment & Qt::AlignRight )
-        x = w - image.width();
+        x = w - imagesize.width();
 
     // y - alignment
     if ( alignment & Qt::AlignVCenter )
-        y = (h - image.height())/2;
+        y = (h - imagesize.height())/2;
     else if ( alignment & Qt::AlignTop )
         y = 0;
     else if ( alignment & Qt::AlignBottom )
-        y = h - image.height();
+        y = h - imagesize.height();
 
     //
     // perform the actual drawing
     //
-    p.drawImage( x, y, image );
+    p.drawImage( QRect( x, y, imagesize.width(), imagesize.height()), image );
 
     if ( printFilename )


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

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