[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdeaddons/konq-plugins/kimgalleryplugin
From: Maks Orlovich <mo002j () mail ! rochester ! edu>
Date: 2003-05-26 3:12:24
[Download RAW message or body]
CVS commit by orlovich:
Do not needlessly create pixmaps and convert back-and-forth to images.
Loading, scaling, and saving are all done on the client side, so no need to
get the X server involved or to spend time doing expensive conversions.
Make thumbnailing the random screenshots in my home directory take 6 seconds instead of
16.
CCMAIL: 57023-done@bugs.kde.org
M +7 -7 imgalleryplugin.cpp 1.45
--- kdeaddons/konq-plugins/kimgalleryplugin/imgalleryplugin.cpp #1.44:1.45
@@ -435,5 +435,5 @@ bool KImGalleryPlugin::createThumb( cons
const QString& imgGalleryDir, const QString& imageFormat)
{
- QPixmap pix;
+ QImage img;
const QString pixPath = sourceDirName + QString::fromLatin1("/") + imgName;
@@ -455,7 +455,7 @@ bool KImGalleryPlugin::createThumb( cons
m_imgWidth = 120; // Setting the size of the images is
m_imgHeight = 90; // required to generate faster 'loading' pages
- if ( pix.load( pixPath ) )
+ if ( img.load( pixPath ) )
{
- int w = pix.width(), h = pix.height();
+ int w = img.width(), h = img.height();
// scale to pixie size
// kdDebug() << "w: " << w << " h: " << h << endl;
@@ -477,14 +477,14 @@ bool KImGalleryPlugin::createThumb( cons
Q_ASSERT( w <= extent );
}
- const QImage img(pix.convertToImage().smoothScale( w, h ));
- if ( img.width() != w || img.height() != h )
+ const QImage scaleImg(img.smoothScale( w, h ));
+ if ( scaleImg.width() != w || scaleImg.height() != h )
{
kdDebug() << "Resizing failed. Aborting." << endl;
return false;
}
- pix.convertFromImage( img );
+ img = scaleImg;
}
kdDebug() << "Saving thumbnail to: " << thumbDir + imgNameFormat << endl;
- if (!pix.save(thumbDir + imgNameFormat, imageFormat.latin1()))
+ if (!img.save(thumbDir + imgNameFormat, imageFormat.latin1()))
{
kdDebug() << "Saving failed. Aborting." << endl;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic