Skip to content

fix(stroke): the pen's lift no longer waits on the canvas - #288

Open
R19988088 wants to merge 1 commit into
artcraft-android:mainfrom
R19988088:fix/pen-lift
Open

R19988088 wants to merge 1 commit into
artcraft-android:mainfrom
R19988088:fix/pen-lift

Conversation

@R19988088

Copy link
Copy Markdown

Two things held the pen up after every stroke, measured on 0.0.7-beta (RTX 3080 Ti, Vulkan, WinTab pen, 2520×1575 canvas):

  • remember_last_stroke() called flush(), so the stroke just ended was laid out in full before the lift returned: 105 ms for a 5734-stamp stroke, 245 ms for an 18416-stamp one. Its step is counted as made instead — Canvas::end_stroke has queued it and the next render makes it, so a later change still shows against it.

  • lay_stroke() laid the whole stroke again as the pen lifted for wet paint (a blending brush, StrokeStyle::in_place()), which has changed its layer as it went: 67-87 ms for 36-50 samples, about 1.9 ms a stamp through the compute passes — and the frame after the lift then waited that long at the surface. Wet paint now counts as laid for good, as a smudge's and an adjustment's do (Canvas::paints_in_place()). What the canvas shows while drawing is what the stroke leaves, which is what the brush previewed anyway.

After: lift taken in 0.4-2.3 ms, and no surface wait in the frame that follows.

Tests: cargo test -p procraft-core --lib quickshape (7 passed) and the_last_stroke_snaps_to_a_shape_until_something_else_is_done; cargo check -p procraft-core -p procraft-gpu clean on top of main (3c0d69b).

Two things held the pen up after every stroke, measured on 0.0.7-beta (RTX 3080
Ti, Vulkan, WinTab pen, 2520×1575):

- remember_last_stroke() flushed the canvas, laying the stroke just ended before
  the lift returned: 105 ms for a 5734-stamp stroke, 245 ms for an 18416-stamp
  one. Its step is counted as made instead: Canvas::end_stroke has queued it and
  the next render makes it, so a later change still shows against it.

- lay_stroke() laid the whole stroke again as the pen lifted for wet paint (a
  blending brush, StrokeStyle::in_place()), which has changed its layer as it
  went: 67-87 ms for 36-50 samples, about 1.9 ms a stamp through the compute
  passes, and the frame after the lift waited that long at the surface. Wet paint
  now counts as laid for good, as a smudge's and an adjustment's do
  (Canvas::paints_in_place()).

After: lift taken in 0.4-2.3 ms, and no surface wait in the frame that follows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant