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

List:       kde-commits
Subject:    kdenox/konq-embed/kdesrc/khtml/patches
From:       Eva Brucherseifer <eva () kde ! org>
Date:       2006-03-17 16:43:54
Message-ID: 1142613834.406654.23116.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 519603 by eva:

when scaling an image, use QImage::smoothScaling instead of
QPixmap::xForm
This is probably slower, but gives much better results. In qt2 xForm 
doesn't even work for jpgs and alpha channels.


 M  +30 -0     image_scaling.patch  


--- trunk/kdenox/konq-embed/kdesrc/khtml/patches/image_scaling.patch #519602:519603
@@ -231,3 +231,33 @@
          _style->setDisplay(BLOCK);
          _style->setVisuallyOrdered( visuallyOrdered );
          // ### make the font stuff _really_ work!!!!
+--- rendering/render_image.cpp	2006-03-15 19:17:49.000000000 +0100
++++ rendering/render_image.cpp.org	2006-03-15 19:17:27.000000000 +0100
+@@ -305,10 +305,12 @@
+ //                  kdDebug( 6040 ) << "have to scale: " << endl;
+ //                  qDebug("cw=%d ch=%d  pw=%d ph=%d  rcw=%d, rch=%d",
+ //                          cWidth, cHeight, intrinsicWidth(), intrinsicHeight(), \
resizeCache.width(), resizeCache.height()); +-                QWMatrix matrix;
+-                matrix.scale( (float)(cWidth)/intrinsicWidth(),
+-                              (float)(cHeight)/intrinsicHeight() );
+-                resizeCache = pix.xForm( matrix );
++//                QWMatrix matrix;
++//                matrix.scale( (float)(cWidth)/intrinsicWidth(),
++//                              (float)(cHeight)/intrinsicHeight() );
++//                resizeCache = pix.xForm( matrix );
++                QImage qi = pix.convertToImage();
++                resizeCache = qi.smoothScale(cWidth,cHeight);
+                 scaledrect.setWidth( ( cWidth*scaledrect.width() ) / \
intrinsicWidth() ); +                 scaledrect.setHeight( ( \
cHeight*scaledrect.height() ) / intrinsicHeight() ); + //                   \
qDebug("resizeCache size: %d/%d", resizeCache.width(), resizeCache.height()); +--- \
rendering/render_image.cpp	2006-03-17 17:38:48.000000000 +0100 ++++ \
rendering/render_image.cpp.org	2006-03-15 19:17:27.000000000 +0100 +@@ -298,7 +298,7 \
@@ +         if ( (cWidth != intrinsicWidth() ||  cHeight != intrinsicHeight()) &&
+              pix.width() > 0 && pix.height() > 0 && i->valid_rect().isValid())
+         {
+-            if (resizeCache.isNull() && cWidth && cHeight && intrinsicWidth() && \
intrinsicHeight() && pix.width() && pix.height() ) ++            if \
(resizeCache.isNull() && cWidth && cHeight && intrinsicWidth() && intrinsicHeight()) \
+             { +                 QRect scaledrect(i->valid_rect());
+ //                 kdDebug(6040) << "time elapsed: " << dt->elapsed() << endl;


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

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