6161#if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO)
6262#include < mapnik/cairo/cairo_context.hpp>
6363#include < mapnik/cairo/cairo_image_util.hpp>
64- #if PY_MAJOR_VERSION >= 3
6564#include < py3cairo.h>
66- #else
67- #include < pycairo.h>
68- #endif
6965#include < cairo.h>
7066#endif
7167
@@ -80,38 +76,20 @@ using namespace boost::python;
8076// output 'raw' pixels
8177PyObject* tostring1 ( image_any const & im)
8278{
83- return
84- #if PY_VERSION_HEX >= 0x03000000
85- ::PyBytes_FromStringAndSize
86- #else
87- ::PyString_FromStringAndSize
88- #endif
89- ((const char *)im.bytes (),im.size ());
79+ return ::PyBytes_FromStringAndSize ((const char *)im.bytes (),im.size ());
9080}
9181
9282// encode (png,jpeg)
9383PyObject* tostring2 (image_any const & im, std::string const & format)
9484{
9585 std::string s = mapnik::save_to_string (im, format);
96- return
97- #if PY_VERSION_HEX >= 0x03000000
98- ::PyBytes_FromStringAndSize
99- #else
100- ::PyString_FromStringAndSize
101- #endif
102- (s.data (),s.size ());
86+ return ::PyBytes_FromStringAndSize (s.data (),s.size ());
10387}
10488
10589PyObject* tostring3 (image_any const & im, std::string const & format, mapnik::rgba_palette const & pal)
10690{
10791 std::string s = mapnik::save_to_string (im, format, pal);
108- return
109- #if PY_VERSION_HEX >= 0x03000000
110- ::PyBytes_FromStringAndSize
111- #else
112- ::PyString_FromStringAndSize
113- #endif
114- (s.data (),s.size ());
92+ return ::PyBytes_FromStringAndSize (s.data (),s.size ());
11593}
11694
11795
0 commit comments