-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Summary
draw_gouraud_triangle
is used as the primitive drawing method of the base draw_gouraud_triangles
.
matplotlib/lib/matplotlib/backend_bases.py
Lines 321 to 322 in f8cf0ee
for tri, col in zip(triangles_array, colors_array): | |
self.draw_gouraud_triangle(gc, tri, col, transform) |
However, a backend that overloads draw_gouraud_triangles
may not have to define a draw_gouraud_triangle
method (except that it may be a suitable name) as any code only calls draw_gouraud_triangles
at the "top level".
This leads to that some draw_gouraud_triangle
methods will never be called (e.g. Agg, PDF and PS backends), where the PDF and PS backends actually does it the other way round:
matplotlib/lib/matplotlib/backends/backend_pdf.py
Lines 2156 to 2158 in f8cf0ee
def draw_gouraud_triangle(self, gc, points, colors, trans): | |
self.draw_gouraud_triangles(gc, points.reshape((1, 3, 2)), | |
colors.reshape((1, 3, 4)), trans) |
Proposed fix
Is it realistic that there will be an artist that calls draw_gouraud_triangle
directly or should we just drop those unused methods and somehow clarify that if draw_gouraud_triangles
is overloaded in a backend, there is no need to overload draw_gouraud_triangle
? (If there is ever such an artist, we can just use the PDF/PS backend code to use draw_gouraud_triangles
instead.) Not sure if there is some documentation about what methods a backend is expected to have though.
It seems to be a waste maintaining code that in practice is dead.