sumatrapdfreader / sumatrapdf

SumatraPDF reader
http://www.sumatrapdfreader.org
GNU General Public License v3.0
13.71k stars 1.73k forks source link

Blink when you move from page to page #4437

Closed H5820121 closed 3 months ago

H5820121 commented 3 months ago

In Single Page view, when you move from page to page, there is often a blink. In version V3.6.16550 it was fine, now I'm back to that version and the blink is gone, It began somewhere after this version. Thank you!

kjk commented 3 months ago

Can you provide a test file? Are you using a theme? Are you using invert colors?

H5820121 commented 3 months ago

I don't use invert colors. I only use: TextColor = #000000 BackgroundColor = #ffffca I sent an attachment test file to your email. And I emphasize that for the same file, in V3.6.16550 64-bit there is no blink in going from page to page, now I checked it again. Thanks!

‫בתאריך יום א׳, 4 באוג׳ 2024 ב-19:56 מאת ‪Krzysztof Kowalczyk‬‏ <‪ @.***‬‏>:‬

Can you provide a test file? Are you using a theme? Are you using invert colors?

— Reply to this email directly, view it on GitHub , or unsubscribe

. You are receiving this because you authored the thread.Message ID: @.***>

H5820121 commented 3 months ago

@kjk I checked again, and the problem of blinking is felt in the dark theme. But as stated in V3.6.16550 even in dark theme does not have the problem.

‫בתאריך יום א׳, 4 באוג׳ 2024 ב-19:56 מאת ‪Krzysztof Kowalczyk‬‏ <‪ @.***‬‏>:‬

Can you provide a test file? Are you using a theme? Are you using invert colors?

— Reply to this email directly, view it on GitHub , or unsubscribe

. You are receiving this because you authored the thread.Message ID: @.***>

kjk commented 3 months ago

Yes, it does flicker more. I'm looking into this.

kjk commented 3 months ago

I reverted cache render to 3.5 state.

I'm not sure if it fixes your particular case.

For me the largest flicker happens when using dark theme and rendering white page (no invert colors).

When page is not rendered quickly enough we paint dark background (because dark theme) and then when page is rendered we paint white which shows as flash.

But I don't see how now it would be different than 16550

Maybe would be improved if I draw the background using document colors so that re-rendering mostly white document on white background would flicker less.

kjk commented 3 months ago

@H5820121 try the latest pre-release. I've made a change that eliminates flicker but it introduces lag.

Flicker is caused by painting empty space when the page hasn't render yet and then painting the rendered page when it's available.

The no-flicker mode doesn't paint when we don't have a rendered page so there's on flicker. But it might feel laggy because nothing seemingly changes.

Maybe I should paint some info to indicate something is happening.

user1823 commented 3 months ago

I have an observation that might be somewhat related:

If I scroll fast (several pages in a fraction of a second), the pages load slowly even after I have stopped scrolling.

However, if I use the ToC to jump to a specific page, it loads so quickly that I can't notice any lag.

So, probably, the loading of pages when scrolling needs some optimization.

Version: 3.6.16616

kjk commented 3 months ago

Well, yes, but it's because it is optimized.

If you quickly flip the pages quickly then we have to render them. A simple implementation would be to render page on main thread which would block advancing to the next page until a page is rendered. On slow pages you would be blocked for a long time and flipping pages would be slow.

So we have a render cache and we render pages in a background thread so we just queue for rendering and re-paint when a page finishes rendering.

So you can continue flipping pages but still that queues pages to render so if you flip 10 pages, we still have to render 10 pages which will be slower than if we render just 1 page if you go there directly.

user1823 commented 3 months ago

we still have to render 10 pages which will be slower than if we render just 1 page if you go there directly.

I think that this is not expected. If I have scrolled to a new page, Sumatra should ideally stop loading the previous ones

kjk commented 3 months ago

Of course, but if such behavior was easy to implement then I would have implemented it.

H5820121 commented 3 months ago

"try the latest pre-release" @kjk The issue is solved, Thanks!

‫בתאריך יום ב׳, 5 באוג׳ 2024 ב-20:45 מאת ‪Krzysztof Kowalczyk‬‏ <‪ @.***‬‏>:‬

@H5820121 https://github.com/H5820121 try the latest pre-release. I've made a change that eliminates flicker but it introduces lag.

Flicker is caused by painting empty space when the page hasn't render yet and then painting the rendered page when it's available.

The no-flicker mode doesn't paint when we don't have a rendered page so there's on flicker. But it might feel laggy because nothing seemingly changes.

Maybe I should paint some info to indicate something is happening.

— Reply to this email directly, view it on GitHub https://github.com/sumatrapdfreader/sumatrapdf/issues/4437#issuecomment-2269588104, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZFMFTEK4LP2YEK2QOJTJW3ZP623NAVCNFSM6AAAAABL67KVOKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRZGU4DQMJQGQ . You are receiving this because you were mentioned.Message ID: @.***>