21 #include <Cocoa/Cocoa.h>
23 # include <ft2build.h>
24 # include FT_FREETYPE_H
47 const Float_t kScale = 0.93376068;
51 namespace X11 = ROOT::MacOSX::X11;
52 namespace Quartz = ROOT::Quartz;
53 namespace Util = ROOT::MacOSX::Util;
58 void ConvertPointsROOTToCocoa(Int_t nPoints,
const TPoint *xy, std::vector<TPoint> &dst,
59 NSObject<X11Drawable> *drawable)
61 assert(nPoints != 0 &&
"ConvertPointsROOTToCocoa, nPoints parameter is 0");
62 assert(xy != 0 &&
"ConvertPointsROOTToCocoa, xy parameter is null");
63 assert(drawable != 0 &&
"ConvertPointsROOTToCocoa, drawable parameter is null");
65 const auto scaleFactor = drawable.fScaleFactor;
68 for (Int_t i = 0; i < nPoints; ++i) {
69 dst[i].fX = SCoord_t(xy[i].fX * scaleFactor);
70 dst[i].fY = SCoord_t(X11::LocalYROOTToCocoa(drawable, xy[i].fY) * scaleFactor);
78 : fUseAA(true), fUseFAAA(false)
83 if (!TTF::IsInitialized())
87 if (!TTF::IsInitialized())
88 Error(
"TGQuartz",
"TTF::Init() failed");
98 TGQuartz::TGQuartz(
const char *name,
const char *title)
99 : TGCocoa(name, title),
100 fUseAA(true), fUseFAAA(false)
103 if (!TTF::IsInitialized())
107 if (!TTF::IsInitialized())
108 Error(
"TGQuartz",
"TTF::Init() failed");
118 void TGQuartz::DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode)
122 if (!fPimpl->GetDrawable(fSelectedDrawable).fIsPixmap)
123 fPimpl->fX11CommandBuffer.AddDrawBoxXor(fSelectedDrawable, x1, y1, x2, y2);
127 NSObject<X11Drawable> *
const drawable = (NSObject<X11Drawable> *)GetSelectedDrawableChecked(
"DrawBox");
131 CGContextRef ctx = drawable.fContext;
132 const Quartz::CGStateGuard ctxGuard(ctx);
134 const Quartz::CGAAStateGuard aaCtxGuard(ctx, fUseAA);
137 y1 = Int_t(X11::LocalYROOTToCocoa(drawable, y1));
138 y2 = Int_t(X11::LocalYROOTToCocoa(drawable, y2));
140 if (
const TColorGradient *
const gradient = dynamic_cast<TColorGradient *>(gROOT->GetColor(GetFillColor()))) {
144 polygon[0].fX = x1, polygon[0].fY = y1;
145 polygon[1].fX = x2, polygon[1].fY = y1;
146 polygon[2].fX = x2, polygon[2].fY = y2;
147 polygon[3].fX = x1, polygon[3].fY = y2;
149 Quartz::DrawPolygonWithGradientFill(ctx, gradient, CGSizeMake(drawable.fWidth, drawable.fHeight),
152 const bool isHollow = mode == kHollow || GetFillStyle() / 1000 == 2;
156 unsigned patternIndex = 0;
158 if (!Quartz::SetLineColor(ctx, GetLineColor())) {
159 Error(
"DrawBox",
"Can not find color for index %d",
int(GetLineColor()));
163 if (!Quartz::SetFillAreaParameters(ctx, &patternIndex)) {
164 Error(
"DrawBox",
"SetFillAreaParameters failed");
168 Quartz::SetLineStyle(ctx, GetLineStyle());
169 Quartz::SetLineWidth(ctx, GetLineWidth());
170 Quartz::DrawBox(ctx, x1, y1, x2, y2, isHollow);
176 void TGQuartz::DrawFillArea(Int_t n, TPoint *xy)
192 NSObject<X11Drawable> *
const drawable =
193 (NSObject<X11Drawable> *)GetSelectedDrawableChecked(
"DrawFillArea");
198 CGContextRef ctx = drawable.fContext;
201 ConvertPointsROOTToCocoa(n, xy, fConvertedPoints, drawable);
203 const Quartz::CGStateGuard ctxGuard(ctx);
205 const Quartz::CGAAStateGuard aaCtxGuard(ctx, fUseFAAA);
207 if (drawable.fScaleFactor > 1.) {
209 CGContextScaleCTM(ctx, 1. / drawable.fScaleFactor, 1. / drawable.fScaleFactor);
212 const TColor *
const fillColor = gROOT->GetColor(GetFillColor());
214 Error(
"DrawFillArea",
"Could not find TColor for index %d", GetFillColor());
218 if (
const TColorGradient *
const gradient = dynamic_cast<const TColorGradient *>(fillColor)) {
219 Quartz::DrawPolygonWithGradientFill(ctx, gradient, CGSizeMake(drawable.fWidth, drawable.fHeight),
220 n, &fConvertedPoints[0], kFALSE);
222 unsigned patternIndex = 0;
223 if (!Quartz::SetFillAreaParameters(ctx, &patternIndex)) {
224 Error(
"DrawFillArea",
"SetFillAreaParameters failed");
228 Quartz::DrawFillArea(ctx, n, &fConvertedPoints[0], kFALSE);
234 void TGQuartz::DrawCellArray(Int_t , Int_t , Int_t , Int_t ,
235 Int_t , Int_t , Int_t *)
242 void TGQuartz::DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
249 if (!fPimpl->GetDrawable(fSelectedDrawable).fIsPixmap)
250 fPimpl->fX11CommandBuffer.AddDrawLineXor(fSelectedDrawable, x1, y1, x2, y2);
255 assert(fSelectedDrawable > fPimpl->GetRootWindowID() &&
"DrawLine, bad drawable is selected");
256 NSObject<X11Drawable> *
const drawable =
257 (NSObject<X11Drawable> *)GetSelectedDrawableChecked(
"DrawLine");
261 CGContextRef ctx = drawable.fContext;
262 const Quartz::CGStateGuard ctxGuard(ctx);
264 const Quartz::CGAAStateGuard aaCtxGuard(ctx, fUseAA);
266 if (!Quartz::SetLineColor(ctx, GetLineColor())) {
267 Error(
"DrawLine",
"Could not set line color for index %d",
int(GetLineColor()));
271 Quartz::SetLineStyle(ctx, GetLineStyle());
272 Quartz::SetLineWidth(ctx, GetLineWidth());
274 Quartz::DrawLine(ctx, x1, X11::LocalYROOTToCocoa(drawable, y1), x2,
275 X11::LocalYROOTToCocoa(drawable, y2));
280 void TGQuartz::DrawPolyLine(Int_t n, TPoint *xy)
292 NSObject<X11Drawable> *
const drawable =
293 (NSObject<X11Drawable> *)GetSelectedDrawableChecked(
"DrawPolyLine");
297 CGContextRef ctx = drawable.fContext;
298 const Quartz::CGStateGuard ctxGuard(ctx);
300 const Quartz::CGAAStateGuard aaCtxGuard(ctx, fUseAA);
302 if (!Quartz::SetLineColor(ctx, GetLineColor())) {
303 Error(
"DrawPolyLine",
"Could not find TColor for index %d", GetLineColor());
307 Quartz::SetLineStyle(ctx, GetLineStyle());
308 Quartz::SetLineWidth(ctx, GetLineWidth());
311 ConvertPointsROOTToCocoa(n, xy, fConvertedPoints, drawable);
313 if (drawable.fScaleFactor > 1.)
314 CGContextScaleCTM(ctx, 1. / drawable.fScaleFactor, 1. / drawable.fScaleFactor);
316 Quartz::DrawPolyLine(ctx, n, &fConvertedPoints[0]);
323 void TGQuartz::DrawPolyMarker(Int_t n, TPoint *xy)
335 NSObject<X11Drawable> *
const drawable =
336 (NSObject<X11Drawable> *)GetSelectedDrawableChecked(
"DrawPolyMarker");
340 CGContextRef ctx = drawable.fContext;
341 const Quartz::CGStateGuard ctxGuard(ctx);
343 const Quartz::CGAAStateGuard aaCtxGuard(ctx, fUseAA);
345 if (!Quartz::SetFillColor(ctx, GetMarkerColor())) {
346 Error(
"DrawPolyMarker",
"Could not find TColor for index %d", GetMarkerColor());
350 Quartz::SetLineColor(ctx, GetMarkerColor());
351 Quartz::SetLineStyle(ctx, 1);
352 Quartz::SetLineWidth(ctx, 1);
354 ConvertPointsROOTToCocoa(n, xy, fConvertedPoints, drawable);
356 if (drawable.fScaleFactor > 1.)
357 CGContextScaleCTM(ctx, 1. / drawable.fScaleFactor, 1. / drawable.fScaleFactor);
359 Quartz::DrawPolyMarker(ctx, n, &fConvertedPoints[0], GetMarkerSize() * drawable.fScaleFactor, GetMarkerStyle());
364 void TGQuartz::DrawText(Int_t x, Int_t y, Float_t , Float_t ,
365 const char *text, ETextMode )
370 if (!text || !text[0])
373 if (GetTextSize()<1.5)
376 NSObject<X11Drawable> *
const drawable =
377 (NSObject<X11Drawable> *)GetSelectedDrawableChecked(
"DrawText");
381 CGContextRef ctx = drawable.fContext;
382 const Quartz::CGStateGuard ctxGuard(ctx);
385 CGContextSetTextMatrix(ctx, CGAffineTransformIdentity);
388 if (CTFontRef currentFont = fPimpl->fFontManager.SelectFont(GetTextFont(), kScale*GetTextSize())) {
389 const unsigned fontIndex = GetTextFont() / 10;
390 if (fontIndex == 12 || fontIndex == 15) {
396 typedef std::vector<UniChar>::size_type size_type;
398 std::vector<UniChar> unichars(std::strlen(text));
399 for (size_type i = 0, len = unichars.size(); i < len; ++i)
400 unichars[i] = 0xF000 + (
unsigned char)text[i];
402 Quartz::TextLine ctLine(unichars, currentFont, GetTextColor());
403 ctLine.DrawLine(ctx, x, X11::LocalYROOTToCocoa(drawable, y));
405 const Quartz::TextLine ctLine(text, currentFont, GetTextColor());
406 ctLine.DrawLine(ctx, x, X11::LocalYROOTToCocoa(drawable, y));
409 }
catch (
const std::exception &e) {
410 Error(
"DrawText",
"Exception from Quartz::TextLine: %s", e.what());
415 void TGQuartz::DrawText(Int_t x, Int_t y, Float_t angle, Float_t ,
const wchar_t *text, ETextMode mode)
417 if (!text || !text[0])
420 if (!TTF::IsInitialized()) {
421 Error(
"DrawText",
"wchar_t string to draw, but TTF initialization failed");
433 TTF::SetSmoothing(kTRUE);
434 TTF::SetRotationMatrix(angle);
435 TTF::PrepareString(text);
439 RenderTTFString(x, y, mode);
443 void TGQuartz::GetTextExtent(UInt_t &w, UInt_t &h,
char *text)
451 if (!text || !text[0]) {
457 if (fPimpl->fFontManager.SelectFont(GetTextFont(), kScale*GetTextSize())) {
458 const unsigned fontIndex = GetTextFont() / 10;
459 if (fontIndex == 12 || fontIndex == 15) {
460 typedef std::vector<UniChar>::size_type size_type;
462 std::vector<UniChar> unichars(std::strlen(text));
463 for (size_type i = 0, len = unichars.size(); i < len; ++i)
464 unichars[i] = 0xF000 + (
unsigned char)text[i];
466 fPimpl->fFontManager.GetTextBounds(w, h, unichars);
468 fPimpl->fFontManager.GetTextBounds(w, h, text);
474 Int_t TGQuartz::GetFontAscent()
const
479 if (fPimpl->fFontManager.SelectFont(GetTextFont(), kScale*GetTextSize()))
480 return Int_t(fPimpl->fFontManager.GetAscent());
486 Int_t TGQuartz::GetFontAscent(
const char *text)
const
493 if (!text || !text[0])
494 return GetFontAscent();
496 if (fPimpl->fFontManager.SelectFont(GetTextFont(), kScale*GetTextSize())) {
497 const unsigned fontIndex = GetTextFont() / 10;
498 if (fontIndex == 12 || fontIndex == 15) {
500 typedef std::vector<UniChar>::size_type size_type;
502 std::vector<UniChar> unichars(std::strlen(text));
503 for (size_type i = 0, len = unichars.size(); i < len; ++i)
504 unichars[i] = 0xF000 + (
unsigned char)text[i];
506 return Int_t(fPimpl->fFontManager.GetAscent(unichars));
508 return Int_t(fPimpl->fFontManager.GetAscent(text));
515 Int_t TGQuartz::GetFontDescent()
const
520 if (fPimpl->fFontManager.SelectFont(GetTextFont(), kScale*GetTextSize()))
521 return Int_t(fPimpl->fFontManager.GetDescent());
527 Int_t TGQuartz::GetFontDescent(
const char *text)
const
534 if (!text || !text[0])
535 return GetFontDescent();
537 if (fPimpl->fFontManager.SelectFont(GetTextFont(), kScale*GetTextSize())) {
538 const unsigned fontIndex = GetTextFont() / 10;
539 if (fontIndex == 12 || fontIndex == 15) {
541 typedef std::vector<UniChar>::size_type size_type;
543 std::vector<UniChar> unichars(std::strlen(text));
544 for (size_type i = 0, len = unichars.size(); i < len; ++i)
545 unichars[i] = 0xF000 + (
unsigned char)text[i];
547 return Int_t(fPimpl->fFontManager.GetDescent(unichars));
549 return Int_t(fPimpl->fFontManager.GetDescent(text));
557 Float_t TGQuartz::GetTextMagnitude()
564 void TGQuartz::SetLineColor(Color_t cindex)
567 TAttLine::SetLineColor(cindex);
572 void TGQuartz::SetLineStyle(Style_t lstyle)
575 TAttLine::SetLineStyle(lstyle);
580 void TGQuartz::SetLineWidth(Width_t width)
584 TAttLine::SetLineWidth(width);
589 void TGQuartz::SetFillColor(Color_t cindex)
593 TAttFill::SetFillColor(cindex);
598 void TGQuartz::SetFillStyle(Style_t style)
601 TAttFill::SetFillStyle(style);
606 void TGQuartz::SetMarkerColor(Color_t cindex)
609 TAttMarker::SetMarkerColor(cindex);
614 void TGQuartz::SetMarkerSize(Float_t markersize)
619 TAttMarker::SetMarkerSize(markersize);
624 void TGQuartz::SetMarkerStyle(Style_t markerstyle)
628 TAttMarker::SetMarkerStyle(markerstyle);
633 void TGQuartz::SetTextAlign(Short_t talign)
640 TAttText::SetTextAlign(talign);
644 void TGQuartz::SetTextColor(Color_t cindex)
648 TAttText::SetTextColor(cindex);
653 void TGQuartz::SetTextFont(Font_t fontNumber)
657 TAttText::SetTextFont(fontNumber);
659 if (!TTF::IsInitialized()) {
660 Error(
"SetTextFont",
"TTF is not initialized");
664 TTF::SetTextFont(fontNumber);
668 Int_t TGQuartz::SetTextFont(
char *fontName, ETextSetMode )
672 if (!TTF::IsInitialized()) {
673 Error(
"SetTextFont",
"TTF is not initialized");
677 return TTF::SetTextFont(fontName);
681 void TGQuartz::SetTextSize(Float_t textsize)
685 TAttText::SetTextSize(textsize);
687 if (!TTF::IsInitialized()) {
688 Error(
"SetTextSize",
"TTF is not initialized");
692 TTF::SetTextSize(textsize);
697 void TGQuartz::SetOpacity(Int_t )
709 void TGQuartz::AlignTTFString()
720 const EAlign align = EAlign(fTextAlign);
723 if (align == kTLeft || align == kTCenter || align == kTRight) {
724 fAlign.y = TTF::GetAscent();
725 }
else if (align == kMLeft || align == kMCenter || align == kMRight) {
726 fAlign.y = TTF::GetAscent() / 2;
732 if (align == kTRight || align == kMRight || align == kBRight) {
733 fAlign.x = TTF::GetWidth();
734 }
else if (align == kTCenter || align == kMCenter || align == kBCenter) {
735 fAlign.x = TTF::GetWidth() / 2;
740 FT_Vector_Transform(&fAlign, TTF::GetRotMatrix());
742 fAlign.x = fAlign.x >> 6;
743 fAlign.y = fAlign.y >> 6;
747 Bool_t TGQuartz::IsTTFStringVisible(Int_t x, Int_t y, UInt_t w, UInt_t h)
764 GetWindowSize(GetCurrentWindow(), xy, xy, width, height);
767 if (x +
int(w) <= 0 || x >=
int(width))
770 if (y +
int(h) <= 0 || y >=
int(height))
777 void TGQuartz::RenderTTFString(Int_t x, Int_t y, ETextMode mode)
786 NSObject<X11Drawable> *
const drawable = (NSObject<X11Drawable> *)GetSelectedDrawableChecked(
"DrawText");
790 QuartzPixmap *dstPixmap = nil;
791 if ([drawable isKindOfClass : [QuartzPixmap
class]])
792 dstPixmap = (QuartzPixmap *)drawable;
793 else if ([drawable isKindOfClass : [QuartzView
class]] || [drawable isKindOfClass : [QuartzWindow
class]])
794 dstPixmap = ((NSObject<X11Window> *)drawable).fBackBuffer;
798 Error(
"DrawText",
"fSelectedDrawable is neither QuartzPixmap nor a double buffered window");
804 const Int_t xOff = TTF::GetBox().xMin < 0 ? -TTF::GetBox().xMin : 0;
805 const Int_t yOff = TTF::GetBox().yMin < 0 ? -TTF::GetBox().yMin : 0;
807 const Int_t w = TTF::GetBox().xMax + xOff;
808 const Int_t h = TTF::GetBox().yMax + yOff;
810 const Int_t x1 = x - xOff - fAlign.x;
811 const Int_t y1 = y + yOff + fAlign.y - h;
813 if (!IsTTFStringVisible(x1, y1, w, h))
817 Util::NSScopeGuard<QuartzPixmap> pixmap([[QuartzPixmap alloc] initWithW : w H : h scaleFactor : 1.f]);
819 Error(
"DrawText",
"pixmap creation failed");
823 const unsigned char defaultBackgroundPixel[] = {255, 255, 255, 255};
824 Util::ScopedArray<unsigned char> arrayGuard;
825 if (mode == kClear) {
829 X11::Rectangle bbox(x1, y1, w, h);
832 if (X11::AdjustCropArea(dstPixmap, bbox))
833 arrayGuard.Reset([dstPixmap readColorBits : bbox]);
835 if (!arrayGuard.Get()) {
836 Error(
"DrawText",
"problem with reading background pixels");
841 const Int_t xo = x1 < 0 ? -x1 : 0;
842 const Int_t yo = y1 < 0 ? -y1 : 0;
844 for (
int yp = 0; yp < int(bbox.fHeight) && yo + yp < h; ++yp) {
845 const unsigned char *srcBase = arrayGuard.Get() + bbox.fWidth * yp * 4;
846 for (
int xp = 0; xp < int(bbox.fWidth) && xo + xp < w; ++xp) {
847 const unsigned char *
const pixel = srcBase + xp * 4;
848 [pixmap.Get() putPixel : pixel X : xo + xp Y : yo + yp];
853 [pixmap.Get() addPixel : defaultBackgroundPixel];
856 CGContextRef ctx = drawable.fContext;
857 const Quartz::CGStateGuard ctxGuard(ctx);
859 CGContextSetRGBStrokeColor(ctx, 0., 0., 1., 1.);
861 TTF::TTGlyph *glyph = TTF::GetGlyphs();
862 for (
int n = 0; n < TTF::GetNumGlyphs(); ++n, ++glyph) {
863 if (FT_Glyph_To_Bitmap(&glyph->fImage, TTF::GetSmoothing() ? ft_render_mode_normal : ft_render_mode_mono, 0, 1 ))
866 FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph->fImage;
867 FT_Bitmap *source = &bitmap->bitmap;
868 const Int_t bx = bitmap->left + xOff;
869 const Int_t by = h - bitmap->top - yOff;
871 DrawFTGlyphIntoPixmap(pixmap.Get(), source, TGCocoa::GetPixel(GetTextColor()),
872 mode == kClear ? ULong_t(-1) : 0xffffff, bx, by);
875 const X11::Rectangle copyArea(0, 0, w, h);
876 const X11::Point dstPoint(x1, y1);
877 [dstPixmap copy : pixmap.Get() area : copyArea withMask : nil clipOrigin : X11::Point() toPoint : dstPoint];
881 void TGQuartz::DrawFTGlyphIntoPixmap(
void *pHack, FT_Bitmap *source, ULong_t fore, ULong_t back, Int_t bx, Int_t by)
889 QuartzPixmap *pixmap = (QuartzPixmap *)pHack;
890 assert(pixmap != nil &&
"DrawFTGlyphIntoPixmap, pixmap parameter is nil");
891 assert(source != 0 &&
"DrawFTGlyphIntoPixmap, source parameter is null");
893 if (TTF::GetSmoothing()) {
894 static ColorStruct_t col[5];
897 if (back == ULong_t(-1) && source->width) {
898 const int maxDots = 50000;
899 int dots = Int_t(source->width * source->rows);
906 ULong_t r = 0, g = 0, b = 0;
907 for (
int y = 0, dotCnt = 0; y < int(source->rows); y++) {
908 for (
int x = 0; x < int(source->width); x++) {
909 if (x + bx <
int(pixmap.fWidth) && y + by <
int(pixmap.fHeight)) {
910 const unsigned char *
const pixels = pixmap.fData + (y + by) * pixmap.fWidth * 4 + (x + bx) * 4;
911 r += UShort_t(pixels[0] / 255. * 0xffff);
912 g += UShort_t(pixels[1] / 255. * 0xffff);
913 b += UShort_t(pixels[2] / 255. * 0xffff);
916 if (++dotCnt >= maxDots)
927 if (col[0].fRed == r && col[0].fGreen == g && col[0].fBlue == b) {
928 col[0].fPixel = back;
930 col[0].fPixel = ~back;
931 col[0].fRed = (UShort_t) r;
932 col[0].fGreen = (UShort_t) g;
933 col[0].fBlue = (UShort_t) b;
940 if (fore != col[4].fPixel || back != col[0].fPixel) {
941 col[4].fPixel = fore;
942 TGCocoa::QueryColor(kNone, col[4]);
943 if (back != (ULong_t)-1) {
944 col[0].fPixel = back;
945 TGCocoa::QueryColor(kNone, col[0]);
949 for (
int x = 3; x > 0; --x) {
950 col[x].fRed = (col[4].fRed * x + col[0].fRed * (4 - x)) / 4;
951 col[x].fGreen = (col[4].fGreen * x + col[0].fGreen * (4 - x)) / 4;
952 col[x].fBlue = (col[4].fBlue * x + col[0].fBlue * (4 - x)) / 4;
953 TGCocoa::AllocColor(kNone, col[x]);
959 const unsigned char *s = source->buffer;
960 for (
int y = 0; y < (int) source->rows; ++y) {
961 for (
int x = 0; x < (int) source->width; ++x) {
962 unsigned char d = *s++ & 0xff;
963 d = ((d + 10) * 5) / 256;
966 if (d && x < (
int) source->width) {
967 const UChar_t pixel[] = {UChar_t(
double(col[d].fRed) / 0xffff * 255),
968 UChar_t(
double(col[d].fGreen) / 0xffff * 255),
969 UChar_t(
double(col[d].fBlue) / 0xffff * 255), 255};
970 [pixmap putPixel : pixel X : bx + x Y : by + y];
976 unsigned char rgba[4] = {};
978 X11::PixelToRGB(fore, rgba);
981 const unsigned char *row = source->buffer;
982 for (
int y = 0; y < int(source->rows); ++y) {
984 const unsigned char *s = row;
985 for (
int x = 0; x < int(source->width); ++x) {
989 if (TESTBIT(d,7 - n))
990 [pixmap putPixel : rgba X : bx + x Y : by + y];
992 if (++n ==
int(kBitsPerByte))
996 row += source->pitch;
1004 void TGQuartz::SetAA()
1007 const TString value(TString(gEnv->GetValue(
"Cocoa.EnableAntiAliasing",
"auto")).Strip());
1008 if (value ==
"auto") {
1009 [[NSScreen mainScreen] backingScaleFactor] > 1. ? fUseAA =
true : fUseAA =
false;
1010 }
else if (value ==
"no")
1013 assert(value ==
"yes" &&
"SetAA, value must be 'yes', 'no' or 'auto'");
1016 const TString valuefa(TString(gEnv->GetValue(
"Cocoa.EnableFillAreaAntiAliasing",
"auto")).Strip());
1017 if (valuefa ==
"auto") {
1018 [[NSScreen mainScreen] backingScaleFactor] > 1. ? fUseFAAA =
true : fUseFAAA =
false;
1019 }
else if (valuefa ==
"no")
1022 assert(valuefa ==
"yes" &&
"SetAA, value must be 'yes', 'no' or 'auto'");
1029 void *TGQuartz::GetSelectedDrawableChecked(
const char *calledFrom)
const
1031 assert(calledFrom != 0 &&
"GetSelectedDrawableChecked, calledFrom parameter is null");
1032 assert(fSelectedDrawable > fPimpl->GetRootWindowID() &&
"GetSelectedDrawableChecked, bad drawable is selected");
1034 NSObject<X11Drawable> *drawable = fPimpl->GetDrawable(fSelectedDrawable);
1035 if (!drawable.fIsPixmap) {
1037 if ([drawable isKindOfClass : [QuartzView
class]]) {
1038 QuartzView *view = (QuartzView *)drawable;
1039 if (!view.fBackBuffer) {
1040 Error(calledFrom,
"Selected window is not double buffered");
1044 drawable = view.fBackBuffer;
1046 Error(calledFrom,
"Selected drawable is neither a pixmap, nor a double buffered window");
1051 if (!drawable.fContext) {
1052 Error(calledFrom,
"Context is null");