Refactor: Replace horizontal/vertical AddLine() calls to AddLineH(),AddLineV() - #711
Conversation
|
Thanks for making the changes! The new ImDrawList results look great, also, nice work on the Wiki! I agree (B) sounds like the best. I noticed the "Allow edits from maintainers" is turned off, so feel free to implement the new methods or allow me to edit the branch, then I can make the changes myself. I think it's always nice to keep support for old ImGui versions, when the code gets too messy then we can decide to drop support for ImGui < X.YYY.Z. To offload some work from you, I could also start porting your ImPlot changes to ImPlot3D and add you as reviewer there, let me know if you prefer implementing the changes in both ImPlot and ImPlot3D yourself. Thanks for the great work! |
|
Thanks I’ll makes the change soon. Feel free to work on equivalent ImPlot3d change. |
…AddLineV() wrappers. (epezent#711) 3 remaining AddLine() calls to check evaluate for 1.93.0 change.
|
Reworked as 0182a86. |
|
@ocornut I've created the PR in ImPlot3D brenocq/implot3d#195, feel free to take a look at it when you have some time (I'm not very familiar with AA lines). |
Note: I do not suggest merging as-is. Read on.
1.92.8 introduced helper
AddLineV(),AddLineH()functions.There have a nicer API but in current version is essentially identical.
An upcoming rework of ImDrawList will slightly change
AddLine()(with a legacy path available) and basically using AddLineV()/AddLineH() will be both faster and a "simpler" path to backward compatibility.This PR changes all horizontal/vertical
AddLine()calls toAddLineV/AddLineH.There are only 3 remaining
AddLine()which may need revaluation when the 1.93.0 is ready (either add +0.5 to provide pixel center, either pass ImDrawFlags_StrokeLegacy. Will provide details later as this is not out yet).In theory you could merge this today and it makes ImPlot code a little bit simpler and shorter.
BUT, this requires 1.92.8, and unfortunately as
ImDrawListfunctions are methods we can't easily add them locally.I see 3 options:
ImPlot_AddLineH(drawlist, ...which makes it easy to support <1.92.8. I can change the PR to do that. It only creates a syntax asymmetry calling those functions.I would suggest (B) so it feels silly that the current PR is for (A) but I'll let you confirm what you think is the right approach.