Bug 419962

Summary: Troubles viewing djvu file
Product: [Applications] okular Reporter: sandu7ip
Component: DjVu backendAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, nate, yurchor
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Sample file
An empty page
Rendering of the page 8 of the original document

Description sandu7ip 2020-04-11 14:28:33 UTC
Created attachment 127450 [details]
Sample file

Okular has some issues with .djvu

It opens the file, but some pages aren't read/displayed properly.

See the attached file. Compare with Document Viewer.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu 18.04
Okular Version: 19.12.3
Comment 1 Yuri Chornoivan 2020-04-11 14:52:55 UTC
Created attachment 127451 [details]
An empty page

Okular does not like empty pages (like page 4 from the attached document). Those pages can be extracted with

djvused j.djvu -e 'select 4; save-page p04.djvu'

Not critical but sometimes it ruins the comfort of reading.
Comment 2 Albert Astals Cid 2020-04-12 14:57:21 UTC
i don't understand the problem.

Can you be more clear?
Comment 3 Yuri Chornoivan 2020-04-12 15:09:17 UTC
(In reply to Albert Astals Cid from comment #2)
> i don't understand the problem.
> 
> Can you be more clear?

If you open the initial test file page 4 will be filled with garbage from the previous pages. My test page (extracted from the initial file) is half white/half black.

For some reason, QImage::fill in kdjvu.cpp:499 cannot fill the whole page with Qt::white.
Comment 4 Yuri Chornoivan 2020-04-12 15:16:23 UTC
Created attachment 127472 [details]
Rendering of the page 8 of the original document
Comment 5 Albert Astals Cid 2020-04-12 15:29:07 UTC
(In reply to Yuri Chornoivan from comment #3)
> (In reply to Albert Astals Cid from comment #2)
> > i don't understand the problem.
> > 
> > Can you be more clear?
> 
> If you open the initial test file page 4 will be filled with garbage from
> the previous pages. My test page (extracted from the initial file) is half
> white/half black.
> 
> For some reason, QImage::fill in kdjvu.cpp:499 cannot fill the whole page
> with Qt::white.

I don't get any garbage it's all correctly white here.

Oh, actually i get garbage if i increase the zoom enough.

Interesting.
Comment 6 Albert Astals Cid 2020-04-12 15:39:07 UTC
https://invent.kde.org/kde/okular/-/merge_requests/155
Comment 7 Yuri Chornoivan 2020-04-12 17:24:18 UTC
(In reply to Albert Astals Cid from comment #6)
> https://invent.kde.org/kde/okular/-/merge_requests/155

Tested on my djvu collection. No regressions found. All empty pages are shown white. Thanks.
Comment 8 Albert Astals Cid 2020-04-12 17:45:48 UTC
Git commit da24829ee2b425185b9e9c0ed7582d37ce1c9bd4 by Albert Astals Cid.
Committed on 12/04/2020 at 15:37.
Pushed by aacid into branch 'release/20.04'.

djvu: Fix garbage on empty pages at "high" zoom levels

M  +4    -7    generators/djvu/kdjvu.cpp

https://invent.kde.org/kde/okular/commit/da24829ee2b425185b9e9c0ed7582d37ce1c9bd4