Skip to content

Commit 6e8ee9e

Browse files
committed
[padpainter] use base class methods in attributes setters
Reduce direct access to protected class memebers Reduce code duplication
1 parent f4ef7ae commit 6e8ee9e

File tree

3 files changed

+12
-25
lines changed

3 files changed

+12
-25
lines changed

graf2d/gpad/src/TPadPainter.cxx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ void TPadPainter::DrawPixels(const unsigned char * /*pixelData*/, UInt_t /*width
197197

198198
void TPadPainter::SetAttFill(const TAttFill &att)
199199
{
200-
if (&fAttFill != &att)
201-
att.Copy(fAttFill);
200+
TPadPainterBase::SetAttFill(att);
202201

203202
gVirtualX->SetAttFill(fWinContext, att);
204203
}
@@ -208,8 +207,7 @@ void TPadPainter::SetAttFill(const TAttFill &att)
208207

209208
void TPadPainter::SetAttLine(const TAttLine &att)
210209
{
211-
if (&fAttLine != &att)
212-
att.Copy(fAttLine);
210+
TPadPainterBase::SetAttLine(att);
213211

214212
gVirtualX->SetAttLine(fWinContext, att);
215213
}
@@ -219,8 +217,7 @@ void TPadPainter::SetAttLine(const TAttLine &att)
219217

220218
void TPadPainter::SetAttMarker(const TAttMarker &att)
221219
{
222-
if (&fAttMarker != &att)
223-
att.Copy(fAttMarker);
220+
TPadPainterBase::SetAttMarker(att);
224221

225222
gVirtualX->SetAttMarker(fWinContext, att);
226223
}
@@ -230,8 +227,7 @@ void TPadPainter::SetAttMarker(const TAttMarker &att)
230227

231228
void TPadPainter::SetAttText(const TAttText &att)
232229
{
233-
if (&fAttText != &att)
234-
att.Copy(fAttText);
230+
TPadPainterBase::SetAttText(att);
235231

236232
gVirtualX->SetAttText(fWinContext, att);
237233
}

graf2d/gpad/src/TPadPainterPS.cxx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ void TPadPainterPS::SetOpacity(Int_t percent)
6565

6666
void TPadPainterPS::SetAttFill(const TAttFill &att)
6767
{
68-
if (&att != &fAttFill)
69-
att.Copy(fAttFill);
68+
TPadPainterBase::SetAttFill(att);
7069

7170
fPS->SetFillColor(att.GetFillColor());
7271
fPS->SetFillStyle(att.GetFillStyle());
@@ -77,8 +76,7 @@ void TPadPainterPS::SetAttFill(const TAttFill &att)
7776

7877
void TPadPainterPS::SetAttLine(const TAttLine &att)
7978
{
80-
if (&att != &fAttLine)
81-
att.Copy(fAttLine);
79+
TPadPainterBase::SetAttLine(att);
8280

8381
fPS->SetLineColor(att.GetLineColor());
8482
fPS->SetLineStyle(att.GetLineStyle());
@@ -90,8 +88,7 @@ void TPadPainterPS::SetAttLine(const TAttLine &att)
9088

9189
void TPadPainterPS::SetAttMarker(const TAttMarker &att)
9290
{
93-
if (&att != &fAttMarker)
94-
att.Copy(fAttMarker);
91+
TPadPainterBase::SetAttMarker(att);
9592

9693
fPS->SetMarkerColor(att.GetMarkerColor());
9794
fPS->SetMarkerSize(att.GetMarkerSize());
@@ -103,8 +100,7 @@ void TPadPainterPS::SetAttMarker(const TAttMarker &att)
103100

104101
void TPadPainterPS::SetAttText(const TAttText &att)
105102
{
106-
if (&att != &fAttText)
107-
att.Copy(fAttText);
103+
TPadPainterBase::SetAttText(att);
108104

109105
fPS->SetTextAlign(att.GetTextAlign());
110106
fPS->SetTextAngle(att.GetTextAngle());

graf3d/gl/src/TGLPadPainter.cxx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,12 @@ void TGLPadPainter::OnPad(TVirtualPad *pad)
9393
fWinContext = gVirtualX->GetWindowContext(pad->GetCanvasID());
9494
}
9595

96-
9796
////////////////////////////////////////////////////////////////////////////////
9897
/// Set fill attributes
9998

10099
void TGLPadPainter::SetAttFill(const TAttFill &att)
101100
{
102-
if (&fAttFill != &att)
103-
att.Copy(fAttFill);
101+
TPadPainterBase::SetAttFill(att);
104102

105103
// TODO: dismiss in the future, gVirtualX attributes not needed in GL
106104
if (fWinContext && gVirtualX)
@@ -112,8 +110,7 @@ void TGLPadPainter::SetAttFill(const TAttFill &att)
112110

113111
void TGLPadPainter::SetAttLine(const TAttLine &att)
114112
{
115-
if (&fAttLine != &att)
116-
att.Copy(fAttLine);
113+
TPadPainterBase::SetAttLine(att);
117114

118115
// TODO: dismiss in the future, gVirtualX attributes not needed in GL
119116
if (fWinContext && gVirtualX)
@@ -125,8 +122,7 @@ void TGLPadPainter::SetAttLine(const TAttLine &att)
125122

126123
void TGLPadPainter::SetAttMarker(const TAttMarker &att)
127124
{
128-
if (&fAttMarker != &att)
129-
att.Copy(fAttMarker);
125+
TPadPainterBase::SetAttMarker(att);
130126

131127
// TODO: dismiss in the future, gVirtualX attributes not needed in GL
132128
if (fWinContext && gVirtualX)
@@ -138,8 +134,7 @@ void TGLPadPainter::SetAttMarker(const TAttMarker &att)
138134

139135
void TGLPadPainter::SetAttText(const TAttText &att)
140136
{
141-
if (&fAttText != &att)
142-
att.Copy(fAttText);
137+
TPadPainterBase::SetAttText(att);
143138

144139
// TODO: dismiss in the future, gVirtualX attributes not needed in GL
145140
if (fWinContext && gVirtualX)

0 commit comments

Comments
 (0)