Open WardenPotato opened 2 weeks ago
To add onto my original post, the stack seems to calculate the following values and throws them into a PaintState
Calculated inset
Calculated Absolute position
Calculated scissor/clip rect
Corrected top left origin
Would be sweet to return all of those if they arent already as they all come from the same place surface.GetPaintState() maybe?
Details
The goal is to get the absolute panel position to offset rendering functions relative towards the screens 0,0 position without having to pass references. Internally in the engine this is done through
void CMatSystemSurface::PushMakeCurrent(VPANEL pPanel, bool useInSets)
before calling functions likePaint()
as seen in this snippethttps://github.com/lua9520/source-engine-2018-hl2_src/blob/master/vgui2/vgui_controls/Panel.cpp#L1209-L1211
This is very similar to #2394 but would solve the issue of getting a panel reference out of thin air, it just scopes the usability to this stack being set, which would make almost no practical difference as its only intended to be used within
Paint()
functions to begin with.After this stack is set it seems that surface calls in the engine happen as follows
surface()->someRenderingFunction
to which i assumesurface()
itsg_pVGuiSurface
return value goes back to thePushMakeCurrent
stack.