summaryrefslogtreecommitdiff
path: root/qt4/src
diff options
context:
space:
mode:
authorFabio D'Urso <fabiodurso@hotmail.it>2012-05-24 23:17:27 +0200
committerAlbert Astals Cid <aacid@kde.org>2012-06-09 01:49:23 +0200
commit6e3503b5591b105fa92e6cc6568b8819f6acd625 (patch)
tree1a19b1f218400d425ab8797de53337bad8fef5bb /qt4/src
parent4f2ac544f36aa11747c3e13ff69fc19bdd0136dc (diff)
qt4: Keep page rotation into account when normalizing annotation coords
If the page is rotated by 90 or 270 degrees, width and height need to be swapped
Diffstat (limited to 'qt4/src')
-rw-r--r--qt4/src/poppler-annotation.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/qt4/src/poppler-annotation.cc b/qt4/src/poppler-annotation.cc
index c9a28509..f6341b0c 100644
--- a/qt4/src/poppler-annotation.cc
+++ b/qt4/src/poppler-annotation.cc
@@ -203,10 +203,22 @@ void AnnotationPrivate::fillMTX(double MTX[6]) const
// build a normalized transform matrix for this page at 100% scale
GfxState * gfxState = new GfxState( 72.0, 72.0, pdfPage->getCropBox(), pdfPage->getRotate(), gTrue );
double * gfxCTM = gfxState->getCTM();
+
+ double w = pdfPage->getCropWidth();
+ double h = pdfPage->getCropHeight();
+
+ // Swap width and height if the page is rotated landscape or seascape
+ if ( pdfPage->getRotate() == 90 || pdfPage->getRotate() == 270 )
+ {
+ double t = w;
+ w = h;
+ h = t;
+ }
+
for ( int i = 0; i < 6; i+=2 )
{
- MTX[i] = gfxCTM[i] / pdfPage->getCropWidth();
- MTX[i+1] = gfxCTM[i+1] / pdfPage->getCropHeight();
+ MTX[i] = gfxCTM[i] / w;
+ MTX[i+1] = gfxCTM[i+1] / h;
}
delete gfxState;
}