delete the old rotation code and make this generator working again

svn path=/trunk/playground/graphics/okular/; revision=599791
remotes/origin/KDE/4.0
Pino Toscano 20 years ago
parent 90ee1a0547
commit 9b5a184aa3
  1. 15
      generators/kimgio/generator_kimgio.cpp

@ -8,9 +8,7 @@
***************************************************************************/ ***************************************************************************/
#include <qpainter.h> #include <qpainter.h>
#include <qpixmap.h>
#include <qimage.h> #include <qimage.h>
#include <kimageeffect.h>
#include <kprinter.h> #include <kprinter.h>
#include "core/page.h" #include "core/page.h"
@ -54,13 +52,12 @@ bool KIMGIOGenerator::canGeneratePixmap( bool /* async */ ) const
void KIMGIOGenerator::generatePixmap( Okular::PixmapRequest * request ) void KIMGIOGenerator::generatePixmap( Okular::PixmapRequest * request )
{ {
// perform a smooth scaled generation // perform a smooth scaled generation
QImage smoothImage = m_pix->toImage().scaled( request->width(), request->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ); int width = request->width();
// rotate, if necessary int height = request->height();
int rotation = request->page()->rotation(); if ( request->page()->rotation() % 2 == 1 )
QImage finalImage = rotation > 0 qSwap( width, height );
? KImageEffect::rotate( smoothImage, (KImageEffect::RotateDirection)( rotation - 1 ) ) QImage image = m_pix->toImage().scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
: smoothImage; request->page()->setImage( request->id(), image );
request->page()->setImage(request->id(), finalImage);
// signal that the request has been accomplished // signal that the request has been accomplished
signalRequestDone(request); signalRequestDone(request);

Loading…
Cancel
Save