Bug 421468 - Zoom farther than 1600%
Summary: Zoom farther than 1600%
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 1.9.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-13 14:43 UTC by Dennis Schridde
Modified: 2020-06-18 11:52 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.11.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Schridde 2020-05-13 14:43:47 UTC
SUMMARY
The maximum zoom is 1600%, but the documents I need to view contain text that at 1600% is still only a few pixels large and needs much more zoom.

STEPS TO REPRODUCE
1. Have a document with really really tiny text
2. Try to zoom in far enough to allow you to read the text
3. Be stopped by Okular at 1600%
4. Notice that the text is still only a few pixel high and thus way to small to be read

OBSERVED RESULT
Zooming stops at 1600%

EXPECTED RESULT
Zooming should be infinite at best

I would not mind if scrolling at this zoom would be ultra slow or Okular would use gibibytes of memory, if only I could read the document.

SOFTWARE/OS VERSIONS

Operating System: Fedora 32
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.13.2
Kernel Version: 5.6.11-300.fc32.x86_64
OS Type: 64-bit
Processors: 12 × Intel® Core™ i7-8750H CPU @ 2.20GHz
Memory: 62,5 GiB of RAM
Comment 1 Oliver Sander 2020-05-14 07:58:20 UTC
pageview.cpp:4203 hardwires the limit:

    const float upperZoomLimit = d->document->supportsTiles() ? 16.0 : 4.0;

I haven't tried whether anything bad happens (besides possibly large memory/CPU consumption) if that limit is increased further.
Comment 2 Yuri Chornoivan 2020-05-14 10:37:07 UTC
(In reply to Oliver Sander from comment #1)
> pageview.cpp:4203 hardwires the limit:
> 
>     const float upperZoomLimit = d->document->supportsTiles() ? 16.0 : 4.0;
> 
> I haven't tried whether anything bad happens (besides possibly large
> memory/CPU consumption) if that limit is increased further.

Works fine on a relatively slow machine (Core2 Duo, 2.6GHz, 6GB of RAM) for 100x with the following patch. It is hard to say if it is worth implementing this for a regular user though.

diff --git a/ui/pageview.cpp b/ui/pageview.cpp
index 938aa5039..f184886e9 100644
--- a/ui/pageview.cpp
+++ b/ui/pageview.cpp
@@ -104,7 +104,7 @@ static const int pageflags = PagePainter::Accessibility | PagePainter::EnhanceLi
                        PagePainter::EnhanceImages | PagePainter::Highlights |
                        PagePainter::TextSelection | PagePainter::Annotations;
 
-static const std::array<float, 13> kZoomValues { 0.12, 0.25, 0.33, 0.50, 0.66, 0.75, 1.00, 1.25, 1.50, 2.00, 4.00, 8.00, 16.00 };
+static const std::array<float, 14> kZoomValues { 0.12, 0.25, 0.33, 0.50, 0.66, 0.75, 1.00, 1.25, 1.50, 2.00, 4.00, 8.00, 16.00, 100.00 };
 
 // This is the length of the text that will be shown when the user is searching for a specific piece of text.
 static const int searchTextPreviewLength = 21;
@@ -2774,7 +2774,7 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
                 double nX = (double)(selRect.left() + selRect.right()) / (2.0 * (double)contentAreaWidth());
                 double nY = (double)(selRect.top() + selRect.bottom()) / (2.0 * (double)contentAreaHeight());
 
-                const float upperZoomLimit = d->document->supportsTiles() ? 16.0 : 4.0;
+                const float upperZoomLimit = d->document->supportsTiles() ? 100.0 : 4.0;
                 if ( d->zoomFactor <= upperZoomLimit || zoom <= 1.0 )
                 {
                     d->zoomFactor *= zoom;
@@ -4200,7 +4200,7 @@ void PageView::updateZoom( ZoomMode newZoomMode )
             d->zoomFactor = -1;
             break;
     }
-    const float upperZoomLimit = d->document->supportsTiles() ? 16.0 : 4.0;
+    const float upperZoomLimit = d->document->supportsTiles() ? 100.0 : 4.0;
     if ( newFactor > upperZoomLimit )
         newFactor = upperZoomLimit;
     if ( newFactor < 0.1 )
@@ -4253,7 +4253,7 @@ void PageView::updateZoomText()
     bool inserted = false; //use: "d->zoomMode != ZoomFixed" to hide Fit/* zoom ratio
     int zoomValueCount = 11;
     if ( d->document->supportsTiles() )
-        zoomValueCount = 13;
+        zoomValueCount = 14;
     while ( idx < zoomValueCount || !inserted )
     {
         float value = idx < zoomValueCount ? kZoomValues[ idx ] : newFactor;
Comment 3 Oliver Sander 2020-05-14 12:47:16 UTC
Thanks for testing!

> It is hard to say if it is worth implementing this for a regular user though.

I'd say "definitely": People do request it, and people who don't need it are not bothered by it.  Would you mind opening a merge request?

-        zoomValueCount = 13;
+        zoomValueCount = 14;

If 100 is the new highest zoom level, then 14 is probably not enough.
Comment 4 Yuri Chornoivan 2020-05-14 13:15:18 UTC
(In reply to Oliver Sander from comment #3)
> I'd say "definitely": People do request it, and people who don't need it are
> not bothered by it.  Would you mind opening a merge request?

https://invent.kde.org/kde/okular/-/merge_requests/165
Comment 5 Oliver Sander 2020-05-15 17:44:08 UTC
Git commit 7eb37c99c9cd27bfd918dffe2dca7b9ec22ab5fb by Oliver Sander, on behalf of Yuri Chornoivan.
Committed on 15/05/2020 at 17:44.
Pushed by sander into branch 'master'.

Add more scale factors

M  +5    -5    ui/pageview.cpp

https://invent.kde.org/kde/okular/commit/7eb37c99c9cd27bfd918dffe2dca7b9ec22ab5fb
Comment 6 Laura David Hurka 2020-06-18 11:52:19 UTC
Zooming farther than 2000% using middle-click-drag zoom is laggy on my Thinkpad X240 (Core i5 4300, 8GB). Additionaly the console reports:

Running out of memory on page 2 (26436x25245 px);

Apparently tiling does not work correctly there, such a big pixmap would indeed not fit in the memory.