summaryrefslogtreecommitdiffstats
path: root/kpdf/core
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-12-14 08:57:48 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-12-14 08:57:48 +0000
commit9116c29739aa3e15eb5e052d335b1f76700f6b32 (patch)
treec7301ec627341f5207fba729b3e2ad4e6cb9dfb0 /kpdf/core
parent47d455dd55be855e4cc691c32f687f723d9247ee (diff)
downloadtdegraphics-9116c29739aa3e15eb5e052d335b1f76700f6b32.tar.gz
tdegraphics-9116c29739aa3e15eb5e052d335b1f76700f6b32.zip
* kpdf page rotate options
* kdvi options dialog enhancements * djvu plugin for kviewshell git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1062216 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpdf/core')
-rw-r--r--kpdf/core/generator.h5
-rw-r--r--kpdf/core/generator_pdf/generator_pdf.cpp5
-rw-r--r--kpdf/core/page.cpp39
-rw-r--r--kpdf/core/page.h3
4 files changed, 40 insertions, 12 deletions
diff --git a/kpdf/core/generator.h b/kpdf/core/generator.h
index ca0ea015..e0c892fd 100644
--- a/kpdf/core/generator.h
+++ b/kpdf/core/generator.h
@@ -92,8 +92,8 @@ class Generator : public QObject
*/
struct PixmapRequest
{
- PixmapRequest( int rId, int n, int w, int h, int p, bool a = false )
- : id( rId ), pageNumber( n ), width( w ), height( h ),
+ PixmapRequest( int rId, int n, int w, int h, int p, bool a = false, int r = 0 )
+ : id( rId ), pageNumber( n ), width( w ), height( h ), rotation( r ),
priority( p ), async( a ), page( 0 ) {};
// observer id
@@ -102,6 +102,7 @@ struct PixmapRequest
int pageNumber;
int width;
int height;
+ int rotation;
// asyncronous request priority (less is better, 0 is max)
int priority;
// generate the pixmap in a thread and notify observer when done
diff --git a/kpdf/core/generator_pdf/generator_pdf.cpp b/kpdf/core/generator_pdf/generator_pdf.cpp
index 7ad34152..35020e56 100644
--- a/kpdf/core/generator_pdf/generator_pdf.cpp
+++ b/kpdf/core/generator_pdf/generator_pdf.cpp
@@ -316,7 +316,8 @@ void PDFGenerator::generatePixmap( PixmapRequest * request )
// 1. Set OutputDev parameters and Generate contents
// note: thread safety is set on 'false' for the GUI (this) thread
kpdfOutputDev->setParams( request->width, request->height, genObjectRects, genObjectRects, false );
- pdfdoc->displayPage( kpdfOutputDev, page->number() + 1, fakeDpiX, fakeDpiY, 0, false, true, false );
+ pdfdoc->displayPage( kpdfOutputDev, page->number() + 1, fakeDpiX, fakeDpiY, request->rotation,
+ false, true, false );
if ( genObjectRects )
pdfdoc->processLinks( kpdfOutputDev, page->number() + 1 );
@@ -1225,7 +1226,7 @@ void PDFPixmapGeneratorThread::run()
d->generator->kpdfOutputDev->setParams( width, height,
genObjectRects, genObjectRects, TRUE /*thread safety*/ );
d->generator->pdfdoc->displayPage( d->generator->kpdfOutputDev, page->number() + 1,
- fakeDpiX, fakeDpiY, 0, false, true, false );
+ fakeDpiX, fakeDpiY, d->currentRequest->rotation, false, true, false );
if ( genObjectRects )
d->generator->pdfdoc->processLinks( d->generator->kpdfOutputDev, page->number() + 1 );
diff --git a/kpdf/core/page.cpp b/kpdf/core/page.cpp
index e6a847a8..70bc71bc 100644
--- a/kpdf/core/page.cpp
+++ b/kpdf/core/page.cpp
@@ -27,10 +27,40 @@ KPDFPage::KPDFPage( uint page, float w, float h, int r )
: m_number( page ), m_rotation( r ), m_width( w ), m_height( h ),
m_bookmarked( false ), m_text( 0 ), m_transition( 0 )
{
+ setRotation( r );
+}
+
+KPDFPage::~KPDFPage()
+{
+ deletePixmapsAndRects();
+ deleteHighlights();
+ delete m_text;
+ delete m_transition;
+}
+
+void KPDFPage::rotate90degrees()
+ {
+ float w = m_width;
+ m_width = m_height;
+ m_height = w;
+
+ // avoid Division-By-Zero problems in the program
+
+ if ( m_width <= 0 )
+ m_width = 1;
+ if ( m_height <= 0 )
+ m_height = 1;
+
+ deletePixmapsAndRects();
+ }
+
+void KPDFPage::setRotation( int r )
+{
// if landscape swap width <-> height (rotate 90deg CCW)
if ( r == 90 || r == 270 )
{
- m_width = h;
+ float w = m_width;
+ m_width = m_height;
m_height = w;
}
// avoid Division-By-Zero problems in the program
@@ -38,17 +68,10 @@ KPDFPage::KPDFPage( uint page, float w, float h, int r )
m_width = 1;
if ( m_height <= 0 )
m_height = 1;
-}
-KPDFPage::~KPDFPage()
-{
deletePixmapsAndRects();
- deleteHighlights();
- delete m_text;
- delete m_transition;
}
-
bool KPDFPage::hasPixmap( int id, int width, int height ) const
{
if ( !m_pixmaps.contains( id ) )
diff --git a/kpdf/core/page.h b/kpdf/core/page.h
index ebd6e522..4a8be71d 100644
--- a/kpdf/core/page.h
+++ b/kpdf/core/page.h
@@ -120,6 +120,9 @@ class KPDFPage
void deletePixmapsAndRects();
void deleteHighlights( int s_id = -1 );
+ void setRotation( int r );
+ void rotate90degrees();
+
private:
friend class PagePainter;
int m_number, m_rotation;