Skip to content

[MNT]: Make draw_gouraud_triangle optional #23819

Closed
@oscargus

Description

@oscargus

Summary

draw_gouraud_triangle is used as the primitive drawing method of the base draw_gouraud_triangles.

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions