@@ -1910,13 +1910,15 @@ RendererAgg::draw_gouraud_triangles(const Py::Tuple& args)
19101910 Py::Object points_obj = args[1 ];
19111911 Py::Object colors_obj = args[2 ];
19121912 agg::trans_affine trans = py_to_agg_transformation_matrix (args[3 ].ptr ());
1913+ double c_points[6 ];
1914+ double c_colors[12 ];
19131915
19141916 theRasterizer.reset_clipping ();
19151917 rendererBase.reset_clipping (true );
19161918 set_clipbox (gc.cliprect , theRasterizer);
19171919 bool has_clippath = render_clippath (gc.clippath , gc.clippath_trans );
19181920
1919- PyArrayObject* points = (PyArrayObject*)PyArray_ContiguousFromAny
1921+ PyArrayObject* points = (PyArrayObject*)PyArray_FromObject
19201922 (points_obj.ptr (), PyArray_DOUBLE, 3 , 3 );
19211923 if (!points ||
19221924 PyArray_DIM (points, 1 ) != 3 || PyArray_DIM (points, 2 ) != 2 )
@@ -1926,7 +1928,7 @@ RendererAgg::draw_gouraud_triangles(const Py::Tuple& args)
19261928 }
19271929 points_obj = Py::Object ((PyObject*)points, true );
19281930
1929- PyArrayObject* colors = (PyArrayObject*)PyArray_ContiguousFromAny
1931+ PyArrayObject* colors = (PyArrayObject*)PyArray_FromObject
19301932 (colors_obj.ptr (), PyArray_DOUBLE, 3 , 3 );
19311933 if (!colors ||
19321934 PyArray_DIM (colors, 1 ) != 3 || PyArray_DIM (colors, 2 ) != 4 )
@@ -1943,9 +1945,20 @@ RendererAgg::draw_gouraud_triangles(const Py::Tuple& args)
19431945
19441946 for (int i = 0 ; i < PyArray_DIM (points, 0 ); ++i)
19451947 {
1948+ for (int j = 0 ; j < 3 ; ++j) {
1949+ for (int k = 0 ; k < 2 ; ++k) {
1950+ c_points[j*2 +k] = *(double *)PyArray_GETPTR3 (points, i, j, k);
1951+ }
1952+ }
1953+
1954+ for (int j = 0 ; j < 3 ; ++j) {
1955+ for (int k = 0 ; k < 4 ; ++k) {
1956+ c_colors[j*4 +k] = *(double *)PyArray_GETPTR3 (colors, i, j, k);
1957+ }
1958+ }
1959+
19461960 _draw_gouraud_triangle (
1947- (double *)PyArray_GETPTR1 (points, i),
1948- (double *)PyArray_GETPTR1 (colors, i), trans, has_clippath);
1961+ c_points, c_colors, trans, has_clippath);
19491962 }
19501963
19511964 return Py::Object ();
0 commit comments