Skip to content

Commit f4a598a

Browse files
committed
No CGContextGetLineWidth in Cocoa; pass the line width from Python instead.
svn path=/trunk/matplotlib/; revision=8417
1 parent 7b9ec69 commit f4a598a

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

lib/matplotlib/backends/backend_macosx.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ def set_width_height (self, width, height):
5252
def draw_path(self, gc, path, transform, rgbFace=None):
5353
if rgbFace is not None:
5454
rgbFace = tuple(rgbFace)
55-
gc.draw_path(path, transform, rgbFace)
55+
linewidth = gc.get_linewidth()
56+
gc.draw_path(path, transform, linewidth, rgbFace)
5657

5758
def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None):
5859
if rgbFace is not None:
5960
rgbFace = tuple(rgbFace)
60-
gc.draw_markers(marker_path, marker_trans, path, trans, rgbFace)
61+
linewidth = gc.get_linewidth()
62+
gc.draw_markers(marker_path, marker_trans, path, trans, linewidth, rgbFace)
6163

6264
def draw_path_collection(self, gc, master_transform, paths, all_transforms,
6365
offsets, offsetTrans, facecolors, edgecolors,

src/_macosx.m

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,7 @@ static int _get_snap(GraphicsContext* self, enum e_quantize_mode* mode)
864864
PyObject* path;
865865
PyObject* transform;
866866
PyObject* rgbFace;
867+
float linewidth;
867868

868869
int n;
869870

@@ -878,9 +879,10 @@ static int _get_snap(GraphicsContext* self, enum e_quantize_mode* mode)
878879
return NULL;
879880
}
880881

881-
if(!PyArg_ParseTuple(args, "OO|O",
882+
if(!PyArg_ParseTuple(args, "OOf|O",
882883
&path,
883884
&transform,
885+
&linewidth,
884886
&rgbFace)) return NULL;
885887

886888
if(rgbFace==Py_None) rgbFace = NULL;
@@ -891,7 +893,7 @@ static int _get_snap(GraphicsContext* self, enum e_quantize_mode* mode)
891893
0,
892894
rect,
893895
QUANTIZE_AUTO,
894-
CGContextGetLineWidth(self),
896+
linewidth,
895897
rgbFace == NULL);
896898
if (!iterator)
897899
{
@@ -969,7 +971,7 @@ static int _get_snap(GraphicsContext* self, enum e_quantize_mode* mode)
969971
0,
970972
rect,
971973
QUANTIZE_AUTO,
972-
CGContextGetLineWidth(self),
974+
linewidth,
973975
0);
974976
if (!iterator)
975977
{
@@ -995,6 +997,7 @@ static int _get_snap(GraphicsContext* self, enum e_quantize_mode* mode)
995997
PyObject* marker_transform;
996998
PyObject* path;
997999
PyObject* transform;
1000+
float linewidth;
9981001
PyObject* rgbFace;
9991002

10001003
int ok;
@@ -1015,11 +1018,12 @@ static int _get_snap(GraphicsContext* self, enum e_quantize_mode* mode)
10151018
return NULL;
10161019
}
10171020

1018-
if(!PyArg_ParseTuple(args, "OOOO|O",
1021+
if(!PyArg_ParseTuple(args, "OOOOf|O",
10191022
&marker_path,
10201023
&marker_transform,
10211024
&path,
10221025
&transform,
1026+
&linewidth,
10231027
&rgbFace)) return NULL;
10241028

10251029
if(rgbFace==Py_None) rgbFace = NULL;
@@ -1046,7 +1050,7 @@ static int _get_snap(GraphicsContext* self, enum e_quantize_mode* mode)
10461050
0,
10471051
rect,
10481052
mode,
1049-
CGContextGetLineWidth(self),
1053+
linewidth,
10501054
0);
10511055
if (!iterator)
10521056
{

0 commit comments

Comments
 (0)