Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduce GUI lag/stuttering by eliminating unnecessary work #18132

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ralfbrown
Copy link
Collaborator

Whenever a widget is refreshed in darkroom view, the entire window is redrawn and a lot of other activity is kicked off, including running the coordinate transform chain (which gets very slow if there are any active instances of liquify) multiple times. This PR reworks things (short of the complete rearchitecting of expose() which is actually needed) to reduce the number of calls for transforms and the amount of work done in mouse-motion callbacks.

The latter also fixes a subtle UI bug -- when modules have a drawn mask and the shapes display is enabled, but the module itself is disabled, the mouse still interacts with the (invisible) drawn shapes. This leads to surprises such as a scroll or drag resizing/moving a shape rather
than zooming/panning the image. It may be worth cherry-picking 648a74b for 5.0.1.

Don't call dt_dev_get_pointer_zoom_pos (which calls
dt_dev_distort_transform, which can take 100+ms when a liquify
instance is active with large areas being distorted) on mouse activity
in the darkroom center image unless actually needed.

Avoid calling distort transform from the darkroom view expose()
function unless invoking a module post-expose callback which needs the
transformed mouse pointer position.

Reduce the number of distort_transform calls generated by
dt_view_paint_surface (called by expose) from two to one.

The overall result is much smoother mouse movement and scrolling when
a module with a slow distort_transform() function is enabled.
This reduces overhead and thus lag/stuttering when moving the mouse
across the center image in darkroom (especially for the liquify
module, which needs to compute the distortion map *every* time).

It also fixes a subtle UI bug -- when modules have a drawn mask and
the shapes display is enabled, but the module itself is disabled, the
mouse still interacts with the (invisible) drawn shapes.  This leads
to surprises such as a scroll or drag resizing/moving a shape rather
than zooming/panning the image.
@ralfbrown ralfbrown added scope: UI user interface and interactions scope: performance doing everything the same but faster labels Jan 1, 2025
@TurboGit TurboGit added this to the 5.2 milestone Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: performance doing everything the same but faster scope: UI user interface and interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants