Skip to content

[pad] Improve TCanvas::FeedbackMode - #23312

Open
linev wants to merge 21 commits into
root-project:masterfrom
linev:pad_feedback
Open

[pad] Improve TCanvas::FeedbackMode#23312
linev wants to merge 21 commits into
root-project:masterfrom
linev:pad_feedback

Conversation

@linev

@linev linev commented Sep 9, 2026

Copy link
Copy Markdown
Member

Method now return boolean, which indicates if such mode supported by canvas.
It requires usage of invert painting and double-buffer support.
For now it works in plain and GL painters
Pad painter has boolean method which indicates if invert painting method is supported.

Fully rewrite THistPainter::ShowProjection3(). It was invented 20 years ago and uses wrong pixel -> lego coordinates conversion. Plus many direct gVirtualX calls. Now histpainter fully free from gVirtualX usage.

Continue removing gVirtualX from canvas and pad.
When closing canvas, one select canvas window right before calling gVirtualX->CloseWindow().

linev added 11 commits September 8, 2026 08:02
Feedback mode used to implement specialized interactive painters
like projections display. On some platforms (like web or GL) such invert
painting not implemented. Therefore one can dismiss such interactive
painting completely.

Method now will return kTRUE when mode was really changed.
Also provide method already in the TVirtualPad and redirect call to the canvas.
Before direct gVirtualX calls were used
Do not perform drawing when functionality not available
Like in other places, use pad painter instead direct gVirtualX calls
Allows to requests doublebuffer flag for the pad instance without accessing canvas
Disable invert painting when double buffer was active. Happens when in-between other interactive actions performed on the pad - like resize of dragging of stats box/title.

Avoids artifacts on the pad because of remaining invert zone
Was used to draw outline when TH1 bincontent was modifying
Reduce number of used static variables
Only bin position defined by px1 is relevant for the handling
Do not use unique_ptr while gPad can remove/delete object.
Instead set kCanDelete bit indicating that object can be deleted any time.
Every time check that gPad contains zooming box

Support non-opaque zooming when box not redrawn with all primitives,
but painted directly in inverse mode
In such mode drawing must be done differently and completely fails when GL painter is activated
Instead use of plain gVirtualX convert 3D coordinates into
fictional X/Y coordinates and use pp->DrawPolyLine method
Use indicies for calculating coordinates which extremely simplifies logic

Fully avoid use of gVirtualX in hist painter
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 17h 25m 25s ⏱️
 3 881 tests  3 879 ✅ 0 💤 2 ❌
76 145 runs  76 142 ✅ 1 💤 2 ❌

For more details on these failures, see this check.

Results for commit ad01bd4.

♻️ This comment has been updated with latest results.

Search for the position using view->WCtoNDC conversion instead
of heuristic code. Not most efficient, but reliable way to detect
axes bins for building projection.

Compress code around creating projection
Correctly decode options arguement
Use canv->Add methods
Instead direclty use gPad->FeedbackMode and gPad->PaintLine methods.
Via return value of FeedbackMode method one can detect if inverse drawing
in the canvas is possible
No need to check and access TCanvas pointer
Before it was hapenning in TCanvas::Close() but
we removing gVirtualX from there.
Therefore do it explicitely already in TRootCanvas::Close()
On different platforms setting of invert mode may fail
Therefore let detect if requested drawing mode works at all.
Default implementation should support TVirtualX::kCopy mode which
just means normal patining.

Provide proper implementation in TPadPainter and TGLPadPainter
where gVirtualX used directly for such painting.
If invert painting can not be performed / not supported by painter,
method returns false.
Now it happens in the canvas implementation and therefore not necessary.
no need to check web or batch flags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant