From c7200b100d8ed49816c4d92e7882403d98e1f12c Mon Sep 17 00:00:00 2001 From: Danilo Piparo Date: Wed, 13 Mar 2024 17:13:00 +0100 Subject: [PATCH] [graphics] Save memory when obtaining TImageDump instance by using TClass instead of the interpreter. As a side effect, the whole process is much faster. fixes an incarnation of #14156, mitigating the overall effect of the highlighted behaviour --- graf2d/asimage/CMakeLists.txt | 1 + graf2d/asimage/src/TASImage.cxx | 40 +++++++++++++++++---------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/graf2d/asimage/CMakeLists.txt b/graf2d/asimage/CMakeLists.txt index 4e64d82a6651f..31114ad45d4ee 100644 --- a/graf2d/asimage/CMakeLists.txt +++ b/graf2d/asimage/CMakeLists.txt @@ -33,6 +33,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(ASImage DEPENDENCIES Core Graf + Postscript BUILTINS AFTERIMAGE ) diff --git a/graf2d/asimage/src/TASImage.cxx b/graf2d/asimage/src/TASImage.cxx index 6984204e0b486..7e046f4724bf8 100644 --- a/graf2d/asimage/src/TASImage.cxx +++ b/graf2d/asimage/src/TASImage.cxx @@ -61,37 +61,39 @@ ROOT tutorials: `$ROOTSYS/tutorials/image/` #include FT_FREETYPE_H #include FT_GLYPH_H +#include "RConfigure.h" +#include "TArrayD.h" +#include "TArrayL.h" #include "TASImage.h" #include "TASImagePlugin.h" -#include "TROOT.h" #include "TBuffer.h" -#include "TMath.h" -#include "TSystem.h" -#include "TVirtualX.h" -#include "TVirtualPad.h" -#include "TArrayD.h" -#include "TVectorD.h" -#include "TVirtualPS.h" -#include "TGaxis.h" #include "TColor.h" -#include "TObjArray.h" -#include "TArrayL.h" -#include "TPoint.h" +#include "TEnv.h" #include "TFrame.h" -#include "TTF.h" -#include "TRandom.h" -#include +#include "TGaxis.h" #include "THashTable.h" +#include "TImageDump.h" +#include "TMath.h" +#include "TObjArray.h" #include "TPluginManager.h" -#include "TEnv.h" +#include "TPoint.h" +#include "TRandom.h" +#include "TROOT.h" #include "TStyle.h" +#include "TSystem.h" #include "TText.h" -#include "RConfigure.h" +#include "TTF.h" +#include "TVectorD.h" +#include "TVirtualPad.h" #include "TVirtualPadPainter.h" -#include "snprintf.h" +#include "TVirtualPS.h" +#include "TVirtualX.h" +#include #include +#include "snprintf.h" + #ifndef WIN32 #ifndef R__HAS_COCOA # include @@ -1095,7 +1097,7 @@ void TASImage::FromPad(TVirtualPad *pad, Int_t x, Int_t y, UInt_t w, UInt_t h) if (gROOT->IsBatch()) { // in batch mode TVirtualPS *psave = gVirtualPS; - gVirtualPS = (TVirtualPS*)gROOT->ProcessLineFast("new TImageDump()"); + gVirtualPS = new TImageDump(); gVirtualPS->Open(pad->GetName(), 114); // in memory gVirtualPS->SetBit(BIT(11)); //kPrintingPS