Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f84173f
Fix TText methods in case of NDC
linev May 7, 2026
ad36ae2
Exclude gVirtualX from TText
linev May 7, 2026
0501fe5
Adjust TText::BBox methods
linev May 7, 2026
785443c
Support abs coordinates in TAttBBox methods
linev May 7, 2026
81c8982
Improve TText::executeEvent
linev May 7, 2026
0049614
Use new method in TLine::ExecuteEvent
linev May 7, 2026
8c32985
Adjust TEllipse BBox and ExecuteEvent
linev May 7, 2026
a5891f1
Optmize TEllipse painting
linev May 7, 2026
b37cccf
Reimplement TEllipse::ExecuteEvent
linev May 7, 2026
1eaf64d
[padpainter] suppot polyline abs coordinates in non-opaque mode
linev May 11, 2026
b369cb8
[glpainter] support polymaker in interactive mode
linev May 11, 2026
6a200c4
[glpainter] support polyline in invert mode
linev May 11, 2026
87ccfaf
Further simplification of TEllipse::ExecuteEvent
linev May 11, 2026
8736849
[quartz] Add marker support to xor operations
linev May 12, 2026
25ce4e4
[quartz] support polyline in xor operations
linev May 12, 2026
144a61e
[quartz] use override syntax, use temporary points buffer
linev May 12, 2026
1b7c4aa
[glpainter] use GL_LINE_LOOP for box border
linev May 12, 2026
04054d3
Update stressGraphics for ellipse
linev May 13, 2026
edf0626
Adjust TPolyMarker::Paint
linev May 12, 2026
6a6c71f
Implement TMarker::PaintMarkerNDC
linev May 12, 2026
213acdd
Adjust TCurlyLine::ExecuteEvent and bbox
linev May 13, 2026
752e2cd
Optimize TLine::ExecuteEvent and GetBBox
linev May 13, 2026
766c6a8
Better TCurlyLine::ExecuteEvent
linev May 13, 2026
f627947
Optimize TCurlyArc::ExecuteEvent and BBox
linev May 13, 2026
b10682c
Optimize TEllipse::ExecuteEvent
linev May 13, 2026
a5a11dc
Modernize TPolyLine::ExecuteEvent
linev May 13, 2026
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
4 changes: 2 additions & 2 deletions core/base/inc/TAttBBox2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class TAttBBox2D {

protected:

Double_t GetXCoord(const Int_t x, Bool_t is_ndc = kFALSE);
Double_t GetYCoord(const Int_t y, Bool_t is_ndc = kFALSE);
Double_t GetXCoord(const Int_t x, Bool_t is_ndc = kFALSE, Bool_t is_absolute = kFALSE);
Double_t GetYCoord(const Int_t y, Bool_t is_ndc = kFALSE, Bool_t is_absolute = kFALSE);

public:
virtual ~TAttBBox2D();
Expand Down
28 changes: 21 additions & 7 deletions core/base/src/TAttBBox2D.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,34 +54,48 @@ void TAttBBox2D::SetBBoxCenter(const TPoint &p)
}

////////////////////////////////////////////////////////////////////////////////
// Return user X coordinate for pixel X value
// Used in derived classes to implement SetBBox... methods
/// Return user X coordinate for pixel X value
/// Can return ndc or normal values
/// Also one can specify to use absolute coordinates for input parameter x
/// Used in derived classes to implement SetBBox... methods

Double_t TAttBBox2D::GetXCoord(const Int_t x, Bool_t is_ndc)
Double_t TAttBBox2D::GetXCoord(const Int_t x, Bool_t is_ndc, Bool_t is_absolute)
{
if (!gPad)
return 0.;

if (!is_ndc)
return gPad->PadtoX(gPad->PixeltoX(x));
return gPad->PadtoX(is_absolute ? gPad->AbsPixeltoX(x) : gPad->PixeltoX(x));

if (is_absolute) {
Double_t ww = gPad->GetWw();
Double_t wndc = gPad->GetAbsWNDC();
return ww > 0 && wndc > 0 ? (x / ww - gPad->GetAbsXlowNDC()) / wndc : 0.;
}
Int_t pw = gPad->GetPadWidth();
return pw > 0 ? 1. * x / pw : 0.;
}

