[okular] [Bug 421468] Zoom farther than 1600%

Yuri Chornoivan bugzilla_noreply at kde.org
Thu May 14 11:37:07 BST 2020


https://bugs.kde.org/show_bug.cgi?id=421468

Yuri Chornoivan <yurchor at ukr.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yurchor at ukr.net

--- Comment #2 from Yuri Chornoivan <yurchor at ukr.net> ---
(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;

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list