Commit graph

37 commits

Author SHA1 Message Date
Albert Astals Cid 19d98d6a74 Run clang-format
find . \( -name "*.cpp" -or -name "*.h"  -or -name "*.c"  -or -name "*.cc" \) -exec clang-format -i {} \;

If you reached this file doing a git blame, please see README.clang-format (added 2 commits in the future of this one)
2020-07-11 09:17:33 +02:00
Albert Astals Cid b82682037e Merge remote-tracking branch 'origin/release/19.12' 2020-01-31 10:22:59 +01:00
Tobias Deiminger 378e99d719 Fix race condition in generator.cpp
The check whether to allocate a new QMutex was unprotected.
Two threads may check and allocate concurrently, but only one pointer gets
remembered, the other one will leak. In worst case the returned
mutex is different for two threads, so that two threads try to
synchronize by using two different mutexes.
2020-01-30 09:42:17 +01:00
Albert Astals Cid 0a2287be19 CI: Enable two readability clang-tidy checks
Use jq to filter compile_commands.json to not include the compilation of
autogenerated files, we don't want to check those

Also filter out the synctex folder, since that is imported code
2019-12-23 12:06:49 +01:00
Yuri Chornoivan 39b6e8147d Fix minor EBN issues 2018-09-01 11:25:57 +03:00
Yuri Chornoivan c04ca1fa96 Fix minor EBN issues 2018-08-31 12:23:45 +03:00
Albert Astals Cid 2d8b2c7e95 Add support for cancellable image rendering and text extraction
Summary:
Only supported by the pdf backend if using poppler >= 0.63

Sadly had to change the generator API

Text cancellation is a bit wobbly still since poppler has large parts
of the code where doesn't check for the cancellation flag, but that
is something that will get automagically fixed for us if the poppler
side is improved

Test Plan: Needs https://bugs.freedesktop.org/show_bug.cgi?id=104263

Reviewers: ervin, rkflx

Reviewed By: ervin, rkflx

Subscribers: #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D9328
2018-02-01 22:53:28 +01:00
Albert Astals Cid a2f5560c00 PDF: Support the poppler 0.62 renderToImage with update callback
Summary:
This way pages that take more than 500ms to render get updated every so often so that the
user can see that the program didn't hang, it's just that it's taking long to render

Tags:
incremental rendering, partial updates

BUGS: 344081

Subscribers: #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8379
2017-11-09 17:28:54 +01:00
Albert Astals Cid 453f45e7f7 Start the text generation request via a queued connection
Summary:
so that pixmap generation gets a chance to start before the text generation

This makes that on files where both the text generation and the pixmap generation
are slow at least we see something "as fast as possible" since only either text generation
or pixmap generation threads run at the same time

Reviewers: #okular, mlaurent

Reviewed By: mlaurent

Subscribers: michaelweghorn, dvratil, mlaurent, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8378
2017-10-31 10:04:03 +01:00
Albert Astals Cid 4072eb0c3a Add override 2017-03-02 20:38:50 +01:00
Michal Humpula c07ee043a3 Multiple Tiles Managers per Page
It's straighforward implementation. Every single place, where there were call for (or with) TilesManager, now has a DocumentObserver as companion. The m_tiledManager reference in PagePrivate was changed to QMap<DocumentObserver, TilesManager>.

REVIEW: 113986
2014-02-19 23:41:22 +01:00
Eugene Shalygin ed35594627 Use DPI of current screen for PDF rendering
Includes some fixes from Albert:
 * kscreen cmake fixes
   Don't make libkscreen mandatory, give the proper version we need
 * Fix the @since
 * Kill Resolution and use a QSizeF
   I first thought QSizeF didn't make sense, but well what's a dpi if not a number of pixels in width and some others in height?
 * Remove unwanted const
 * Remove unneeded utils.h includes
 * Fix comments on realDPIXY()
 * Make it compile in non X11

REVIEW: 111829
2014-01-13 01:37:56 +01:00
Albert Astals Cid 541650a4f4 Remove the concept of observer/view id
Just use the pointer as id :-)

This is BIC and SIC, increase the soversion now to makes sure we don't forget in the future

Patch based in an earlier patch by Bogdan Cristea <cristeab@gmail.com>
REVIEW: 109115
2013-02-24 23:01:02 +01:00
Fabio D'Urso b8f4cdc808 Packed bool members in PixmapRequestPrivate 2012-11-09 18:24:58 +01:00
Mailson Menezes 96f325896e Keep track of visible region even when not using tiles
The visible region was set in the PixmapRequest only a tiles manager was
available. Because of that the generator could check if it was supposed
to used tiles by simply checking if its normalized rect was null.
However is good to know the visible region even when a tiles manager is
not present. This way if the request is big enough to start a tiles
manager we already know the visible region and can change the
PixmapRequest accordingly.
2012-08-24 14:02:07 -03:00
Mailson Menezes 3c09b93713 Merge branch 'master' into tiled-rendering
Conflicts:
	core/document.cpp
