Skip to content

Commit 9531c31

Browse files
committed
[glcanvas] add extra update when store image
When GL canvas directly stored into image, it remain black. One need to call extra update to get correct image
1 parent 6bf5355 commit 9531c31

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

graf2d/gpad/src/TPad.cxx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5064,11 +5064,10 @@ void TPad::Print(const char *filename, Option_t *option)
50645064
Int_t wid = (this == GetCanvas()) ? GetCanvas()->GetCanvasID() : GetPixmapID();
50655065
Color_t hc = gPad->GetCanvas()->GetHighLightColor();
50665066
gPad->GetCanvas()->SetHighLightColor(-1);
5067-
gPad->Modified();
5068-
gPad->Update();
5069-
if (GetPainter()) {
5070-
GetPainter()->SelectDrawable(wid);
5071-
GetPainter()->SaveImage(this, psname.Data(), gtype);
5067+
gPad->ModifiedUpdate();
5068+
if (auto pp = GetPainter()) {
5069+
pp->SelectDrawable(wid);
5070+
pp->SaveImage(this, psname.Data(), gtype);
50725071
}
50735072
if (!gSystem->AccessPathName(psname.Data())) {
50745073
Info("Print", "GIF file %s has been created", psname.Data());
@@ -5079,11 +5078,13 @@ void TPad::Print(const char *filename, Option_t *option)
50795078
if (gtype != TImage::kUnknown) {
50805079
Color_t hc = gPad->GetCanvas()->GetHighLightColor();
50815080
gPad->GetCanvas()->SetHighLightColor(-1);
5082-
gPad->Modified();
5083-
gPad->Update();
5081+
gPad->ModifiedUpdate();
5082+
// GL canvas requires extra update to correctly flush image, fix #22157
5083+
if (gPad->GetCanvas()->UseGL())
5084+
gPad->UpdateAsync();
50845085
gPad->GetCanvasImp()->UpdateDisplay(1, kTRUE);
5085-
if (GetPainter())
5086-
GetPainter()->SaveImage(this, psname, gtype);
5086+
if (auto pp = GetPainter())
5087+
pp->SaveImage(this, psname, gtype);
50875088
if (!gSystem->AccessPathName(psname)) {
50885089
Info("Print", "file %s has been created", psname.Data());
50895090
}

0 commit comments

Comments
 (0)