8000 Windows-related fixes, thanks to @cgohlke · matplotlib/matplotlib@37a470a · GitHub
[go: up one dir, main page]

Skip to content

Commit 37a470a

Browse files
committed
Windows-related fixes, thanks to @cgohlke
1 parent 4c2045f commit 37a470a

File tree

5 files changed

+< 10000 !-- -->18
-5
lines changed

5 files changed

+18
-5
lines changed

src/_gtkagg.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/* -*- mode: c++; c-basic-offset: 4 -*- */
32

43
#include <vector>
@@ -62,7 +61,7 @@ static PyObject *Py_agg_to_gtk_drawable(PyObject *self, PyObject *args, PyObject
6261

6362
if (rect.x1 == 0.0 && rect.x2 == 0.0 && rect.y1 == 0.0 && rect.y2 == 0.0) {
6463
// bbox is None; copy the entire image
65-
destbufferptr = (agg::int8u *)buffer;
64+
destbufferptr = (agg::int8u *)buffer.data();
6665
destwidth = srcwidth;
6766
destheight = srcheight;
6867
deststride = srcstride;
@@ -81,7 +80,7 @@ static PyObject *Py_agg_to_gtk_drawable(PyObject *self, PyObject *args, PyObject
8180
renderer_base destrb(destpf);
8281

8382
agg::rendering_buffer srcrbuf;
84-
srcrbuf.attach((agg::int8u *)buffer, buffer.dim(1), buffer.dim(0), buffer.dim(1) * 4);
83+
srcrbuf.attach((agg::int8u *)buffer.data(), buffer.dim(1), buffer.dim(0), buffer.dim(1) * 4);
8584

8685
agg::rect_base<int> region(destx, desty, (int)rect.x2, srcheight - (int)rect.y1);
8786
destrb.copy_from(srcrbuf, &region, -destx, -desty);

src/_image.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ Image *pcolor(CoordinateArray &x,
231231
// Check dimensions match
232232
unsigned long nx = x.dim(0);
233233
unsigned long ny = y.dim(0);
234-
if (nx != d.dim(1) || ny != d.dim(0)) {
234+
if (nx != (unsigned long)d.dim(1) || ny != (unsigned long)d.dim(0)) {
235235
throw "data and axis dimensions do not match";
236236
}
237237

@@ -337,7 +337,7 @@ Image *pcolor2(CoordinateArray &x,
337337
// Check dimensions match
338338
unsigned long nx = x.dim(0);
339339
unsigned long ny = y.dim(0);
340-
if (nx != d.dim(1) + 1 || ny != d.dim(0) + 1) {
340+
if (nx != (unsigned long)d.dim(1) + 1 || ny != (unsigned long)d.dim(0) + 1) {
341341
throw "data and axis bin boundary dimensions are incompatible";
342342
}
343343

src/ft2font.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
#include "ft2font.h"
88
#include "mplutils.h"
99

10+
#ifndef M_PI
11+
#define M_PI 3.14159265358979323846264338328
12+
#endif
13+
1014
/**
1115
To improve the hinting of the fonts, this code uses a hack
1216
presented here:

src/mplutils.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
#ifndef _MPLUTILS_H
66
#define _MPLUTILS_H
77

8+
#ifdef _MSC_VER && _MSC_VER <= 1600
9+
typedef unsigned __int8 uint8_t;
10+
#else
11+
#include <stdint.h>
12+
#endif
13+
814
#include <Python.h>
915

1016
#if PY_MAJOR_VERSION >= 3

src/numpy_cpp.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,15 @@ struct type_num_of<npy_double>
116116
value = NPY_DOUBLE
117117
};
118118
};
119+
#if NPY_LONGDOUBLE != NPY_DOUBLE
119120
template <>
120121
struct type_num_of<npy_longdouble>
121122
{
122123
enum {
123124
value = NPY_LONGDOUBLE
124125
};
125126
};
127+
#endif
126128
template <>
127129
struct type_num_of<npy_cfloat>
128130
{
@@ -151,13 +153,15 @@ struct type_num_of<std::complex<npy_double> >
151153
value = NPY_CDOUBLE
152154
};
153155
};
156+
#if NPY_CLONGDOUBLE != NPY_CDOUBLE
154157
template <>
155158
struct type_num_of<npy_clongdouble>
156159
{
157160
enum {
158161
value = NPY_CLONGDOUBLE
159162
};
160163
};
164+
#endif
161165
template <>
162166
struct type_num_of<std::complex<npy_longdouble> >
163167
{

0 commit comments

Comments
 (0)
0