Bug 257370 - "Trim Margins" cuts too much
Summary: "Trim Margins" cuts too much
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: DjVu backend (show other bugs)
Version: 0.11.2
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
: 292680 303622 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-11-19 23:42 UTC by Alexander Potashev
Modified: 2012-07-17 19:19 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.0


Attachments
"Trim Margins" disabled (317.58 KB, image/png)
2010-11-19 23:45 UTC, Alexander Potashev
Details
"Trim Margins" enabled (299.26 KB, image/png)
2010-11-19 23:46 UTC, Alexander Potashev
Details
Title page with trimmed margins on 0.12.2 (93.89 KB, image/png)
2011-07-12 15:40 UTC, Davor Cubranic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Potashev 2010-11-19 23:42:46 UTC
Version:           0.11.2 (using KDE 4.5.3) 
OS:                Linux

In some DjVU documents the "Trim Margins" options does not work correctly: some part of text on pages become hidden along with margins.

Reproducible: Didn't try

Steps to Reproduce:
1. open a DjVU document (http://www.mccme.ru/free-books/prasolov/knots.djvu , see 2nd page)
2. enable "View" -> "Trim Margins"

Actual Results:  
Parts of text on the left and on the right of the page hide.

Expected Results:  
Margins removal without affecting text.

OS: Linux (x86_64) release 2.6.32
Compiler: x86_64-pc-linux-gnu-gcc
Comment 1 Alexander Potashev 2010-11-19 23:45:42 UTC
Created attachment 53564 [details]
"Trim Margins" disabled
Comment 2 Alexander Potashev 2010-11-19 23:46:10 UTC
Created attachment 53565 [details]
"Trim Margins" enabled
Comment 3 Christopher Reichert 2011-07-12 05:05:48 UTC
I cannot reproduce this in 0.12.2 or 0.12.8. Can anyone else reproduce this behavior?
Comment 4 Davor Cubranic 2011-07-12 15:40:11 UTC
Created attachment 61813 [details]
Title page with trimmed margins on 0.12.2

In 0.12.2, second and subsequent pages look fine with margins trimmed (hardly any difference from no trim, actually), but the front page gets part of the title cut off (attached).
Comment 5 auxsvr 2012-06-23 08:20:38 UTC
The "trim margins" feature in okular worked find until KDE 4.7. In KDE 4.8, pdf documents sometimes have too much of the page trimmed, some pages are incorrectly left intact, and it is very likely that the page in focus when the feature is turned on will be excessively trimmed. Also, the algorithm for trimming has become unstable, i.e. reloading the same file will often leave different areas of a page trimmed. If the page is resized only once after "trim margins" is activated, then trimming is successful, otherwise it fails and the process takes longer to complete.
Comment 6 Fabio D'Urso 2012-07-17 19:12:14 UTC
*** Bug 292680 has been marked as a duplicate of this bug. ***
Comment 7 Fabio D'Urso 2012-07-17 19:12:34 UTC
*** Bug 303622 has been marked as a duplicate of this bug. ***
Comment 8 Fabio D'Urso 2012-07-17 19:12:57 UTC
Git commit edbb4ef9f5aa8f120558b9d4f4b9f68970100c4b by Fabio D'Urso.
Committed on 17/07/2012 at 20:35.
Pushed by fabiod into branch 'KDE/4.9'.

Call Generator::signalPixmapRequestDone _after_ saving the calculated bounding box

Fixes a bug that causes the extraction of a wrong bounding box:

If the request queue is not empty, signalPixmapRequestDone causes a new
pixmap request to be started, thus overwriting mPixmapGenerationThread's
mCalcBoundingBox before it is read by the if in the next line.

Now signalPixmapRequestDone is called after the bounding box is saved,
so that new requests are started only after all data from
mPixmapGenerationThread have been saved.
REVIEW: 105600

M  +1    -1    core/generator.cpp

http://commits.kde.org/okular/edbb4ef9f5aa8f120558b9d4f4b9f68970100c4b
Comment 9 Fabio D'Urso 2012-07-17 19:13:05 UTC
Git commit 5b12bf685df1c02be025cdb870f97df62da72b09 by Fabio D'Urso.
Committed on 17/07/2012 at 20:35.
Pushed by fabiod into branch 'master'.

Call Generator::signalPixmapRequestDone _after_ saving the calculated bounding box

Fixes a bug that causes the extraction of a wrong bounding box:

If the request queue is not empty, signalPixmapRequestDone causes a new
pixmap request to be started, thus overwriting mPixmapGenerationThread's
mCalcBoundingBox before it is read by the if in the next line.

Now signalPixmapRequestDone is called after the bounding box is saved,
so that new requests are started only after all data from
mPixmapGenerationThread have been saved.
REVIEW: 105600

M  +1    -1    core/generator.cpp

http://commits.kde.org/okular/5b12bf685df1c02be025cdb870f97df62da72b09