make the rotation working almost again

svn path=/trunk/playground/graphics/okular/; revision=599808
remotes/origin/KDE/4.0
Pino Toscano 20 years ago
parent a3667a7202
commit 4c3d96c193
  1. 24
      generators/ghostview/generator_ghostview.cpp
  2. 1
      generators/ghostview/generator_ghostview.h

@ -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() << " " <<req->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<double>(req->width())/req->page()->width() ,
static_cast<double>(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<double>(req->width())/req->page()->width() ,
static_cast<double>(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));

@ -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;

Loading…
Cancel
Save