@@ -66,95 +66,6 @@ TGLPadPainter::TGLPadPainter()
6666}
6767
6868
69- // //////////////////////////////////////////////////////////////////////////////
70- // /Delegate to gVirtualX.
71-
72- Color_t TGLPadPainter::GetLineColor () const
73- {
74- return gVirtualX ->GetLineColor ();
75- }
76-
77- // //////////////////////////////////////////////////////////////////////////////
78- // /Delegate to gVirtualX.
79-
80- Style_t TGLPadPainter::GetLineStyle () const
81- {
82- return gVirtualX ->GetLineStyle ();
83- }
84-
85- // //////////////////////////////////////////////////////////////////////////////
86- // /Delegate to gVirtualX.
87-
88- Width_t TGLPadPainter::GetLineWidth () const
89- {
90- return gVirtualX ->GetLineWidth ();
91- }
92-
93- // //////////////////////////////////////////////////////////////////////////////
94- // /Delegate to gVirtualX.
95-
96- void TGLPadPainter::SetLineColor (Color_t lcolor)
97- {
98- gVirtualX ->SetLineColor (lcolor);
99- }
100-
101- // //////////////////////////////////////////////////////////////////////////////
102- // /Delegate to gVirtualX.
103-
104- void TGLPadPainter::SetLineStyle (Style_t lstyle)
105- {
106- gVirtualX ->SetLineStyle (lstyle);
107- }
108-
109- // //////////////////////////////////////////////////////////////////////////////
110- // /Delegate to gVirtualX.
111-
112- void TGLPadPainter::SetLineWidth (Width_t lwidth)
113- {
114- gVirtualX ->SetLineWidth (lwidth);
115- }
116-
117- // //////////////////////////////////////////////////////////////////////////////
118- // /Delegate to gVirtualX.
119-
120- Color_t TGLPadPainter::GetFillColor () const
121- {
122- return gVirtualX ->GetFillColor ();
123- }
124-
125- // //////////////////////////////////////////////////////////////////////////////
126- // /Delegate to gVirtualX.
127-
128- Style_t TGLPadPainter::GetFillStyle () const
129- {
130- return gVirtualX ->GetFillStyle ();
131- }
132-
133- // //////////////////////////////////////////////////////////////////////////////
134- // /Delegate to gVirtualX.
135- // /IsTransparent is implemented as inline function in TAttFill.
136-
137- Bool_t TGLPadPainter::IsTransparent () const
138- {
139- return gVirtualX ->IsTransparent ();
140- }
141-
142- // //////////////////////////////////////////////////////////////////////////////
143- // /Delegate to gVirtualX.
144-
145- void TGLPadPainter::SetFillColor (Color_t fcolor)
146- {
147- gVirtualX ->SetFillColor (fcolor);
148- }
149-
150- // //////////////////////////////////////////////////////////////////////////////
151- // /Delegate to gVirtualX.
152-
153- void TGLPadPainter::SetFillStyle (Style_t fstyle)
154- {
155- gVirtualX ->SetFillStyle (fstyle);
156- }
157-
15869// //////////////////////////////////////////////////////////////////////////////
15970// /Delegate to gVirtualX.
16071
@@ -166,151 +77,73 @@ void TGLPadPainter::SetOpacity(Int_t percent)
16677// //////////////////////////////////////////////////////////////////////////////
16778// /Delegate to gVirtualX.
16879
169- Short_t TGLPadPainter::GetTextAlign () const
170- {
171- return gVirtualX ->GetTextAlign ();
172- }
173-
174- // //////////////////////////////////////////////////////////////////////////////
175- // /Delegate to gVirtualX.
176-
177- Float_t TGLPadPainter::GetTextAngle () const
178- {
179- return gVirtualX ->GetTextAngle ();
180- }
181-
182- // //////////////////////////////////////////////////////////////////////////////
183- // /Delegate to gVirtualX.
184-
185- Color_t TGLPadPainter::GetTextColor () const
186- {
187- return gVirtualX ->GetTextColor ();
188- }
189-
190- // //////////////////////////////////////////////////////////////////////////////
191- // /Delegate to gVirtualX.
192-
193- Font_t TGLPadPainter::GetTextFont () const
194- {
195- return gVirtualX ->GetTextFont ();
196- }
197-
198- // //////////////////////////////////////////////////////////////////////////////
199- // /Delegate to gVirtualX.
200-
201- Float_t TGLPadPainter::GetTextSize () const
202- {
203- return gVirtualX ->GetTextSize ();
204- }
205-
206- // //////////////////////////////////////////////////////////////////////////////
207- // /Delegate to gVirtualX.
208-
20980Float_t TGLPadPainter::GetTextMagnitude () const
21081{
21182 return gVirtualX ->GetTextMagnitude ();
21283}
21384
21485// //////////////////////////////////////////////////////////////////////////////
215- // /Delegate to gVirtualX.
216-
217- void TGLPadPainter::SetTextAlign (Short_t align)
218- {
219- gVirtualX ->SetTextAlign (align);
220- }
221-
222- // //////////////////////////////////////////////////////////////////////////////
223- // /Delegate to gVirtualX.
224-
225- void TGLPadPainter::SetTextAngle (Float_t tangle)
226- {
227- gVirtualX ->SetTextAngle (tangle);
228- }
229-
230- // //////////////////////////////////////////////////////////////////////////////
231- // /Delegate to gVirtualX.
86+ // / Select pad where current painting will be performed
23287
233- void TGLPadPainter::SetTextColor (Color_t tcolor )
88+ void TGLPadPainter::OnPad (TVirtualPad *pad )
23489{
235- gVirtualX ->SetTextColor (tcolor);
90+ // GL painter does not use proper id for sub-pads (see CreateDrawable)
91+ // so one always use canvas ID to execute TVirtualX-specific commands
92+ if (!fWinContext )
93+ fWinContext = gVirtualX ->GetWindowContext (pad->GetCanvasID ());
23694}
23795
238- // //////////////////////////////////////////////////////////////////////////////
239- // /Delegate to gVirtualX.
240-
241- void TGLPadPainter::SetTextFont (Font_t tfont)
242- {
243- gVirtualX ->SetTextFont (tfont);
244- }
24596
24697// //////////////////////////////////////////////////////////////////////////////
247- // /Delegate to gVirtualX.
98+ // / Set fill attributes
24899
249- void TGLPadPainter::SetTextSize (Float_t tsize )
100+ void TGLPadPainter::SetAttFill ( const TAttFill &att )
250101{
251- gVirtualX -> SetTextSize (tsize);
252- }
102+ if (& fAttFill != &att)
103+ att. Copy ( fAttFill );
253104
254- // //////////////////////////////////////////////////////////////////////////////
255- // /Delegate to gVirtualX.
256-
257- void TGLPadPainter::SetTextSizePixels (Int_t npixels)
258- {
259- gVirtualX ->SetTextSizePixels (npixels);
105+ // TODO: dismiss in the future, gVirtualX attributes not needed in GL
106+ if (fWinContext && gVirtualX )
107+ gVirtualX ->SetAttFill (fWinContext , att);
260108}
261109
262-
263110// //////////////////////////////////////////////////////////////////////////////
264- // / Delegate to gVirtualX.
111+ // / Set line attributes
265112
266- Color_t TGLPadPainter::GetMarkerColor () const
113+ void TGLPadPainter::SetAttLine ( const TAttLine &att)
267114{
268- return gVirtualX ->GetMarkerColor ();
269- }
270-
271-
272- // //////////////////////////////////////////////////////////////////////////////
273- // / Delegate to gVirtualX.
115+ if (&fAttLine != &att)
116+ att.Copy (fAttLine );
274117
275- Style_t TGLPadPainter::GetMarkerStyle () const
276- {
277- return gVirtualX ->GetMarkerStyle ( );
118+ // TODO: dismiss in the future, gVirtualX attributes not needed in GL
119+ if ( fWinContext && gVirtualX )
120+ gVirtualX ->SetAttLine ( fWinContext , att );
278121}
279122
280-
281123// //////////////////////////////////////////////////////////////////////////////
282- // / Delegate to gVirtualX.
124+ // / Set marker attributes
283125
284- Size_t TGLPadPainter::GetMarkerSize () const
126+ void TGLPadPainter::SetAttMarker ( const TAttMarker &att)
285127{
286- return gVirtualX -> GetMarkerSize ();
287- }
128+ if (& fAttMarker != &att)
129+ att. Copy ( fAttMarker );
288130
289-
290- // //////////////////////////////////////////////////////////////////////////////
291- // / Delegate to gVirtualX.
292-
293- void TGLPadPainter::SetMarkerColor (Color_t mcolor)
294- {
295- gVirtualX ->SetMarkerColor (mcolor);
131+ // TODO: dismiss in the future, gVirtualX attributes not needed in GL
132+ if (fWinContext && gVirtualX )
133+ gVirtualX ->SetAttMarker (fWinContext , att);
296134}
297135
298-
299136// //////////////////////////////////////////////////////////////////////////////
300- // / Delegate to gVirtualX.
137+ // / Set text attributes
301138
302- void TGLPadPainter::SetMarkerStyle (Style_t mstyle )
139+ void TGLPadPainter::SetAttText ( const TAttText &att )
303140{
304- gVirtualX -> SetMarkerStyle (mstyle);
305- }
141+ if (& fAttText != &att)
142+ att. Copy ( fAttText );
306143
307-
308- // //////////////////////////////////////////////////////////////////////////////
309- // / Delegate to gVirtualX.
310-
311- void TGLPadPainter::SetMarkerSize (Size_t msize)
312- {
313- gVirtualX ->SetMarkerSize (msize);
144+ // TODO: dismiss in the future, gVirtualX attributes not needed in GL
145+ if (fWinContext && gVirtualX )
146+ gVirtualX ->SetAttText (fWinContext , att);
314147}
315148
316149/*
@@ -376,14 +209,16 @@ void TGLPadPainter::DestroyDrawable(Int_t /* device */)
376209
377210void TGLPadPainter::SelectDrawable (Int_t /* device */ )
378211{
212+ auto pad = dynamic_cast <TPad *>(gPad );
213+ if (!fWinContext && pad)
214+ fWinContext = gVirtualX ->GetWindowContext (pad->GetCanvasID ());
215+
379216 if (fLocked )
380217 return ;
381218
382- if (TPad * pad = dynamic_cast <TPad *>( gPad ) ) {
219+ if (pad) {
383220 // GL painter does not use proper id for sub-pads (see CreateDrawable)
384221 // so one always use canvas ID to execute TVirtualX-specific commands
385- fWinContext = gVirtualX ->GetWindowContext (pad->GetCanvasID ());
386-
387222 Int_t px = 0 , py = 0 ;
388223
389224 pad->XYtoAbsPixel (pad->GetX1 (), pad->GetY1 (), px, py);
@@ -524,6 +359,7 @@ void TGLPadPainter::DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
524359 // from TView3D::ExecuteRotateView. This means in fact,
525360 // that TView3D wants to draw itself in a XOR mode, via
526361 // gVirtualX.
362+ // TODO: only here set line attributes to virtual x
527363 if (fWinContext && (gVirtualX ->GetDrawModeW (fWinContext ) == TVirtualX::kInvert )) {
528364 gVirtualX ->DrawLineW (fWinContext ,
529365 gPad ->XtoAbsPixel (x1), gPad ->YtoAbsPixel (y1),
@@ -570,6 +406,7 @@ void TGLPadPainter::DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t
570406 const Int_t py1 = gPad ->VtoPixel (v1);
571407 const Int_t px2 = gPad ->UtoPixel (u2);
572408 const Int_t py2 = gPad ->VtoPixel (v2);
409+ // TODO: only here set line attributes to virtual x
573410 gVirtualX ->DrawLineW (fWinContext , px1, py1, px2, py2);
574411 }
575412 return ;
0 commit comments