From 4c3d96c1933e7f74dc9d57972730b48072cd3fc2 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sat, 28 Oct 2006 16:47:33 +0000 Subject: [PATCH] make the rotation working almost again svn path=/trunk/playground/graphics/okular/; revision=599808 --- generators/ghostview/generator_ghostview.cpp | 24 +++++++++++--------- generators/ghostview/generator_ghostview.h | 1 - 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/generators/ghostview/generator_ghostview.cpp b/generators/ghostview/generator_ghostview.cpp index 5d3bb9ab9..ce77942e2 100644 --- a/generators/ghostview/generator_ghostview.cpp +++ b/generators/ghostview/generator_ghostview.cpp @@ -244,11 +244,6 @@ void GSGenerator::slotAsyncPixmapGenerated(QPixmap * pix) docLock.unlock(); } -void GSGenerator::rotationChanged( int newOrientation, int /*oldOrientation*/ ) -{ - internalDoc->setOrientation(orientation(newOrientation)); -} - bool GSGenerator::supportsPaperSizes() const { return true; @@ -363,6 +358,15 @@ void GSGenerator::generatePixmap( Okular::PixmapRequest * req ) { kWarning() << "receiving req id=" << req->id() << " " <width() << "x" << req->height() << "@" << req->pageNumber() << " async == " << req->asynchronous() << endl; int pgNo=req->pageNumber(); + double width = req->page()->width(); + double height = req->page()->height(); + int reqwidth = req->width(); + int reqheight = req->height(); + if ( req->page()->rotation() ) + { + qSwap( width, height ); + qSwap( reqwidth, reqheight ); + } if ( req->asynchronous() ) { docLock.lock(); @@ -371,12 +375,11 @@ void GSGenerator::generatePixmap( Okular::PixmapRequest * req ) asyncGenerator->setOrientation(rotation (internalDoc->orientation(pgNo))); // asyncGenerator->setBoundingBox( internalDoc->boundingBox(i)); kWarning() << "setSize\n"; - asyncGenerator->setSize(req->width() ,req->height()); + asyncGenerator->setSize( reqwidth, reqheight ); kWarning() << "setMedia\n"; asyncGenerator->setMedia( internalDoc -> getPaperSize ( internalDoc -> pageMedia( pgNo )) ); kWarning() << "setMagnify\n"; - asyncGenerator->setMagnify(qMax(static_cast(req->width())/req->page()->width() , - static_cast(req->height())/req->page()->height())); + asyncGenerator->setMagnify( qMax( (double)reqwidth / width, (double)reqheight / height ) ); GSInterpreterLib::Position u=internalDoc->pagePos(pgNo); // kWarning () << "Page pos is " << pgNo << ":"<< u.first << "/" << u.second << endl; if (!asyncGenerator->interpreterRunning()) @@ -403,10 +406,9 @@ void GSGenerator::generatePixmap( Okular::PixmapRequest * req ) // this, SLOT(slotPixmapGenerated (const QImage*))); pixGenerator->setMedia( internalDoc -> getPaperSize ( internalDoc -> pageMedia( pgNo )) ); - pixGenerator->setMagnify(qMax(static_cast(req->width())/req->page()->width() , - static_cast(req->height())/req->page()->height())); + pixGenerator->setMagnify( qMax( (double)reqwidth / width, (double)reqheight / height ) ); pixGenerator->setOrientation(rotation (internalDoc->orientation(pgNo))); - pixGenerator->setSize(req->width() ,req->height()); + pixGenerator->setSize( reqwidth, reqheight ); // pixGenerator->setBoundingBox( internalDoc->boundingBox(i)); diff --git a/generators/ghostview/generator_ghostview.h b/generators/ghostview/generator_ghostview.h index 024f81e76..0c21bcab7 100644 --- a/generators/ghostview/generator_ghostview.h +++ b/generators/ghostview/generator_ghostview.h @@ -38,7 +38,6 @@ class GSGenerator : public Okular::Generator void generatePixmap( Okular::PixmapRequest * request ) ; bool supportsRotation() const { return true; } ; - void rotationChanged( int newOrientation, int oldOrientation ); // paper size management bool supportsPaperSizes() const;