← Back to team overview

qpdfview team mailing list archive

Re: [Question #207821]: DocumentView class in an embedded device.

 

Question #207821 on qpdfview changed:
https://answers.launchpad.net/qpdfview/+question/207821

    Status: Open => Answered

Adam Reichold proposed the following answer:
Hello Michael,

As a hobbyist programmer with no experience in embedded development,
please have a bucket of salt ready before reading this...

The program obviously was not designed with really (meaning less than
small desktop systems) limited memory use in mind, e.g. always carrying
around a separate QGraphicsView for thumbnails in case the user wants to
see those and the thumbnail items having all the data of the page items
present even though they don't use most of  it. So you might have a hard
time with this. (Removing everything connected to the thumbnails may be
one simpler step to reduce memory requirements by a constant factor. But
that is probably not really what you need.) (Same goes for outline and
properties if you don't need them. All of this could probably be done
using preprocessor directives.)

The problem with the page items themselves is probably not so much the
rendering since this is done on demand anyway and its memory
requirements are more or less (but not strictly because of the
threading) fixed to image buffers for the visible pages which are
released after they are painted. At least if the cache size
(PageItem::setCacheSize) is zero and prefetch (Document::setPrefetch) is
disabled.

The problem is more that the document view assumes to have all page
positions and sizes (i.e. bounding rectangles) available at once. This
is used extensively to determine layout and visibility, e.g. in
DocumentView::prepareScene, ::prepareView and
::on_verticalScrollBar_valueChanged... I doubt that the design is
flexible enough to fundamentally change this. Just loading the meta-data
of a few pages at once and layouting them is probably just not possible
with the current design. Sorry for this. (Again, you could try to get a
constant factor reduction by stripping unused parts from PageItem like
annotations and such but the memory scaling will be the same...)

A long-term solution might be to use QGraphicsGridLayout to do the
layout dynamically for a few pages only but this will be quite a lot of
work. Sorry for not being able to be more helpful at the moment. Of
course, we can continue to discuss this if you decide on attacking this
in some way or the other.

Best regards, Adam.

-- 
You received this question notification because you are a member of
qpdfview, which is an answer contact for qpdfview.