[poppler] qt4/src
Pino Toscano
pino at kemper.freedesktop.org
Wed Aug 13 04:56:50 PDT 2008
qt4/src/poppler-form.cc | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
New commits:
commit 27ddf3c5e839358c8553d41743faa8ee304767bf
Author: Pino Toscano <pino at kde.org>
Date: Wed Aug 13 13:55:57 2008 +0200
[Qt4] make sure to use the correct page width/height for form widgets coordinates
diff --git a/qt4/src/poppler-form.cc b/qt4/src/poppler-form.cc
index 07675cd..bfd6d26 100644
--- a/qt4/src/poppler-form.cc
+++ b/qt4/src/poppler-form.cc
@@ -35,17 +35,23 @@ namespace Poppler {
FormField::FormField(FormFieldData &dd)
: m_formData(&dd)
{
+ const int rotation = m_formData->page->getRotate();
// reading the coords
double left, top, right, bottom;
m_formData->fm->getRect(&left, &bottom, &right, &top);
// build a normalized transform matrix for this page at 100% scale
- GfxState gfxState( 72.0, 72.0, m_formData->page->getMediaBox(), m_formData->page->getRotate(), gTrue );
+ GfxState gfxState( 72.0, 72.0, m_formData->page->getMediaBox(), rotation, gTrue );
double * gfxCTM = gfxState.getCTM();
double MTX[6];
+ double pageWidth = m_formData->page->getCropWidth();
+ double pageHeight = m_formData->page->getCropHeight();
+ // landscape and seascape page rotation: be sure to use the correct (== rotated) page size
+ if (((rotation / 90) % 2) == 1)
+ qSwap(pageWidth, pageHeight);
for ( int i = 0; i < 6; i+=2 )
{
- MTX[i] = gfxCTM[i] / m_formData->page->getCropWidth();
- MTX[i+1] = gfxCTM[i+1] / m_formData->page->getCropHeight();
+ MTX[i] = gfxCTM[i] / pageWidth;
+ MTX[i+1] = gfxCTM[i+1] / pageHeight;
}
QPointF topLeft;
XPDFReader::transform( MTX, qMin( left, right ), qMax( top, bottom ), topLeft );
More information about the poppler
mailing list