2012-08-15 11:44:22 -03:00
Fabio D'Urso 569c9b84ce Before preloading pixmaps check that they fit in cache 2012-07-10 00:57:49 +02:00
Mailson Menezes 48d105672f Use NormalizedRect instead of VisiblePageRect on PixmapRequest 2012-07-08 15:24:20 -03:00
Mailson Menezes 83282971d8 Render current viewport only 2012-05-29 14:06:02 -03:00
Pino Toscano 6725e71340 when generating the page image in an internal secondary thread (started by the base generator), then also calculate the page bounding box in the thread
svn path=/trunk/KDE/kdegraphics/okular/; revision=810380
2008-05-20 15:20:40 +00:00
Pino Toscano 697d51e1a2 Make the rendering for TextDocument-based generators threaded, only if Qt (via QFontDatabase) tells us we can.
... but, as it's proving to be buggy (text disappearing from menus) and crashing (out-of-range font engine list), it's disabled for now, define OKULAR_TEXTDOCUMENT_THREADED_RENDERING to try it.

svn path=/trunk/KDE/kdegraphics/okular/; revision=804719
2008-05-06 20:20:10 +00:00
Pino Toscano c44ce52719 add a private reimplementation of metaData() so the text document generator can show the title of a document
svn path=/trunk/KDE/kdegraphics/okular/; revision=785821
2008-03-15 02:15:16 +00:00
Pino Toscano e023effb15 Add a requestPixmaps() overload that takes options as flags.
This way we can tell to "merge" in a smart way the new pixmap request with the enqueued ones of the same ID.

Add a (private) slot to refresh all the pixmaps of a page.

svn path=/trunk/KDE/kdegraphics/okular/; revision=783259
2008-03-07 15:50:48 +00:00
Pino Toscano 66376cf31f make swap() private
svn path=/trunk/KDE/kdegraphics/okular/; revision=744918
2007-12-04 21:36:32 +00:00
Pino Toscano 5b01430bb0 remove internal aboutdata+componentdata of the generator, now it's handled by the plugin system
svn path=/trunk/KDE/kdegraphics/okular/; revision=744197
2007-12-02 22:55:12 +00:00
Pino Toscano 4060ef669e Make the document closing a bit more safe wrt internal threading - the closing waits for the background threads, to avoid aving them running with stale stuff.
This affects all the generators that use the internal generator threading, own threading models have to be fixed properly.

svn path=/trunk/KDE/kdegraphics/okular/; revision=723161
2007-10-08 21:49:27 +00:00
Pino Toscano d51e9fa4d8 remove the private methods of PixmapRequest, and make the Document work with its private class
svn path=/trunk/KDE/kdegraphics/okular/; revision=719319
2007-09-30 21:44:31 +00:00
Pino Toscano 4dcadf5544 Add a mutex in the base generator class, so any generator that wants a mutex can use it.
Adapt the poppler and the chm generator to use it instead of the own.

svn path=/trunk/KDE/kdegraphics/okular/; revision=712821
2007-09-15 11:35:53 +00:00
Pino Toscano f8ed5302ec - move the Document::requestDone() to the private class, as it's something internal to the generator work
- make the Generator internally keep an pointer to the private class Document, so we can access easily to the Document' stuff

svn path=/trunk/KDE/kdegraphics/okular/; revision=712498
2007-09-14 15:29:16 +00:00
Pino Toscano 006111382b common d_ptr+q_ptr structure for Generator/TextDocumentGenerator, and their private classes
svn path=/trunk/KDE/kdegraphics/okular/; revision=712465
2007-09-14 13:31:55 +00:00
Pino Toscano 2a29b247f7 save really few bytes
svn path=/trunk/KDE/kdegraphics/okular/; revision=709414
2007-09-07 13:13:50 +00:00
Pino Toscano 964424d62f stop gracefully the font extraction thread when closing a document or the properties dialog; make the thread deleting itself when finished
svn path=/trunk/KDE/kdegraphics/okular/; revision=685437
2007-07-08 21:22:37 +00:00
Pino Toscano e5037f45b1 Refator a bit the way Document and the generators use to read the font information from a document.
Instead of having a synchronous function that extracts all the information at once, use a function to read the fonts of a single page.
This way, we can get all the result step by step (aka page by page), and possibly in an asynchronous way.
The resuls of the font "scanning" are sent via signals, as well the end of the work.
So, instead of block waiting for the results of all the document at once, the Fonts tab in the properties dialog can have a progress bar with the progress, and the results (the fonts) that are added incrementally to the list.

Only two minor things are left:
- the process is always asynchronous at the moment, as the only generator that can provide this kind of information is the Poppler one (safe)
- there is no check for duplicate fonts
But they should be easy to solve.

svn path=/trunk/KDE/kdegraphics/okular/; revision=685002
2007-07-07 20:35:01 +00:00
Pino Toscano fc97f3b23b on demand creation of the auxiliary threads
svn path=/trunk/KDE/kdegraphics/okular/; revision=656230
2007-04-20 17:59:12 +00:00
Pino Toscano 166ba5b87a move the Generator::Private to a GeneratorPrivate, and move the implementations of the provate threads to a cpp
svn path=/trunk/KDE/kdegraphics/okular/; revision=656221
2007-04-20 17:17:44 +00:00
Albert Astals Cid 0d47b62715 krazy include order issues
svn path=/trunk/KDE/kdegraphics/okular/; revision=655893
2007-04-19 18:30:20 +00:00
Pino Toscano 92ea1bba69 Last step of the ThreadedGenerator -> Generator merge: remove the old files and rename the used file.
svn path=/trunk/playground/graphics/okular/; revision=628856
2007-01-31 18:41:21 +00:00
Renamed from core/threadedgenerator_p.h (Browse further)