| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1557,6 +1557,7 @@ RendererAgg::_draw_path_collection_generic | |||
| 1557 | 1557 | ||
| 1558 | 1558 | if ((Nfacecolors == 0 && Nedgecolors == 0) || Npaths == 0) | |
| 1559 | 1559 | { | |
| 1560 | + Py_XDECREF(transforms_arr); | ||
| 1560 | 1561 | return Py::Object(); | |
| 1561 | 1562 | } | |
| 1562 | 1563 | ||
@@ -1708,6 +1709,8 @@ RendererAgg::_draw_path_collection_generic | |||
| 1708 | 1709 | } | |
| 1709 | 1710 | } | |
| 1710 | 1711 | ||
| 1712 | + Py_XDECREF(transforms_arr); | ||
| 1713 | + | ||
| 1711 | 1714 | return Py::Object(); | |
| 1712 | 1715 | } | |
| 1713 | 1716 | ||
@@ -2383,11 +2386,7 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args) | |||
| 2383 | 2386 | ||
| 2384 | 2387 | int newwidth = 0; | |
| 2385 | 2388 | int newheight = 0; | |
| 2386 | - #if PY3K | ||
| 2387 | - Py::Bytes data; | ||
| 2388 | - #else | ||
| 2389 | - Py::String data; | ||
| 2390 | - #endif | ||
| 2389 | + PyObject *data; | ||
| 2391 | 2390 | ||
| 2392 | 2391 | if (xmin < xmax && ymin < ymax) | |
| 2393 | 2392 | { | |
@@ -2406,18 +2405,12 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args) | |||
| 2406 | 2405 | // the _AsString() API. | |
| 2407 | 2406 | unsigned int* dst; | |
| 2408 | 2407 | ||
| 2409 | - #if PY3K | ||
| 2410 | - data = Py::Bytes(static_cast<const char*>(NULL), (int) newsize); | ||
| 2411 | - dst = reinterpret_cast<unsigned int*>(PyBytes_AsString(data.ptr())); | ||
| 2412 | - #else | ||
| 2413 | - data = Py::String(static_cast<const char*>(NULL), (int) newsize); | ||
| 2414 | - dst = reinterpret_cast<unsigned int*>(PyString_AsString(data.ptr())); | ||
| 2415 | - #endif | ||
| 2416 | - | ||
| 2417 | - if (dst == NULL) | ||
| 2408 | + data = PyBytes_FromStringAndSize(NULL, newsize); | ||
| 2409 | + if (data == NULL) | ||
| 2418 | 2410 | { | |
| 2419 | 2411 | throw Py::MemoryError("RendererAgg::tostring_minimized could not allocate memory"); | |
| 2420 | 2412 | } | |
| 2413 | + dst = (unsigned int *)PyBytes_AsString(data); | ||
| 2421 | 2414 | ||
| 2422 | 2415 | unsigned int* src = (unsigned int*)pixBuffer; | |
| 2423 | 2416 | for (int y = ymin; y < ymax; ++y) | |
@@ -2436,7 +2429,8 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args) | |||
| 2436 | 2429 | bounds[3] = Py::Int(newheight); | |
| 2437 | 2430 | ||
| 2438 | 2431 | Py::Tuple result(2); | |
| 2439 | - result[0] = data; | ||
| 2432 | + result[0] = Py::Object(data, false); | ||
| 2433 | + Py_DECREF(data); | ||
| 2440 | 2434 | result[1] = bounds; | |
| 2441 | 2435 | ||
| 2442 | 2436 | return result; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1264,7 +1264,7 @@ _image_module::frombuffer(const Py::Tuple& args) | |||
| 1264 | 1264 | ||
| 1265 | 1265 | args.verify_length(4); | |
| 1266 | 1266 | ||
| 1267 | - PyObject *bufin = new_reference_to(args[0]); | ||
| 1267 | + PyObject *bufin = args[0].ptr(); | ||
| 1268 | 1268 | size_t x = (long)Py::Int(args[1]); | |
| 1269 | 1269 | size_t y = (long)Py::Int(args[2]); | |
| 1270 | 1270 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments