Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 237ba38

Browse files
committed
Changed the way the target OS X version is determined in _macosx.m.
svn path=/trunk/matplotlib/; revision=7518
1 parent 5221429 commit 237ba38

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

src/_macosx.m

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55
#include "numpy/arrayobject.h"
66
#include "path_cleanup.h"
77

8+
/* Proper way to check for the OS X version we are compiling for, from
9+
http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development */
10+
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
11+
#define COMPILING_FOR_10_5
12+
#endif
813

914
static int nwin = 0; /* The number of open windows */
1015

1116
/* Use Atsui for Mac OS X 10.4, CoreText for Mac OS X 10.5 */
12-
#ifndef MAC_OS_X_VERSION_10_5
17+
#ifndef COMPILING_FOR_10_5
1318
static int ngc = 0; /* The number of graphics contexts in use */
1419

1520

@@ -175,7 +180,7 @@ static int wait_for_stdin(void)
175180
return 1;
176181
}
177182

178-
#ifndef MAC_OS_X_VERSION_10_5
183+
#ifndef COMPILING_FOR_10_5
179184
static int _init_atsui(void)
180185
{
181186
OSStatus status;
@@ -451,7 +456,7 @@ static int _get_snap(GraphicsContext* self, enum e_quantize_mode* mode)
451456
self->cr = NULL;
452457
self->level = 0;
453458

454-
#ifndef MAC_OS_X_VERSION_10_5
459+
#ifndef COMPILING_FOR_10_5
455460
if (ngc==0)
456461
{
457462
int ok = _init_atsui();
@@ -466,7 +471,7 @@ static int _get_snap(GraphicsContext* self, enum e_quantize_mode* mode)
466471
return (PyObject*) self;
467472
}
468473

469-
#ifndef MAC_OS_X_VERSION_10_5
474+
#ifndef COMPILING_FOR_10_5
470475
static void
471476
GraphicsContext_dealloc(GraphicsContext *self)
472477
{
@@ -1877,7 +1882,7 @@ static BOOL _clip(CGContextRef cr, PyObject* object)
18771882
}
18781883

18791884

1880-
#ifdef MAC_OS_X_VERSION_10_5
1885+
#ifdef COMPILING_FOR_10_5
18811886
static CTFontRef
18821887
#else
18831888
static ATSFontRef
@@ -1891,7 +1896,7 @@ static BOOL _clip(CGContextRef cr, PyObject* object)
18911896
const char* temp;
18921897
const char* name = "Times-Roman";
18931898
CFStringRef string;
1894-
#ifdef MAC_OS_X_VERSION_10_5
1899+
#ifdef COMPILING_FOR_10_5
18951900
CTFontRef font = 0;
18961901
#else
18971902
ATSFontRef font = 0;
@@ -2091,7 +2096,7 @@ static BOOL _clip(CGContextRef cr, PyObject* object)
20912096
string = CFStringCreateWithCString(kCFAllocatorDefault,
20922097
temp,
20932098
kCFStringEncodingMacRoman);
2094-
#ifdef MAC_OS_X_VERSION_10_5
2099+
#ifdef COMPILING_FOR_10_5
20952100
font = CTFontCreateWithName(string, size, NULL);
20962101
#else
20972102
font = ATSFontFindFromPostScriptName(string, kATSOptionFlagsDefault);
@@ -2109,20 +2114,20 @@ static BOOL _clip(CGContextRef cr, PyObject* object)
21092114
{ string = CFStringCreateWithCString(kCFAllocatorDefault,
21102115
name,
21112116
kCFStringEncodingMacRoman);
2112-
#ifdef MAC_OS_X_VERSION_10_5
2117+
#ifdef COMPILING_FOR_10_5
21132118
font = CTFontCreateWithName(string, size, NULL);
21142119
#else
21152120
font = ATSFontFindFromPostScriptName(string, kATSOptionFlagsDefault);
21162121
#endif
21172122
CFRelease(string);
21182123
}
2119-
#ifndef MAC_OS_X_VERSION_10_5
2124+
#ifndef COMPILING_FOR_10_5
21202125
CGContextSelectFont(cr, name, size, kCGEncodingMacRoman);
21212126
#endif
21222127
return font;
21232128
}
21242129

2125-
#ifdef MAC_OS_X_VERSION_10_5
2130+
#ifdef COMPILING_FOR_10_5
21262131
static PyObject*
21272132
GraphicsContext_draw_text (GraphicsContext* self, PyObject* args)
21282133
{
@@ -2821,7 +2826,7 @@ static void _data_provider_release(void* info, const void* data, size_t size)
28212826
"_macosx.GraphicsContext", /*tp_name*/
28222827
sizeof(GraphicsContext), /*tp_basicsize*/
28232828
0, /*tp_itemsize*/
2824-
#ifdef MAC_OS_X_VERSION_10_5
2829+
#ifdef COMPILING_FOR_10_5
28252830
0, /*tp_dealloc*/
28262831
#else
28272832
(destructor)GraphicsContext_dealloc, /*tp_dealloc*/

0 commit comments

Comments
 (0)