////////////////////////////////////////////////////////////////////////////////
// Return user Y coordinate for pixel Y value
/// Can return ndc or normal values
/// Also one can specify to use absolute coordinates for input parameter x
// Used in derived classes to implement SetBBox... methods

Double_t TAttBBox2D::GetYCoord(const Int_t y, Bool_t is_ndc)
Double_t TAttBBox2D::GetYCoord(const Int_t y, Bool_t is_ndc, Bool_t is_absolute)
{
if (!gPad)
return 0.;

if (!is_ndc)
return gPad->PadtoY(gPad->PixeltoY(y - gPad->VtoPixel(0)));
return gPad->PadtoY(is_absolute ? gPad->AbsPixeltoY(y) : gPad->PixeltoY(y - gPad->VtoPixel(0)));

Int_t ph = gPad->GetPadHeight();
if (is_absolute) {
Double_t wh = gPad->GetWh();
Double_t hndc = gPad->GetAbsHNDC();
return wh > 0 && hndc > 0 ? ((1. - y / wh) - gPad->GetAbsYlowNDC()) / hndc : 0.;
}

Int_t ph = gPad->GetPadHeight();
return ph > 0 ? 1. - 1. * y / ph : 0.;
}
5 changes: 5 additions & 0 deletions graf2d/cocoa/inc/QuartzWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#include "X11Events.h"
#include "GuiTypes.h"

class TAttMarker;
class TAttLine;

namespace ROOT {
namespace MacOSX {
namespace X11 {
Expand Down Expand Up @@ -134,6 +137,8 @@ class Command;
- (void) removeXorWindow;
- (void) addXorLine : (QuartzView *) view : (Int_t) x1 : (Int_t) y1 : (Int_t) x2 : (Int_t) y2;
- (void) addXorBox : (QuartzView *) view : (Int_t) x1 : (Int_t) y1 : (Int_t) x2 : (Int_t) y2;
- (void) addXorPolyLine : (QuartzView *) view : (Int_t) n : (TPoint *) pnts : (const TAttLine &) att;
- (void) addXorMarker : (QuartzView *) view : (Int_t) n : (TPoint *) pnts : (const TAttMarker &) att;
- (void) setDrawMode : (TVirtualX::EDrawMode) newMode;
- (TVirtualX::EDrawMode) getDrawMode;

Expand Down
4 changes: 0 additions & 4 deletions graf2d/cocoa/inc/TGQuartz.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ class TGQuartz : public TGCocoa {

private:

//Unfortunately, I have to convert from
//top-left to bottom-left corner system.
std::vector<TPoint> fConvertedPoints;

//Lines with AA can be quite different
//from what we always had with X11.
//Now this is a switch in our configuration file (system.rootrc),
Expand Down
95 changes: 65 additions & 30 deletions graf2d/cocoa/inc/X11Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

#include "CocoaGuiTypes.h"
#include "GuiTypes.h"
#include "TAttMarker.h"
#include "TAttLine.h"
#include "TPoint.h"

//////////////////////////////////////////////////////////////////////////////////
// //
Expand Down Expand Up @@ -54,11 +57,11 @@ class Command {
Command(Drawable_t wid, const GCValues_t &gc);
virtual ~Command();

virtual bool HasOperand(Drawable_t drawable)const;
virtual bool IsGraphicsCommand()const;//By-default - false.
virtual bool HasOperand(Drawable_t drawable) const;
virtual bool IsGraphicsCommand() const;//By-default - false.

virtual void Execute()const = 0;
virtual void Execute(CGContextRef /*ctx*/)const;
virtual void Execute() const = 0;
virtual void Execute(CGContextRef /*ctx*/) const;

void setView(NSView *v)
{
Expand All @@ -76,8 +79,8 @@ class DrawLine : public Command {

public:
DrawLine(Drawable_t wid, const GCValues_t &gc, const Point &p1, const Point &p2);
void Execute()const;
bool IsGraphicsCommand()const
void Execute() const override;
bool IsGraphicsCommand() const override
{
return true;
}
Expand All @@ -89,8 +92,8 @@ class DrawSegments : public Command {

public:
DrawSegments(Drawable_t wid, const GCValues_t &gc, const Segment_t *segments, Int_t nSegments);
void Execute()const;
bool IsGraphicsCommand()const
void Execute() const override;
bool IsGraphicsCommand() const override
{
return true;
}
Expand All @@ -102,8 +105,8 @@ class ClearArea : public Command {

public:
ClearArea(Window_t wid, const Rectangle_t &area);
void Execute()const;
bool IsGraphicsCommand()const
void Execute() const override;
bool IsGraphicsCommand() const override
{
return true;
}
Expand All @@ -118,13 +121,13 @@ class CopyArea : public Command {
public:
CopyArea(Drawable_t src, Drawable_t dst, const GCValues_t &gc, const Rectangle_t &area, const Point &dstPoint);

bool HasOperand(Drawable_t drawable)const;
bool IsGraphicsCommand()const
bool HasOperand(Drawable_t drawable) const override;
bool IsGraphicsCommand() const override
{
return true;
}

void Execute()const;
void Execute() const override;

};

Expand All @@ -136,12 +139,12 @@ class DrawString : public Command {
public:
DrawString(Drawable_t wid, const GCValues_t &gc, const Point &point, const std::string &text);

bool IsGraphicsCommand()const
bool IsGraphicsCommand() const override
{
return true;
}

void Execute()const;
void Execute() const override;
};

class FillRectangle : public Command {
Expand All @@ -151,12 +154,12 @@ class FillRectangle : public Command {
public:
FillRectangle(Drawable_t wid, const GCValues_t &gc, const Rectangle_t &rectangle);

bool IsGraphicsCommand()const
bool IsGraphicsCommand() const override
{
return true;
}

void Execute()const;
void Execute() const override;
};

class FillPolygon : public Command {
Expand All @@ -166,12 +169,12 @@ class FillPolygon : public Command {
public:
FillPolygon(Drawable_t wid, const GCValues_t &gc, const Point_t *points, Int_t nPoints);

bool IsGraphicsCommand()const
bool IsGraphicsCommand() const override
{
return true;
}

void Execute()const;
void Execute() const override;
};

class DrawRectangle : public Command {
Expand All @@ -181,12 +184,12 @@ class DrawRectangle : public Command {
public:
DrawRectangle(Drawable_t wid, const GCValues_t &gc, const Rectangle_t &rectangle);

bool IsGraphicsCommand()const
bool IsGraphicsCommand() const override
{
return true;
}

void Execute()const;
void Execute() const override;
};

class UpdateWindow : public Command {
Expand All @@ -196,18 +199,18 @@ class UpdateWindow : public Command {
public:
UpdateWindow(QuartzView *view);

bool IsGraphicsCommand()const
bool IsGraphicsCommand() const override
{
return true;
}

void Execute()const;
void Execute() const override;
};

class DeletePixmap : public Command {
public:
DeletePixmap(Pixmap_t pixmap);
void Execute()const;
void Execute() const override;
};

//Set of 'xor' operations, required by TCanvas and ExecuteEvent's machinery.
Expand All @@ -219,8 +222,8 @@ class DrawBoxXor : public Command {
public:
DrawBoxXor(Window_t windowID, const Point &p1, const Point &p2);

void Execute()const;
void Execute(CGContextRef ctx)const;
void Execute() const override {}
void Execute(CGContextRef ctx) const override;
};

class DrawLineXor : public Command {
Expand All @@ -231,13 +234,45 @@ class DrawLineXor : public Command {
public:
DrawLineXor(Window_t windowID, const Point &p1, const Point &p2);

void Execute()const;
void Execute(CGContextRef ctx)const;
void Execute() const override {}
void Execute(CGContextRef ctx) const override;

Point start() const {return fP1;}
Point end() const {return fP2;}
Point start() const { return fP1; }
Point end() const { return fP2; }
};

class DrawPolyLineXor : public Command {
private:
std::vector<TPoint> fPnts;
TAttLine fAtt;
float fScaleFactor = 1.;

public:
DrawPolyLineXor(Window_t windowID, const TAttLine &att) :
Command(windowID, GCValues_t()), fAtt(att) {}
void setPoints(Int_t n, TPoint *xy);

void Execute() const override {}
void Execute(CGContextRef ctx) const override;
};


class DrawMarkerXor : public Command {
private:
std::vector<TPoint> fPnts;
TAttMarker fAtt;
float fScaleFactor = 1.;

public:
DrawMarkerXor(Window_t windowID, const TAttMarker &att) :
Command(windowID, GCValues_t()), fAtt(att) {}
void setPoints(Int_t n, TPoint *xy);

void Execute() const override {}
void Execute(CGContextRef ctx) const override;
};


class CommandBuffer {
private:
CommandBuffer(const CommandBuffer &rhs);
Expand Down
43 changes: 41 additions & 2 deletions graf2d/cocoa/src/QuartzWindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1559,7 +1559,7 @@ - (void) addXorLine : (QuartzView *) view : (Int_t) x1 : (Int_t) y1 : (Int_t) x2
auto xorWindow = [self addXorWindow];

try {
std::unique_ptr<ROOT::MacOSX::X11::DrawLineXor> cmd(new ROOT::MacOSX::X11::DrawLineXor(-1, ROOT::MacOSX::X11::Point(x1, y1), ROOT::MacOSX::X11::Point(x2, y2)));
auto cmd = std::make_unique<ROOT::MacOSX::X11::DrawLineXor>(-1, ROOT::MacOSX::X11::Point(x1, y1), ROOT::MacOSX::X11::Point(x2, y2));
cmd->setView(view);

auto cv = (XorDrawingView *)xorWindow.contentView;
Expand All @@ -1578,7 +1578,7 @@ - (void) addXorBox : (QuartzView *) view : (Int_t) x1 : (Int_t) y1 : (Int_t) x2
auto xorWindow = [self addXorWindow];

try {
std::unique_ptr<ROOT::MacOSX::X11::DrawBoxXor> cmd(new ROOT::MacOSX::X11::DrawBoxXor(-1, ROOT::MacOSX::X11::Point(x1, y1), ROOT::MacOSX::X11::Point(x2, y2)));
auto cmd = std::make_unique<ROOT::MacOSX::X11::DrawBoxXor>(-1, ROOT::MacOSX::X11::Point(x1, y1), ROOT::MacOSX::X11::Point(x2, y2));
cmd->setView(view);

auto cv = (XorDrawingView *)xorWindow.contentView;
Expand All @@ -1590,6 +1590,45 @@ - (void) addXorBox : (QuartzView *) view : (Int_t) x1 : (Int_t) y1 : (Int_t) x2
}
}

//______________________________________________________________________________
- (void) addXorPolyLine : (QuartzView *) view : (Int_t) n : (TPoint *) pnts : (const TAttLine &) att
{
auto xorWindow = [self addXorWindow];

try {
auto cmd = std::make_unique<ROOT::MacOSX::X11::DrawPolyLineXor>(-1, att);
cmd->setView(view);
cmd->setPoints(n, pnts);

auto cv = (XorDrawingView *)xorWindow.contentView;
[cv addXorCommand : cmd.get()];
cmd.release();
[cv setNeedsDisplay : YES];

} catch (const std::exception &) {
throw;
}
}

//______________________________________________________________________________
- (void) addXorMarker : (QuartzView *) view : (Int_t) n : (TPoint *) pnts : (const TAttMarker &) att
{
auto xorWindow = [self addXorWindow];

try {
auto cmd = std::make_unique<ROOT::MacOSX::X11::DrawMarkerXor>(-1, att);
cmd->setView(view);
cmd->setPoints(n, pnts);

auto cv = (XorDrawingView *)xorWindow.contentView;
[cv addXorCommand : cmd.get()];
cmd.release();
[cv setNeedsDisplay : YES];

} catch (const std::exception &) {
throw;
}
}

//______________________________________________________________________________
- (void) setDrawMode : (TVirtualX::EDrawMode) newMode
Expand Down
Loading
Loading