mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-28 19:28:38 +00:00
Almost foget to fordwardport r582561
Fix bug 133507 that prevented the correct restoring of the document viewport on session restore for remote documents svn path=/trunk/playground/graphics/okular/; revision=584932
This commit is contained in:
parent
9f6f989e1c
commit
4e04b301f1
9 changed files with 27 additions and 10 deletions
|
@ -861,6 +861,10 @@ void KPDFDocument::setNextViewport()
|
|||
}
|
||||
}
|
||||
|
||||
void KPDFDocument::setNextDocumentViewport( const DocumentViewport & viewport )
|
||||
{
|
||||
d->nextDocumentViewport = viewport;
|
||||
}
|
||||
|
||||
bool KPDFDocument::searchText( int searchID, const QString & text, bool fromStart, bool caseSensitive,
|
||||
SearchType type, bool moveViewport, const QColor & color, bool noDialogs )
|
||||
|
|
|
@ -125,6 +125,7 @@ class OKULAR_EXPORT KPDFDocument : public QObject
|
|||
void setViewport( const DocumentViewport & viewport, int excludeId = -1, bool smoothMove = false );
|
||||
void setPrevViewport();
|
||||
void setNextViewport();
|
||||
void setNextDocumentViewport( const DocumentViewport & viewport );
|
||||
void requestPixmaps( const QLinkedList< PixmapRequest * > & requests );
|
||||
void requestTextPage( uint page );
|
||||
void addPageAnnotation( int page, Annotation * annotation );
|
||||
|
|
12
part.cpp
12
part.cpp
|
@ -1195,15 +1195,21 @@ void Part::doPrint(KPrinter &printer)
|
|||
}
|
||||
}
|
||||
|
||||
void Part::restoreDocument(const KUrl &url, int page)
|
||||
void Part::restoreDocument(KConfig* config)
|
||||
{
|
||||
if (openUrl(url)) goToPage(page);
|
||||
KUrl url ( config->readPathEntry( "URL" ) );
|
||||
if ( url.isValid() )
|
||||
{
|
||||
QString viewport = config->readEntry( "Viewport" );
|
||||
if (!viewport.isEmpty()) m_document->setNextDocumentViewport( DocumentViewport( viewport ) );
|
||||
openUrl( url );
|
||||
}
|
||||
}
|
||||
|
||||
void Part::saveDocumentRestoreInfo(KConfig* config)
|
||||
{
|
||||
config->writePathEntry( "URL", url().url() );
|
||||
if (m_document->pages() > 0) config->writeEntry( "Page", m_document->currentPage() + 1 );
|
||||
config->writeEntry( "Viewport", m_document->viewport().toString() );
|
||||
}
|
||||
|
||||
void Part::psTransformEnded()
|
||||
|
|
2
part.h
2
part.h
|
@ -137,7 +137,7 @@ protected slots:
|
|||
public slots:
|
||||
// connected to Shell action (and browserExtension), not local one
|
||||
void slotPrint();
|
||||
void restoreDocument(const KUrl &url, int page);
|
||||
void restoreDocument(KConfig* config);
|
||||
void saveDocumentRestoreInfo(KConfig* config);
|
||||
void slotFileDirty( const QString& );
|
||||
void slotDoFileDirty();
|
||||
|
|
|
@ -96,7 +96,7 @@ void Shell::init()
|
|||
m_part = 0;
|
||||
return;
|
||||
}
|
||||
connect( this, SIGNAL( restoreDocument(const KUrl &, int) ),m_part, SLOT( restoreDocument(const KUrl &, int)));
|
||||
connect( this, SIGNAL( restoreDocument(KConfig*) ),m_part, SLOT( restoreDocument(KConfig*)));
|
||||
connect( this, SIGNAL( saveDocumentRestoreInfo(KConfig*) ), m_part, SLOT( saveDocumentRestoreInfo(KConfig*)));
|
||||
connect( m_part, SIGNAL( enablePrintAction(bool) ), m_printAction, SLOT( setEnabled(bool)));
|
||||
|
||||
|
@ -188,8 +188,7 @@ void Shell::readProperties(KConfig* config)
|
|||
// in 'saveProperties'
|
||||
if(m_part)
|
||||
{
|
||||
KUrl url ( config->readPathEntry( "URL" ) );
|
||||
if ( url.isValid() ) emit restoreDocument(url, config->readEntry( "Page", 1 ));
|
||||
emit restoreDocument(config);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class Part;
|
|||
void delayedOpen();
|
||||
|
||||
signals:
|
||||
void restoreDocument(const KUrl &url, int page);
|
||||
void restoreDocument(KConfig* config);
|
||||
void saveDocumentRestoreInfo(KConfig* config);
|
||||
|
||||
private:
|
||||
|
|
|
@ -711,6 +711,7 @@ void PagePainter::drawShapeOnImage(
|
|||
//float antiAliasRadius
|
||||
)
|
||||
{
|
||||
op = Multiply;
|
||||
// safety checks
|
||||
int pointsNumber = normPath.size();
|
||||
if ( pointsNumber < 2 )
|
||||
|
@ -736,6 +737,7 @@ void PagePainter::drawShapeOnImage(
|
|||
// create 'pixel buffer', 'clipped renderer', 'scanline renderer' on bgra32 format
|
||||
typedef agg::pixfmt_bgra32 bgra32;
|
||||
typedef agg::renderer_base< bgra32 > rb_bgra32;
|
||||
kDebug() << (op == Multiply) << endl;
|
||||
bgra32 pixels( buffer, op == Multiply ? 1 : 0 );
|
||||
rb_bgra32 rb( pixels );
|
||||
agg::renderer_scanline_aa_solid< rb_bgra32 > render( rb );
|
||||
|
|
|
@ -53,7 +53,7 @@ class PagePainter
|
|||
|
||||
// my pretty dear raster function
|
||||
typedef QList< NormalizedPoint > NormalizedPath;
|
||||
enum RasterOperation { Normal, Multiply };
|
||||
enum RasterOperation { Normal = 0, Multiply = 1 };
|
||||
static void drawShapeOnImage(
|
||||
QImage & image,
|
||||
const NormalizedPath & imagePoints,
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "agg_color_rgba.h"
|
||||
#include "agg_rendering_buffer.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace agg
|
||||
{
|
||||
// Nice trick from Qt4's Arthur
|
||||
|
@ -135,7 +137,9 @@ namespace agg
|
|||
//--------------------------------------------------------------------
|
||||
pixel_formats_rgba( rendering_buffer& rb, int rasterMode ) :
|
||||
m_rbuf(&rb), m_mode( rasterMode )
|
||||
{}
|
||||
{
|
||||
printf("B %d\n", m_mode);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE unsigned width() const { return m_rbuf->width(); }
|
||||
|
@ -150,6 +154,7 @@ namespace agg
|
|||
value_type* p = (value_type*)m_rbuf->row(y) + (x << 2);
|
||||
|
||||
calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8;
|
||||
printf ("A %d\n", m_mode);
|
||||
if ( !m_mode )
|
||||
{
|
||||
if(alpha == base_mask)
|
||||
|
|
Loading…
Reference in a new issue