10000 Remove PyCXX dependency for core extension modules by mdboom · Pull Request #3646 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Remove PyCXX dependency for core extension modules #3646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Oct 18, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Windows-related fixes, thanks to @cgohlke
  • Loading branch information
mdboom committed Oct 17, 2014
commit 5204635911f911a48c03ca3cf2f1f70341d396cf
5 changes: 2 additions & 3 deletions src/_gtkagg.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/* -*- mode: c++; c-basic-offset: 4 -*- */

#include <vector>
Expand Down Expand Up @@ -62,7 +61,7 @@ static PyObject *Py_agg_to_gtk_drawable(PyObject *self, PyObject *args, PyObject

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

agg::rendering_buffer srcrbuf;
srcrbuf.attach((agg::int8u *)buffer, buffer.dim(1), buffer.dim(0), buffer.dim(1) * 4);
srcrbuf.attach((agg::int8u *)buffer.data(), buffer.dim(1), buffer.dim(0), buffer.dim(1) * 4);

agg::rect_base<int> region(destx, desty, (int)rect.x2, srcheight - (int)rect.y1);
destrb.copy_from(srcrbuf, &region, -destx, -desty);
Expand Down
4 changes: 2 additions & 2 deletions src/_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ Image *pcolor(CoordinateArray &x,
// Check dimensions match
unsigned long nx = x.dim(0);
unsigned long ny = y.dim(0);
if (nx != d.dim(1) || ny != d.dim(0)) {
if (nx != (unsigned long)d.dim(1) || ny != (unsigned long)d.dim(0)) {
throw "data and axis dimensions do not match";
}

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

Expand Down
4 changes: 4 additions & 0 deletions src/ft2font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#include "ft2font.h"
#include "mplutils.h"

#ifndef M_PI
#define M_PI 3.14159265358979323846264338328
#endif

/**
To improve the hinting of the fonts, this code uses a hack
presented here:
Expand Down
6 changes: 6 additions & 0 deletions src/mplutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
#ifndef _MPLUTILS_H
#define _MPLUTILS_H

#ifdef _MSC_VER && _MSC_VER <= 1600
typedef unsigned __int8 uint8_t;
#else
#include <stdint.h>
#endif

#include <Python.h>

#if PY_MAJOR_VERSION >= 3
Expand Down
4 changes: 4 additions & 0 deletions src/numpy_cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,15 @@ struct type_num_of<npy_double>
value = NPY_DOUBLE
};
};
#if NPY_LONGDOUBLE != NPY_DOUBLE
template <>
struct type_num_of<npy_longdouble>
{
enum {
value = NPY_LONGDOUBLE
};
};
#endif
template <>
struct type_num_of<npy_cfloat>
{
Expand Down Expand Up @@ -151,13 +153,15 @@ struct type_num_of<std::complex<npy_double> >
value = NPY_CDOUBLE
};
};
#if NPY_CLONGDOUBLE != NPY_CDOUBLE
template <>
struct type_num_of<npy_clongdouble>
{
enum {
value = NPY_CLONGDOUBLE
};
};
#endif
template <>
struct type_num_of<std::complex<npy_longdouble> >
{
Expand Down
0