Skip to content
Snippets Groups Projects
Commit 24048396 authored by Timur Pocheptsov's avatar Timur Pocheptsov
Browse files

Apple's docs say that "should anti-alias" is a part of state, which is saved and restored.

But this is not true - scope guard object restores state, but aa flag is lost and
it's easy to see - window's titlebar has ugly screwed font.
The same problem can be reproduced in a standalone program.
I have to manually turn on anti-aliasing every time I turn it off.


git-svn-id: http://root.cern.ch/svn/root/trunk@44155 27541ba8-7e3a-0410-8455-c3a389f83636
parent fce15f67
No related branches found
No related tags found
No related merge requests found
......@@ -1155,13 +1155,15 @@ void TGCocoa::DrawLineAux(Drawable_t wid, const GCValues_t &gcVals, Int_t x1, In
//I use a small translation, after all, this is ONLY gui method and it
//will not affect anything except GUI.
CGContextTranslateCTM(ctx, 0.f, 1.);
CGContextSetAllowsAntialiasing(ctx, 0);//Smoothed line is of wrong color and in a wrong position - this is bad for GUI.
CGContextSetAllowsAntialiasing(ctx, false);//Smoothed line is of wrong color and in a wrong position - this is bad for GUI.
SetStrokeParametersFromX11Context(ctx, gcVals);
CGContextBeginPath(ctx);
CGContextMoveToPoint(ctx, x1, y1);
CGContextAddLineToPoint(ctx, x2, y2);
CGContextStrokePath(ctx);
CGContextSetAllowsAntialiasing(ctx, true);//Somehow, it's not saved/restored, this affects ... window's titlebar.
}
//______________________________________________________________________________
......@@ -1282,6 +1284,8 @@ void TGCocoa::DrawRectangleAux(Drawable_t wid, const GCValues_t &gcVals, Int_t x
const CGRect rect = CGRectMake(x, y, w, h);
CGContextStrokeRect(ctx, rect);
CGContextSetAllowsAntialiasing(ctx, true);
}
//______________________________________________________________________________
......@@ -1446,6 +1450,8 @@ void TGCocoa::FillPolygonAux(Window_t wid, const GCValues_t &gcVals, const Point
for (Int_t i = 1; i < nPoints; ++i)
CGContextAddLineToPoint(ctx, polygon[i].fX, polygon[i].fY - 2);
CGContextFillPath(ctx);
CGContextSetAllowsAntialiasing(ctx, true);
}
//______________________________________________________________________________
......@@ -1598,7 +1604,7 @@ void TGCocoa::DrawStringAux(Drawable_t wid, const GCValues_t &gcVals, Int_t x, I
CGContextScaleCTM(ctx, 1., -1.);
//Text must be antialiased.
CGContextSetAllowsAntialiasing(ctx, 1);
CGContextSetAllowsAntialiasing(ctx, true);
assert(gcVals.fMask & kGCFont && "DrawString, font is not set in a context");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment