Bug 318829

Summary: Alternating "bad" and "good" quality while editing annotations or forms in rotated documents
Product: [Applications] okular Reporter: Fabio D'Urso <fabiodurso>
Component: generalAssignee: Fabio D'Urso <fabiodurso>
Status: RESOLVED FIXED    
Severity: normal CC: aacid
Priority: NOR    
Version: 0.16.60   
Target Milestone: ---   
Platform: Other   
OS: All   
Latest Commit: Version Fixed In: 4.10.3
Attachments: Proposed patch
Hacky patch to test the previous one

Description Fabio D'Urso 2013-04-25 01:20:17 UTC
While PDF annotations or forms are being edited, okular needs to re-render the whole page.
In rotated documents, these renderings often look very low quality.

This issue mostly applies to PDF documents, but the issue is in the core so I've reported it against the general component.

Reproducible: Always

Steps to Reproduce:
1. Open a document with annotations or forms
2. Rotate it by 90 degrees from the original orientation
3. Edit annotations or forms and notice how renderings have alternating "good" and "bad" quality


Expected Results:  
Always good quality, of course.
Comment 1 Fabio D'Urso 2013-04-25 01:26:28 UTC
Created attachment 79430 [details]
Proposed patch

I've identified the issue to be in DocumentPrivate::refreshPixmaps swapping width and height. Since generators swap them again, this results in pages being rendered with distorted proportions. I'm attaching a patch for it.
Comment 2 Fabio D'Urso 2013-04-25 01:38:03 UTC
The alternating behavior comes from the fact that, if the previous rendering produced a distorted pixmap, swapping again will now produce correct results (and viceversa).
Comment 3 Fabio D'Urso 2013-04-25 01:39:54 UTC
Created attachment 79431 [details]
Hacky patch to test the previous one

The previous patch is easy to test on PDF documents by playing with annotations or forms.

For the other formats, I'm attaching an hacky patch that causes "Edit->Select all" to call DocumentPrivate::refreshPixmaps on the first page. Of course, this is for testing only and it's not meant to be shipped.
Comment 4 Albert Astals Cid 2013-04-25 21:33:50 UTC
Patch looks good feel free to commit to 4.10 and merge to master
Comment 5 Fabio D'Urso 2013-04-25 22:04:09 UTC
Git commit 9812f5277e97ded115515b0b6f5ad7b0e84dfa39 by Fabio D'Urso.
Committed on 25/04/2013 at 01:57.
Pushed by fabiod into branch 'KDE/4.10'.

Do *not* swap width and height in DocumentPrivate::refreshPixmaps

They must not be swapped, because generators already swap them on their
own, and swapping them twice results in distorted pixmaps.
FIXED-IN: 4.10.3

M  +0    -2    core/document.cpp

http://commits.kde.org/okular/9812f5277e97ded115515b0b6f5ad7b0e84dfa39