@@ -151,8 +151,9 @@ void Screenshot::perform(std::string fileName, o2::detectors::DetID::mask_t dete
151151 std::ostringstream filepath;
152152 filepath << outDirectory << " /Screenshot_" << time_str << " .png" ;
153153
154- TASImage image (width, height);
155- image.FillRectangle (backgroundColorHex.c_str (), 0 , 0 , width, height);
154+ TASImage* image = new TASImage (width, height);
155+
156+ image->FillRectangle (backgroundColorHex.c_str (), 0 , 0 , width, height);
156157
157158 const auto annotationStateTop = MultiView::getInstance ()->getAnnotationTop ()->GetState ();
158159 const auto annotationStateBottom = MultiView::getInstance ()->getAnnotationBottom ()->GetState ();
@@ -165,22 +166,25 @@ void Screenshot::perform(std::string fileName, o2::detectors::DetID::mask_t dete
165166 MultiView::getInstance ()->getAnnotationBottom ()->SetState (annotationStateBottom);
166167
167168 scaledImage = ScaleImage ((TASImage*)view3dImage, width * 0.65 , height * 0.95 , backgroundColorHex);
169+ delete view3dImage;
168170 if (scaledImage) {
169- CopyImage (& image, scaledImage, width * 0.015 , height * 0.025 , 0 , 0 , scaledImage->GetWidth (), scaledImage->GetHeight ());
171+ CopyImage (image, scaledImage, width * 0.015 , height * 0.025 , 0 , 0 , scaledImage->GetWidth (), scaledImage->GetHeight ());
170172 delete scaledImage;
171173 }
172174
173175 TImage* viewRphiImage = MultiView::getInstance ()->getView (MultiView::EViews::ViewRphi)->GetGLViewer ()->GetPictureUsingBB ();
174176 scaledImage = ScaleImage ((TASImage*)viewRphiImage, width * 0.3 , height * 0.45 , backgroundColorHex);
177+ delete viewRphiImage;
175178 if (scaledImage) {
176- CopyImage (& image, scaledImage, width * 0.68 , height * 0.025 , 0 , 0 , scaledImage->GetWidth (), scaledImage->GetHeight ());
179+ CopyImage (image, scaledImage, width * 0.68 , height * 0.025 , 0 , 0 , scaledImage->GetWidth (), scaledImage->GetHeight ());
177180 delete scaledImage;
178181 }
179182
180183 TImage* viewZYImage = MultiView::getInstance ()->getView (MultiView::EViews::ViewZY)->GetGLViewer ()->GetPictureUsingBB ();
181184 scaledImage = ScaleImage ((TASImage*)viewZYImage, width * 0.3 , height * 0.45 , backgroundColorHex);
185+ delete viewZYImage;
182186 if (scaledImage) {
183- CopyImage (& image, scaledImage, width * 0.68 , height * 0.525 , 0 , 0 , scaledImage->GetWidth (), scaledImage->GetHeight ());
187+ CopyImage (image, scaledImage, width * 0.68 , height * 0.525 , 0 , 0 , scaledImage->GetWidth (), scaledImage->GetHeight ());
184188 delete scaledImage;
185189 }
186190
@@ -190,9 +194,9 @@ void Screenshot::perform(std::string fileName, o2::detectors::DetID::mask_t dete
190194 if (aliceLogo->IsValid ()) {
191195 double ratio = 1434 . / 1939 .;
192196 aliceLogo->Scale (0.08 * width, 0.08 * width / ratio);
193- image.Merge (aliceLogo, " alphablend" , 20 , 20 );
194- delete aliceLogo;
197+ image->Merge (aliceLogo, " alphablend" , 20 , 20 );
195198 }
199+ delete aliceLogo;
196200 }
197201
198202 int fontSize = 0.015 * height;
@@ -208,14 +212,14 @@ void Screenshot::perform(std::string fileName, o2::detectors::DetID::mask_t dete
208212 int o2LogoY = 0.01 * width;
209213 int o2LogoSize = 0.04 * width;
210214 o2Logo->Scale (o2LogoSize, o2LogoSize / ratio);
211- image. Merge (o2Logo, " alphablend" , o2LogoX, height - o2LogoSize / ratio - o2LogoY);
215+ image-> Merge (o2Logo, " alphablend" , o2LogoX, height - o2LogoSize / ratio - o2LogoY);
212216 textX = o2LogoX + o2LogoSize + o2LogoX;
213217 textY = height - o2LogoSize / ratio - o2LogoY;
214- delete o2Logo;
215218 } else {
216219 textX = 229 ;
217220 textY = 1926 ;
218221 }
222+ delete o2Logo;
219223 }
220224
221225 auto detectorsString = detectors::DetID::getNames (detectorsMask);
@@ -228,14 +232,15 @@ void Screenshot::perform(std::string fileName, o2::detectors::DetID::mask_t dete
228232 lines.push_back ((std::string)settings.GetValue (" screenshot.message.line.3" , TString::Format (" Detectors: %s" , detectorsString.c_str ())));
229233 }
230234
231- image. BeginPaint ();
235+ image-> BeginPaint ();
232236
233237 for (int i = 0 ; i < 4 ; i++) {
234- image. DrawText (textX, textY + i * textLineHeight, lines[i].c_str (), fontSize, " #BBBBBB" , " FreeSansBold.otf" );
238+ image-> DrawText (textX, textY + i * textLineHeight, lines[i].c_str (), fontSize, " #BBBBBB" , " FreeSansBold.otf" );
235239 }
236- image. EndPaint ();
240+ image-> EndPaint ();
237241
238- image.WriteImage (fileName.c_str (), TImage::kPng );
242+ image->WriteImage (fileName.c_str (), TImage::kPng );
243+ delete image;
239244}
240245
241246} // namespace event_visualisation
0 commit comments