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

Image artifact with zoombox on 1D hist if SetFillStyle 0 on Ubuntu #9763

Closed
8 tasks done
ferdymercury opened this issue Jan 31, 2022 · 31 comments · Fixed by #9774
Closed
8 tasks done

Image artifact with zoombox on 1D hist if SetFillStyle 0 on Ubuntu #9763

ferdymercury opened this issue Jan 31, 2022 · 31 comments · Fixed by #9774
Assignees
Labels

Comments

@ferdymercury
Copy link
Collaborator

  • Checked for duplicates

Describe the bug

image
On a canvas with a histogram, if I zoom using right click, SetRangeUser, all works fine. If I zoom using the scroll wheel on the x-axis, it works well, too. If I zoom using press and hold, then release, I get an image artifact:

image
The artifact disappears after clicking once on the canvas.

I do not get the artifact at all if I call at script beginning: gStyle->SetCanvasPreferGL()

It seems that the image artifact has exactly the same pattern as the semi-transparent fill-style zooming window. See here:

While Zooming:
image

After Zooming:
image

The pattern in the old labels is slightly different:
image

Expected behavior

No image artifact is shown.

To Reproduce

  • Download test_zoom.zip
  • root -l test_zoom.cpp+
  • Zoom between 0 and 3000 via mouse press and hold on X axis.

Setup

The issue appears with:

  • Master / Ubuntu 18 and 20
  • 6.20.06 / Ubuntu 20
  • 6.13.08 / Ubuntu 18
  • 5.34.19 / Ubuntu 14 (over ssh)

It does not appear with:

  • MacOS.
  • 5.34.18/Ubuntu 14 (over ssh)
  • 5.32.04/Ubuntu 14 (over ssh)

Additional context

3787e53
#9740

@couet
Copy link
Member

couet commented Feb 1, 2022

Why do you think this is related to: 3787e53 ?
Does the artefact disappear if you turn off the move opaque mode ?

@couet couet self-assigned this Feb 1, 2022
@ferdymercury
Copy link
Collaborator Author

ferdymercury commented Feb 1, 2022

Why do you think this is related to: 3787e53 ? Does the artefact disappear if you turn off the move opaque mode ?

The artifact appeared at some point between 5.34/18 and 5.34/19, so I thought that these commits could be related.

Yes, calling canvas->MoveOpaque(0) makes the artifact disappear.

@couet
Copy link
Member

couet commented Feb 1, 2022

The artifact appeared at some point between 5.34/18 and 5.34/19, so I thought that these commits could be related.

Ok, that's quite old. Does reverting this patch you pointed fixes it ?

@ferdymercury
Copy link
Collaborator Author

(I did not try yet reverting it.)

@couet
Copy link
Member

couet commented Feb 1, 2022

The MoveOpaque issue pointed in 3787e53 is connected to TLine. But it seems the artefacts are coming from the shaded area used to highlight the zoomed interval. At least according to the screen captures you posted ....

@ferdymercury
Copy link
Collaborator Author

Yes, the shaded area might be the culprit.
It's also when it was included in the release note, fourth point: https://github.com/root-project/root/blob/master/gui/doc/v600/index.md

@couet
Copy link
Member

couet commented Feb 1, 2022

It's also when it was included in the release note, fourth point: https://github.com/root-project/root/blob/master/gui/doc/v600/index.md

That one is for 2D histograms. Your plot ia a 1D one...
It is weird nobody complained before ... this is so old ...

@ferdymercury
Copy link
Collaborator Author

ferdymercury commented Feb 1, 2022

The zoom on axis and on 2D histogram
I think it applies to both 1D and 2D ?
In 5.34/18 there is no shaded rectangle, and 5.34/19, there is one, and the effect appears.

@couet
Copy link
Member

couet commented Feb 1, 2022

I think it applies to both 1D and 2D ?

well ... yes may be I need to retrieve the patch...

@couet
Copy link
Member

couet commented Feb 1, 2022

This mechanism is implemented in THistPainter::ExecuteEvent.
In that code the TBox zoombox is used to draw this shaded area.

@couet
Copy link
Member

couet commented Feb 1, 2022

In that code you are in the case where the alpha mode is not supported (with X11).

@ferdymercury
Copy link
Collaborator Author

Hmm not sure why here there is only a ->Delete if dimension==2:

zoombox->Delete();

@couet
Copy link
Member

couet commented Feb 1, 2022

Hmm not sure why here there is only a ->Delete if dimension==2:

me neither ... I do not remember... that's too old.

@couet
Copy link
Member

couet commented Feb 1, 2022

Indeed that code is for 2D only it seems. I changed the boombox color to red and it appears red only in the 2D case.

@couet couet closed this as completed Feb 1, 2022
@couet couet reopened this Feb 1, 2022
@couet
Copy link
Member

