delete the old rotation code and make this generator working again

svn path=/trunk/playground/graphics/okular/; revision=599791
This commit is contained in:
Pino Toscano 2006-10-28 16:08:08 +00:00
parent 90ee1a0547
commit 9b5a184aa3

View file

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