qt4/src/poppler-annotation.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
New commits: commit 6e3503b5591b105fa92e6cc6568b8819f6acd625 Author: Fabio D'Urso <[email protected]> Date: Thu May 24 23:17:27 2012 +0200 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 diff --git a/qt4/src/poppler-annotation.cc b/qt4/src/poppler-annotation.cc index c9a2850..f6341b0 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; } _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
