@@ -741,8 +741,14 @@ void TPad::Clear(Option_t *option)
741741 getchar ();
742742 }
743743
744- if (!gPad ->IsBatch () && GetPainter ()) GetPainter ()->ClearDrawable ();
745- if (gVirtualPS && gPad == gPad ->GetCanvas ()) gVirtualPS ->NewPage ();
744+ auto pp = GetPainter ();
745+ // If pad painter uses PS, ClearDrawable() start new page
746+ if (pp) {
747+ if (pp->IsNative ())
748+ pp->ClearDrawable ();
749+ else if (this == GetCanvas ())
750+ pp->NewPage ();
751+ }
746752
747753 PaintBorder (GetFillColor (), kTRUE );
748754 fCrosshairPos = 0 ;
@@ -3199,9 +3205,12 @@ void TPad::GetRangeAxis(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t
31993205
32003206void TPad::HighLight (Color_t color, Bool_t set)
32013207{
3202- if (gVirtualPS && gVirtualPS ->TestBit (kPrintingPS )) return ;
3208+ if (auto pp = GetPainter ())
3209+ if (!pp->IsNative ())
3210+ return ;
32033211
3204- if (color <= 0 ) return ;
3212+ if (color <= 0 )
3213+ return ;
32053214
32063215 AbsCoordinates (kTRUE );
32073216
@@ -3220,10 +3229,8 @@ void TPad::HighLight(Color_t color, Bool_t set)
32203229 // momentarily such that when DrawClone is called, it is
32213230 // not the right value (for DrawClone). Should be FIXED.
32223231 gROOT ->SetSelectedPad (this );
3223- if (GetBorderMode ()>0 ) {
3224- if (set) PaintBorder (-color, kFALSE );
3225- else PaintBorder (-GetFillColor (), kFALSE );
3226- }
3232+ if (GetBorderMode () > 0 )
3233+ PaintBorder (set ? -color : -GetFillColor (), kFALSE );
32273234 }
32283235
32293236 AbsCoordinates (kFALSE );
@@ -3811,7 +3818,7 @@ void TPad::PaintBorder(Color_t color, Bool_t /* tops */)
38113818 // With Cocoa we have a transparency. But we also have
38123819 // pixmaps, and if you just paint a new content over the old one
38133820 // with alpha < 1., you'll be able to see the old content.
3814- if (pp->IsNative () && gVirtualX -> InheritsFrom ( " TGCocoa " ))
3821+ if (pp->IsNative () && pp-> IsCocoa ( ))
38153822 pp->ClearDrawable ();
38163823
38173824 PaintBox (fX1 , fY1 , fX2 , fY2 );
@@ -3917,7 +3924,7 @@ void TPad::PaintBorder(Color_t color, Bool_t /* tops */)
39173924}
39183925
39193926// //////////////////////////////////////////////////////////////////////////////
3920- // / Paint a frame border with Postscript.
3927+ // / Paint a frame border with Postscript - no longer used
39213928
39223929void TPad::PaintBorderPS (Double_t xl,Double_t yl,Double_t xt,Double_t yt,Int_t bmode,Int_t bsize,Int_t dark,Int_t light)
39233930{
@@ -4028,7 +4035,9 @@ void TPad::PaintModified()
40284035 TContext ctxt (this , kTRUE );
40294036 if (IsModified () || IsTransparent ()) {
40304037 if ((fFillStyle < 3026 ) && (fFillStyle > 3000 )) {
4031- if (!gPad ->IsBatch () && GetPainter ()) GetPainter ()->ClearDrawable ();
4038+ auto pp = GetPainter ();
4039+ if (pp && pp->IsNative ())
4040+ pp->ClearDrawable ();
40324041 }
40334042 PaintBorder (GetFillColor (), kTRUE );
40344043 }
@@ -4129,7 +4138,7 @@ void TPad::PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t
41294138 // ignore this style option when this is the canvas itself
41304139 if (this == fMother ) {
41314140 // It's clear, that virtual X checks a style (4000) and will render a hollow rect!
4132- if (gVirtualX -> InheritsFrom ( " TGCocoa " )) {
4141+ if (pp-> IsCocoa ( )) {
41334142 style0 = style;
41344143 pp->SetFillStyle (1000 );
41354144 }
@@ -5946,9 +5955,10 @@ void TPad::ResizePad(Option_t *option)
59465955 if (gPad ->IsBatch ())
59475956 fPixmapID = 0 ;
59485957 else {
5949- if (GetPainter ()){
5950- GetPainter ()->SetLineWidth (-1 );
5951- GetPainter ()->SetTextSize (-1 );
5958+ auto pp = GetPainter ();
5959+ if (pp){
5960+ pp->SetLineWidth (-1 );
5961+ pp->SetTextSize (-1 );
59525962 }
59535963 // create or re-create off-screen pixmap
59545964 if (fPixmapID ) {
@@ -5972,13 +5982,12 @@ void TPad::ResizePad(Option_t *option)
59725982 h = 10 ;
59735983 }
59745984 if (fPixmapID == -1 ) { // this case is handled via the ctor
5975- if (GetPainter ()) fPixmapID = GetPainter ()->CreateDrawable (w, h);
5985+ if (pp)
5986+ fPixmapID = pp->CreateDrawable (w, h);
59765987 } else {
5977- if (gVirtualX ) {
5978- if (gVirtualX ->ResizePixmap (fPixmapID , w, h)) {
5979- Resized ();
5980- Modified (kTRUE );
5981- }
5988+ if (pp && pp->ResizeDrawable (fPixmapID , w, h)) {
5989+ Resized ();
5990+ Modified (kTRUE );
59825991 }
59835992 }
59845993 }
0 commit comments