Closed SirePi closed 3 years ago
Thanks! Finally managed to look into this again and update the review.
Instead of requesting a few more changes, I took the time to add them myself right away, to avoid going stale again, since I think this is a pretty useful feature. Some of the changes were not part of earlier review requests and only occurred to me when doing a more thorough review today, checking out the most recent changes. I know it's not the cleanest way to go through with this PR, but right now it's the best I can manage, given the limited time I have - sorry about that, but I hope that's fine with you.
Changes I made and rationale behind them:
DrawImage
is a shortcut that aims specifically to fit the "I want to draw this texture as-is" use case, since all others are better off with existing, more complex / verbose API.ContentRef<Material>
and BatchInfo
overloads, since they are easily available via canvas.State.SetMaterial
if needed. "Specifying a full material is already beyond the shortcut path that this should address."canvas.FillRect
when setting the material beforehand. "Specifying an explicit size is already beyond the shortcut path that this should address."DrawImage
.
As per #784, this introduces a DrawImage(Material / BatchInfo) to the Canvas. The code has been taken inspiration from FillRect, but feel free to add suggestions on how it can be improved