couet commented Feb 1, 2022

Yes, the zoombox is for the 2D case. Do you see such artefact with a 2D histo also ?
Let me try to understand what is done in case of 1D.

@couet
Copy link
Member

couet commented Feb 1, 2022

Indeed I was wrong . In case of 1D the zoom is done in TPad.cxx

@ferdymercury
Copy link
Collaborator Author

I don't remember having seen this problem for 2D histograms, but maybe is the interplay with TLines and TGaxis which causes it in my example, rather than it being 1D? Hard to say.

@couet
Copy link
Member

couet commented Feb 1, 2022

In any case the zoombox for 1D is managed in TPad.cxx. I de-activated the alpha mode on Mac to be in the same configuration as yourself. But even with your example I do not see any artefact. May be you can deactivate the zoombox in TPad::ExecuteEventAxis and see if the artefact remains ? By the way if you do a simple drawing of a 1D histogram and try to zoom it, do you also see the artefact ?

@ferdymercury
Copy link
Collaborator Author

Yes, I see it with a simple 1D histogram, too, no need for secondary axes.

But... Ok I found out the issue.

I do see the artifact only if I call:
c->SetFillStyle(0);

@couet
Copy link
Member

couet commented Feb 1, 2022

I tried to call that also but I still do not see the problem on Mac

root [0] auto c = new TCanvas()
root [1]  c->SetFillStyle(0);
root [2] hpx->Draw()

@ferdymercury
Copy link
Collaborator Author

ferdymercury commented Feb 1, 2022

You can reproduce it on a free online Ubuntu 20 browser-box:

  • Go to https://www.onworks.net/os-distributions/ubuntu-based
  • Select Ubuntu 20, Start
  • Open a WebBrowser within it, google "cern ROOT install".
  • Copy the line of the "required dependencies"
  • Open a Terminal
  • sudo apt update
  • Paste the line of the required dependencies to install missing packages
  • Go back to web browser
  • Copy link to download binary release
  • Back to terminal, paste it there
  • tar -xzvf ...
  • source root/bin/thisroot.sh
  • Back to browser, search "cern root github", go to Issues
  • Download the reproducer of this issue
  • unzip
  • root -l test_zoom.cpp
  • Then zoom

I did the process and it's the case the artifact is there on such a fresh independent install.

@ferdymercury
Copy link
Collaborator Author

A more simple reproducer here shows the same effect on Ubuntu 18:

TCanvas* c = new TCanvas()
TH1* h = new TH1F("h","h",100,0,10)
c->SetFillStyle(0)
h->Draw()

image

@couet
Copy link
Member

couet commented Feb 1, 2022

.... well

Copy the line of the "required dependencies"

I am not sure what line you mean

Open a Terminal

ok

sudo apt update

ask me for a password I do not know ...
Never mind ..

@ferdymercury
Copy link
Collaborator Author

Copy the line of the "required dependencies"

image

ask me for a password I do not know ... Never mind ..

pwd is 123456

@couet
Copy link
Member

couet commented Feb 1, 2022

Ok ... that's too painful ... not stable ... it disconnect ... I don't spend more time on that. Thanks for the recipe anyway

@ferdymercury
Copy link
Collaborator Author

May be you can deactivate the zoombox in TPad::ExecuteEventAxis and see if the artifact remains ?

If I deactivate the 'removal' of the zoombox after button release, I get this on Ubuntu 20:
image

I can move around with the zoombox, make it smaller, etc. and the artifact is still there. Touching on the canvas does not clear the artifacts, which surprises me!

image

Only if I right click on the box, "Delete", the artifacts go away. (without having to click on the canvas)

@ferdymercury
Copy link
Collaborator Author

If I completely disable the zoombox creation in TPad.cxx, I can still zoom 'invisibly' on the canvas, and the artifact does not appear :)

@couet
Copy link
Member

couet commented Feb 1, 2022

yes ... that's really the zoombox ...

@ferdymercury
Copy link
Collaborator Author

I found a solution. Not sure if the difference is that when releasing the mouse, in MacOS another 'button' is detected which already calls the Modified/Update sequence, in comparison to with Ubuntu.

@ferdymercury ferdymercury changed the title Image artifact when zooming with a mouse area Image artifact with zoombox on 1D hist if SetFillStyle 0 on Ubuntu Feb 1, 2022
@couet
Copy link
Member

couet commented Feb 2, 2022

All the problems mentioned in this issue are fixed. I close it.
@ferdymercury: thanks again for the debugging and fixes !

@github-actions
Copy link

github-actions bot commented Feb 3, 2022

Hi @couet,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely,
🤖

@couet couet added this to Issues in Fixed in 6.28/00 via automation Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants