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
2 changes: 2 additions & 0 deletions core/base/inc/TVirtualPad.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ class TVirtualPad : public TObject, public TAttLine, public TAttFill,
virtual Int_t VtoPixel(Double_t v) const = 0;
virtual Int_t XtoAbsPixel(Double_t x) const = 0;
virtual Int_t YtoAbsPixel(Double_t y) const = 0;
virtual Int_t HtoAbsPixel(Double_t y1, Double_t y2) const = 0;
virtual Int_t WtoAbsPixel(Double_t x1, Double_t x2) const = 0;
virtual void XYtoAbsPixel(Double_t x, Double_t y, Int_t &xpixel, Int_t &ypixel) const = 0;
virtual void XYtoAbsPixel(Double_t x, Double_t y, Double_t &xpixel, Double_t &ypixel) const = 0;
virtual Double_t XtoPad(Double_t x) const = 0;
Expand Down
6 changes: 2 additions & 4 deletions core/base/src/TAttText.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,8 @@ Float_t TAttText::GetTextSizePercent(Float_t size)
{
Float_t rsize = size;
if (fTextFont%10 > 2 && gPad) {
UInt_t w = std::abs(gPad->XtoAbsPixel(gPad->GetX2()) -
gPad->XtoAbsPixel(gPad->GetX1()));
UInt_t h = std::abs(gPad->YtoAbsPixel(gPad->GetY2()) -
gPad->YtoAbsPixel(gPad->GetY1()));
UInt_t w = std::abs(gPad->WtoAbsPixel(gPad->GetX1(), gPad->GetX2()));
UInt_t h = std::abs(gPad->HtoAbsPixel(gPad->GetY1(), gPad->GetY2()));
if (w < h)
rsize = rsize/w;
else
Expand Down
2 changes: 2 additions & 0 deletions graf2d/gpad/inc/TPad.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ friend class TWebCanvas;
TObject *WaitPrimitive(const char *pname="", const char *emode="") override;
Int_t XtoAbsPixel(Double_t x) const override;
Int_t YtoAbsPixel(Double_t y) const override;
Int_t HtoAbsPixel(Double_t y1, Double_t y2) const override;
Int_t WtoAbsPixel(Double_t x1, Double_t x2) const override;
Double_t XtoPad(Double_t x) const override;
Double_t YtoPad(Double_t y) const override;
Int_t XtoPixel(Double_t x) const override;
Expand Down
21 changes: 21 additions & 0 deletions graf2d/gpad/src/TPad.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7652,6 +7652,27 @@ Int_t TPad::YtoAbsPixel(Double_t y) const
return TMath::Nint(pixel_boundary(fYtoAbsPixelk + y*fYtoPixel));
}

////////////////////////////////////////////////////////////////////////////////
/// Convert a vertical distance [y1,y2] to pixel

Int_t TPad::HtoAbsPixel(Double_t y1, Double_t y2) const
{
double h1 = fYtoAbsPixelk + y1*fYtoPixel;
double h2 = fYtoAbsPixelk + y2*fYtoPixel;
return TMath::Nint(pixel_boundary(h1-h2));
}

////////////////////////////////////////////////////////////////////////////////
/// Convert a horizontal distance [x1,x2] to pixel

Int_t TPad::WtoAbsPixel(Double_t x1, Double_t x2) const
{
double w1 = fXtoAbsPixelk + x1*fXtoPixel;
double w2 = fXtoAbsPixelk + x2*fXtoPixel;
return TMath::Nint(pixel_boundary(w1-w2));
}


////////////////////////////////////////////////////////////////////////////////
/// Convert Y coordinate to pixel

Expand Down
Loading