| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1265,11 +1265,13 @@ def get_extension(self): | |||
| 1265 | 1265 | sources = [ | |
| 1266 | 1266 | 'src/ft2font.cpp', | |
| 1267 | 1267 | 'src/ft2font_wrapper.cpp', | |
| 1268 | - 'src/mplutils.cpp' | ||
| 1268 | + 'src/mplutils.cpp', | ||
| 1269 | + 'src/py_converters.cpp', | ||
| 1269 | 1270 | ] | |
| 1270 | 1271 | ext = make_extension('matplotlib.ft2font', sources) | |
| 1271 | 1272 | FreeType().add_flags(ext) | |
| 1272 | 1273 | Numpy().add_flags(ext) | |
| 1274 | + LibAgg().add_flags(ext, add_sources=False) | ||
| 1273 | 1275 | return ext | |
| 1274 | 1276 | ||
| 1275 | 1277 | ||
@@ -1394,9 +1396,11 @@ def get_extension(self): | |||
| 1394 | 1396 | sources = [ | |
| 1395 | 1397 | "src/_contour.cpp", | |
| 1396 | 1398 | "src/_contour_wrapper.cpp", | |
| 1399 | + 'src/py_converters.cpp', | ||
| 1397 | 1400 | ] | |
| 1398 | 1401 | ext = make_extension('matplotlib._contour', sources) | |
| 1399 | 1402 | Numpy().add_flags(ext) | |
| 1403 | + LibAgg().add_flags(ext, add_sources=False) | ||
| 1400 | 1404 | return ext | |
| 1401 | 1405 | ||
| 1402 | 1406 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -396,11 +396,11 @@ static PyObject *PyRendererAgg_draw_quad_mesh(PyRendererAgg *self, PyObject *arg | |||
| 396 | 396 | numpy::array_view<const double, 2> offsets; | |
| 397 | 397 | agg::trans_affine offset_trans; | |
| 398 | 398 | numpy::array_view<const double, 2> facecolors; | |
| 399 | - int antialiased; | ||
| 399 | + bool antialiased; | ||
| 400 | 400 | numpy::array_view<const double, 2> edgecolors; | |
| 401 | 401 | ||
| 402 | 402 | if (!PyArg_ParseTuple(args, | |
| 403 | - "O&O&IIO&O&O&O&iO&:draw_quad_mesh", | ||
| 403 | + "O&O&IIO&O&O&O&O&O&:draw_quad_mesh", | ||
| 404 | 404 | &convert_gcagg, | |
| 405 | 405 | &gc, | |
| 406 | 406 | &convert_trans_affine, | |
@@ -415,6 +415,7 @@ static PyObject *PyRendererAgg_draw_quad_mesh(PyRendererAgg *self, PyObject *arg | |||
| 415 | 415 | &offset_trans, | |
| 416 | 416 | &convert_colors, | |
| 417 | 417 | &facecolors, | |
| 418 | + &convert_bool, | ||
| 418 | 419 | &antialiased, | |
| 419 | 420 | &convert_colors, | |
| 420 | 421 | &edgecolors)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,6 @@ | |||
| 1 | 1 | #include "src/_contour.h" | |
| 2 | 2 | #include "src/mplutils.h" | |
| 3 | + #include "src/py_converters.h" | ||
| 3 | 4 | #include "src/py_exceptions.h" | |
| 4 | 5 | ||
| 5 | 6 | /* QuadContourGenerator */ | |
@@ -29,15 +30,15 @@ static int PyQuadContourGenerator_init(PyQuadContourGenerator* self, PyObject* a | |||
| 29 | 30 | { | |
| 30 | 31 | QuadContourGenerator::CoordinateArray x, y, z; | |
| 31 | 32 | QuadContourGenerator::MaskArray mask; | |
| 32 | - int corner_mask; | ||
| 33 | + bool corner_mask; | ||
| 33 | 34 | long chunk_size; | |
| 34 | 35 | ||
| 35 | - if (!PyArg_ParseTuple(args, "O&O&O&O&il", | ||
| 36 | + if (!PyArg_ParseTuple(args, "O&O&O&O&O&l", | ||
| 36 | 37 | &x.converter_contiguous, &x, | |
| 37 | 38 | &y.converter_contiguous, &y, | |
| 38 | 39 | &z.converter_contiguous, &z, | |
| 39 | 40 | &mask.converter_contiguous, &mask, | |
| 40 | - &corner_mask, | ||
| 41 | + &convert_bool, &corner_mask, | ||
| 41 | 42 | &chunk_size)) { | |
| 42 | 43 | return -1; | |
| 43 | 44 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -119,8 +119,6 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs) | |||
| 119 | 119 | PyObject *py_output_array = NULL; | |
| 120 | 120 | PyObject *py_transform = NULL; | |
| 121 | 121 | resample_params_t params; | |
| 122 | - int resample_; | ||
| 123 | - int norm_; | ||
| 124 | 122 | ||
| 125 | 123 | PyArrayObject *input_array = NULL; | |
| 126 | 124 | PyArrayObject *output_array = NULL; | |
@@ -133,10 +131,10 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs) | |||
| 133 | 131 | "resample", "alpha", "norm", "radius", NULL }; | |
| 134 | 132 | ||
| 135 | 133 | if (!PyArg_ParseTupleAndKeywords( | |
| 136 | - args, kwargs, "OOO|iidid:resample", (char **)kwlist, | ||
| 134 | + args, kwargs, "OOO|iO&dO&d:resample", (char **)kwlist, | ||
| 137 | 135 | &py_input_array, &py_output_array, &py_transform, | |
| 138 | - ¶ms.interpolation, &resample_, ¶ms.alpha, &norm_, | ||
| 139 | - ¶ms.radius)) { | ||
| 136 | + ¶ms.interpolation, &convert_bool, ¶ms.resample, | ||
| 137 | + ¶ms.alpha, &convert_bool, ¶ms.norm, ¶ms.radius)) { | ||
| 140 | 138 | return NULL; | |
| 141 | 139 | } | |
| 142 | 140 | ||
@@ -146,9 +144,6 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs) | |||
| 146 | 144 | goto error; | |
| 147 | 145 | } | |
| 148 | 146 | ||
| 149 | - params.resample = (resample_ != 0); | ||
| 150 | - params.norm = (norm_ != 0); | ||
| 151 | - | ||
| 152 | 147 | input_array = (PyArrayObject *)PyArray_FromAny( | |
| 153 | 148 | py_input_array, NULL, 2, 3, NPY_ARRAY_C_CONTIGUOUS, NULL); | |
| 154 | 149 | if (input_array == NULL) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -310,12 +310,12 @@ static PyObject *Py_point_in_path_collection(PyObject *self, PyObject *args, PyO | |||
| 310 | 310 | numpy::array_view<const double, 3> transforms; | |
| 311 | 311 | numpy::array_view<const double, 2> offsets; | |
| 312 | 312 | agg::trans_affine offset_trans; | |
| 313 | - int filled; | ||
| 313 | + bool filled; | ||
| 314 | 314 | e_offset_position offset_position; | |
| 315 | 315 | std::vector<int> result; | |
| 316 | 316 | ||
| 317 | 317 | if (!PyArg_ParseTuple(args, | |
| 318 | - "dddO&OO&O&O&iO&:point_in_path_collection", | ||
| 318 | + "dddO&OO&O&O&O&O&:point_in_path_collection", | ||
| 319 | 319 | &x, | |
| 320 | 320 | &y, | |
| 321 | 321 | &radius, | |
@@ -328,6 +328,7 @@ static PyObject *Py_point_in_path_collection(PyObject *self, PyObject *args, PyO | |||
| 328 | 328 | &offsets, | |
| 329 | 329 | &convert_trans_affine, | |
| 330 | 330 | &offset_trans, | |
| 331 | + &convert_bool, | ||
| 331 | 332 | &filled, | |
| 332 | 333 | &convert_offset_position, | |
| 333 | 334 | &offset_position)) { | |
@@ -402,15 +403,16 @@ static PyObject *Py_clip_path_to_rect(PyObject *self, PyObject *args, PyObject * | |||
| 402 | 403 | { | |
| 403 | 404 | py::PathIterator path; | |
| 404 | 405 | agg::rect_d rect; | |
| 405 | - int inside; | ||
| 406 | + bool inside; | ||
| 406 | 407 | std::vector<Polygon> result; | |
| 407 | 408 | ||
| 408 | 409 | if (!PyArg_ParseTuple(args, | |
| 409 | - "O&O&i:clip_path_to_rect", | ||
| 410 | + "O&O&O&:clip_path_to_rect", | ||
| 410 | 411 | &convert_path, | |
| 411 | 412 | &path, | |
| 412 | 413 | &convert_rect, | |
| 413 | 414 | &rect, | |
| 415 | + &convert_bool, | ||
| 414 | 416 | &inside)) { | |
| 415 | 417 | return NULL; | |
| 416 | 418 | } | |
@@ -527,20 +529,21 @@ static PyObject *Py_path_intersects_rectangle(PyObject *self, PyObject *args, Py | |||
| 527 | 529 | { | |
| 528 | 530 | py::PathIterator path; | |
| 529 | 531 | double rect_x1, rect_y1, rect_x2, rect_y2; | |
| 530 | - int filled = 0; | ||
| 532 | + bool filled = false; | ||
| 531 | 533 | const char *names[] = { "path", "rect_x1", "rect_y1", "rect_x2", "rect_y2", "filled", NULL }; | |
| 532 | 534 | bool result; | |
| 533 | 535 | ||
| 534 | 536 | if (!PyArg_ParseTupleAndKeywords(args, | |
| 535 | 537 | kwds, | |
| 536 | - "O&dddd|i:path_intersects_rectangle", | ||
| 538 | + "O&dddd|O&:path_intersects_rectangle", | ||
| 537 | 539 | (char **)names, | |
| 538 | 540 | &convert_path, | |
| 539 | 541 | &path, | |
| 540 | 542 | &rect_x1, | |
| 541 | 543 | &rect_y1, | |
| 542 | 544 | &rect_x2, | |
| 543 | 545 | &rect_y2, | |
| 546 | + &convert_bool, | ||
| 544 | 547 | &filled)) { | |
| 545 | 548 | return NULL; | |
| 546 | 549 | } | |
@@ -594,28 +597,30 @@ static PyObject *Py_cleanup_path(PyObject *self, PyObject *args, PyObject *kwds) | |||
| 594 | 597 | { | |
| 595 | 598 | py::PathIterator path; | |
| 596 | 599 | agg::trans_affine trans; | |
| 597 | - int remove_nans; | ||
| 600 | + bool remove_nans; | ||
| 598 | 601 | agg::rect_d clip_rect; | |
| 599 | 602 | e_snap_mode snap_mode; | |
| 600 | 603 | double stroke_width; | |
| 601 | 604 | PyObject *simplifyobj; | |
| 602 | 605 | bool simplify = false; | |
| 603 | - int return_curves; | ||
| 606 | + bool return_curves; | ||
| 604 | 607 | SketchParams sketch; | |
| 605 | 608 | ||
| 606 | 609 | if (!PyArg_ParseTuple(args, | |
| 607 | - "O&O&iO&O&dOiO&:cleanup_path", | ||
| 610 | + "O&O&O&O&O&dOO&O&:cleanup_path", | ||
| 608 | 611 | &convert_path, | |
| 609 | 612 | &path, | |
| 610 | 613 | &convert_trans_affine, | |
| 611 | 614 | &trans, | |
| 615 | + &convert_bool, | ||
| 612 | 616 | &remove_nans, | |
| 613 | 617 | &convert_rect, | |
| 614 | 618 | &clip_rect, | |
| 615 | 619 | &convert_snap, | |
| 616 | 620 | &snap_mode, | |
| 617 | 621 | &stroke_width, | |
| 618 | 622 | &simplifyobj, | |
| 623 | + &convert_bool, | ||
| 619 | 624 | &return_curves, | |
| 620 | 625 | &convert_sketch_params, | |
| 621 | 626 | &sketch)) { | |
@@ -675,14 +680,14 @@ static PyObject *Py_convert_to_string(PyObject *self, PyObject *args, PyObject * | |||
| 675 | 680 | int precision; | |
| 676 | 681 | PyObject *codesobj; | |
| 677 | 682 | char *codes[5]; | |
| 678 | - int postfix; | ||
| 683 | + bool postfix; | ||
| 679 | 684 | char *buffer = NULL; | |
| 680 | 685 | size_t buffersize; | |
| 681 | 686 | PyObject *result; | |
| 682 | 687 | int status; | |
| 683 | 688 | ||
| 684 | 689 | if (!PyArg_ParseTuple(args, | |
| 685 | - "O&O&O&OO&iOi:convert_to_string", | ||
| 690 | + "O&O&O&OO&iOO&:convert_to_string", | ||
| 686 | 691 | &convert_path, | |
| 687 | 692 | &path, | |
| 688 | 693 | &convert_trans_affine, | |
@@ -694,6 +699,7 @@ static PyObject *Py_convert_to_string(PyObject *self, PyObject *args, PyObject * | |||
| 694 | 699 | &sketch, | |
| 695 | 700 | &precision, | |
| 696 | 701 | &codesobj, | |
| 702 | + &convert_bool, | ||
| 697 | 703 | &postfix)) { | |
| 698 | 704 | return NULL; | |
| 699 | 705 | } | |
@@ -727,7 +733,7 @@ static PyObject *Py_convert_to_string(PyObject *self, PyObject *args, PyObject * | |||
| 727 | 733 | CALL_CPP("convert_to_string", | |
| 728 | 734 | (status = convert_to_string( | |
| 729 | 735 | path, trans, cliprect, simplify, sketch, | |
| 730 | - precision, codes, (bool)postfix, &buffer, | ||
| 736 | + precision, codes, postfix, &buffer, | ||
| 731 | 737 | &buffersize))); | |
| 732 | 738 | ||
| 733 | 739 | if (status) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | #include "mplutils.h" | |
| 2 | 2 | #include "ft2font.h" | |
| 3 | 3 | #include "file_compat.h" | |
| 4 | + #include "py_converters.h" | ||
| 4 | 5 | #include "py_exceptions.h" | |
| 5 | 6 | #include "numpy_cpp.h" | |
| 6 | 7 | ||
@@ -829,11 +830,11 @@ const char *PyFT2Font_draw_glyphs_to_bitmap__doc__ = | |||
| 829 | 830 | ||
| 830 | 831 | static PyObject *PyFT2Font_draw_glyphs_to_bitmap(PyFT2Font *self, PyObject *args, PyObject *kwds) | |
| 831 | 832 | { | |
| 832 | - int antialiased = 1; | ||
| 833 | + bool antialiased = true; | ||
| 833 | 834 | const char *names[] = { "antialiased", NULL }; | |
| 834 | 835 | ||
| 835 | - if (!PyArg_ParseTupleAndKeywords( | ||
| 836 | - args, kwds, "|i:draw_glyphs_to_bitmap", (char **)names, &antialiased)) { | ||
| 836 | + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O&:draw_glyphs_to_bitmap", | ||
| 837 | + (char **)names, &convert_bool, &antialiased)) { | ||
| 837 | 838 | return NULL; | |
| 838 | 839 | } | |
| 839 | 840 | ||
@@ -849,11 +850,12 @@ const char *PyFT2Font_get_xys__doc__ = | |||
| 849 | 850 | ||
| 850 | 851 | static PyObject *PyFT2Font_get_xys(PyFT2Font *self, PyObject *args, PyObject *kwds) | |
| 851 | 852 | { | |
| 852 | - int antialiased = 1; | ||
| 853 | + bool antialiased = true; | ||
| 853 | 854 | std::vector<double> xys; | |
| 854 | 855 | const char *names[] = { "antialiased", NULL }; | |
| 855 | 856 | ||
| 856 | - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i:get_xys", (char **)names, &antialiased)) { | ||
| 857 | + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O&:get_xys", | ||
| 858 | + (char **)names, &convert_bool, &antialiased)) { | ||
| 857 | 859 | return NULL; | |
| 858 | 860 | } | |
| 859 | 861 | ||
@@ -879,19 +881,20 @@ static PyObject *PyFT2Font_draw_glyph_to_bitmap(PyFT2Font *self, PyObject *args, | |||
| 879 | 881 | PyFT2Image *image; | |
| 880 | 882 | double xd, yd; | |
| 881 | 883 | PyGlyph *glyph; | |
| 882 | - int antialiased = 1; | ||
| 884 | + bool antialiased = true; | ||
| 883 | 885 | const char *names[] = { "image", "x", "y", "glyph", "antialiased", NULL }; | |
| 884 | 886 | ||
| 885 | 887 | if (!PyArg_ParseTupleAndKeywords(args, | |
| 886 | 888 | kwds, | |
| 887 | - "O!ddO!|i:draw_glyph_to_bitmap", | ||
| 889 | + "O!ddO!|O&:draw_glyph_to_bitmap", | ||
| 888 | 890 | (char **)names, | |
| 889 | 891 | &PyFT2ImageType, | |
| 890 | 892 | &image, | |
| 891 | 893 | &xd, | |
| 892 | 894 | &yd, | |
| 893 | 895 | &PyGlyphType, | |
| 894 | 896 | &glyph, | |
| 897 | + &convert_bool, | ||
| 895 | 898 | &antialiased)) { | |
| 896 | 899 | return NULL; | |
| 897 | 900 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments