Logo ROOT  
Reference Guide
QuartzUtils.mm
Go to the documentation of this file.
1// @(#)root/graf2d:$Id$
2// Author: Timur Pocheptsov, 11/06/2012
3
4/*************************************************************************
5 * Copyright (C) 1995-2011, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include <cassert>
13
14#include "QuartzUtils.h"
15
16namespace ROOT {
17namespace Quartz {
18
19//______________________________________________________________________________
21 : fCtx(ctx.Get())
22{
23 assert(fCtx != 0 && "CGStateGuard, ctx parameter is null");
24 CGContextSaveGState(fCtx);
25}
26
27//______________________________________________________________________________
29 : fCtx(ctx)
30{
31 assert(ctx != 0 && "CGStateGuard, ctx parameter is null");
32 CGContextSaveGState(ctx);
33}
34
35//______________________________________________________________________________
37{
38 CGContextRestoreGState(fCtx);
39}
40
41//Actually, this class does any work only if you disable anti-aliasing, by default I have it on
42//and there is nothing to do for a guard if you want it on.
43
44//______________________________________________________________________________
46 : fCtx(ctx),
47 fEnable(enable)
48{
49 assert(ctx != 0 && "CGAAStateGuard, ctx parameter is null");
50
51 if (!enable)
52 CGContextSetAllowsAntialiasing(ctx, false);
53}
54
55//______________________________________________________________________________
57{
58 //Enable it back:
59 if (!fEnable)
60 CGContextSetAllowsAntialiasing(fCtx, true);
61}
62
63}//Quartz
64}//ROOT
CGAAStateGuard(CGContextRef ctx, bool enable)
Definition: QuartzUtils.mm:45
CGStateGuard(MacOSX::Util::CFScopeGuard< CGContextRef > &ctx)
Definition: QuartzUtils.mm:20
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.