Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Extend TCanvasImp interface
- let create TVirtualPadPainter via the TCanvasImp.
- handling of TCanvas::Update() can be perfromed in TCanvasImp
  • Loading branch information
linev committed Jun 7, 2017
commit 31fb30ff38c68b8dbe17acdb10b992dbd3ca2131
5 changes: 4 additions & 1 deletion core/base/inc/TCanvasImp.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "Rtypes.h"

class TCanvas;

class TVirtualPadPainter;

class TCanvasImp {
friend class TCanvas;
Expand All @@ -42,6 +42,9 @@ friend class TCanvas;
virtual void Unlock() { }
virtual Bool_t IsLocked() { return kFALSE; }

virtual Bool_t PerformUpdate() { return kFALSE; }
virtual TVirtualPadPainter *CreatePadPainter() { return 0; }

public:
TCanvasImp(TCanvas *c=0) : fCanvas(c) { }
TCanvasImp(TCanvas *c, const char *name, UInt_t width, UInt_t height);
Expand Down
21 changes: 13 additions & 8 deletions graf2d/gpad/src/TCanvas.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2249,14 +2249,18 @@ void TCanvas::Update()

fUpdating = kTRUE;

if (!IsBatch()) FeedbackMode(kFALSE); // Goto double buffer mode
if (!fCanvasImp->PerformUpdate()) {

if (!UseGL())
PaintModified(); // Repaint all modified pad's
if (!IsBatch()) FeedbackMode(kFALSE); // Goto double buffer mode

Flush(); // Copy all pad pixmaps to the screen
if (!UseGL())
PaintModified(); // Repaint all modified pad's

Flush(); // Copy all pad pixmaps to the screen

SetCursor(kCross);
}

SetCursor(kCross);
fUpdating = kFALSE;
}

Expand Down Expand Up @@ -2299,9 +2303,10 @@ void TCanvas::CreatePainter()
{
//Even for batch mode painter is still required, just to delegate
//some calls to batch "virtual X".
if (!UseGL() || fBatch)
fPainter = new TPadPainter;//Do not need plugin manager for this!
else {
if (!UseGL() || fBatch) {
fPainter = !fCanvasImp ? 0 : fCanvasImp->CreatePadPainter();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is

if (fCanvasImp)
  fPainter = fCanvasImp->CreatePadPainter();

maybe a more readable version of this code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a more readable version of this code?

Done

if (!fPainter) fPainter = new TPadPainter;//Do not need plugin manager for this!
} else {
fPainter = TVirtualPadPainter::PadPainter("gl");
if (!fPainter) {
Error("CreatePainter", "GL Painter creation failed! Will use default!");
Expand Down