TPaveText and TH2 have different Drawing behaviour

Dear all,

I noticed that if I mistakenly draw again an again the same TPaveText, the canvas becomes sluggish.

Proof:

TCanvas c
pt = new TPaveText(0.78,0.63,0.98,0.83,"brNDC");
pt->Draw()
TStopwatch w 
w.Reset() ; w.Start(); c.Update() ; w.Stop(); w.Print("u"); // here it says something really small
for(int i = 0 ; i < 100000 ; i++) {
   pt->Draw();
}
w.Reset() ; w.Start(); c.Update() ; w.Stop(); w.Print("u"); // here it says something bigger

Interestingly, if you save the canvas as a Macro you can see the 100000 pave text instantiated. In the canvas though, there is only 1 TPaveText.

I tried to reproduce the same behaviour with an histogram but couldn’t. The histograms behave as I expected: drawing the same thing several times doesn’t change anything (it is the same pointer added to the same list,correct?).

Is it on purpose that the TPaveText behaves differently ?
If not, I think that it would be worth fixing it. For me it took quite some time to find out why my canvas was becoming slower and slower.

Cheers,
Barth

I’ll check

Solved by phone