Viewing cache-missed animation frames too
ClosedPublic

Authored by fazek on Mar 19 2016, 7:57 PM.

Details

Reviewers
dkazakov
Summary

If you view an animation frame for the first time and it's not in the OpenGL cache yet (this usually happens right after opening an animated document), the frame goes into the cache, but actually not viewed. This is specially annoying if you scrub on the timeline. This is a simple solution, drawing the frame without the cache.

There could be a complicated other solution, to catch the changed() signal when the cache is ready, this maybe slower, but much simpler. This cache miss happens rarely I think.

I also modified the warning message to show it only once during playback. It also slows down the playing otherwise...

Test Plan
  1. create a document with some animation and save it.
  2. load the document into Krita again.
  3. click on the header of the animation timeline (the horizontal ruler with the frame numbers) and drag the cursor. During the first few steps you can see wrong frames of the animation because these are not cached yet.

Diff Detail

Repository
R37 Krita
Lint
Lint Skipped
Unit
Unit Tests Skipped
fazek updated this revision to Diff 2860.Mar 19 2016, 7:57 PM
fazek retitled this revision from to Viewing cache-missed animation frames too.
fazek updated this object.
fazek edited the test plan for this revision. (Show Details)
fazek added a reviewer: dkazakov.
fazek set the repository for this revision to R37 Krita.
fazek added a subscriber: fazek.
fazek updated this revision to Diff 2861.Mar 20 2016, 6:32 AM

I updated the code to the signal handling version. I can't decide which one is better. This takes half computing time but it is a deadlock if somehow the frame not appearing into the cache.

I also removed the warning message handling, maybe I can put it back if needed.

fazek updated this revision to Diff 2893.Mar 21 2016, 7:08 PM

Update: I figured out that the loop is a possible deadlock, because the OpenGL cache rejects the new rendering if there is already a rendering in progress. So I reverted this back to its first version, only removed the warning message handling because there is no message at all.

dkazakov accepted this revision.Mar 23 2016, 3:42 PM
dkazakov edited edge metadata.

Hi, @fazek!

Speaking truly, I cannot see a defference now, except of the style :) But yes, please commit :)

This revision is now accepted and ready to land.Mar 23 2016, 3:42 PM
fazek added a comment.Mar 23 2016, 4:48 PM

If you look closely the difference between these that when the cache exists and there is no frame to view (cache miss), the original version does nothing, but the new one goes to the joined else case and view the frame without the cache. If the frame is not in the cache, it only starts to render if no another rendering in progress. The problem was that when the frame is not ready the program never shows it (even if it's ready later), so you see the last viewed frame. It's really annoying when you scrub on the timeline frame by frame with the mouse.

fazek closed this revision.Mar 24 2016, 7:59 PM